1 #include <proto/exec.h>
2 #include <proto/graphics.h>
3 #include <proto/layers.h>
4 #include <exec/types.h>
5 #include <intuition/intuition.h>
6 #include <aros/oldprograms.h>
7 #include <graphics/gfxbase.h>
8 #include <graphics/rastport.h>
9 #include <graphics/regions.h>
12 struct NewWindow MyWin
=
14 20,20,300,200,-1,-1,IDCMP_CLOSEWINDOW
|/*IDCMP_DELTAMOVE|*/IDCMP_MOUSEMOVE
,
15 WINDOWCLOSE
|WINDOWDRAG
|WINDOWDEPTH
|WINDOWSIZING
|WFLG_SMART_REFRESH
|WFLG_REPORTMOUSE
,
16 NULL
,NULL
,(char *)"Testwindow",
17 NULL
,NULL
,0,0,0,0,WBENCHSCREEN
20 struct GfxBase
* GfxBase
;
21 struct Library
* LayersBase
;
23 void installClipRegion(struct Window
* w
)
26 struct Rectangle Rect
;
28 struct Region
* R
= NewRegion();
29 printf("Width of ClipRegion Rectangles: ");
31 printf("Height of ClipRegion Rectangles: ");
34 if (height
== 0 || width
== 0)
40 x
= (line
& 1) * width
;
45 Rect
.MaxX
= x
+width
-1;
46 Rect
.MaxY
= y
+height
-1;
47 OrRectRegion(R
,&Rect
);
55 InstallClipRegion(w
->WLayer
, R
);
59 void uninstallClipRegion(struct Window
* w
)
61 struct Region
* R
= InstallClipRegion(w
->WLayer
, NULL
);
68 LayersBase
= OpenLibrary("layers.library",0);
69 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library",0);
72 struct IntuitionBase
* IntuitionBase
=
73 (struct IntuitionBase
*)OpenLibrary("intuition.library",0);
74 if (NULL
!= IntuitionBase
)
76 struct Window
* TheDude
= OpenWindow(&MyWin
);
79 struct RastPort
* rp
= TheDude
->RPort
;
81 struct IntuiMessage
* Msg
;
82 UWORD areabuffer
[250];
84 struct AreaInfo myAreaInfo
;
85 installClipRegion(TheDude
);
86 InitArea(&myAreaInfo
, &areabuffer
[0], 50);
87 rp
->AreaInfo
= &myAreaInfo
;
88 InitTmpRas(&tmpras
, AllocRaster(320,200),RASSIZE(320,200));
91 /* Let's draw something */
106 AreaDraw(rp
,110,100);
111 AreaEllipse(rp, 110, 30, 50, 20);
124 ScrollRaster(&IntuitionBase->ActiveScreen->RastPort,
132 printf("press a key and hit return!");
145 WaitPort(TheDude
->UserPort
);
146 Msg
= (struct IntuiMessage
*)GetMsg(TheDude
->UserPort
);
147 if (IDCMP_CLOSEWINDOW
== Msg
->Class
)
149 if (IDCMP_MOUSEMOVE
== Msg
->Class
)
151 printf("Received a delta move message! (%i,%i)\n",Msg
->MouseX
,Msg
->MouseY
);
153 ReplyMsg((struct Message
*)Msg
);
155 uninstallClipRegion(TheDude
);
156 CloseWindow(TheDude
);
158 CloseLibrary((struct Library
*)IntuitionBase
);
160 CloseLibrary((struct Library
*)GfxBase
);