Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
QuickDraw
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Graphics primitives== Everything seen on a classic Mac OS screen is drawn by QuickDraw, but the library itself is quite low level. The primitive objects it can draw are: * Lines * Rectangles * Rounded (and oval) cornered rectangles * Ovals (including circles and ellipses) * Arcs (and wedges), both circular and oval * Polygons (arbitrary closed shapes built from a list of points joined by lines) * Regions (arbitrary sets of pixels—see below) * [[Bitmap]]s and [[Pixmap]]s * Text Each of these objects (except text) may be drawn using a "pen", which can have any rectangular dimensions, pattern or color. Note that, because the pen is rectangular and axis-aligned, diagonal lines will end up thicker than horizontal or vertical ones. Shapes may be drawn filled or framed, using any pattern or color. A filled Arc forms a wedge. Text may be drawn in any installed font, in a variety of stylistic variations, and at any size and color. Depending on how the selected font is stored, text can be scaled in a variety of ways - [[TrueType]] fonts will scale smoothly to any size, whereas [[Computer font#Bitmap_fonts|bitmap fonts]] do not usually scale well. An important feature of QuickDraw was support for ''transfer modes'', which governed how a destination pixel value was related to its previous value and the color of the object being drawn. The set of attributes of the pen and text drawing are associated with the GrafPort. '''Regions''' are a key data structure in QuickDraw. They define an arbitrary set of pixels, rather like a bitmap, but in a compressed form which can be very rapidly manipulated in complex ways. Regions can be combined (union), subtracted (difference), and [[Exclusive or|XORed]] to form other Regions. They can be used within a GrafPort for [[Clipping (computer graphics)|clipping]], or drawn filled or framed like any other shape. A series of framed shapes and connected lines may be combined into a Region. A Region need not consist of a contiguous set of pixels - disconnected regions are possible and common. Although regions could allow powerful graphic manipulations they are limited by the current implementation that restricts the maximum region data storage size to a sixteen bit value and so are not practical as a general-purpose drawing composition tool and practical use at high resolution is also restricted. Regions underpin the rest of QuickDraw, permitting clipping to arbitrary shapes, essential for the implementation of multiple overlapping windows. Invented by Bill Atkinson, Regions were patented as a separate invention by Apple.[https://web.archive.org/web/20150519163534/http://patft1.uspto.gov/netacgi/nph-Parser?Sect2=PTO1&Sect2=HITOFF&p=1&u=%2Fnetahtml%25%2FPTO%25%2Fsearch-bool.html&r=1&f=G&l=50&d=PALL&RefSrch=yes&Query=PN%2F4622545] A region is specified (after initial creation) by an ''opening'' of the region, drawing various QuickDraw shapes, and ''closing'' the region. Hidden routines construct the region as the QuickDraw commands are executed. Bitmaps may also be converted to regions, and bitmaps may be made from regions by "painting" or "filling" the region into a graphics port. The internal structure of a region, other than the storage length and its bounding rectangle, is opaque - there are no Apple-published documents available, though the mechanism is outlined in the patent. Regions are implemented using both vertical and horizontal [[Data compression|compression]]. A region is stored as a series of horizontal scan lines ("[[Raster graphics|rasters]]"), each of which contains a vertical coordinate followed by a list of horizontal inversion coordinates. Each inversion point can be thought of as toggling inclusion in the region for all the points after it: the first point turns the region on, the second turns it off, and so on. Further compression is achieved by storing each line differentially: each line contains only the differences from the previous line rather than a full set of inversion points. Finally, identical adjacent scan lines are efficiently encoded by simply skipping them. In this way, a commonly used region, the rounded corner rectangle, is efficiently encoded, and complex operations such as region composition and image clipping may be done without requiring either extensive processor cycles or large amounts of memory. (The original systems executing QuickDraw code used processors operating at 8 megahertz clock rates and systems had but 128 kilobytes of writable memory.) Because regions are bound to a specific orientation, a ninety degree rotation of a region would require both detailed [[reverse engineering]] of the structure and extensive coding. A general rotation is impractical when compared to rotating the original source boundary description and simply creating a new region. However, the API includes conversion routines to and from BitMaps. (Bitmaps may also be rotated using well known methods, but with various degrees of image degradation depending upon angle chosen, the storage and processor cycles available to the operation, and the complexity of the algorithm.) Apple has recently (in the [[Carbon (API)|Carbon API]]) defined regions as an opaque structure under some program compilation options.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)