![]() |
CalcColorTableProcPtr |
||||
Header: | PictUtils.h | Carbon status: | Supported | |
Defines a pointer to a color table calculation callback. Your color calculation callback selects as many colors as are requested by your application from the color bank for a picture or pixel map and then fills these colors into an array of ColorSpec structures.
typedef OSErr(* CalcColorTableProcPtr) ( UInt32 dataRef, SInt16 colorsRequested, void *colorBankPtr, CSpecArray resultPtr );
You would declare your function like this if you were to name it MyCalcColorTableCallback:
OSErr MyCalcColorTableCallback ( UInt32 dataRef, SInt16 colorsRequested, void *colorBankPtr, CSpecArray resultPtr );
A handle to any data your method needs. Your application initially creates this handle using the InitPickMethodProcPtr function.
The number of colors requested by your application to be gathered for examination in a ColorTable or Palette structure.
If your MyInitPickMethodCallback function returned either the colorBankIsExactAnd555 or colorBankIs555 constant, then this parameter contains a pointer to the 5-5-5 histogram that describes all of the colors in the picture, pixel map, or bitmap being examined. (The format of the 5-5-5 histogram is explained in the function description for the InitPickMethodProcPtr function.) Your MyCalcColorTableCallback function should examine these colors and then, using its own criterion for selecting the colors, fill in an array of ColorSpec structures with the number of colors specified in the colorsRequested parameter.
If your MyInitPickMethodCallback function returned the colorBankIsCustom constant, then the value passed in this parameter is invalid. In this case, your MyCalcColorTableCallback function should use the custom color bank that your application created (using the RecordColorsProcPtr function) for filling in an array of ColorSpec structures with the number of colors specified in the colorsRequested parameter.
Your MyCalcColorTableCallback function should return a pointer to this array of ColorSpec structures in the next parameter.
A pointer to the array of ColorSpec structures to be filled with the number of colors specified in the colorsRequested parameter. The Picture Utilities function that your application initially called places these colors in a Palette structure or ColorTable structure, as specified by your application.
A result code. If MyCalcColorTableCallback generates an error, it should return the error as its function result. This error is passed back to the GetPictInfo, GetPixMapInfo, or NewPictInfo function, which in turn passes the error to your application as a function result.
Selecting from the color bank created for the picture, bitmap, or pixel map being examined, MyCalcColorTableCallback fills an array of ColorSpec structures with the number of colors requested in the colorsRequested parameter and returns this array in the resultPtr parameter.
If more colors are requested than the picture contains, MyCalcColorTable fills the remaining entries with black (0000 0000 0000).
The colorBankPtr parameter is of type Ptr because the data stored in the color bank is of the type specified by your InitPickMethodProcPtr function. Thus, if you specified colorBankIs555 in the colorBankType parameter, the color bank would be an array of integers. However, if the Picture Utilities support other data types in the future, the colorBankPtr parameter could point to completely different data types.
Always coerce the value passed in the colorBankPtr parameter to a pointer to an integer. In the future you may need to coerce this value to a pointer of the type you specify in your MyInitPickMethodCallback function.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)