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
;
15 struct PaletteExtra
* pe
;
20 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library",0);
21 GfxBase
= OpenLibrary("graphics.library",0);
23 cm
= GetColorMap(NUMCOLORS
);
25 vp
= &IntuitionBase
->ActiveScreen
->ViewPort
;
27 AttachPalExtra(cm
,vp
);
37 printf("Got pen number %ld.\n",n
[0]);
39 printf("Trying to obtain the same pen as shared.\n");
47 printf("Got pen number %ld (=%ld!).\n",n
[1],n
[0]);
49 printf("Trying to obtain a pen as exclusive.\n");
57 printf("Got pen number %ld.\n",n
[2]);
59 printf("Trying to allocate pen %ld as exclusive again.\n",n
[2]);
67 printf("Got pen number %ld.\n",n
[3]);
69 printf("Trying to allocate pen %ld as shared.\n",n
[2]);
77 printf("Got pen number %ld.\n",n
[4]);
79 printf("Releasing all pens.\n");
86 printf("Obtaining a shared pen.\n");
94 printf("Got pen number %ld.\n",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",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",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",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",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",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",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",n
[i
]);
201 printf("Trying to allocate %d shared pens (bo 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",n
[i
+NUMCOLORS
]);
211 printf("Releasing all pens!\n");
213 while (i
< 2*NUMCOLORS
)
215 ReleasePen(cm
, n
[i
]);
219 printf("---------------------------\n");