Macintosh : QuickDraw : Zerro Below

All opinions on this site are those of the author alone.
No warranty of any kind is provided.   All information herein is provided as is without any warranty of any kind.

ASM
FUN
Macintosh
WORK
CODE

QuickDraw:

WIP : Work In Progress

There are a few technologies that put the Macintosh System Software ahead of the pack in some ways, QuickDraw is likely the most significant of these. QuickDraw is the graphics drawing, blitting, and clipping package of the Macintosh System Software, with some very fast methods of accomplishing these tasks. The main thing that QuickDraw has going for it beyond all others is the use of QuickDraw Regions, a way of defining an outline that can be used for clipping, drawing, and much more.

Some QuickDraw Procedures:

This section is a very quick overview of some of the useful QuickDraw procedures provided in the Macintosh System Software. This is far from a complete list, and just provides a quick listing of some procedures. This does not give parameters or other information needed to use these procedures, that information is available in Inside Macintosh, and some will be covered on this site as the documentation here expands. Some documentation on this site in the future may even cover procedures not listed here, I will attempt to remember to add those to this list as I go.

As the documentation here grows the QuickDraw Data structures that are needed will be covered in the sections that cover the procedures that use said data structures. At least one data structure will be documented here more completely than it is in the Inside Macintosh documentation, that being the structure of the QuickDraw Region. In much documentation here I will also mention the differences for use with the Apple IIgs GS/OS version of QuickDraw (called Color QuickDraw II), as GS/OS is a great OS whose differences sometimes put it in a better position than the Macintosh System Software (from which it evolved).

At its core QuickDraw is a simple vector graphics and bitmap font rendering library, with routines tuned for speed of execution on a Big Endian CPU. As such QuickDraw has drawing and graphics manipulation routines for:

  • HidePen : Suspends drawing in the current pen, allowing for purely move operations.
  • ShowPen : The opposite of HidePen, resumes drawing (calls must balance, as visibility counter is increased).
  • GetPen : Returns the location of the current Graphics Pen.
  • GetPenState : Returns a structure of all information on the current graphics pen.
  • SetPenState : Set the visibility, location, pattern, size, and drawing mode of the current graphics pen.
  • PenSize : Set the size of the pen being used.
  • PenMode : Specify how the pen draws (set, clear, xor, or, not-set, not-or, not-xor, not-clear, etc).
  • PenPat : Set the pen pattern, mostly useful for dithering. Newer programs generally just use a solid pattern.
  • PenNormal : Set the current pen to the current GraphPort defaults.
  • BackPat : Set the background pattern (used for erase operations).
  • MoveTo : Move the graphics cursor to new location relative to its current position..
  • Move : Move the graphics cursor to specified coordinates.
  • LineTo : Draws a line from the current graphics cursor position to the specified location.
  • Line : Draws a line from the specified start location to the specified destination.
  • FrameRect : Draw Rectangle outline.
  • PaintRect : Draw Filled Rectangle in current pen.
  • FillRect : Draw Filled Rectangle with any available pattern.
  • EraseRect : Draw over a rectangle with the current Back Ground pattern for the current GraphPort.
  • InvertRect : Inverts the color of each pixel within the specified Rectangle.
  • FrameRoundRect : Draw the outline of a Rectangle with Rounded Corners.
  • PaintRoundRect : Draw filled Rounded Corner Rectangle using current pen.
  • FillRoundRect : Draw filled Rounded Corner Rectangle in any available pattern.
  • EraseRoundRect : Draw Rounded corner Rectangle in background pattern.
  • InvertRoundRect: Invert the color of each pixel in Rounded Rectangle.
  • FrameOval : Draw the outline of an Oval.
  • PaintOval : Draw a filled Oval using current pen.
  • FillOval : Draw a filled Oval in any available pattern.
  • EraseOval : Draw background pattern to Oval.
  • InvertOval : Invert every pixel within an Oval.
  • FrameArch : Draw an Arc of an oval.
  • PaintArc : Draw filled pie slice of an Oval with current pen.
  • FillArc : Draw filled pie slice of an Oval using any available pattern.
  • EraseArc : Draw filled Pie slice of an oval in background pattern.
  • InvertArc : Invert all pixel colors in a Pie Slice of an Oval.
  • OpenPoly : Start defining a Polygon shape.
  • ClosePoly : Finish defining a polygon shape.
  • killPoly : Delete a defined polygon shape from memory.
  • FramePoly : Draw the outline of a defined Poly.
  • PaintPoly : Draw a defined Poly filled in the current pen.
  • FillPoly : Draw a defined Poly filled with any available pattern.
  • ErasePoly : Draw a defined Poly filled with the background pattern.
  • InvertPoly : Invert each pixel color inside a defined Poly.
  • OffsetPoly : Move a defined Poly.

