Important: The information in this document is obsolete and should not be used for new development.
IconMethodToRgnYou can use the
IconMethodToRgnfunction to convert, to a region, the mask for an icon that
IconMethodToRgnobtains with the aid of your icon getter function.
FUNCTION IconMethodToRgn (theRgn: RgnHandle; iconRect: Rect; align: IconAlignmentType; theMethod: IconGetter; yourDataPtr: Ptr): OSErr;
IconMethodToRgnreturns a handle to the requested region in this parameter. You must allocate memory for the region handle before calling
- The rectangle in which to draw the icon, specified in local coordinates of the current graphics port. The
IconMethodToRgnfunction obtains the data for the icon mask from your icon getter function and then converts the icon mask to a region.
IconMethodToRgnuses the rectangle specified in this parameter as the bounding box of the region.
- A value that specifies how
IconMethodToRgnshould align the region within the rectangle. See the description of
PlotIconIDon page 5-20 for a list of constants you can use in this parameter.
- A pointer to an icon getter function.
- A pointer to data that is passed to your icon getter function.
IconMethodToRgnfunction modifies the region referred to by the handle in the
theRgnparameter. The region corresponds to the icon's mask (as returned by your icon getter function, and according to the rectangle and alignment specified in the
IconMethodToRgnpasses to your icon getter function the type of the icon to get and the value specified in the
IconMethodToRgnfunction examines the size of the rectangle and requests the appropriate icon from your icon getter function--an icon of icon type
'ics#'. Your icon getter function should return a handle to the data of the requested icon type. The
IconMethodToRgnfunction extracts the mask from the icon data that your icon getter function returns. If your icon getter function returns data that does not correspond to an icon of type
IconMethodToRgnattempts to generate a mask from the returned data.
Your icon getter function can get the data for the icon and its mask using whatever method is appropriate to your application. For example, your application might maintain its own cache of icons (and pass a pointer to it in the
yourDataPtrparameter) or use its icon getter function to get an icon from the desktop database.
noErr 0 No error noMaskFoundErr -1000 No mask found