2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <proto/graphics.h>
7 #include <proto/exec.h>
8 #include <intuition/intuitionbase.h>
9 #include <intuition/screens.h>
10 #include <graphics/view.h>
16 struct IntuitionBase
* IntuitionBase
;
17 struct Library
* GfxBase
;
24 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library",0);
25 GfxBase
= OpenLibrary("graphics.library",0);
27 vp
= &IntuitionBase
->ActiveScreen
->ViewPort
;
37 printf("Got pen number %ld.\n",(long)n
[0]);
39 printf("Trying to obtain the same pen as shared.\n");
47 printf("Got pen number %ld (=%ld!).\n",(long)n
[1],(long)n
[0]);
49 printf("Trying to obtain a pen as exclusive.\n");
57 printf("Got pen number %ld.\n",(long)n
[2]);
59 printf("Trying to allocate pen %ld as exclusive again.\n",(long)n
[2]);
67 printf("Got pen number %ld.\n",(long)n
[3]);
69 printf("Trying to allocate pen %ld as shared.\n",(long)n
[2]);
77 printf("Got pen number %ld.\n",(long)n
[4]);
79 printf("Releasing all pens.\n");
86 printf("Obtaining a shared pen.\n");
94 printf("Got pen number %ld.\n",(long)n
[0]);
98 printf("---------------------------\n");
100 printf("Trying to allocate %d shared pens\n",NUMCOLORS
);
102 while (i
< NUMCOLORS
)
104 n
[i
] = ObtainPen(cm
, -1, i
<< 28, i
<< 24, i
<< 20,0);
106 printf("Got pen %ld\n",(long)n
[i
]);
110 printf("Trying to get %d exclusive pens (no pen was released)\n",NUMCOLORS
);
112 while (i
< NUMCOLORS
)
114 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,PENF_EXCLUSIVE
);
116 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
120 printf("Releasing all pens!\n");
122 while (i
< 2 * NUMCOLORS
)
124 ReleasePen(cm
, n
[i
]);
128 printf("---------------------------\n");
131 printf("Trying to get %d exclusive pens\n",NUMCOLORS
);
133 while (i
< NUMCOLORS
)
135 n
[i
] = ObtainPen(cm
, -1, 0,0,0,PENF_EXCLUSIVE
);
137 printf("Got pen %ld\n",(long)n
[i
]);
141 printf("Trying to allocate %d shared pens (no pen was released)\n",NUMCOLORS
);
143 while (i
< NUMCOLORS
)
145 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,0);
147 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
151 printf("Releasing all pens!\n");
153 while (i
< 2*NUMCOLORS
)
155 ReleasePen(cm
, n
[i
]);
159 printf("---------------------------\n");
161 printf("Trying to allocate %d shared pens at certain indices\n",NUMCOLORS
);
163 while (i
< NUMCOLORS
)
165 n
[i
] = ObtainPen(cm
, i
, 0, 0, 0,0);
167 printf("Got pen %ld\n",(long)n
[i
]);
171 printf("Trying to get %d exclusive pens (no pen was released)\n",NUMCOLORS
);
173 while (i
< NUMCOLORS
)
175 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,PENF_EXCLUSIVE
);
177 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
181 printf("Releasing all pens!\n");
183 while (i
< 2 * NUMCOLORS
)
185 ReleasePen(cm
, n
[i
]);
189 printf("---------------------------\n");
191 printf("Trying to get %d exclusive pens at certain indices\n",NUMCOLORS
);
193 while (i
< NUMCOLORS
)
195 n
[i
] = ObtainPen(cm
, i
, 0,0,0,PENF_EXCLUSIVE
);
197 printf("Got pen %ld\n",(long)n
[i
]);
201 printf("Trying to allocate %d shared pens (no pen was released)\n",NUMCOLORS
);
203 while (i
< NUMCOLORS
)
205 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,0);
207 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
211 printf("Releasing all pens!\n");
213 while (i
< 2*NUMCOLORS
)
215 ReleasePen(cm
, n
[i
]);
219 printf("---------------------------\n");