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
Color QuickDraw Routines / Creating and Disposing of Pixel Patterns


To create the appearance of otherwise unavailable colors on indexed devices, you can use the MakeRGBPat procedure.

PROCEDURE MakeRGBPat (ppat: PixPatHandle; myColor: RGBColor);
A handle to hold the generated pixel pattern.
An RGBColor record that defines the color you want to approximate.
The MakeRGBPat procedure generates a PixPat record that, when used to draw a pixel pattern, approximates the color you specify in the myColor parameter. For example, if your application draws to an indexed device that supports 4 bits per pixel, you only have 16 colors available if you simply set the foreground color and draw. If you use MakeRGBPat to create a pattern, and then draw using that pattern, you effectively get 125 different colors. If the graphics device has 8 bits per pixel, you effectively get 2197 colors. (More colors are theoretically possible; this implementation opted for a fast pattern selection rather than the best possible pattern selection.)

For a pixel pattern, the patMap^^.bounds field of the PixPat record always contains the values (0,0,8,8), and the patMap^^.rowbytes field equals 2.

Because patterns produced with MakeRGBPat aren't usually solid--they provide a selection of colors by alternating between colors, with up to four colors in a pattern-- lines that are only one pixel wide may not look good.

When MakeRGBPat creates a ColorTable record, it fills in only the rgb fields of its ColorSpec records; the value fields are computed at the time the drawing actually takes place, using the current pixel depth for the system.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996