Important: The information in this document is obsolete and should not be used for new development.
PenMode
To set the pattern mode of the graphics pen in the current graphics port, use thePenMode
procedure.
PROCEDURE PenMode (mode: Integer);
mode
- The pattern mode. The following list shows the constants you can
use--and the values they represent--for specifying the pattern mode.CONST patCopy = 8; {where pattern pixel is black, apply } { foreground color to destination pixel; } { where pattern pixel is white, apply } { background color to destination pixel} patOr = 9; {where pattern pixel is black, invert } { destination pixel; where pattern } { pixel is white, leave } { destination pixel unaltered} patXor = 10; {where pattern pixel is black, invert } { destination pixel; where pattern } { pixel is white, leave destination } { pixel unaltered} patBic = 11; {where pattern pixel is black, apply } { background color to destination pixel; } { where pattern pixel is white, leave } { destination pixel unaltered} notPatCopy = 12; {where pattern pixel is black, apply } { background color to destination pixel; } { where pattern pixel is white, apply } { foreground color to destination pixel} notPatOr = 13; {where pattern pixel is black, leave } { destination pixel unaltered; where } { pattern pixel is white, apply } { foreground color to destination pixel} notPatXor = 14; {where pattern pixel is black, } { leave destination pixel unaltered; } { where pattern pixel is white, } { invert destination pixel} notPatBic = 15; {where pattern pixel is black, } { leave destination pixel unaltered; } { where pattern pixel is white, apply } { background color to destination pixel}DESCRIPTION
Using the pattern mode you specify in themode
parameter, thePenMode
procedure sets the manner in which the pattern of the graphics pen is transferred onto the bitmap (or pixel map) when you draw lines or shapes in the current graphics port. These actions are illustrated in Figure 3-4 on page 3-8.If you specify a source mode (such as one used with the
CopyBits
procedure) instead of a pattern mode, no drawing is performed.The current pattern mode is stored in the
pnMode
field of the current graphics port. The initial pattern mode value ispatCopy
, in which the pen pattern is copied directly to the bitmap.To use highlighting, you can add this constant or its value to the source or pattern mode:
CONST hilite = 50; {add to source or pattern mode for highlighting}With highlighting, QuickDraw replaces the background color with the highlight color when your application draws or copies images between graphics ports. This has the visual effect of using a highlighting pen to select the object. (The global variableHiliteRGB
is read from parameter RAM when the machine starts. Basic graphics ports use the color stored in theHiliteRGB
global variable as the highlight color. Color graphics ports default to theHiliteRGB
global variable, but can be overridden by theHiliteColor
procedure, described in the chapter "Color QuickDraw.")SPECIAL CONSIDERATIONS
When your application draws with a pixel pattern, Color QuickDraw ignores the pattern mode and simply transfers the pattern directly to the pixel map without regard to the foreground and background colors.The results of inverting a pixel are predictable only with direct pixels or 1-bit pixel maps. For indexed pixels, Color QuickDraw performs the inversion on the pixel indexes, which means the results depend entirely on the contents of the color table (which is described in the chapter "Color QuickDraw"). The eight colors used in basic QuickDraw are stored in a color table represented by the global variable
QDColors
. To display those eight basic QuickDraw colors on an indexed device, Color QuickDraw uses the Color Manager to obtain indexes to the colors in the CLUT that best map to the colors in theQDColors
color table. Because the index, not the color value, is inverted, the results are unpredictable.SEE ALSO
Pattern modes are discussed in detail in "Boolean Transfer Modes With 1-Bit Pixels" beginning on page 3-7 of this chapter and in "Boolean Transfer Modes With Color Pixels" beginning on page 4-23 in the chapter "Color QuickDraw."