Handle Boolean tags safely.
[tangerine.git] / test / convertpixels.c
blobf49ede6104c8e5c31738c1ae3f4935cc84430516
1 #include <hidd/graphics.h>
2 #include <proto/graphics.h>
4 #include <stdio.h>
6 #if AROS_BIG_ENDIAN
7 #define SRC_PIXFMT vHidd_StdPixFmt_ARGB32
8 #define DST_PIXFMT vHidd_StdPixFmt_RGB15
9 #else
10 #define SRC_PIXFMT vHidd_StdPixFmt_BGRA32
11 #define DST_PIXFMT vHidd_StdPixFmt_RGB15_LE
12 #endif
14 static ULONG argb[8] =
16 0x00112233,
17 0x00FFFFFF,
18 0xFF888888,
19 0x00FF0000,
20 0x0000FF00,
21 0x000000FF,
22 0x00FFFF00,
23 0x8899AABB,
25 static UWORD rgb15[8];
26 static ULONG argb_inv[8];
28 int main(void)
30 ConvertPixelsA(argb, 0, SRC_PIXFMT, rgb15, 0, DST_PIXFMT, 8, 1, 0);
31 ConvertPixelsA(rgb15, 0, DST_PIXFMT, argb_inv, 0, SRC_PIXFMT, 8, 1, 0);
34 int i;
36 for(i = 0; i < 8; i++)
38 printf("ARGB32 %08lx = RGB15 %04x (%02x %02x %02x) (%3d%% %3d%% %3d%%) [%08x]\n",
39 argb[i], rgb15[i],
40 (rgb15[i] & 0x7C00) >> 10,
41 (rgb15[i] & 0x03E0) >> 5,
42 (rgb15[i] & 0x001F),
43 ((rgb15[i] & 0x7C00) >> 10) * 100 / 31,
44 ((rgb15[i] & 0x03E0) >> 5) * 100 / 31,
45 (rgb15[i] & 0x001F) * 100 / 31,
46 argb_inv[i]
51 return 0;