Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 4 - Color QuickDraw / Color QuickDraw Reference

Data Structures

This section shows the Pascal data structures for the PixMap, CGrafPort, RGBColor, ColorSpec, ColorTable, MatchRec, PixPat, CQDProcs, and GrafVars records.

Analogous to the bitmap that basic QuickDraw uses to describe a bit image, a pixel map is used by Color QuickDraw to describe a pixel image. A pixel map, which is a data structure of type PixMap, contains information about the dimensions and contents of a pixel image, as well as information about the image's storage format, depth, resolution, and color usage.

As a basic graphics port (described in the chapter "Basic QuickDraw") defines the black-and-white and basic eight-color drawing environment for basic QuickDraw, a color graphics port defines the more sophisticated color drawing environment for Color QuickDraw. A color graphics port is defined by a data structure of type CGrafPort.

You usually specify a color to Color QuickDraw by creating an RGBColor record in which you assign the red, green, and blue values of the color. For example, when you want to set the foreground color for drawing, you create an RGBColor record that defines the foreground color you desire, then you pass that record as a parameter to the RGBForeColor procedure.

When creating a PixMap record for an indexed device, Color QuickDraw creates a ColorTable record that defines the best colors available for the pixel image on that graphics device. The Color Manager also stores a ColorTable record for the currently available colors in the graphics device's CLUT.

One of the fields in a ColorTable record requires a value of type cSpecArray, which is defined as an array of ColorSpec records. Typically, your application needs to create ColorTable records and ColorSpec records only if it uses the Palette Manager, as described in the chapter "Palette Manager" in Advanced Color Imaging on the Mac OS.

You can customize the SeedCFill and CalcCMask procedures by writing your own color search functions and pointing to them in the matchProc parameters for these procedures. When SeedCFill or CalcCMask calls your color search function, the GDRefCon field of the current GDevice record (described in the chapter "Graphics Devices") contains a pointer to a MatchRec record. This record contains the RGB value of the seed pixel or seed color for which your color search function should search.

Your application typically does not create PixPat records. Although you can create PixPat records in your program code, it is usually easier to create pixel patterns using the pixel pattern resource, which is described on page 4-94.

You need to use the CQDProcs record only if you customize one or more of QuickDraw's low-level drawing routines.

Finally, the GrafVars record contains color information that supplements the information in the CGrafPort record, of which it is logically a part.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996