Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 7 - Pictures / Pictures Reference
Application-Defined Routines /


MyRecordColors

When you return the colorBankIsCustom constant in the colorBankType parameter to your MyInitPickMethod function (described in the preceding section), your color-picking method ('cpmt') resource must include a routine that creates this color bank; for example, your application may want to create a histogram with a resolution of 8 bits per color. Here is how you would declare this routine if it were a Pascal function named MyRecordColors:

FUNCTION MyRecordColors (dataRef: LongInt; 
                        colorsArray: RGBColorArray; 
                        colorCount: LongInt; 
                        VAR uniqueColors: LongInt): OSErr;
dataRef
A handle to any data your method needs. Your application initially creates this handle using the MyInitPickMethod routine (explained in the preceding section).
colorsArray
An array of RGBColor records. (RGBColor records are described in the chapter "Color QuickDraw" in this book.) Your MyRecordColors routine should store the color information for this array of RGBColor records in a data structure of type RGBColorArray. You should define the RGBColorArray data type as follows:
            TYPE RGBColorArray  =  ARRAY[0..0] OF RGBColor;
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 routine once for every color in the picture, pixel map, or bitmap.) Your MyRecordColors routine must calculate the number of unique colors (to the resolution of the color bank) that are added by this call. Your MyRecordColors routine should add this amount to the value passed upon input in this parameter and then return the sum in this parameter.
DESCRIPTION
Your MyRecordColors routine should store each color encountered in a picture or pixel into its own color bank. The Picture Utilities call MyRecordColors only if your MyInitPickMethod routine returns the constant colorBankIsCustom in the colorBankType parameter. The Picture Utilities functions call MyRecordColors for all the colors in the picture, pixel map, or bitmap. If your MyRecordColors routine generates any error, it should return the error as its function result.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996