void bitblt(drawing dest, drawing src, point dp, rect sr, int mode); void scrollrect(point dp, rect sr); void copyrect(drawing src, point dp, rect sr); void texturerect(drawing src, rect dr); void invertrect(rect r); void drawimage(image i, rect dr, rect sr); rgb getpixel(point p); void setpixel(point p, rgb c);
enum DrawingModes {
Zeros, DnorS, DandnotS, notS,
notDandS, notD, DxorS, DnandS,
DandS, DxnorS, D, DornotS,
S, notDorS, DorS, Ones
};
The bitblt (bit block transfer) function copies pixels from one bitmap, window or control to another. The drawing dest is the destination of the transfer, while src is the source. A drawing is a generic term for bitmaps, windows and control, which can all be sources of, and destinations for, pixel transfers.
The rectangle sr is the source rectangle which is to be copied from src to dest. The bitblt function transfers the rectangular area into the destination, using dp as the top-left point of the destination rectangle. It will approximate colours if transferring between two bitmaps which have different numbers of bits per pixel, or different colour palettes. The destination and source drawing can be the same drawing.
The mode specified in the call to bitblt is a drawing mode. A mode of S will copy the rectangular area from the source to the destination, while a mode of DxorS will perform an XOR operation between the destination and source pixels, in a bit-wise fashion.
The bitblt function takes all of its context information from its arguments, and hence does not rely on the current drawing. The other drawing functions do rely on the current drawing to determine where drawing will occur. The drawto function can be used to set which is the current drawing (see above).
The scrollrect function is used to move a rectangular area around within the same drawing. It is designed to overcome any problems which bitblt might have in drawing to its own source. The copyrect function is similar to bitblt except it draws to the current drawing, using the current mode.
The texturerect function overlays the entire destination rectangle dr with copies of the source drawing src, starting in the top-left point of dr and proceeding to the left and down. This produces a wall-paper effect. The invertrect function performs a bit-wise negation of the pixels within the rectangle r, converting black to white and vice-versa. Using this on colours may produce unexpected effects.
The drawimage function draws the given image onto the current drawing, and into the given destination rectangle. If the size of the rectangle differs from the size of the image, the image will be scaled to fit. Note that functions such as bitblt will not work with images. See the section on images for more image drawing functions.
The getpixel function returns the colour of the pixel at point p within the current drawing. It returns the colour as an rgb value. The setpixel function sets the colour of the pixel at point p to the given rgb value.