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)

ParameterDescription
iDstLeftLeft horizontal coordinate of the destination area.
iDstTopLeft vertical coordinate of the destination area.
iDstWidthWidth of the area to copy.
iDstHeightHeight of the area to copy.
objSourceSource object.
iSrcLeftLeft horizontal origin coordinate of the area to copy.
iSrcTopLeft vertical origin coordinate of the area to copy.
eModeRaster 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 ValueDescription
hbDrawPaint0Write every source pixels to the destination. If a bitmap has transparency flag set, hbDrawPaint behaves like hbDrawOverlay instead.
hbDrawErase1Write BackColor if the source pixel is transparent.
hbDrawMask2Write BackColor if the source pixel is not transparent.
hbDrawInvert3Bitwise XOR between the source pixel and the destination pixel. This mode does not take account of the transparent pixels.
hbDrawOverlay4Write 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.
hbDrawPaintInverse5Invert the source pixel color and then proceed as with hbDrawPaint.

The Autograph sample contains several examples of use of this method.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A