try to make sure compiler/include/mmakefile is always refreshed correctly.
[AROS.git] / rom / intuition / pointinimage.c
blob3632bfed4b274172a6e0585a5e3ac0051223beb4
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
8 #include <intuition/classusr.h>
9 #include <proto/alib.h>
11 /*****************************************************************************
13 NAME */
14 #include <intuition/intuition.h>
15 #include <intuition/imageclass.h>
16 #include <proto/intuition.h>
18 AROS_LH2(BOOL, PointInImage,
20 /* SYNOPSIS */
21 AROS_LHA(ULONG, point, D0),
22 AROS_LHA(struct Image *, image, A0),
24 /* LOCATION */
25 struct IntuitionBase *, IntuitionBase, 104, Intuition)
27 /* FUNCTION
28 Check whether a point is inside an image.
30 INPUTS
31 point - This are the packed point coordinates. The X coordinate
32 in in the upper 16 bits and the Y coordinate is in the
33 lower 16 bits. The coordinates are signed.
34 image - Check against this image.
36 RESULT
37 TRUE if the point is inside the image, FALSE otherwise.
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
52 BOOL result = FALSE;
53 WORD X = (point >> 16L);
54 WORD Y = point & 0x0000FFFFL;
55 struct impHitTest method;
57 if (image != NULL)
59 if (image->Depth == CUSTOMIMAGEDEPTH)
61 method.MethodID = IM_HITTEST;
62 method.imp_Point.X = X;
63 method.imp_Point.Y = Y;
65 result = DoMethodA((Object *)image, (Msg)&method) != 0;
67 else
70 if ((X >= image->LeftEdge && X <= image->LeftEdge + image->Width) &&
71 (Y >= image->TopEdge && Y <= image->TopEdge + image->Height))
73 result = TRUE;
77 else
79 /* NULL image returns TRUE per intuition autodoc! */
80 result = TRUE;
83 return (result);
85 AROS_LIBFUNC_EXIT
86 } /* PointInImage */