Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / intuition / pointinimage.c
blob008b3a2787cf5b53b51e3af5573d8fe41001c8b1
1 /*
2 Copyright © 1995-2007, 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 is the point is inside the image, FALSE otherwise.
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 HISTORY
50 29-10-95 digulla automatically created from
51 intuition_lib.fd and clib/intuition_protos.h
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
56 BOOL result = FALSE;
57 WORD X = (point >> 16L);
58 WORD Y = point & 0x0000FFFFL;
59 struct impHitTest method;
61 if (image != NULL)
63 if (image->Depth == CUSTOMIMAGEDEPTH)
65 method.MethodID = IM_HITTEST;
66 method.imp_Point.X = X;
67 method.imp_Point.Y = Y;
69 result = DoMethodA((Object *)image, (Msg)&method) != 0;
71 else
74 if ((X >= image->LeftEdge && X <= image->LeftEdge + image->Width) &&
75 (Y >= image->TopEdge && Y <= image->TopEdge + image->Height))
77 result = TRUE;
81 else
83 /* NULL image returns TRUE per intuition autodoc! */
84 result = TRUE;
87 return (result);
89 AROS_LIBFUNC_EXIT
90 } /* PointInImage */