MakeRGBPat
To create the appearance of otherwise unavailable colors on indexed devices, you can use theMakeRGBPatprocedure.
PROCEDURE MakeRGBPat (ppat: PixPatHandle; myColor: RGBColor);
ppat- A handle to hold the generated pixel pattern.
myColor- An
RGBColorrecord that defines the color you want to approximate.DESCRIPTION
TheMakeRGBPatprocedure generates aPixPatrecord that, when used to draw a pixel pattern, approximates the color you specify in themyColorparameter. 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 useMakeRGBPatto 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^^.boundsfield of thePixPatrecord always contains the values (0,0,8,8), and thepatMap^^.rowbytesfield equals 2.SPECIAL CONSIDERATIONS
Because patterns produced withMakeRGBPataren'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
MakeRGBPatcreates aColorTablerecord, it fills in only thergbfields of itsColorSpecrecords; thevaluefields are computed at the time the drawing actually takes place, using the current pixel depth for the system.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help