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 / Determining Whether a Point or Rectangle Is Within an Icon


RectInIconSuite

You can use the RectInIconSuite function to hit-test a rectangle against the appropriate icon mask from an icon suite for a specified destination rectangle and alignment.

FUNCTION RectInIconSuite (testRect: Rect; iconRect: Rect;
                          align: IconAlignmentType;
                          theIconSuite: Handle): Boolean;
testRect
The rectangle to be tested, specified in local coordinates of the current graphics port.
iconRect
The rectangle in which the icon appears, specified in local coordinates of the current graphics port. Like PtInIconSuite, RectInIconSuite determines, from the size of the rectangle specified in this parameter, which icon mask from the icon suite specified by theIconSuite to test the testRect parameter against.
align
A value that specifies how the icon against which to hit-test is aligned within the rectangle specified by iconRect. See the description of PlotIconSuite on page 5-35 for a list of constants you can use in this parameter.
theIconSuite
A handle to an icon suite.
DESCRIPTION
The RectInIconSuite function hit-tests the rectangle specified by testRect
against the appropriate icon mask from the icon suite as it appears in the iconRect rectangle. The parameters iconRect and align should be the same as when the icon was last drawn. The RectInIconSuite function returns TRUE if the rectangle intersects the icon mask and FALSE if it doesn't.

For example, if the coordinates of the iconRect parameter are (100,100,116,116) and the icon cache contains entries for each icon family member, RectInIconSuite
uses the icon mask defined by the 'ics#' entry. The function aligns this mask (according to the align parameter) within the iconRect rectangle. The function then intersects the rectangle specified by testRect with the icon mask in the iconRect rectangle. Continuing with this example, if the icon mask is left-aligned so that its rightmost pixel appears at coordinates (112,112) and the coordinates of testRect are
(114,114,130,130), then RectInIconSuite returns FALSE.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996