7 #define NB_RESERVED_COLORS 20 /* number of fixed colors in system palette */
9 static const PALETTEENTRY sys_pal_template
[NB_RESERVED_COLORS
] =
11 /* first 10 entries in the system palette */
12 /* red green blue flags */
13 { 0x00, 0x00, 0x00, 0 },
14 { 0x80, 0x00, 0x00, 0 },
15 { 0x00, 0x80, 0x00, 0 },
16 { 0x80, 0x80, 0x00, 0 },
17 { 0x00, 0x00, 0x80, 0 },
18 { 0x80, 0x00, 0x80, 0 },
19 { 0x00, 0x80, 0x80, 0 },
20 { 0xc0, 0xc0, 0xc0, 0 },
21 { 0xc0, 0xdc, 0xc0, 0 },
22 { 0xa6, 0xca, 0xf0, 0 },
24 /* ... c_min/2 dynamic colorcells */
26 /* ... gap (for sparse palettes) */
28 /* ... c_min/2 dynamic colorcells */
30 { 0xff, 0xfb, 0xf0, 0 },
31 { 0xa0, 0xa0, 0xa4, 0 },
32 { 0x80, 0x80, 0x80, 0 },
33 { 0xff, 0x00, 0x00, 0 },
34 { 0x00, 0xff, 0x00, 0 },
35 { 0xff, 0xff, 0x00, 0 },
36 { 0x00, 0x00, 0xff, 0 },
37 { 0xff, 0x00, 0xff, 0 },
38 { 0x00, 0xff, 0xff, 0 },
39 { 0xff, 0xff, 0xff, 0 } /* last 10 */
44 AnimatePalette(HPALETTE hpal
,
47 const PALETTEENTRY
*ppe
)
49 return NtGdiDoPalette(hpal
, iStartIndex
, cEntries
, (PALETTEENTRY
*)ppe
, GdiPalAnimate
, TRUE
);
54 CreatePalette(CONST LOGPALETTE
* plpal
)
56 return NtGdiCreatePaletteInternal((LPLOGPALETTE
)plpal
, plpal
->palNumEntries
);
64 GetPaletteEntries(HPALETTE hpal
,
69 return NtGdiDoPalette(hpal
, iStartIndex
, cEntries
, ppe
, GdiPalGetEntries
, FALSE
);
74 SetPaletteEntries(HPALETTE hpal
,
77 const PALETTEENTRY
*ppe
)
79 return NtGdiDoPalette(hpal
, iStartIndex
, cEntries
, (PALETTEENTRY
*)ppe
, GdiPalSetEntries
, TRUE
);
84 GetSystemPaletteEntries(HDC hDC
,
89 PALETTEENTRY ippe
[256];
91 if ((INT
)cEntries
>= 0)
93 if (GetDeviceCaps(hDC
, RASTERCAPS
) & RC_PALETTE
)
95 return NtGdiDoPalette(hDC
,
99 GdiPalGetSystemEntries
,
104 RtlCopyMemory(ippe
, sys_pal_template
, 10 * sizeof(PALETTEENTRY
));
105 RtlCopyMemory(&ippe
[246], &sys_pal_template
[10], 10 * sizeof(PALETTEENTRY
));
106 RtlZeroMemory(&ippe
[10], sizeof(ippe
) - 20 * sizeof(PALETTEENTRY
));
108 if (iStartIndex
< 256)
112 min(256 - iStartIndex
, cEntries
) *
113 sizeof(PALETTEENTRY
));
123 GetDIBColorTable(HDC hDC
,
129 return NtGdiDoPalette(hDC
, iStartIndex
, cEntries
, pColors
, GdiPalGetColorTable
, FALSE
);
138 RealizePalette(HDC hDC
) /* [in] Handle of device context */
141 // Handle something other than a normal dc object.
142 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
144 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
148 HPALETTE Pal
= GetDCObject(hDC
, GDI_OBJECT_TYPE_PALETTE
);
149 PLDC pLDC
= GdiGetLDC((HDC
) Pal
);
150 if ( !pLDC
) return FALSE
;
151 if (pLDC
->iType
== LDC_EMFLDC
) return EMFDRV_(Pal
);
156 return UserRealizePalette(hDC
);
169 return NtGdiResizePalette(hPalette
, nEntries
);
177 SetDIBColorTable(HDC hDC
,
180 const RGBQUAD
*pColors
)
186 retValue
= NtGdiDoPalette(hDC
, iStartIndex
, cEntries
, (RGBQUAD
*)pColors
, GdiPalSetColorTable
, TRUE
);
201 ((PW32CLIENTINFO
)NtCurrentTeb()->Win32ClientInfo
)->cSpins
= 0;
202 return NtGdiUpdateColors(hdc
);