2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
7 #include <proto/graphics.h>
8 #include <proto/layers.h>
9 #include <exec/types.h>
10 #include <intuition/intuition.h>
11 #include <aros/oldprograms.h>
12 #include <graphics/gfxbase.h>
13 #include <graphics/rastport.h>
14 #include <graphics/regions.h>
17 struct NewWindow MyWin
=
19 20,20,300,200,-1,-1,IDCMP_CLOSEWINDOW
|/*IDCMP_DELTAMOVE|*/IDCMP_MOUSEMOVE
,
20 WINDOWCLOSE
|WINDOWDRAG
|WINDOWDEPTH
|WINDOWSIZING
|WFLG_SMART_REFRESH
|WFLG_REPORTMOUSE
,
21 NULL
,NULL
,(char *)"Testwindow",
22 NULL
,NULL
,0,0,0,0,WBENCHSCREEN
25 struct GfxBase
* GfxBase
;
26 struct Library
* LayersBase
;
28 void installClipRegion(struct Window
* w
)
31 struct Rectangle Rect
;
33 struct Region
* R
= NewRegion();
34 printf("Width of ClipRegion Rectangles: ");
36 printf("Height of ClipRegion Rectangles: ");
39 if (height
== 0 || width
== 0)
45 x
= (line
& 1) * width
;
50 Rect
.MaxX
= x
+width
-1;
51 Rect
.MaxY
= y
+height
-1;
52 OrRectRegion(R
,&Rect
);
60 InstallClipRegion(w
->WLayer
, R
);
64 void uninstallClipRegion(struct Window
* w
)
66 struct Region
* R
= InstallClipRegion(w
->WLayer
, NULL
);
73 LayersBase
= OpenLibrary("layers.library",0);
74 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library",0);
77 struct IntuitionBase
* IntuitionBase
=
78 (struct IntuitionBase
*)OpenLibrary("intuition.library",0);
79 if (NULL
!= IntuitionBase
)
81 struct Window
* TheDude
= OpenWindow(&MyWin
);
84 struct RastPort
* rp
= TheDude
->RPort
;
86 struct IntuiMessage
* Msg
;
87 UWORD areabuffer
[250];
89 struct AreaInfo myAreaInfo
;
90 installClipRegion(TheDude
);
91 InitArea(&myAreaInfo
, &areabuffer
[0], 50);
92 rp
->AreaInfo
= &myAreaInfo
;
93 InitTmpRas(&tmpras
, AllocRaster(320,200),RASSIZE(320,200));
96 /* Let's draw something */
103 AreaDraw(rp,110,100);
111 AreaDraw(rp
,110,100);
116 AreaEllipse(rp, 110, 30, 50, 20);
129 ScrollRaster(&IntuitionBase->ActiveScreen->RastPort,
137 printf("press a key and hit return!");
150 WaitPort(TheDude
->UserPort
);
151 Msg
= (struct IntuiMessage
*)GetMsg(TheDude
->UserPort
);
152 if (IDCMP_CLOSEWINDOW
== Msg
->Class
)
154 if (IDCMP_MOUSEMOVE
== Msg
->Class
)
156 printf("Received a delta move message! (%i,%i)\n",Msg
->MouseX
,Msg
->MouseY
);
158 ReplyMsg((struct Message
*)Msg
);
160 uninstallClipRegion(TheDude
);
161 CloseWindow(TheDude
);
163 CloseLibrary((struct Library
*)IntuitionBase
);
165 CloseLibrary((struct Library
*)GfxBase
);