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 3 - QuickDraw Drawing / QuickDraw Drawing Reference
Data Structures /


PenState

The GetPenState procedure (described on page 3-39) saves the location, size, pattern, and pattern mode of the graphics pen for the current graphics port in a PenState record, which is a data structure of type PenState. After changing the graphics pen as necessary, you can later restore these pen states with the SetPenState procedure (described on page 3-39).

Here is how a PenState record is defined:

TYPE PenState =
   RECORD
      pnLoc:   Point;      {pen location}
      pnSize:  Point;      {pen size}
      pnMode:  Integer;    {pen's pattern mode}
      pnPat:   Pattern;    {pen pattern}
   END;
Field Description
pnLoc
For the current graphics port at the time the GetPenState procedure was called, the value of that graphics port's pnLoc field. This value is the point where QuickDraw begins drawing next. The location of the graphics pen is a point in the graphics port's coordinate system, not a pixel in a bit image. The upper-left corner of the pen is at the pen location; the graphics pen hangs below and to the right of this point.
pnSize
For the current graphics port at the time the GetPenState procedure was called, the value of that graphics port's pnSize field. The graphics pen is rectangular in shape, and its width and height are specified by the values in the pnSize field. The default size is a 1-by-1 bit square; the width and height can range from 0 by 0 to 32,767 by 32,767. If either the pen width or the pen height is 0, the pen does not draw. Heights or widths of less than 0 are undefined.
pnMode
The pattern mode--that is, for the current graphics port at the time the GetPenState procedure was called, the value of that graphics port's pnMode field. This value determines how the pen pattern is to affect what's already in the bit image when lines or shapes are drawn. When the graphics pen draws, QuickDraw first determines what bits in the bit image are affected, finds their corresponding bits in the pattern, and then transfers the bits from the pattern into the image according to this mode, which specifies one of eight Boolean transfer operations. The resulting bit is stored into its proper place in the bit image. The various pattern modes are described in "Boolean Transfer Modes With 1-Bit Pixels" beginning on page 3-7.
pnPat
For the current graphics port at the time the GetPenState procedure was called, the pen pattern for that graphics port. This pattern determines how the bits under the graphics pen are affected when lines or shapes are drawn.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996