Regions are areas defined by a simple line by line outline, ordered such that it only records lines that are different from those that are above that line. Regions may be non-continuous areas, and of arbitrary shapes, this makes them ideal for both drawing and using as a clipping mask.

  • NewRgn : Create a new region.
  • DisposeRgn : Remove a region and free its memory.
  • OpenRgn : Open a region to define its shape.
  • CloseRgn : Close a region when done defining its shape.
  • SetEmptyRgn : Make a region be an empty region.
  • BitMapToRgn : Convert a bitmap to a region.
  • PtInRgn : Determines if a point is within a region.
  • RectInRgn : Determines if a rectangle is within a region.
  • EmptyRgn : Determine if a given region is an empty region.
  • EqualRgn : Determine if two regions are equal.
  • SetRectRgn : Cause region to be a rectangle.
  • CopyRgn : Creates a copy of a Region.
  • OffsetRgn : Move a region.
  • InsetRgn : Shrink or expand Region.
  • SectRgn : Calculate the intersection of two regions (think AND operation).
  • UnionRgn : Calculate the union of two regions (think OR operation).
  • DiffRgn : Calculate the difference of two regions (think NOT AND operation).
  • XorRgn : Calculate the XOR of two regions.
  • FrameRgn : Draw the outline of a region.
  • PaintRgn : Draw filled region using current pen.
  • FillRgn : Draw filled region with any available pattern.
  • EraseRgn : Draw filled region in background pattern and color.
  • InvertRgn : Invert the color of all pixels in region.
  • ForeColor : Sets the basic QuickDraw Foreground Color.
  • BackColor : Sets the basic QuickDraw Background Color..
  • QDDone : Tells if QuickDraw is done drawing (rarely needed).

Graphics port's (GrpahPort's) specify the area (port) to draw to. Here are some basic operations on QuickDraw GraphPort. In QuickDraw the bounds of a GraphPort are defined by a region, as is the clipping area of the port by another region.

  • ScrollRect : Scrolls (moves relative to) a rectangular area in a specified region.
  • SetOrigin : Sets the point used as the origin for absolute position drawing in the current graphics port.
  • PortSize : Sets the size of the current GraphPort.
  • MovePortTo : Moves the current graphics port location.
  • GetClip : Returns a region that is the clipping region of the current GraphPort.
  • SetClip : Set the clipping Region of the current GraphPort to that provided in the call.

QuickDraw also provides for some simple bitmap copy routines including:

  • CopyBits : Copy a pixel image rectangle.
  • CopyMask : Copy a masked pixel image rectangle.
  • ScalePt : Calculate the scaling ratio of two rectangles.
  • MapPt : Map a point in one rectangle to the same scaled point in another.
  • MapRect : Map and scale a rectangle within one rectangle to a correctly scaled rectangle within another.
  • MapRgn : Map and scale a region in one rectangle to a correctly scaled region in another.
  • MapPoly : Map and scale a Poly in one rectangle to a correctly scaled Poly in another.

Color QuickDraw adds some basic drawing routines:

  • GetPixPat : Retrieve a pixel pattern from a resource fork.
  • NewPixPat : Create a new Pixel Pattern.
  • CopyPixPat : Copies one Pixel Pattern into another.
  • MakeRGBPat : Creates a Pixel Pattern that acts as a dithered version of a color not directly available in the current color depth.
  • DisposePixPat: Gets rid of and deallocates a Pixel Pattern.
  • PenPixPat : Set the pens pixel pattern for drawing.
  • BackPixPat : Set the background pixel pattern.
  • PmForeColor : Use palette to set foreground color.
  • PmBackColor : Use Palette to set background color.
  • RGBForeColor: Set Foreground Color in a direct color mode.
  • RGBBackColor: Set the Background Color in a direct color mode.
  • GetForeColor: Obtain the current foreground color for the current Color GraphPort.
  • GetBackColor: Obtain the current set background color in the current Color GraphPort.
  • SetCPix : Set a single pixel color.
  • GetCPix : Get the color value of a single pixel.
  • FillCRect : Fill a rectangle with the current color pattern.
  • FillCRoundRect: Fill a rounded corner rectangle with the current color pattern.
  • FillCOval : Fill an oval with color pattern.
  • FillCArc : Fill a pie slice with the color pattern.
  • FillCPoly : Fill a Poly with the color pattern.
  • FillCRgn : Fill a region with color pattern.
  • OpColor : Defines the max RGB color for addPen and subPen mode and the weight color for blend mode.
  • HiliteColor: Set the highlight color for the current Color GraphPort.

Additionally Color QuickDraw adds a few GraphPort related calls:

  • New: .
  • OpenCPort : Open a color GraphPort.
  • InitCPort : Used by OpenCPort to initialize graphics port.
  • CloseCPort : Closes an open Color GraphPort.

Color QuickDraw uses PixMaps, these can be manipulated with some procedures provided by Color QuickDraw:

  • NewPixMap : Create and initialize a new PixMap.
  • CopyPixMap : Copy an existing PixMap into another PixMap.
  • SetPortPix : To set the pixel map used by a Color GraphPort, this should never be needed in most applications.
  • DisposePixMap: Forget and deallocate a pixel map.

Despite the length of the above lists they only cover a small part of the QuickDraw routines, and do not cover any of the detail needed to use them. Some things will be expanded on in separate pages, other simpler details will be covered below on this page. This will not ever be an exhaustive reference, just enough to do most common screen drawing using QuickDraw, for an exhaustive reference see Inside Macintosh : Imaging With QuickDraw.

While this is not an exhaustive reference some things that are left out of Inside Macintosh will be covered, like the details of how regions are stored in memory and manipulated.

--:

--:

.

--:

.

.



This site hosted by NEOCITIES
THIS SITE BEST VIEWED IN YOUR FAVORITE BROWSER
© 2022 David Cagle