Quickdraw
Code Examples
How to Spool a Picture to a File
GrafPort
InitGraf Initialize for using Quickdraw
OpenPort Allocate and initialize a new GrafPort
ClosePort Release memory used by an open GrafPort
GetPort Find which GrafPort is currently active
SetPort Activate a GrafPort
InitPort Reset fields of a GrafPort to initial values
SetPortBits Assigns a new bit map to the active GrafPort
GrafDevice Set the device field for a GrafPort
PortSize Change the height and width of current GrafPort
GetClip Obtain a copy of the current clipping Region
SetClip Set clipping region of active GrafPort
ClipRect Set clipping region to a rectangle
MovePortTo Change position of top-left corner of portRect
SetOrigin Change local coordinate system
Cursor
InitCursor Initialize cursor to the standard arrow
SetCursor Change the shape of the mouse cursor
HideCursor Remove the mouse cursor from the screen
ShowCursor Display the mouse cursor
ObscureCursor Hide cursor until mouse moves
Pen / Line Drawing
Move Move the pen relative to its current location
MoveTo Set pen location without drawing
GetPen Obtain current pen position
PenMode Set the graphics pen pattern transfer mode
PenPat Set the graphics pen pattern
PenSize Set dimensions of pen for current GrafPort
PenNormal Reset pen parameters to initial state
GetPenState Obtain current location, size, and mode of pen
SetPenState Set the pen location, size, pattern and mode
HidePen Make subsequent pen drawing invisible
ShowPen Balance previous HidePen(); make pen visible
Line Draw a line a specified distance
LineTo Draw a line to specified coordinates
Text
DrawChar Draw a character at current pen location
DrawString Draw a length-prefixed string of characters
DrawText Draw text from any arbitrary buffer
CharWidth Get width of one character
StringWidth Get width of Pascal-style string
TextWidth Get width of unformatted text
MeasureText Get width of every leading subset of unformatted text
TextFace Select style for subsequent text drawing
TextFont Select font for subsequent text drawing
TextMode Set text-drawing transfer mode
TextSize Set the size for subsequent text drawing
SpaceExtra Space out text for left/right justification
GetFontInfo Obtain font sizing information
Rectangles
EraseRect Fill rectangle with background pattern
FillRect Fill rectangle with specified pattern
FrameRect Draw the outline of rectangle
InvertRect Invert all pixels en closed by a rectangle
PaintRect Fill rectangle with current pen pattern and mode
SetRect Assign boundary coordinates to a Rect
OffsetRect Move a rectangle horizontally and vertically
InsetRect Shrink or expand a rectangle
EmptyRect Determine if a rectangle is empty
EqualRect Find if two rectangles are equal
SectRect Get intersection of two rectangles; check for overlap
UnionRect Find smallest rectangle enclosing two rectangles
MapRect Scale and reposition a rectangle
PtInRect Find if a point is en closed by a rectangle
Pt2Rect Find smallest rectangle enclosing two points
Ovals
EraseOval Fill oval with background pattern
FillOval Fill an oval with specified pattern
FrameOval Draw an oval within a specified rectangle
InvertOval Invert all pixels in an oval
PaintOval Fill an oval with current pen pattern and mode
RoundRects
EraseRoundRect Fill rounded-rectangle with background pattern
FillRoundRect Fill a rounded-rectangle with specified pattern
FrameRoundRect Draw a rounded-corner rectangle
InvertRoundRect Invert all pixels in a round-corner rectangle
PaintRoundRect Fill roundRect with current pen pattern and mode
Arcs / Wedges
EraseArc Fill wedge of an oval with background pattern
FillArc Fill a wedge of an oval with specified pattern
FrameArc Draw an arc
InvertArc Invert all pixels in a wedge of an oval
PaintArc Fill a wedge with current pen pattern and mode
Regions
EraseRgn Fill region with background pattern
FillRgn Fill region with specified pattern
FrameRgn Draw the outline of a region
InvertRgn Invert all pixels en closed by a region
PaintRgn Fill a region with current pen pattern and mode
NewRgn Create an empty Region; obtain a region handle
DisposeRgn Deallocate memory used to store a region
OpenRgn Begin recording a region shape
CloseRgn Stop recording region definition; obtain its data
RectRgn Set region to rectangle, specifying a Rect
SetRectRgn Set region to rectangle, specifying 4 coordinates