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

Drawing Rectangles

A rectangle is defined by a data structure of type Rect, in which you specify two points (for the upper-left and lower-right corners of the rectangle) or four boundary coordinates (one for each side of the rectangle). After defining a rectangle (such as by using the SetRect procedure), you can use the FrameRect procedure to outline it with the size, pattern, and pattern mode of the graphics pen.

You can use the PaintRect procedure to draw a rectangle's interior with the pattern of the graphics pen, using the pattern mode of the graphics pen.

Using the FillRect procedure, you can draw a rectangle's interior with any pattern you specify. The procedure transfers the pattern with the patCopy pattern mode, which directly copies your requested pattern into the shape.

You can use the EraseRect procedure to erase a rectangle; this procedure fills the rectangle's interior with the background pattern for the current graphics port. Making the shape blend into the background pattern of the graphics port effectively erases the shape. For example, you can use EraseRect to erase the port rectangle for a window before redrawing into the window.

You can use the InvertRect procedure to invert a rectangle; this procedure reverses the colors of all pixels within the rectangle's boundary. On a black-and-white monitor, this changes all black pixels in the shape to white, and changes all white pixels to black. Although this procedure operates on color pixels in color graphics ports, the results are predictable only with direct pixels or 1-bit pixel maps.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996