April 5, 2008
WikiColor Quick Draw
Color Quick Draw
Color QuickDraw performs its operations in a graphics port called a color graphics port, which is based on a data structure of type CGrafPort.
A color graphics port defines a complete drawing environment that determines where and how color graphics operations take place. As with basic graphics ports, you can open many color graphics ports at once. Each color graphics port has its own local coordinate system, drawing pattern, background pattern, pen size and location, foreground color, background color, and pixel map.
A color graphics port is defined by a CGrafPort record, which is diagrammed in below:

Your application generally should not directly set any fields of a CGrafPort record; instead you should use the QuickDraw routines described in this book to manipulate them.
- In a GrafPort record, the portBits field contains a complete 14-byte BitMap record. In a CGrafPort record, this field is partly replaced by the 4-byte portPixMap field; this field contains a handle to a PixMap record.
- In what would be the rowBytes field of the BitMap record stored in the portBits field of a GrafPort record, a CGrafPort record has a 2-byte portVersion field in which the 2 high bits are always set. QuickDraw uses these bits to distinguish CGrafPort records from GrafPort records, in which the 2 high bits of the rowBytes field are always clear.
bufferRowBytes = ((*(bufferPixmap))->rowBytes) & 0x7fff;
// that's where it comes from.
Pixel Maps
The portPixMap field of a CGrafPort record contains a handle to a pixel map, a data structure of type PixMap. Just as basic QuickDraw does all of its drawing in a bitmap, Color QuickDraw draws in a pixel map.

The representation of a color image in memory is a pixel image, analogous to the bit image used by basic QuickDraw. A PixMap record includes a pointer to a pixel image, its dimensions, storage format, depth, resolution, and color usage.
Continue Reading
Back to Archive