Function GraBitBlt() Foundation
Copies section of a raster image into a presentation space (bit-blitting).
GraBitBlt( [<oTargetPS>], ;
[<oSourcePS>], ;
<aTargetRect>, ;
<aSourceRect>, ;
[<nRasterOP>], ;
[<nCompress>] ) --> lSuccess
The return value of GraBitBlt() is .T. (true) if the raster image was copied from the specified area in <oSourcePS> to <oTargetPS>, otherwise it is .F. (false). If the return value is equal to .F., the cause of the error can be determined using GraError().
The function GraBitBlt() is an efficient function for copying raster images (bitmaps). Unlike a vector image which consists of vector-based shapes, a raster image contains all the pixels that make up the image.
GraBitBlt() operations are very fast. Using GraBitBlt(), sections of raster images (bitmaps) are copied, enlargements and reductions are produced and multiple copies of a raster image are displayed very quickly. For example, a window background might be filled with a fill pattern defined in a bitmap file and copied repeatedly to fill the window.
Raster images cannot be scaled without loss of information. Enlarging a bitmap causes individual pixels to be expanded, which introduces jagged edges that become more pronounced with increasing scale factors. Similarly, reducing an image in size causes pixels to be eliminated and hence color information to be lost. GraBitBlt() supports several modes which affect the way eliminated pixels are treated during image reduction. The desired compression mode is selected using the <nCompress> parameter.
The function GraBitBlt() can copy a raster image within a single presentation space or from one presentation space into another. If, for example, the second presentation space <oTarget> is associated with a printer, raster images are printed using GraBitBlt(). More information on the display and output of raster images is found with the class XbpBitmap().
// In the example a simple drawing is displayed. It is
// copied three times by GraBitBlt(), demonstrating different
// variations of the function.
#include "Gra.ch"
PROCEDURE Main
LOCAL aAttrArc, aAttrBox
LOCAL nX0 , nY0 , nX1, nY1, nX2, nY2, nRadius
SetColor("N/W") // fill window with pale gray
CLS
aAttrBox := ARRAY( GRA_AA_COUNT ) // attributes for rectangle
aAttrBox[ GRA_AA_SYMBOL ] := GRA_SYM_DIAG2
aAttrBox[ GRA_AA_COLOR ] := GRA_CLR_RED
aAttrArc := ARRAY( GRA_AA_COUNT ) // attributes for circle
aAttrArc[ GRA_AA_SYMBOL ] := GRA_SYM_DENSE3
aAttrArc[ GRA_AA_COLOR ] := GRA_CLR_BLUE
nRadius := 40 // radius
nX0 := 20 // lower left corner
nY0 := 140
nX1 := 90 // upper right corner
nY1 := 240 // and circle center point
nX2 := nX1 + nRadius // upper right corner
nY2 := nY1 + nRadius // for copying area
GraSetAttrArea( NIL, aAttrBox ) // draw rectangle
GraBox( NIL, {nX0, nY0}, {nX1, nY1}, GRA_OUTLINEFILL )
GraSetAttrArea( NIL, aAttrArc ) // draw circle
GraArc( NIL, {nX1,nY1}, nRadius,,,, GRA_OUTLINEFILL )
GraBitBlt( , , { nX0+150, nY0, ; // copy 1:1
nX2+150, nY2 }, ;
{ nX0, nY0 } )
GraBitBlt( , , { nX0+300, nY0, ; // copy 1:1.2
INT(1.2*nX2) + 300, INT(1.2*nY2) }, ;
{ nX0, nY0, nX2, nY2 } )
GraBitBlt( , , { nX0+450, nY0, ; // copy 1:0.8
INT(0.8*nX2)+450, INT(0.8*nY2) }, ;
{ nX0, nY0, nX2, nY2 } )
Inkey(0) // wait for key press
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.