Rapid-Q Documentation by William Yu (c)1999 Appendix A: QBITMAP

QBITMAP Component

QBitmap is a non-visible component, used to store/retrieve BMP images.

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
CopyModeINTEGERRWcmBlackness

CONST cmBlackness = 0 ' Fill Destination rectange on the canvas with black
CONST cmDstInvert = 1
CONST cmMergeCopy = 2
CONST cmMergePaint = 3
CONST cmNotSrcCopy = 4
CONST cmNotSrcErase = 5
CONST cmPatCopy = 6
CONST cmPatInvert = 7
CONST cmPatPaint = 8
CONST cmSrcAnd = 9
CONST cmSrcCopy = 10 ' Copies source image to the canvas
CONST cmSrcErase = 11
CONST cmSrcInvert = 12
CONST cmSrcPaint = 13
CONST cmWhiteness = 14 ' Fill Destination rectange on the canvas with white
 

W
EmptyINTEGERRW
FontQFONTWW
HandleINTEGERRWW
HeightINTEGERRWWG
MonochromeINTEGERRWW
Pixel2D ARRAY of INTEGERRWWG
PixelFormatINTEGERRWpfDevice
'-- QBITMAP Pixel Formats
CONST pfDevice = 0
CONST pf1bit = 1
CONST pf4bit = 2
CONST pf8bit = 3
CONST pf15bit = 4
CONST pf16bit = 5
CONST pf24bit = 6
CONST pf32bit = 7
W
TopINTEGERRWWG
TransparentINTEGERRWFalseW
TransparentColorINTEGERRWW
TransparentModeINTEGERRW0
'-- QBITMAP TransparentMode
CONST tmAuto = 0
CONST tmFixed = 1
W
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
Hosted by uCoz
Hosted by uCoz