2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <graphics/clip.h>
7 #include <graphics/gfx.h>
9 #include <proto/layers.h>
10 #include <proto/exec.h>
14 struct Library
*LayersBase
;
15 struct Layer dummy_lay
;
17 struct ClipRect dummy_cr
[100];
19 void setcr(WORD which
, WORD x1
, WORD y1
, WORD x2
, WORD y2
)
21 dummy_cr
[which
].bounds
.MinX
= x1
;
22 dummy_cr
[which
].bounds
.MinY
= y1
;
23 dummy_cr
[which
].bounds
.MaxX
= x2
;
24 dummy_cr
[which
].bounds
.MaxY
= y2
;
25 dummy_cr
[which
].Flags
= which
;
27 if (which
> 0) dummy_cr
[which
- 1].Next
= &dummy_cr
[which
];
32 /* 0000000000011111111122
33 0123456789012345678901
35 00 +---+---+------------+
38 03 | | 1 +---+--------+
42 07 +---+---+ 8 +--------+
44 09 +-------+---+--------+
47 setcr(0, 0, 0, 39, 19);
48 setcr(1, 40, 0, 79, 69);
49 setcr(2, 80, 0, 209, 29);
50 setcr(3, 0, 20, 39, 49);
51 setcr(4, 80, 30, 119, 49);
52 setcr(5, 120, 30, 209, 69);
53 setcr(6, 0, 50, 39, 69);
54 setcr(7, 0, 70, 79, 89);
55 setcr(8, 80, 50, 119, 89);
56 setcr(9, 120, 70, 209, 89);
58 dummy_lay
.ClipRect
= dummy_cr
;
61 void doit(char *msg
, WORD dx
, WORD dy
)
65 SortLayerCR(&dummy_lay
, dx
, dy
);
67 printf("\n%s\n----------------------------\n", msg
);
68 cr
= dummy_lay
.ClipRect
;
71 printf("%ld ", (long)cr
->Flags
);
84 doit("UP LEFT", -1, -1);
85 doit("UP RIGHT", 1, -1);
86 doit("DOWN LEFT", -1, 1);
87 doit("DOWN RIGHT", 1, 1);
93 LayersBase
= OpenLibrary("layers.library", 0);
99 CloseLibrary(LayersBase
);