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 / Drawing With Color QuickDraw Colors


RGBForeColor

To change the color of the "ink" used for framing and painting, you can use the RGBForeColor procedure.

PROCEDURE RGBForeColor (color: RGBColor);
color
An RGBColor record.
DESCRIPTION
The RGBForeColor procedure lets you set the foreground color to any color available on the current graphics device.

If the current port is defined by a CGrafPort record, Color QuickDraw supplies its rgbFgColor field with the RGB value that you specify in the color parameter, and places the pixel value most closely matching that color in the fgColor field. For
indexed devices, the pixel value is an index to the current device's CLUT; for direct devices, the value is the 16-bit or 32-bit equivalent to the RGB value.

If the current port is defined by a GrafPort record, basic QuickDraw supplies its fgColor field with a color value determined by taking the high bit of each of the red, green, and blue components of the color that you supply in the color parameter. Basic QuickDraw uses that 3-bit number to select a color from its eight-color system. Table 4-4 lists the default set of eight colors represented by the global variable QDColors (adjusted to match the colors produced on the ImageWriter II printer.)

Table 4-4: The colors defined by the global variable QDColors (Continued)
ValueColorRedGreenBlue
0Black$0000$0000$0000
1Yellow$FC00$F37D$052F
2Magenta$F2D7$0856$84EC
3Red$DD6B$08C2$06A2
4Cyan$0241$AB54$EAFF
5Green$0000$64AF$11B0
6Blue$0000$0000$D400
7White$FFFF$FFFF$FFFF

SPECIAL CONSIDERATIONS
Color QuickDraw ignores the foreground color (and the background color) when your application draws with a pixel pattern. You can draw with a pixel pattern by using the PenPixPat procedure to assign a pixel pattern to the foreground pattern used by the graphics pen; by using the BackPixPat procedure to assign a pixel pattern as the background pattern for the current color graphics port; and by using the FillCRect, FillCOval, FillCRoundRect, FillCArc, FillCRgn, and FillCPoly procedures to fill shapes with a pixel pattern.

The RGBForeColor procedure is available for basic QuickDraw only in System 7.

The RGBForeColor procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.

SEE ALSO
If you want to use one of the eight predefined colors of basic QuickDraw, you can also use the ForeColor procedure. The ForeColor procedure and the eight-color system of basic QuickDraw are described in the chapter "QuickDraw Drawing" in this book.

To determine the current foreground color, use the GetForeColor procedure, which is described on page 4-70.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996