Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.

Changes

Jump to navigation Jump to search
3,019 bytes added ,  16:25, 24 September 2020
no edit summary
Line 4: Line 4:     
Color QuickDraw supplements the black-and-white patterns of basic [[QuickDraw]] with pixel patterns, which can use colors at any pixel depth and can be of any width and height that’s a power of 2. A pixel pattern defines a repeating design (such as stripes of different colors) or a color otherwise unavailable on indexed devices. For example, if your application draws to an indexed device that supports 4 bits per pixel, your application has 16 colors available if it simply sets the foreground color and draws. However, if your application uses the MakeRGBPat procedure to create patterns that use these 16 colors in various combinations, and then draws using that pattern, your application can effectively have as many as 125 approximated colors at its disposal. For example, you can specify a purple color to MakeRGBPat, which creates a pattern that mixes blue and red pixels.
 
Color QuickDraw supplements the black-and-white patterns of basic [[QuickDraw]] with pixel patterns, which can use colors at any pixel depth and can be of any width and height that’s a power of 2. A pixel pattern defines a repeating design (such as stripes of different colors) or a color otherwise unavailable on indexed devices. For example, if your application draws to an indexed device that supports 4 bits per pixel, your application has 16 colors available if it simply sets the foreground color and draws. However, if your application uses the MakeRGBPat procedure to create patterns that use these 16 colors in various combinations, and then draws using that pattern, your application can effectively have as many as 125 approximated colors at its disposal. For example, you can specify a purple color to MakeRGBPat, which creates a pattern that mixes blue and red pixels.
 +
 +
=RGB Colors=
 +
When using Color QuickDraw, you specify colors as RGB colors. An RGB color is defined by its red, green, and blue components. For example, when each of the red, green, and blue components of a color is at maximum intensity ($FFFF), the result is the color white. When each of the components has zero intensity ($0000), the result is the color black.
 +
 +
You specify a color to Color QuickDraw by creating an RGBColor record in which you use three 16-bit unsigned integers to assign intensity values for the three additive primary colors. The RGBColor data type is defined as follows.
 +
<pre>
 +
TYPE RGBColorÊ=
 +
RECORD
 +
  red:Ê    Integer;    {redÊcomponent}
 +
  green:  Integer;    {greenÊcomponent}
 +
  blue:    Integer;    {blueÊcomponent}
 +
END;
 +
</pre>
 +
When you specify an RGB color in an RGBColor record and then draw with that color, Color QuickDraw translates that color to the various indexed or direct devices that your user may be using.
 +
 +
For example, your application can use Color QuickDraw to display images containing up to 256 different colors on indexed devices. An indexed device is a graphics device--that is, a plug-in video card, a video interface built into a Macintosh computer, or an offscreen graphics world--that supports up to 256 colors in a color lookup table. Indexed devices support pixels of 1-bit, 2-bit, 4-bit, or 8-bit depths. On indexed devices, each pixel is represented in memory by an index to the graphics device's color lookup table (also known as the CLUT), where the currently available colors are stored. Such images, although limited in hue, take up relatively small amounts of memory. Color QuickDraw, working with the Color Manager, automatically matches the color your application specifies to the closest available color in the CLUT.
 +
 +
Your application can use the Palette Manager, described in the chapter "Palette Manager" in Inside Macintosh: Advanced Color Imaging, to exercise greater control of the colors in the CLUT. Note, however, that some Macintosh computers--such as black-and-white and grayscale PowerBook computers--have a fixed CLUT, which your application cannot change.
 +
 +
On direct devices, your application can use Color QuickDraw to display images containing thousands or millions of different colors. A direct device is a graphics device that supports up to 16 million colors having a direct correlation between a value placed in the graphics device and the color displayed onscreen. On attached direct devices, each pixel is represented in memory by the most significant bits of the actual red, green, and blue component values specified in an RGBColor record by your application.
 +
 +
Other output devices may render colors that differ from RGB colors; for example, many color printers work with CMYK (cyan, magenta, yellow, and black) colors. See Inside Macintosh: Advanced Color Imaging for information about color matching between screens, which use RGB colors, and devices--like printers--that use CMYK or other colors.
    
=See Also=
 
=See Also=
Line 9: Line 31:  
* [[QuickDraw]]
 
* [[QuickDraw]]
 
* [[QuickDraw GX]]
 
* [[QuickDraw GX]]
 +
* [[Inside Macintosh]]
   −
[[Category:Apple]][[Category:Software]][[Category:Programming]]
+
[[Category:Apple]][[Category:Graphics]][[Category:Programming]]

Navigation menu