Fixed warning while generated AutoDoc documentation: NewList() is not in Exec.
[AROS.git] / test / modeid.c
blob914a1de9559ee007a296eb4041fea52fe1c67f4c
1 #include <cybergraphx/cybergraphics.h>
2 #include <graphics/displayinfo.h>
3 #include <hidd/graphics.h>
4 #include <proto/cybergraphics.h>
5 #include <proto/exec.h>
6 #include <proto/graphics.h>
7 #include <proto/oop.h>
9 #include <stdio.h>
10 #include <stdlib.h>
12 int main(int argc, char **argv)
14 ULONG modeid;
15 BOOL iscyber;
16 struct NameInfo name;
17 struct DimensionInfo info;
18 struct Library *OOPBase;
19 OOP_AttrBase HiddPixFmtAttrBase;
21 if (argc < 2) {
22 printf("Usage: %s <modeid>\n", argv[0]);
23 return 0;
26 modeid = strtoul(argv[1], NULL, 16);
28 OOPBase = OpenLibrary("oop.library", 0);
29 if (!OOPBase) {
30 printf("Failed to open oop.library\n");
31 return 0;
34 HiddPixFmtAttrBase = OOP_ObtainAttrBase(IID_Hidd_PixFmt);
35 if (!HiddPixFmtAttrBase) {
36 printf("Failed to obtain PixFmt attribute base\n");
37 CloseLibrary(OOPBase);
38 return 0;
41 if (GetDisplayInfoData(NULL, (UBYTE *)&name, sizeof(name), DTAG_NAME, modeid) == sizeof(name)) {
42 printf("Obtained NameInfo: %s\n", name.Name);
43 } else
44 printf("Failed to obtain NameInfo\n");
46 iscyber = IsCyberModeID(modeid);
47 printf("IsCyberModeID() returns %d\n", iscyber);
49 if (GetDisplayInfoData(NULL, (UBYTE *)&info, sizeof(info), DTAG_DIMS, modeid) == sizeof(info)) {
50 OOP_Object *pixfmt = (OOP_Object *)info.reserved[1];
51 IPTR val;
53 printf("Obtained DimensionInfo\n");
55 printf("Pixelformat data:\n");
56 OOP_GetAttr(pixfmt, aHidd_PixFmt_ColorModel, &val);
57 printf("Color model: %lu\n", val);
58 OOP_GetAttr(pixfmt, aHidd_PixFmt_RedShift, &val);
59 printf("Red shift: %lu\n", val);
60 OOP_GetAttr(pixfmt, aHidd_PixFmt_GreenShift, &val);
61 printf("Green shift: %lu\n", val);
62 OOP_GetAttr(pixfmt, aHidd_PixFmt_BlueShift, &val);
63 printf("Blue shift: %lu\n", val);
64 OOP_GetAttr(pixfmt, aHidd_PixFmt_AlphaShift, &val);
65 printf("Alpha shift: %lu\n", val);
66 OOP_GetAttr(pixfmt, aHidd_PixFmt_RedMask, &val);
67 printf("Red mask: 0x%08lX\n", val);
68 OOP_GetAttr(pixfmt, aHidd_PixFmt_GreenMask, &val);
69 printf("Green mask: 0x%08lX\n", val);
70 OOP_GetAttr(pixfmt, aHidd_PixFmt_BlueMask, &val);
71 printf("Blue mask: 0x%08lX\n", val);
72 OOP_GetAttr(pixfmt, aHidd_PixFmt_AlphaMask, &val);
73 printf("Alpha mask: 0x%08lX\n", val);
74 OOP_GetAttr(pixfmt, aHidd_PixFmt_Depth, &val);
75 printf("Depth: %lu\n", val);
76 OOP_GetAttr(pixfmt, aHidd_PixFmt_BitsPerPixel, &val);
77 printf("Bits per pixel: %lu\n", val);
78 OOP_GetAttr(pixfmt, aHidd_PixFmt_BytesPerPixel, &val);
79 printf("Bytes per pixel: %lu\n", val);
80 OOP_GetAttr(pixfmt, aHidd_PixFmt_StdPixFmt, &val);
81 printf("Pixelformat code: %lu\n", val);
82 OOP_GetAttr(pixfmt, aHidd_PixFmt_CLUTMask, &val);
83 printf("Palette mask: 0x%08lX\n", val);
84 OOP_GetAttr(pixfmt, aHidd_PixFmt_CLUTShift, &val);
85 printf("Palette shift: %lu\n", val);
86 OOP_GetAttr(pixfmt, aHidd_PixFmt_BitMapType, &val);
87 printf("Bitmap type: %lu\n", val);
88 } else
89 printf("Failed to obtain DimensionInfo\n");
91 OOP_ReleaseAttrBase(IID_Hidd_PixFmt);
92 CloseLibrary(OOPBase);
93 return 0;