The Pixel Map Record
The Pixel Map Record
The pixel map is the modern successor to the bitmap: to that original
image-mapping record, the pixel map record adds information about the depth
of the pixels that make up an image. In black-and-white systems, such as the
original Macintosh computers, only 1 bit was needed per pixel, since black and
white can be indicated by 0 and 1. Color QuickDraw now recognizes pixel
depths of 1, 2, 4, 8, 16, and 32 bits. The pixel map not only describes the
pixel depth; it also specifies how each pixel's information is organized: either
as indexes to color tables or as direct color specifications.
The pixel map record is defined in Color QuickDraw. Color QuickDraw
explains how some fields can have additional values, although the format of the
pixel map record is un changed.
As in a bitmap record, the baseAddr, rowBytes, and bounds fields describe
where in memory the image information begins, how many bytes are used for
each row of the image, and its boundary rectangle.
The hRes and vRes fields describe the horizontal and vertical resolution of the
image. For example, images destined for display on a screen might be set to 72
dots per inch (dpi) in each direction; those prepared for printing on a
LaserWriter might be set to 300 dpi.
The pixelType field indicates whether the pixel values for the image are to be
treated as indexes to a color table or taken as the real color.
The pixelSize field shows the size of each pixel value in memory: 1, 2, 4, or
8 bits for indexed pixel values, and 16 or 32 bits for direct pixel values.
Indexed pixels have one component, the index value. Direct pixels have three
components, one each for red, green, and blue. The cmpCount field contains
either 1 or 3, accordingly.
The cmpSize field lists the component sizes: 1, 2, 4, or 8 bits for the single
component of an indexed pixel, and 5 or 8 bits for each component in a direct
pixel. (The three direct pixel components are the same size, either 5-5-5 or
8-8-8 for the red, green, and blue values.)
The pmTable field contains a handle to the color table for this image. Since
indexed pixel values are just that, indexes, a color table needs to be bundled
with each pixel map to show what color each index value indicates. (Pixel map
records for direct pixel values don't need tables, since the image memory
contains the actual colors, but the pmTable field references a dummy table for
compatibility.)
Pixel map records are key elements of two graphics data structures : color
grafPort records, which describes graphics ports, such as windows, and are
described in The Color GrafPort Record and the graphics device records,
which describe output devices, such as screens, described in
The Graphics Device Record.