4734d4a53b63e9a3d45c23b54f8e14fbc18435e9
[reactos.git] / rostests / apitests / gdi32 / init.c
1
2 #include <stdio.h>
3 #include <windows.h>
4
5 HBITMAP ghbmpDIB32;
6 HDC ghdcDIB32;
7 PULONG pulDIB32Bits;
8 HPALETTE ghpal;
9
10 struct
11 {
12 WORD palVersion;
13 WORD palNumEntries;
14 PALETTEENTRY logpalettedata[8];
15 } gpal =
16 {
17 0x300, 8,
18 {
19 { 0x10, 0x20, 0x30, PC_NOCOLLAPSE },
20 { 0x20, 0x30, 0x40, PC_NOCOLLAPSE },
21 { 0x30, 0x40, 0x50, PC_NOCOLLAPSE },
22 { 0x40, 0x50, 0x60, PC_NOCOLLAPSE },
23 { 0x50, 0x60, 0x70, PC_NOCOLLAPSE },
24 { 0x60, 0x70, 0x80, PC_NOCOLLAPSE },
25 { 0x70, 0x80, 0x90, PC_NOCOLLAPSE },
26 { 0x80, 0x90, 0xA0, PC_NOCOLLAPSE },
27 }
28 };
29
30 BOOL InitStuff(void)
31 {
32 BITMAPINFO bmi32 =
33 {{sizeof(BITMAPINFOHEADER), 4, -4, 1, 32, BI_RGB, 0, 1, 1, 0, 0}};
34
35 ghdcDIB32 = CreateCompatibleDC(0);
36
37 ghbmpDIB32 = CreateDIBSection(ghdcDIB32, &bmi32, DIB_PAL_COLORS, (PVOID*)&pulDIB32Bits, 0, 0 );
38 if (!ghbmpDIB32) return FALSE;
39
40 SelectObject(ghdcDIB32, ghbmpDIB32);
41
42 /* Initialize a logical palette */
43 ghpal = CreatePalette((LOGPALETTE*)&gpal);
44 if (!ghpal)
45 {
46 printf("failed to create a palette \n");
47 return FALSE;
48 }
49
50 return TRUE;
51 }