Added some macros for getting information from status value written by wait() and...
[AROS.git] / rom / hyperlayers / basicfuncs.h
blob8c47d992a0aef84ca6014c81dd318dad1b2ebb72
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Basic support functions for layers.library.
6 Lang: English.
7 */
9 #include "layers_intern.h"
10 #include <exec/types.h>
11 #include <graphics/gfx.h>
12 #include <graphics/clip.h>
16 * Sections:
18 * + Blitter
19 * + Hook
20 * + Layer
21 * + LayerInfo
22 * + Rectangle
23 * + Resource Handling
24 * + Miscellaneous
28 /***************************************************************************/
29 /* BLITTER */
30 /***************************************************************************/
32 void BltRPtoCR(struct RastPort * rp,
33 struct ClipRect * cr,
34 ULONG Mode,
35 struct LayersBase * LayersBase);
37 void BltCRtoRP(struct RastPort * rp,
38 struct ClipRect * cr,
39 ULONG Mode,
40 struct LayersBase * LayersBase);
42 /***************************************************************************/
43 /* HOOK */
44 /***************************************************************************/
46 void _CallLayerHook(struct Hook * h,
47 struct RastPort * rp,
48 struct Layer * L,
49 struct Rectangle * R,
50 WORD offsetx,
51 WORD offsety,
52 struct LayersBase * LayersBase);
55 /***************************************************************************/
56 /* LAYER */
57 /***************************************************************************/
59 void SetLayerPriorities(struct Layer_Info * li);
60 struct Layer * internal_WhichLayer(struct Layer * l, WORD x, WORD y);
61 void _FreeLayer(struct Layer * l, struct LayersBase *LayersBase);
63 /***************************************************************************/
64 /* LAYERINFO */
65 /***************************************************************************/
67 BOOL _AllocExtLayerInfo
68 (struct Layer_Info * li, struct LayersBase *LayersBase);
70 void _FreeExtLayerInfo
71 (struct Layer_Info * li, struct LayersBase *LayersBase);
73 ULONG _InitLIExtra
74 (struct Layer_Info * li, struct LayersBase * LayersBase);
76 void _ExitLIExtra
77 (struct Layer_Info * li, struct LayersBase * LayersBase);
79 BOOL SafeAllocExtLI
80 (struct Layer_Info * li, struct LayersBase * LayersBase);
82 void SafeFreeExtLI
83 (struct Layer_Info * li, struct LayersBase * LayersBase);
85 /***************************************************************************/
86 /* RECTANGLE */
87 /***************************************************************************/
89 //void _TranslateRect(struct Rectangle *rect, WORD dx, WORD dy);
90 struct ClipRect * internal_WhichClipRect(struct Layer * L, WORD x, WORD y);
93 /***************************************************************************/
94 /* RESOURCE HANDLING */
95 /***************************************************************************/
97 BOOL AddLayersResource(struct Layer_Info * li,
98 void * ptr,
99 ULONG Size);
101 struct ResourceNode * AddLayersResourceNode(struct Layer_Info * li);
103 struct ClipRect * _AllocClipRect(struct Layer * L, struct LayersBase *LayersBase);
104 void _FreeClipRect(struct ClipRect * CR, struct Layer * L, struct LayersBase *LayersBase);
105 void _FreeClipRectListBM(struct Layer * L, struct ClipRect * CR, struct LayersBase *LayersBase);
107 void FreeCRBitMap(struct ClipRect * cr);
109 void * AllocLayerStruct(ULONG Size,
110 ULONG Flags,
111 struct Layer_Info * li,
112 struct LayersBase * LayersBase);
114 void FreeLayerResources(struct Layer_Info * li,
115 BOOL flag);
117 /***************************************************************************/
118 /* MISCELLANEOUS */
119 /***************************************************************************/
121 void CleanTopLayer(struct Layer_Info * LI);
122 void CleanupLayers(struct Layer_Info * LI);
123 void UnsplitLayers(struct Layer_Info * LI, struct Rectangle * rect );
124 void CopyAndFreeClipRectsClipRects(struct Layer * L,
125 struct ClipRect * srcCR,
126 struct ClipRect * destCR);
127 int _CopyClipRectsToClipRects(struct Layer * l,
128 struct ClipRect * oldcr,
129 struct ClipRect * newcr,
130 int srcdx,
131 int destdx,
132 int backupmode,
133 int freelist,
134 int addtodamagelist,
135 struct LayersBase *LayersBase);
136 void UninstallClipRegionClipRects(struct Layer_Info * LI);
137 void InstallClipRegionClipRects(struct Layer_Info * LI);
139 /*-----------------------------------END-----------------------------------*/
141 #define RECTAREA(r) (((r)->MaxX - (r)->MinX + 1) * ((r)->MaxY - (r)->MinY + 1))
143 #define DO_OVERLAP(r1,r2) (!( ((r1)->MinX > (r2)->MaxX) || \
144 ((r1)->MinY > (r2)->MaxY) || \
145 ((r1)->MaxX < (r2)->MinX) || \
146 ((r1)->MaxY < (r2)->MinY) ))
148 #define IS_EMPTYREGION(r) (NULL == (r)->RegionRectangle)
150 #define IS_ROOTLAYER(l) ((l) == (l)->LayerInfo->check_lp)
152 #define CHECKDAMAGELIST(l) \
153 if (IS_EMPTYREGION(l->DamageList)) \
155 l->Flags &= ~LAYERREFRESH; \
157 else \
158 l->Flags |= LAYERREFRESH;
160 int _BackupPartsOfLayer(struct Layer * l,
161 struct Region * hide_region,
162 int dx,
163 int backupsimplerefresh,
164 struct LayersBase *);
166 int _ShowPartsOfLayer(struct Layer * l,
167 struct Region * show_region,
168 struct LayersBase *);
170 int _ShowLayer(struct Layer * l, struct LayersBase *LayersBase);
172 struct Layer * _FindFirstFamilyMember(struct Layer * l);
174 void _BackFillRegion(struct Layer * l,
175 struct Region * r,
176 int addtodamagelist,
177 struct LayersBase * LayersBase);
179 struct ClipRect * _CreateClipRectsFromRegion(struct Region *r,
180 struct Layer * l,
181 int invisible,
182 struct Region *inverter,
183 struct LayersBase *LayersBase);
185 struct Region *_InternalInstallClipRegion(struct Layer *l, struct Region *region,
186 WORD srcdx, WORD destdx,
187 struct LayersBase *LayersBase);