Line 1: |
Line 1: |
− | QuickDraw is the 2D graphics library and associated Application Programming Interface (API) which is a core part of the classic Mac OS operating system. It was initially written by [[Bill Atkinson]] and [[Andy Hertzfeld]]. QuickDraw is the part of the Macintosh Toolbox that performs graphics operations on the user's screen. All Macintosh applications use QuickDraw indirectly whenever they call other Toolbox managers to create and manage the basic user interface elements (such as windows, controls, and menus, as described in Inside Macintosh: Macintosh Toolbox Essentials). | + | QuickDraw is the 2D graphics library and associated Application Programming Interface (API) which is a core part of the classic Mac OS operating system. It was initially written by [[Bill Atkinson]] and [[Andy Hertzfeld]]. QuickDraw is the part of the [[Macintosh Toolbox]] that performs graphics operations on the user's screen. All Macintosh applications use QuickDraw indirectly whenever they call other Toolbox managers to create and manage the basic user interface elements (such as windows, controls, and menus, as described in Inside Macintosh: Macintosh Toolbox Essentials). |
| | | |
| =Overview= | | =Overview= |
Line 24: |
Line 24: |
| | | |
| When you use the Window Manager to place a window on the screen, you specify the location of its port rectangle in global coordinates. However, within the port rectangle, the drawing area is described using a local coordinate system. You draw into a window in local coordinates, without regard to the window's location on the screen. | | When you use the Window Manager to place a window on the screen, you specify the location of its port rectangle in global coordinates. However, within the port rectangle, the drawing area is described using a local coordinate system. You draw into a window in local coordinates, without regard to the window's location on the screen. |
| + | |
| + | =Images= |
| + | QuickDraw provides a plethora of routines for drawing different kinds of images. These routines typically require that you start at a particular location in a graphics port and then move the graphics pen. The graphics pen is a metaphorical device for performing drawing operations onscreen. Your application can set this pen to different sizes, patterns, and colors. |
| + | |
| + | You specify where to begin drawing by placing the pen at some location in the window's local coordinate system, and then specifying an act of drawing, usually from there to another location. Take, for example, the following two lines of code: |
| + | <pre> |
| + | MoveTo(20,10); |
| + | LineTo(50,30); |
| + | </pre> |
| + | The MoveTo procedure places the graphics pen at a point with a horizontal coordinate of 20 and a vertical coordinate of 10 in the local coordinate system of the graphics port, and the LineTo procedure draws a line from there to a point with a horizontal coordinate of 50 and a vertical coordinate of 30. |
| + | |
| + | =Colors= |
| + | The earliest Macintosh models all used basic QuickDraw to draw to built-in screens with known characteristics. The [[Macintosh II]] computer introduced [[Color QuickDraw]], which supports a variety of screens of differing sizes and color capabilities. With [[Color QuickDraw]], users can choose from a wide range of screen options, from simple 12-inch black-and-white screens to full-page grayscale monitors to large two-page displays capable of presenting millions of colors. Users can even connect two or more separate screens to the same computer and simultaneously view different portions of the system's global coordinate plane. |
| + | |
| + | A pixel, which is short for picture element, is the smallest dot that QuickDraw can draw. On a black-and-white monitor, a pixel is a single-color phosphor dot that displays in two states--black and white. On a color screen, three phosphor dots (red, green, and blue) compose each color pixel. |
| + | |
| + | A pair of fields in a graphics port, fgColor and bkColor, specify a foreground and background color. The foreground color is the color used for bit patterns and for the graphics pen when drawing. By default, the foreground color is black. The background color is the color of the pixels in the bitmap or pixel map wherever no drawing has taken place. By default, the background color is white. However, when there is a color screen your application can draw with a color other than black by changing the foreground color, and your application can draw into a background other than white by changing the background color. For example, by changing the foreground color to red and the background color to blue before drawing a rectangle, your application can draw a red rectangle against a blue background. |
| + | |
| + | On a color screen, you can draw in color even when you are using a basic graphics port. Although basic QuickDraw graphics routines were designed for black-and-white drawing, they also support an eight-color system that basic QuickDraw predefines for display on color screens and color printers. Because [[Color QuickDraw]] also supports this eight-color system, it is compatible across all Macintosh platforms. |
| | | |
| =See Also= | | =See Also= |
| * [[QuickDraw GX]] | | * [[QuickDraw GX]] |
| + | * [[Color QuickDraw]] |
| + | * [[Inside Macintosh]] |
| | | |
− | [[Category:Apple]][[Category:Software]] | + | [[Category:Apple]][[Category:Graphics]][[Category:Programming]] |