Important: The information in this document is obsolete and should not be used for new development.
GetPixMapInfo
Use theGetPixMapInfofunction to gather color information about a single pixel map or bitmap.
FUNCTION GetPixMapInfo (thePixMapHandle: PixMapHandle; VAR thePictInfo: PictInfo; verb: Integer; colorsRequested: Integer; colorPickMethod: Integer; version: Integer): OSErr;
thePixMapHandle- A handle to a pixel map or bitmap.
thePictInfo- A pointer to a
PictInforecord, which will hold information about a pixel map or bitmap. ThePictInforecord is described on page 7-31.verb- A value indicating whether you want color information returned in a
ColorTablerecord, aPaletterecord, or both. You can also request that black and white not be included among the returned colors. You can use any or all of the following constants or the sum of the integers they represent:CONST returnColorTable = 1; {return a ColorTable record} returnPalette = 2; {return a Palette record} suppressBlackAndWhite = 16; {don't include black and } { white with returned colors}
- Because the Palette Manager adds black and white when creating a
Paletterecord, you can specify the number of colors you want minus 2 in thecolorsRequestedparameter and specify the constantsuppressBlackAndWhitein theverbparameter when gathering colors destined for aPaletterecord or a screen.colorsRequested- From 1 to 256, the number of colors you want in the
ColorTableorPaletterecord returned via thePictInforecord.colorPickMethod- The method by which colors are selected for the
ColorTableorPaletterecord returned via thePictInforecord. You can use one of the following constants or the integer it represents:CONST systemMethod = 0; {let Picture Utilities choose } { the method (currently they } { always choose popularMethod)} popularMethod = 1; {return most frequently used } { colors} medianMethod = 2; {return a weighted distribution } { of colors}
- You can also create your own color-picking method in a resource file of type
'cpmt'and pass its resource ID in thecolorPickMethodparameter. The resource ID must be greater than 127.version- Always set this parameter to 0.
DESCRIPTION
For the pixel map (or bitmap) whose handle you pass in thethePixMapHandleparameter, theGetPixMapInfofunction returns color information in thePictInforecord that you point to in the parameterthePictInfo. Initially, all of the fields in a newPictInforecord are set toNIL. Relevant fields are set to appropriate values depending on the information you request using theGetPixMapInfofunction.Use the
verbparameter to specify whether you want color information returned in aColorTablerecord, aPaletterecord, or both, and use thecolorPickMethodparameter to specify the method by which to select colors.The Picture Utilities provide two color-picking methods: one (specified by the
popularMethodconstant) that gives you the most frequently used colors and one (specified by themedianMethodconstant) that gives you the widest range of colors. If you specify thesystemMethodconstant, the Picture Utilities choose the method; currently they always choosepopularMethod. You can also supply a color-picking method of your own.When you are finished with the information in the
PictInforecord, be sure to dispose of it. Use the Memory Manager procedureDisposeHandleto dispose of thePictInforecord. Dispose of thePaletterecord by using theDisposePaletteprocedure. Dispose of theColorTablerecord by using theDisposeCTableprocedure.SPECIAL CONSIDERATIONS
TheGetPixMapInfofunction may move or purge memory.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theGetPixMapInfofunction are
Trap macro Selector _Pack15 $0801 RESULT CODES
SEE ALSO
See "Application-Defined Routines" beginning on page 7-60 for more information about creating your own color-picking method for thecolorPickMethodparameter. ThePictInforecord is described on page 7-31; thePixMapHandledata type and theColorTablerecord are described in the chapter "Color QuickDraw" in this book; thePaletterecord is described in Advanced Color Imaging on the Mac OS.The
DisposePaletteprocedure is described in Advanced Color Imaging on the Mac OS. TheDisposeCTableprocedure is described in the chapter "Color QuickDraw" in this book. TheDisposeHandleprocedure is described in the chapter "Memory Manager" in Inside Macintosh: Memory.