Language Reference Guide : 4. System Classes : BitmapObject Class : ExtractBitmap Method
 
Share this page                  
ExtractBitmap Method
The ExtractBitmap method captures a region of the bitmap object image as another bitmap object. If a target bitmap is supplied, its contents will be replaced by the extract.
If the specified region lies partly outside the dimensions of the bitmap, the extracted image will be correspondingly truncated.
The source bitmap object is unchanged in all circumstances.
This method has the following syntax:
BitmapObject = BitmapObject.ExtractBitmap([xstart = integer]
          [, ystart = integer][, width = integer][, height = integer]
          [, bitmap = BitmapObject])
This method has the following parameters:
xstart
(Optional) Specifies the x-value of the first pixel in the region of the image to be extracted, in pixels
Default: 1
ystart
(Optional) Specifies the y-value of the first pixel in the region of the image to be extracted, in pixels
Default: 1
width
(Optional) Specifies the width of the region to be captured, in pixels. If width is not specified, this defaults to the remaining width (bitmap width – xstart + 1).
height
(Optional) Specifies the height of the region to be captured, in pixels. If height is not specified, this defaults to the remaining height (bitmap height – ystart + 1).
bitmap
(Optional) Specifies a bitmap object to which the extract will be applied
The method returns a new bitmap object, or a reference to the passed bitmap object, if successful. If an error occurred, the bitmap object's errorstatus is set to a non-zero value, and the return value is null.
Examples—ExtractBitmap method:
The following code extracts a copy of the entire bitmap object image:
imageB = imageA.ExtractBitmap();
The following code extracts a region of the bitmap object image into a passed bitmap object, starting from 15,2 and including all the image beyond and below that point:
imageA.ExtractBitmap( xstart=15,ystart=2, bitmap=imageB);