Initial import of Scalos. To decrease size I have
[AROS-Contrib.git] / scalos / main / Test / pens.c
blob9421b0d571031010d0de14fb78a6152300c800dc
1 // pens.c
2 // 17 Nov 2002 15:12:13
5 #include <exec/types.h>
6 #include <intuition/screens.h>
7 #include <clib/intuition_protos.h>
8 #include <clib/graphics_protos.h>
9 #include <proto/intuition.h>
10 #include <proto/graphics.h>
11 #include <stdlib.h>
12 #include <stdio.h>
15 static CONST_STRPTR driPenNames[] =
17 "DETAILPEN",
18 "BLOCKPEN",
19 "TEXTPEN",
20 "SHINEPEN",
21 "SHADOWPEN",
22 "FILLPEN",
23 "FILLTEXTPEN",
24 "BACKGROUNDPEN",
25 "HIGHLIGHTTEXTPEN",
26 "BARDETAILPEN",
27 "BARBLOCKPEN",
28 "BARTRIMPEN",
31 #define Sizeof(array) (sizeof(array)/sizeof(array[0]))
33 int main(int argc, char *argv[])
35 struct Screen *pubScreen = NULL;
36 struct DrawInfo *drawInfo = NULL;
37 CONST_STRPTR PubScreenName = NULL;
39 if (2 == argc)
40 PubScreenName = argv[1];
42 do {
43 short n;
45 pubScreen = LockPubScreen(PubScreenName);
46 if (NULL == pubScreen)
48 fprintf(stderr, "Failed to lock public screen.\n");
49 break;
52 drawInfo = GetScreenDrawInfo(pubScreen);
53 if (NULL == drawInfo)
55 fprintf(stderr, "GetScreenDrawInfo() failed.\n");
56 break;
59 printf("DrawInfo Version=%ld\nnumber of Pens = %ld\n",
60 drawInfo->dri_Version, drawInfo->dri_NumPens);
62 for (n=0; n<drawInfo->dri_NumPens; n++)
64 ULONG rgb[4];
66 if (n < Sizeof(driPenNames))
67 printf("Pen %2ld <%20s> = %3ld", n, driPenNames[n], drawInfo->dri_Pens[n]);
68 else
69 printf("Pen %2ld = %3ld", n, drawInfo->dri_Pens[n]);
71 GetRGB32(pubScreen->ViewPort.ColorMap, drawInfo->dri_Pens[n], 1, rgb);
73 printf(" RGB = %08lx/%08lx/%08lx\n", rgb[0], rgb[1], rgb[2]);
75 } while (0);
77 if (drawInfo)
78 FreeScreenDrawInfo(pubScreen, drawInfo);
79 if (pubScreen)
80 UnlockPubScreen(NULL, pubScreen);