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: More Macintosh Toolbox /
Chapter 5 - Icon Utilities / Icon Utilities Reference
Icon Utilities Routines / Drawing Icons From Resources


PlotCIcon

You can plot a color icon of resource type 'cicn' using the PlotCIcon procedure. You must have previously obtained a handle to the icon using GetCIcon (or GetResource or other Resource Manager routines).

PROCEDURE PlotCIcon (theRect: Rect; theIcon: CIconHandle);
theRect
The rectangle in which to draw the icon, specified in local coordinates of the current graphics port.
theIcon
A handle to the color icon record of the color icon to draw.
DESCRIPTION
The PlotCIcon procedure draws the color icon specified by the given handle. The iconMask field of the color icon record determines which pixels in the iconPMap field are drawn and which are not. Only pixels with 1s in corresponding positions in the iconMask field are drawn. If the screen depth is 1 or 2 bits per pixel, PlotCIcon uses the iconBMap field instead of the iconPMap field (unless the rowBytes field of IconBMap contains 0, indicating that there is no bitmap for the icon).

When PlotCIcon draws the icon, it uses the bounds field of iconPMap as the source rectangle of the image. If the destination rectangle is not the same size as the icon or its mask, PlotCIcon stretches or shrinks the icon to fit. The icon's pixels are remapped to the current depth and color table, if necessary. The bounds fields of iconPMap, iconBMap, and iconMask are expected to be equal in size.

Unlike PlotIconHandle, PlotCIcon does not allow you to specify any transforms or alignment. The PlotCIcon procedure uses the QuickDraw procedure CopyMask and doesn't send any of its drawing commands through QuickDraw bottleneck routines. Therefore, calls to PlotCIcon are not recorded as pictures.

RESULT CODE
noErr0No error
SEE ALSO
For a description of the color icon record, see "The Color Icon Record" on page 5-17. For information on GetCIcon, see page 5-29. For information on the QuickDraw procedure CopyMask, see Inside Macintosh: Imaging with QuickDraw.

For an example of the use of the PlotCIcon procedure, see Listing 5-7 on page 5-15.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996