In Quartz, everything drawn on the page has color information associated with it. Color components are floating-point values ranging from 0.0 (no color) to 1.0 (full intensity). To support transparency, colors include an alpha component that ranges from 0.0 (transparent) to 1.0 (opaque). Quartz supports drawing with transparency in all types of graphics contexts. There are many uses for transparency in Mac OS X. For example, you can use translucent overlay windows to indicate selection.
Quartz colors are always associated with a color space. This ensures that colors are reproduced faithfully regardless of the drawing destination. Quartz supports separate color spaces for stroking and filling. Further, bitmap images and shadings are drawn to their own color spaces. When drawing is rendered to a destination, Quartz uses ColorSync to achieve accurate color matching.
If color fidelity is critical to your application, you’ll need to learn how to manage colors and how to use calibrated color spaces in Quartz. If you don’t need a sophisticated level of color-matching in your application, don’t panic. Using colors and color spaces in Quartz is straightforward. Starting in Mac OS X v10.4, you can use Generic color spaces, which let Quartz manage color for you in the best way possible, without your needing to know all the particulars of calibrated color spaces.
If you haven’t worked with color spaces, you might want to read Color Management Overview to learn the terminology and basic concepts associated with color and color spaces. This document discusses color perception, the dimensions associated with color, device-dependent and device-independent color spaces, color component values, color matching systems, rendering intents, color profiles, and ColorSync.
Regardless of your needs, before you start to work with color in Quartz, read Color and Color Spaces in Quartz 2D Programming Guide.
Converting Between QuickDraw RGB and Quartz RGB
Creating Color Spaces
Relevant Resources
Last updated: 2006-09-05