Important: The information in this document is obsolete and should not be used for new development.
TextMode
TheTextModeprocedure sets the transfer mode for drawing text in the current
graphics port.
PROCEDURE TextMode (mode: Integer);
mode- The transfer mode to be used to draw the text.
DESCRIPTION
The TextMode procedure sets the transfer mode in the graphics porttxModefield. The transfer mode determines the interplay between what an application is drawing (the source) and what already exists on the display device (the destination), resulting in the text display.There are two basic kinds of modes: pattern (
pat) and source (src). Source is the kind that you use for drawing text. There are four basic Boolean operations:Copy,Or,Xor, andBic(bit clear), each of which has an inverse variant in which the source is inverted before the transfer, yielding eight operations in all. Original QuickDraw supports these eight transfer modes. Color QuickDraw enables your application to achieve color effects within those basic transfer modes, and offers an additional set of transfer modes that perform arithmetic operations on the RGB values of the source and destination pixels. See the chapter "Color QuickDraw" in Inside Macintosh: Imaging for a complete discussion of the arithmetic transfer modes. Other transfer modes aregrayishTextOr,transparentmode, and text mask mode.Table 3-1 shows the eight basic transfer modes and their effects on the destination pixels.
This is how color affects these transfer modes when the source pixels are either all black (all 1's) or white (all 0's).
Copy
TheCopymode applies the foreground color to the black part of the source (the part containing 1's) and the background color to the white part of the source (the part containing 0's), and replaces the destination with the colored source.Or
TheOrmode applies the foreground color to the black part of the source and replaces the destination with the colored source. The white part of the source isn't transferred
to the destination. If the foreground is black, the drawing will be faster. Copying to a white background always reproduces the source image, regardless of the pixel depth.Xor
TheXormode complements the bits in the destination corresponding to the bits equal to 1 in the source. When used on a colored destination, the color of the inverted destination isn't defined.Bic
TheBicmode applies the background color to the black part of the source and
replaces the destination with the colored source. The white part of the source isn't transferred to the destination. The black part of the source is erased, resulting in white
in the destination.NotCopy
TheNotCopymode applies the foreground color to the white part of the source and the background color to the black part of the source, and replaces the destination with the colored source. It thus has the effect of reversing the foreground and background colors.NotOr
TheNotOrmode applies the foreground color to the white part of the source and replaces the destination with the colored source. The black part of the source isn't transferred to the destination. If the foreground is black, the drawing will be faster.NotXor
TheNotXormode inverts the bits that are 0 in the source. When used on a colored destination, the color of the inverted destination isn't defined.NotBic
TheNotBicmode applies the background color to the white part of the source and replaces the destination with the colored source. The black part of the source isn't transferred to the destination.The arithmetic transfer modes are
addOver,addPin,subOver,subPin,adMax,adMin, andblend. For color, the arithmetic modes change the destination pixels by performing arithmetic operations on the source and destination pixels. Arithmetic transfer modes calculate pixel values by adding, subtracting, or averaging the RGB components of the source and destination pixels. They are most useful for 8-bit color, but they work on 4-bit and 2-bit color also. When the destination bitmap is one bit deep, the mode reverts to the basic transfer mode that best approximates the arithmetic mode requested.The
grayishTextOrtransfer mode draws dimmed text on the screen. You can use it for black-and-white or color graphics ports. ThegrayishTextOrtransfer mode is not considered a standard transfer mode because currently it is not stored in pictures, and printing with it is undefined. (It does not pass through the QuickDraw bottleneck routines.)The transparent mode replaces the destination pixel with the source pixel if the source pixel isn't equal to the background color. This mode is most useful in 8-bit, 4-bit, or 2-bit color modes.
Table 3-2 Transfer mode constants and selectors
- Note
- Multibit fonts may have a specific color. Some transfer modes may not produce the desired results with a multibit font. However, the arithmetic modes, transparent mode, and hilite mode work equally well with single bit and multibit fonts. Multibit fonts draw quickly in
srcOrmode only if the foreground is white. Single bit fonts draw quickly insrcOrmode only if the foreground is black. Grayscale fonts produce a spectrum of colors, rather than just the foreground and background colors. The following table shows transfer mode constants and
their selectors.![]()
Transfer mode Selector Transfer mode Selector srcCopy 0 addPin 33 srcOr 1 addOver 34 srcXor 2 subPin 35 srcBic 3 transparent 36 notSrcCopy 4 adMax 37 notSrcOr 5 subOver 38 notSrcXor 6 adMin 39 notSrcBic 7grayishTextOr 49 blend 32mask 64 For more information about transfer modes, see the chapters "QuickDraw Drawing" and "Color QuickDraw" in Inside Macintosh: Imaging.