CRasterImage::Copy

bool Copy( const RECT & rect, CRasterImage & dst ) const;
bool Copy( int left, int right, int bottom, int top, CRasterImage& dst ) const;

Parameters

rect  Rectangle in the CRasterImage-object-held image which content will be copied.
left, right, bottom, top Specifies left, right, bottom and top rectangle edges in the CRasterImage-object-held image which content will be copied.
dst Destination for the copy operation. The image will be copied to this object

Return Value

true if Copy succeeded, false in case of failure. If function fails then additional error information will be stored in the dst object and can be retrieved by calling dst.GetLastErrorMessage().

Remarks

The Copy function copies image from specified rectangle of the CRasterImage to the destination CRasterImage object. Previous content of the destination object will be destroyed and new image with dimension of specified rectangle will be created. Destination CRasterImage object image will be created with the same storage type as the storage type of source image.

Top and bottom source rectangle coordinates must be specified using OpenGL convention where Y coordinates grow from bottom to top. It means that bottom rectangle coordinate must have lower numerical value than the top coordinate. If you specify larger rectangle than the source image dimensions then the rectangle will be internally truncated to source image boundaries before copy takes place.

Column and row coordinates start from zero. For example if source image has dimensions 10x10 pixels then by specifying copy rectangle left=0, righ=5, bottom=0, top=5 lower left portion of the source image will be copied to destination image and resulting destination image size will be 5x5 pixels.

This function is available since ClassGL version 3.6.10.

See Also

CRasterImage class methods