Important: The information in this document is obsolete and should not be used for new development.
Chapter 4 - Color QuickDraw
This chapter describes Color QuickDraw, the version of QuickDraw that provides a range of color and grayscale capabilities to your application. You should read this chapter if your application needs to use shades of gray or more colors than the eight predefined colors provided by basic QuickDraw.Read this chapter to learn how to set up and manage a color graphics port--the sophisticated drawing environment available on Macintosh computers that support Color QuickDraw. You should also read this chapter to learn how to draw using many more colors than are available with basic QuickDraw's eight-color system.
Color QuickDraw supports all of the routines described in the previous chapters of this book. For a color graphics port, for example, you can use the
ScrollRect
andSetOrigin
procedures, which are described in the chapter "Basic QuickDraw." Furthermore, you can use the drawing routines described in the chapter "QuickDraw Drawing" to draw with the sophisticated color and grayscale capabilities available to color graphics ports. For example, after creating anRGBColor
record that describes a medium shade of green, you can use the Color QuickDraw procedureRGBForeColor
to make that color the foreground color. Then, when you use theFrameRect
procedure, Color QuickDraw draws the outline for your rectangle with your specified shade of green.To prevent the choppiness that can occur when you build a complex color image onscreen, your application typically should prepare the image in an offscreen graphics world and then copy it to an onscreen color graphics port as described in the chapter "Offscreen Graphics Worlds." If you want to optimize your application's drawing for screens with different color capabilities, see the chapter "Graphics Devices."
This chapter describes color graphics ports and Color QuickDraw's routines for drawing in color. For many applications, Color QuickDraw provides a device-independent interface: draw colors in the color graphics port for a window, and Color QuickDraw automatically manages the path to the screen. If your application needs more control over its color environment, Macintosh system software provides additional graphics managers to enhance your application's color-handling abilities. These managers are described in Advanced Color Imaging on the Mac OS, which shows you how to
- manage color selection across a variety of indexed devices by using the Palette Manager
- solicit color choices from users by using the Color Picker
- match colors between the screen and other devices--such as scanners and printers--by using the ColorSync Utilities
- directly manipulate the fields of the CLUT on an indexed device--although most applications should never need to do so--by using the Color Manager
Chapter Contents
- About Color QuickDraw
- RGB Colors
- The Color Drawing Environment: Color Graphics Ports
- Pixel Maps
- Pixel Patterns
- Color QuickDraw's Translation of RGB Colors to Pixel Values
- Colors on Grayscale Screens
- Using Color QuickDraw
- Initializing Color QuickDraw
- Creating Color Graphics Ports
- Drawing With Different Foreground Colors
- Drawing With Pixel Patterns
- Copying Pixels Between Color Graphics Ports
- Boolean Transfer Modes With Color Pixels
- Dithering
- Arithmetic Transfer Modes
- Highlighting
- Color QuickDraw Reference
- Data Structures
- Color QuickDraw Routines
- Opening and Closing Color Graphics Ports
- Managing a Color Graphics Pen
- Changing the Background Pixel Pattern
- Drawing With Color QuickDraw Colors
- Determining Current Colors and Best Intermediate Colors
- Calculating Color Fills
- Creating, Setting, and Disposing of Pixel Maps
- Creating and Disposing of Pixel Patterns
- Creating and Disposing of Color Tables
- Retrieving Color QuickDraw Result Codes
- Customizing Color QuickDraw Operations
- Reporting Data Structure Changes to QuickDraw
- Application-Defined Routine
- Resources
- The Pixel Pattern Resource
- The Color Table Resource
- The Color Icon Resource
- Summary of Color QuickDraw
- Pascal Summary
- Constants
- Data Types
- Color QuickDraw Routines
- Application-Defined Routine
- C Summary
- Constants
- Data Types
- Color QuickDraw Functions
- Application-Defined Function
- Assembly-Language Summary
- Data Structures
- Result Codes