![]() |
PixMap |
Header: Quickdraw.h |
struct PixMap { Ptr baseAddr; SInt16 rowBytes; Rect bounds; SInt16 pmVersion; SInt16 packType; SInt32 packSize; Fixed hRes; Fixed vRes; SInt16 pixelType; SInt16 pixelSize; SInt16 cmpCount; SInt16 cmpSize; SInt32 planeBytes; CTabHandle pmTable; SInt32 pmReserved; }; typedef PixMap PixMapPtr;
For an onscreen pixel image, a pointer to the first byte of the image. For optimal performance, this should be a multiple of 4. The pixel image that appears on a screen is normally stored on a graphics card rather than in main memory.
Note that the baseAddr field of the PixMap structure for an offscreen graphics world contains a handle instead of a pointer. You must use the GetPixBaseAddr function to obtain a pointer to the PixMap structure for an offscreen graphics world. Your application should never directly access the baseAddr field of the PixMap structure for an offscreen graphics world.
The offset in bytes from one row of the image to the next. The value must be even, less than $4000, and for best performance it should be a multiple of 4. The high 2 bits of rowBytes are used as flags. If bit 15 = 1, the data structure pointed to is a PixMap structure; otherwise it is a BitMap structure.
The boundary rectangle, which links the local coordinate system of a graphics port to QuickDraws global coordinate system and defines the area of the bit image into which QuickDraw can draw. By default, the boundary rectangle is the entire main screen. Do not use the value of this field to determine the size of the screen; instead use the value of the gdRect field of the GDevice structure for the screen.
The version number of QuickDraw that created this PixMap structure. The value of pmVersion is normally 0. If pmVersion is 4, QuickDraw treats the PixMap structures baseAddr field as 32-bit clean. All other flags are private. Most applications never need to set this field.
The packing algorithm used to compress image data. QuickDraw currently supports a packType of 0, which means no packing, and values of 1 to 4 for packing direct pixels.
The size of the packed image in bytes. When the packType field contains the value 0, this field is always set to 0.
The horizontal resolution of the pixel image in pixels per inch. This value is of type Fixed; by default, the value here is $00480000 (for 72 pixels per inch).
The vertical resolution of the pixel image in pixels per inch. This value is of type Fixed; by default, the value here is $00480000 (for 72 pixels per inch).
The storage format for a pixel image. Indexed pixels are indicated by a value of 0. Direct pixels are specified by a value of RGBDirect, or 16. In the PixMap structure of the GDevice structure for a direct device, this field is set to the constant RGBDirect when the screen depth is set.
Pixel depth; that is, the number of bits used to represent a pixel. Indexed pixels can have sizes of 1, 2, 4, and 8 bits; direct pixel sizes are 16 and 32 bits.
The number of components used to represent a color for a pixel. With indexed pixels, each pixel is a single value representing an index in a color table, and therefore this field contains the value 1the index is the single component. With direct pixels, each pixel contains three componentsone integer each for the intensities of red, green, and blueso this field contains the value 3.
The size in bits of each component for a pixel. QuickDraw expects that the sizes of all components are the same, and that the value of the cmpCount field multiplied by the value of the cmpSize field is less than or equal to the value in the pixelSize field.
For an indexed pixel value, which has only one component, the value of the cmpSize field is the same as the value of the pixelSize fieldthat is, 1, 2, 4, or 8.
For direct pixels there are two additional possibilities:
Generally, therefore, your application should clear the memory for the image to 0 before creating a 16-bit or 32-bit image. The Memory Manager functions NewHandleClear and NewPtrClear assist you in allocating prezeroed memory.
The offset in bytes from one drawing plane to the next. This field is set to 0.
A handle to a ColorTable structure for the colors in this pixel map.
Reserved for future expansion. This field must be set to 0 for future compatibility.
The PixMap structure contains information about the dimensions, contents, storage format, depth, resolution, and color usage of a pixel image. The pixel map for a windows color graphics port always consists of the pixel depth, color table, and boundary rectangle of the main screen, even if the window is created on or moved to an entirely different screen.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)