Rapid-Q Documentation by William Yu (c)1999,  appended by John Kelly Appendix A: QBITMAP

QBITMAP Component

QBitmap is a non-visible component, used to store/retrieve BMP images. Always set the PixelFormat, Width and Height properties first if possible before drawing to the QBITMAP.  
If you have RAPIDQ2.INC then it includes  QBITMAPex that supports clipboard paste and copy, alphablending, loading of other graphic formats (JPG, GIF, TGA, etc.)

QBitmap Properties
FieldTypeR/WDefaultSupport





BMPSTRINGRWW
Use BMP to assign a new bitmap file, or to store BMP in the image cache.
Examples:
DIM Bitmap AS QBITMAP
Bitmap.BMP = "whatever.bmp"
BMPHandleRESOURCEWW
CopyModeINTEGERRWcmBlacknessW
EmptyINTEGERRW
FontQFONTWW
HandleINTEGERRWW
HeightINTEGERRWWG
MonochromeINTEGERRWW
Pixel2D ARRAY of INTEGERRWWG
PixelFormatINTEGERRWpfDeviceW
TopINTEGERRWWG
TransparentINTEGERRWFalseW
TransparentColorINTEGERRWW
TransparentModeINTEGERRW0W
 0 = tmAuto (or ChromaTransparency)
 1 = tmFixed (or ChromaTransparency Fixed)
 -1 = tmAlpha (AlphaTransparency in  32 bits/pixel bitmaps QBitMapEx only)
 
WidthINTEGERRWWG


QBitmap Methods
MethodTypeDescriptionParamsSupport





CircleSUB (x1%, y1%, x2%, y2%, c%, fill%)Draw & Fill Circle6WG
CopyRectSUB (D, Image, S)D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap3W
Example (copies QIMAGE to bitmap at 10,10):
DIM Destination AS QRECT
DIM Source AS QRECT
DIM Image AS QIMAGE
DIM Bitmap AS QBITMAP
Image.BMP = "whatever.bmp"

WITH Destination
.Top = 10
.Left = 10
.Right = .Left+Image.Width
.Bottom = .Top+Image.Height
END WITH
WITH Source
.Top = 0
.Left = 0
.Right = Image.Width
.Bottom = Image.Height
END WITH
Bitmap.CopyRect(Destination, Image, Source)
DrawSUB (x%, y%, BMP)Draw Bitmap on Canvas3WG
FillRectSUB (x1%, y1%, x2%, y2%, c%)Draws & Fills a rectangle5WG
LineSUB (x1%, y1%, x2%, y2%, c%)Draws a line5WG
LoadFromFileSUB (FileName$)Load BMP from a file1W
LoadFromStreamSUB (Stream)Load BMP from a stream1W
PaintSUB (x%, y%, c%, borderc%)Fill Region4WG
PsetSUB (x%, y%, c%)Pixel plot3WG
RectangleSUB (x1%, y1%, x2%, y2%, c%)Draws a rectangle5WG
RotateSUB (xOrigin%, yOrigin%, Angle%)Rotates entire bitmap at specified origin3W
RoundRectSUB (x1%, y1%, x2%, y2%, x3%, y3%, c%)Draws & Fills a rounded rectangle7W
SaveToFileSUB (FileName$)Save BMP to a file1W
SaveToStreamSUB (Stream)Save BMP to a stream1W
StretchDrawSUB (Rect AS QRECT, BMP)Draw BMP and stretch to fit inside Rect2W
TextHeightFUNCTION (Text$) AS WORDReturns the height, in pixels, of Text$ string1W
TextWidthFUNCTION (Text$) AS WORDReturns the width, in pixels, of Text$ string1W
TextRectSUB (Rect AS QRECT, x%, y%, S$, fc%, bc%)Write text, and clip within region Rect6W
TextOutSUB (x%, y%, S$, fc%, bc%)Writes text to image5WG


QBitmap Examples

DIM BitMap AS QBitMap
BitMap.BMP = "close.bmp"

CREATE Form AS QForm
  CREATE Image1 AS QImage
    Left = 100
    Draw 5, 5, BitMap.BMP
  END CREATE
  Center
  ShowModal
END CREATE


Prev Component Contents Next Component