Home > Language Reference > Classes > Display
CopyArea Method
Efficiently copies part of a Display object to another.
Syntax
Public Sub CopyArea(ByVal iDstLeft As Integer, ByVal iDstTop As Integer, ByVal iDstWidth As Integer, ByVal iDstHeight As Integer, ByRef objSource As Display, ByVal iSrcLeft As Integer, ByVal iSrcTop As Integer, Optional ByVal eMode As HbDrawMode = hbDrawPaint)
| Parameter | Description |
| iDstLeft | Left horizontal coordinate of the destination area. |
| iDstTop | Left vertical coordinate of the destination area. |
| iDstWidth | Width of the area to copy. |
| iDstHeight | Height of the area to copy. |
| objSource | Source object. |
| iSrcLeft | Left horizontal origin coordinate of the area to copy. |
| iSrcTop | Left vertical origin coordinate of the area to copy. |
| eMode | Raster operation. |
Remarks
The CopyArea method efficiently copies a rectangular area from one Display object to another. It is typically used to display a bitmap on screen, or to save a part of the screen in a bitmap. Before copying, both graphic instruction buffers of the source and destination objects are emptied by an implicit call to the Flush method.
The iDstLeft, iDstTop, iDstWidth, and iDstHeight parameters specify the coordinates of the destination rectangle relative to the destination Display object. The iSrcLeft, iSrcTop parameters specify the coordinates of the top left corner of the source rectangle relative to the source Display object. The source rectangle is always the same size as the destination rectangle. All coordinates use the destination coordinates system. The source coordinates system is ignored.
The optional eMode parameter specifies the raster operation to perform and should be one of the following constants:
| Constant | Value | Description |
| hbDrawPaint | 0 | Write every source pixels to the destination. If a bitmap has transparency flag set, hbDrawPaint behaves like hbDrawOverlay instead. |
| hbDrawErase | 1 | Write BackColor if the source pixel is transparent. |
| hbDrawMask | 2 | Write BackColor if the source pixel is not transparent. |
| hbDrawInvert | 3 | Bitwise XOR between the source pixel and the destination pixel. This mode does not take account of the transparent pixels. |
| hbDrawOverlay | 4 | Write the source to the destination if the source pixel is not transparent. Transparent pixels are skipped. For a 1-bit display, the 'off' bits are considered to be the transparent color. |
| hbDrawPaintInverse | 5 | Invert the source pixel color and then proceed as with hbDrawPaint. |
The Autograph sample contains several examples of use of this method.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |