Fixed compatibility of output.
[AROS.git] / test / hidds / graphics / modeid.c
blob1592d2563081f65004b540f8e1ab61f16515020a
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <cybergraphx/cybergraphics.h>
7 #include <graphics/displayinfo.h>
8 #include <hidd/graphics.h>
9 #include <proto/cybergraphics.h>
10 #include <proto/exec.h>
11 #include <proto/graphics.h>
12 #include <proto/oop.h>
14 #include <stdio.h>
15 #include <stdlib.h>
17 int main(int argc, char **argv)
19 ULONG modeid;
20 BOOL iscyber;
21 struct NameInfo name;
22 struct DimensionInfo info;
23 struct Library *OOPBase;
24 OOP_AttrBase HiddPixFmtAttrBase;
26 if (argc < 2) {
27 printf("Usage: %s <modeid>\n", argv[0]);
28 return 0;
31 modeid = strtoul(argv[1], NULL, 16);
33 OOPBase = OpenLibrary("oop.library", 0);
34 if (!OOPBase) {
35 printf("Failed to open oop.library\n");
36 return 0;
39 HiddPixFmtAttrBase = OOP_ObtainAttrBase(IID_Hidd_PixFmt);
40 if (!HiddPixFmtAttrBase) {
41 printf("Failed to obtain PixFmt attribute base\n");
42 CloseLibrary(OOPBase);
43 return 0;
46 if (GetDisplayInfoData(NULL, (UBYTE *)&name, sizeof(name), DTAG_NAME, modeid) == sizeof(name)) {
47 printf("Obtained NameInfo: %s\n", name.Name);
48 } else
49 printf("Failed to obtain NameInfo\n");
51 iscyber = IsCyberModeID(modeid);
52 printf("IsCyberModeID() returns %d\n", iscyber);
54 if (GetDisplayInfoData(NULL, (UBYTE *)&info, sizeof(info), DTAG_DIMS, modeid) == sizeof(info)) {
55 OOP_Object *pixfmt = (OOP_Object *)info.reserved[1];
56 IPTR val;
58 printf("Obtained DimensionInfo\n");
60 printf("Pixelformat data:\n");
61 OOP_GetAttr(pixfmt, aHidd_PixFmt_ColorModel, &val);
62 printf("Color model: %lu\n", val);
63 OOP_GetAttr(pixfmt, aHidd_PixFmt_RedShift, &val);
64 printf("Red shift: %lu\n", val);
65 OOP_GetAttr(pixfmt, aHidd_PixFmt_GreenShift, &val);
66 printf("Green shift: %lu\n", val);
67 OOP_GetAttr(pixfmt, aHidd_PixFmt_BlueShift, &val);
68 printf("Blue shift: %lu\n", val);
69 OOP_GetAttr(pixfmt, aHidd_PixFmt_AlphaShift, &val);
70 printf("Alpha shift: %lu\n", val);
71 OOP_GetAttr(pixfmt, aHidd_PixFmt_RedMask, &val);
72 printf("Red mask: 0x%08lX\n", val);
73 OOP_GetAttr(pixfmt, aHidd_PixFmt_GreenMask, &val);
74 printf("Green mask: 0x%08lX\n", val);
75 OOP_GetAttr(pixfmt, aHidd_PixFmt_BlueMask, &val);
76 printf("Blue mask: 0x%08lX\n", val);
77 OOP_GetAttr(pixfmt, aHidd_PixFmt_AlphaMask, &val);
78 printf("Alpha mask: 0x%08lX\n", val);
79 OOP_GetAttr(pixfmt, aHidd_PixFmt_Depth, &val);
80 printf("Depth: %lu\n", val);
81 OOP_GetAttr(pixfmt, aHidd_PixFmt_BitsPerPixel, &val);
82 printf("Bits per pixel: %lu\n", val);
83 OOP_GetAttr(pixfmt, aHidd_PixFmt_BytesPerPixel, &val);
84 printf("Bytes per pixel: %lu\n", val);
85 OOP_GetAttr(pixfmt, aHidd_PixFmt_StdPixFmt, &val);
86 printf("Pixelformat code: %lu\n", val);
87 OOP_GetAttr(pixfmt, aHidd_PixFmt_CLUTMask, &val);
88 printf("Palette mask: 0x%08lX\n", val);
89 OOP_GetAttr(pixfmt, aHidd_PixFmt_CLUTShift, &val);
90 printf("Palette shift: %lu\n", val);
91 OOP_GetAttr(pixfmt, aHidd_PixFmt_BitMapType, &val);
92 printf("Bitmap type: %lu\n", val);
93 } else
94 printf("Failed to obtain DimensionInfo\n");
96 OOP_ReleaseAttrBase(IID_Hidd_PixFmt);
97 CloseLibrary(OOPBase);
98 return 0;