Carbon


RecordColorsProcPtr

Header: PictUtils.h Carbon status: Supported

Defines a pointer to a color recording callback function. Your color recording function creates a color bank.

typedef OSErr(* RecordColorsProcPtr) (
    UInt32 dataRef, 
    RGBColor *colorsArray, 
    SInt32 colorCount, 
    SInt32 *uniqueColors
);

You would declare your function like this if you were to name it MyRecordColorsCallback:

OSErr MyRecordColorsCallback (
    UInt32 dataRef, 
    RGBColor *colorsArray, 
    SInt32 colorCount, 
    SInt32 *uniqueColors
);
Parameter descriptions
dataRef

A handle to any data your function needs. Your application initially creates this handle using the InitPickMethodProcPtr function.

colorsArray

An array of RGBColor structures. Your MyRecordColorsCallback function stores the color information for this array of RGBColor structures in a data structure of type RGBColorArray.

colorCount

The number of colors in the array specified in the colorsArray parameter.

uniqueColors

Upon input, the number of unique colors already added to the array in the colorsArray parameter. (The Picture Utilities functions call your MyRecordColors function once for every color in the picture, pixel map, or bitmap.) Your MyRecordColorsCallback function must calculate the number of unique colors (to the resolution of the color bank) that are added by this call. Your MyRecordColorsCallback function should add this amount to the value passed upon input in this parameter and then return the sum in this parameter.

function result

A result code. If your MyRecordColorsCallback function generates any 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.

DISCUSSION

MyRecordColorsCallback stores each color encountered in a picture or pixel into its own color bank. The Picture Utilities call MyRecordColorsCallback only if your MyInitPickMethodCallback function returns the constant colorBankIsCustom in the colorBankType parameter. When you return the colorBankIsCustom constant in the colorBankType parameter to your MyInitPickMethodCallback function, your color-picking method ('cpmt') resource must include a function that creates this color bank; for example, your application may want to create a histogram with a resolution of 8 bits per color.

The Picture Utilities functions call MyRecordColorsCallback for all the colors in the picture, pixel map, or bitmap.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)