New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / hyperlayers / islayerhiddenbysibling.c
blobd783c0dfa17b350a5fd7ee540fb14d1ae67a302b
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include <exec/types.h>
10 #include <layers_intern.h>
11 #include <aros/libcall.h>
12 #include <proto/graphics.h>
13 #include "basicfuncs.h"
14 #include "../graphics/intregions.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/layers.h>
20 AROS_LH2(BOOL, IsLayerHiddenBySibling,
22 /* SYNOPSIS */
23 AROS_LHA(struct Layer *, l , A0),
24 AROS_LHA(BOOL , check_invisible, D0),
26 /* LOCATION */
27 struct LayersBase *, LayersBase, 44, Layers)
29 /* FUNCTION
30 Checks whether this layer is hidden by any siblings
31 that are in front of it. All these siblings must have
32 the same priority as that layer.
33 It can be specified whether invisible siblings are to be
34 considered in the comparison.
36 INPUTS
37 L - pointer to layer
38 check_invisible - whether invisible siblings are to be considered
40 RESULT
41 TRUE - layer is hidden by one or more siblings
42 FALSE - layer is fully visible
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 HISTORY
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
59 AROS_LIBBASE_EXT_DECL(struct LayersBase *,LayersBase)
61 struct Layer * _l;
62 struct Region * r;
63 BOOL result = FALSE;
65 if (NULL == l ||
66 NULL == (r = NewRegion()))
67 return FALSE;
69 LockLayers(l->LayerInfo);
71 _l = l->front;
73 while (NULL != _l) {
75 * If they differ in priority then return FALSE.
77 if (_l->priority != l->priority) {
78 break;
82 * Only need to check with those layers that
83 * have the same nesting count (are immediate
84 * siblings to the layer l).
86 if (l->nesting == _l->nesting &&
87 ( IS_VISIBLE(_l) || TRUE == check_invisible) &&
88 TRUE == overlap(_l->visibleshape->bounds, l->visibleshape->bounds))
90 /* The layers overlap if an AND operation on
91 * both layers' visible region does not
92 * leave an empty region.
94 SetRegion(l->visibleshape,r);
95 AndRegionRegion(_l->visibleshape,r);
96 if (NULL != r->RegionRectangle) {
97 result = TRUE;
98 break;
101 _l = _l->front;
104 UnlockLayers(l->LayerInfo);
106 DisposeRegion(r);
108 return result;
110 AROS_LIBFUNC_EXIT
111 } /* IsLayerHiddenBySibling */