An outstanding formatting bug.
[AROS.git] / test / monitorclass.c
blobbd39cdf72cfb09e45b7aec1cf50c5ed777ecd591
1 #include <cybergraphx/cybergraphics.h>
2 #include <intuition/monitorclass.h>
3 #include <proto/intuition.h>
5 #include <stdio.h>
7 static STRPTR pfnames[] = {
8 "LUT8",
9 "RGB15",
10 "BGR15",
11 "RGB15PC",
12 "BGR15PC",
13 "RGB16",
14 "BGR16",
15 "RGB16PC",
16 "BGR16PC",
17 "RGB24",
18 "BGR24",
19 "ARGB32",
20 "BGRA32",
21 "RGBA32"
24 static UBYTE depths[] = {8, 15, 16, 24, 32, 0};
26 int main(void)
28 Object **monitors, **mon;
30 monitors = GetMonitorList(NULL);
32 if (!monitors) {
33 printf("Failed to obtain monitors list!\n");
34 return 0;
37 for (mon = monitors; *mon; mon++) {
38 STRPTR name, drvname;
39 ULONG *pfs;
40 UBYTE i;
42 GetAttr(MA_MonitorName, *mon, (IPTR *)&name);
43 GetAttr(MA_DriverName, *mon, (IPTR *)&drvname);
44 printf("Monitor %p %s %s\n", *mon, name, drvname);
46 printf("Supported pixelformats:\n");
47 GetAttr(MA_PixelFormats, *mon, (IPTR *)&pfs);
48 for (i = PIXFMT_LUT8; i <= PIXFMT_RGBA32; i++)
49 printf(" %7s %s\n", pfnames[i], pfs[i] ? "yes" : "no");
51 printf("Preferred pixelformats:\n");
52 for (i = 0; depths[i]; i++) {
53 IPTR pf;
55 printf(" %2d ", depths[i]);
56 DoMethod(*mon, MM_GetDefaultPixelFormat, depths[i], (IPTR *)&pf);
58 if (pf <= PIXFMT_RGBA32)
59 printf("%s\n", pfnames[pf]);
60 else if (pf == -1)
61 printf("Not supported\n");
62 else
63 printf("Unknown (%ld)\n", pf);
65 printf("\n");
68 FreeMonitorList(monitors);
69 return 0;