2013-01-24 23:00:42 +00:00
|
|
|
#include <precomp.h>
|
2008-03-17 10:59:18 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2008-11-21 06:50:36 +00:00
|
|
|
|
|
|
|
#define NB_RESERVED_COLORS 20 /* number of fixed colors in system palette */
|
|
|
|
|
|
|
|
static const PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS] =
|
|
|
|
{
|
|
|
|
/* first 10 entries in the system palette */
|
|
|
|
/* red green blue flags */
|
|
|
|
{ 0x00, 0x00, 0x00, 0 },
|
|
|
|
{ 0x80, 0x00, 0x00, 0 },
|
|
|
|
{ 0x00, 0x80, 0x00, 0 },
|
|
|
|
{ 0x80, 0x80, 0x00, 0 },
|
|
|
|
{ 0x00, 0x00, 0x80, 0 },
|
|
|
|
{ 0x80, 0x00, 0x80, 0 },
|
|
|
|
{ 0x00, 0x80, 0x80, 0 },
|
|
|
|
{ 0xc0, 0xc0, 0xc0, 0 },
|
|
|
|
{ 0xc0, 0xdc, 0xc0, 0 },
|
|
|
|
{ 0xa6, 0xca, 0xf0, 0 },
|
|
|
|
|
|
|
|
/* ... c_min/2 dynamic colorcells */
|
|
|
|
|
|
|
|
/* ... gap (for sparse palettes) */
|
|
|
|
|
|
|
|
/* ... c_min/2 dynamic colorcells */
|
|
|
|
|
|
|
|
{ 0xff, 0xfb, 0xf0, 0 },
|
|
|
|
{ 0xa0, 0xa0, 0xa4, 0 },
|
|
|
|
{ 0x80, 0x80, 0x80, 0 },
|
|
|
|
{ 0xff, 0x00, 0x00, 0 },
|
|
|
|
{ 0x00, 0xff, 0x00, 0 },
|
|
|
|
{ 0xff, 0xff, 0x00, 0 },
|
|
|
|
{ 0x00, 0x00, 0xff, 0 },
|
|
|
|
{ 0xff, 0x00, 0xff, 0 },
|
|
|
|
{ 0x00, 0xff, 0xff, 0 },
|
|
|
|
{ 0xff, 0xff, 0xff, 0 } /* last 10 */
|
|
|
|
};
|
|
|
|
|
2008-03-17 10:59:18 +00:00
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
AnimatePalette(HPALETTE hpal,
|
|
|
|
UINT iStartIndex,
|
|
|
|
UINT cEntries,
|
|
|
|
const PALETTEENTRY *ppe)
|
|
|
|
{
|
|
|
|
return NtGdiDoPalette(hpal, iStartIndex, cEntries, (PALETTEENTRY*)ppe, GdiPalAnimate, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
HPALETTE
|
|
|
|
WINAPI
|
|
|
|
CreatePalette(CONST LOGPALETTE * plpal)
|
|
|
|
{
|
|
|
|
return NtGdiCreatePaletteInternal((LPLOGPALETTE)plpal, plpal->palNumEntries);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
UINT
|
|
|
|
WINAPI
|
|
|
|
GetPaletteEntries(HPALETTE hpal,
|
|
|
|
UINT iStartIndex,
|
|
|
|
UINT cEntries,
|
|
|
|
LPPALETTEENTRY ppe)
|
|
|
|
{
|
|
|
|
return NtGdiDoPalette(hpal, iStartIndex, cEntries, ppe, GdiPalGetEntries, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT
|
|
|
|
WINAPI
|
|
|
|
SetPaletteEntries(HPALETTE hpal,
|
|
|
|
UINT iStartIndex,
|
|
|
|
UINT cEntries,
|
|
|
|
const PALETTEENTRY *ppe)
|
|
|
|
{
|
|
|
|
return NtGdiDoPalette(hpal, iStartIndex, cEntries, (PALETTEENTRY*)ppe, GdiPalSetEntries, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT
|
|
|
|
WINAPI
|
|
|
|
GetSystemPaletteEntries(HDC hDC,
|
|
|
|
UINT iStartIndex,
|
|
|
|
UINT cEntries,
|
|
|
|
LPPALETTEENTRY ppe)
|
|
|
|
{
|
2010-09-07 07:50:51 +00:00
|
|
|
PALETTEENTRY ippe[256];
|
2008-11-21 06:50:36 +00:00
|
|
|
|
2010-09-07 07:50:51 +00:00
|
|
|
if ((INT)cEntries >= 0)
|
|
|
|
{
|
|
|
|
if (GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)
|
|
|
|
{
|
|
|
|
return NtGdiDoPalette(hDC,
|
|
|
|
iStartIndex,
|
|
|
|
cEntries,
|
|
|
|
ppe,
|
|
|
|
GdiPalGetSystemEntries,
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
else if (ppe)
|
|
|
|
{
|
|
|
|
RtlCopyMemory(ippe, sys_pal_template, 10 * sizeof(PALETTEENTRY));
|
|
|
|
RtlCopyMemory(&ippe[246], &sys_pal_template[10], 10 * sizeof(PALETTEENTRY));
|
|
|
|
RtlZeroMemory(&ippe[10], sizeof(ippe) - 20 * sizeof(PALETTEENTRY));
|
2010-12-27 16:23:59 +00:00
|
|
|
|
2010-09-07 07:50:51 +00:00
|
|
|
if (iStartIndex < 256)
|
|
|
|
{
|
2010-12-27 16:23:59 +00:00
|
|
|
RtlCopyMemory(ppe,
|
2010-09-07 07:50:51 +00:00
|
|
|
&ippe[iStartIndex],
|
|
|
|
min(256 - iStartIndex, cEntries) *
|
|
|
|
sizeof(PALETTEENTRY));
|
|
|
|
}
|
2008-11-21 06:50:36 +00:00
|
|
|
}
|
2010-09-07 07:50:51 +00:00
|
|
|
}
|
2008-12-07 21:52:22 +00:00
|
|
|
|
2010-09-07 07:50:51 +00:00
|
|
|
return 0;
|
2008-03-17 10:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT
|
|
|
|
WINAPI
|
|
|
|
GetDIBColorTable(HDC hDC,
|
|
|
|
UINT iStartIndex,
|
|
|
|
UINT cEntries,
|
|
|
|
RGBQUAD *pColors)
|
|
|
|
{
|
2010-12-27 16:23:59 +00:00
|
|
|
if (cEntries)
|
|
|
|
return NtGdiDoPalette(hDC, iStartIndex, cEntries, pColors, GdiPalGetColorTable, FALSE);
|
|
|
|
return 0;
|
2008-03-17 10:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
UINT
|
|
|
|
WINAPI
|
2014-12-29 14:25:30 +00:00
|
|
|
RealizePalette(
|
|
|
|
_In_ HDC hdc) /* [in] Handle of device context */
|
2008-03-17 10:59:18 +00:00
|
|
|
{
|
2014-12-29 14:25:30 +00:00
|
|
|
HANDLE_METADC0P(UINT, RealizePalette, GDI_ERROR, hdc);
|
2015-02-05 09:35:54 +00:00
|
|
|
|
|
|
|
if (GDI_HANDLE_GET_TYPE(hdc) != GDILoObjType_LO_DC_TYPE)
|
|
|
|
{
|
|
|
|
return GDI_ERROR;
|
|
|
|
}
|
|
|
|
|
2014-12-29 14:25:30 +00:00
|
|
|
return UserRealizePalette(hdc);
|
2008-03-17 10:59:18 +00:00
|
|
|
}
|
|
|
|
|
2008-01-09 04:15:42 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
2008-11-30 11:42:05 +00:00
|
|
|
WINAPI
|
2008-01-09 04:15:42 +00:00
|
|
|
ResizePalette(
|
2010-12-27 16:23:59 +00:00
|
|
|
HPALETTE hPalette,
|
|
|
|
UINT nEntries
|
|
|
|
)
|
2008-01-09 04:15:42 +00:00
|
|
|
{
|
2010-12-27 16:23:59 +00:00
|
|
|
return NtGdiResizePalette(hPalette, nEntries);
|
2008-03-17 10:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
UINT
|
|
|
|
WINAPI
|
|
|
|
SetDIBColorTable(HDC hDC,
|
|
|
|
UINT iStartIndex,
|
|
|
|
UINT cEntries,
|
|
|
|
const RGBQUAD *pColors)
|
|
|
|
{
|
|
|
|
UINT retValue=0;
|
|
|
|
|
|
|
|
if (cEntries)
|
|
|
|
{
|
|
|
|
retValue = NtGdiDoPalette(hDC, iStartIndex, cEntries, (RGBQUAD*)pColors, GdiPalSetColorTable, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retValue;
|
2008-01-09 04:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
2008-11-30 11:42:05 +00:00
|
|
|
WINAPI
|
2008-01-09 04:15:42 +00:00
|
|
|
UpdateColors(
|
2010-12-27 16:23:59 +00:00
|
|
|
HDC hdc
|
|
|
|
)
|
2008-01-09 04:15:42 +00:00
|
|
|
{
|
2010-12-27 16:23:59 +00:00
|
|
|
((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
|
|
|
|
return NtGdiUpdateColors(hdc);
|
2008-01-09 04:15:42 +00:00
|
|
|
}
|
2008-03-17 10:59:18 +00:00
|
|
|
|
2014-10-28 21:09:01 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ColorCorrectPalette(HDC hDC,HPALETTE hPalette,DWORD dwFirstEntry,DWORD dwNumOfEntries)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-17 10:59:18 +00:00
|
|
|
/* EOF */
|