Copies an area of the current image to the Dest bitmap.
Parameter
Description
Dest
Destination bitmap
SrcX
Left source position
SrcY
Top source position
DstX
Left destination position. Can be negative (cut top-left rectangle and reduces size)
DstY
Top destination position
RectWidth
Width of rectangle to copy
RectHeight
Height of rectangle to copy
CopyAlpha
If true alpha channel is also copied (only if the source bitmap has an alpha channel). Source alpha replaces any existing alpha
Note: ◼Dest must have the same PixelFormat as the image, or the image can be ie1g and dest ie24RGB (i.e. Monochrome to RGB conversion) ◼If the PixelFormat is ie8p, then you may also need to copy the palette
// Method that takes an image, splits it into multiple cells and saves each cell to file procedure SplitImage(Bitmap: TIEBitmap; cols, rows: integer; DestFolder: string); var cellWidth, cellHeight: Double; x,y : Integer; outBmp: TIEBitmap; begin cellWidth := Bitmap.Width / cols; cellHeight := Bitmap.Height / rows;
for x := 0 to cols do for y := 0 to rows do begin Bitmap.CopyRectTo( outBmp, Round( cellWidth * x ), Round( cellHeight * y ), 0, 0, Round( cellWidth ), Round( cellHeight )); outBmp.SaveToFile( IncludeTrailingPathDelimiter( DestFolder ) + IntToStr( x ) + '_' + IntToStr( y ) + '.bmp' ); end;