1 #include <proto/graphics.h>
2 #include <proto/exec.h>
3 #include <intuition/intuitionbase.h>
4 #include <intuition/screens.h>
5 #include <graphics/view.h>
11 struct IntuitionBase
* IntuitionBase
;
12 struct Library
* GfxBase
;
19 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library",0);
20 GfxBase
= OpenLibrary("graphics.library",0);
22 cm
= GetColorMap(NUMCOLORS
);
24 vp
= &IntuitionBase
->ActiveScreen
->ViewPort
;
26 AttachPalExtra(cm
,vp
);
35 printf("Got pen number %ld.\n",(long)n
[0]);
37 printf("Trying to obtain the same pen as shared.\n");
45 printf("Got pen number %ld (=%ld!).\n",(long)n
[1],(long)n
[0]);
47 printf("Trying to obtain a pen as exclusive.\n");
55 printf("Got pen number %ld.\n",(long)n
[2]);
57 printf("Trying to allocate pen %ld as exclusive again.\n",(long)n
[2]);
65 printf("Got pen number %ld.\n",(long)n
[3]);
67 printf("Trying to allocate pen %ld as shared.\n",(long)n
[2]);
75 printf("Got pen number %ld.\n",(long)n
[4]);
77 printf("Releasing all pens.\n");
84 printf("Obtaining a shared pen.\n");
92 printf("Got pen number %ld.\n",(long)n
[0]);
96 printf("---------------------------\n");
98 printf("Trying to allocate %d shared pens\n",NUMCOLORS
);
100 while (i
< NUMCOLORS
)
102 n
[i
] = ObtainPen(cm
, -1, i
<< 28, i
<< 24, i
<< 20,0);
104 printf("Got pen %ld\n",(long)n
[i
]);
108 printf("Trying to get %d exclusive pens (no pen was released)\n",NUMCOLORS
);
110 while (i
< NUMCOLORS
)
112 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,PENF_EXCLUSIVE
);
114 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
118 printf("Releasing all pens!\n");
120 while (i
< 2 * NUMCOLORS
)
122 ReleasePen(cm
, n
[i
]);
126 printf("---------------------------\n");
129 printf("Trying to get %d exclusive pens\n",NUMCOLORS
);
131 while (i
< NUMCOLORS
)
133 n
[i
] = ObtainPen(cm
, -1, 0,0,0,PENF_EXCLUSIVE
);
135 printf("Got pen %ld\n",(long)n
[i
]);
139 printf("Trying to allocate %d shared pens (no pen was released)\n",NUMCOLORS
);
141 while (i
< NUMCOLORS
)
143 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,0);
145 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
149 printf("Releasing all pens!\n");
151 while (i
< 2*NUMCOLORS
)
153 ReleasePen(cm
, n
[i
]);
157 printf("---------------------------\n");
159 printf("Trying to allocate %d shared pens at certain indices\n",NUMCOLORS
);
161 while (i
< NUMCOLORS
)
163 n
[i
] = ObtainPen(cm
, i
, 0, 0, 0,0);
165 printf("Got pen %ld\n",(long)n
[i
]);
169 printf("Trying to get %d exclusive pens (no pen was released)\n",NUMCOLORS
);
171 while (i
< NUMCOLORS
)
173 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,PENF_EXCLUSIVE
);
175 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
179 printf("Releasing all pens!\n");
181 while (i
< 2 * NUMCOLORS
)
183 ReleasePen(cm
, n
[i
]);
187 printf("---------------------------\n");
189 printf("Trying to get %d exclusive pens at certain indices\n",NUMCOLORS
);
191 while (i
< NUMCOLORS
)
193 n
[i
] = ObtainPen(cm
, i
, 0,0,0,PENF_EXCLUSIVE
);
195 printf("Got pen %ld\n",(long)n
[i
]);
199 printf("Trying to allocate %d shared pens (bo pen was released)\n",NUMCOLORS
);
201 while (i
< NUMCOLORS
)
203 n
[i
+NUMCOLORS
] = ObtainPen(cm
, -1, 0,0,0,0);
205 printf("Got pen %ld (=-1)\n",(long)n
[i
+NUMCOLORS
]);
209 printf("Releasing all pens!\n");
211 while (i
< 2*NUMCOLORS
)
213 ReleasePen(cm
, n
[i
]);
217 printf("---------------------------\n");