ReactOS  0.4.9-dev-717-g6d91262
palette.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for palette.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define NB_RESERVED_COLORS   20 /* number of fixed colors in system palette */
 

Functions

BOOL WINAPI AnimatePalette (HPALETTE hpal, UINT iStartIndex, UINT cEntries, const PALETTEENTRY *ppe)
 
HPALETTE WINAPI CreatePalette (CONST LOGPALETTE *plpal)
 
UINT WINAPI GetPaletteEntries (HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
 
UINT WINAPI SetPaletteEntries (HPALETTE hpal, UINT iStartIndex, UINT cEntries, const PALETTEENTRY *ppe)
 
UINT WINAPI GetSystemPaletteEntries (HDC hDC, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
 
UINT WINAPI GetDIBColorTable (HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
 
UINT WINAPI RealizePalette (_In_ HDC hdc)
 
BOOL WINAPI ResizePalette (HPALETTE hPalette, UINT nEntries)
 
UINT WINAPI SetDIBColorTable (HDC hDC, UINT iStartIndex, UINT cEntries, const RGBQUAD *pColors)
 
BOOL WINAPI UpdateColors (HDC hdc)
 
BOOL WINAPI ColorCorrectPalette (HDC hDC, HPALETTE hPalette, DWORD dwFirstEntry, DWORD dwNumOfEntries)
 

Variables

static const PALETTEENTRY sys_pal_template [NB_RESERVED_COLORS]
 

Macro Definition Documentation

#define NB_RESERVED_COLORS   20 /* number of fixed colors in system palette */

Definition at line 7 of file palette.c.

#define NDEBUG

Definition at line 3 of file palette.c.

Function Documentation

BOOL WINAPI AnimatePalette ( HPALETTE  hpal,
UINT  iStartIndex,
UINT  cEntries,
const PALETTEENTRY ppe 
)

Definition at line 44 of file palette.c.

48 {
49  return NtGdiDoPalette(hpal, iStartIndex, cEntries, (PALETTEENTRY*)ppe, GdiPalAnimate, TRUE);
50 }
#define TRUE
Definition: types.h:120
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
__kernel_entry LONG APIENTRY NtGdiDoPalette(_In_ HGDIOBJ hObj, _In_ WORD iStart, _In_ WORD cEntries, _When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID pUnsafeEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
Definition: palette.c:1074
BOOL WINAPI ColorCorrectPalette ( HDC  hDC,
HPALETTE  hPalette,
DWORD  dwFirstEntry,
DWORD  dwNumOfEntries 
)

Definition at line 202 of file palette.c.

203 {
206  return 0;
207 }
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114
HPALETTE WINAPI CreatePalette ( CONST LOGPALETTE plpal)

Definition at line 54 of file palette.c.

Referenced by test_DIB_PAL_COLORS(), and test_palette_entries().

55 {
57 }
HPALETTE APIENTRY NtGdiCreatePaletteInternal(IN LPLOGPALETTE plogpalUser, IN UINT cEntries)
Definition: palette.c:474
WORD palNumEntries
Definition: wingdi.h:1811
UINT WINAPI GetDIBColorTable ( HDC  hDC,
UINT  iStartIndex,
UINT  cEntries,
RGBQUAD pColors 
)

Definition at line 123 of file palette.c.

Referenced by CreateCompatibleBitmap(), ATL::CImage::GetColorTable(), ImageList_Add(), ImageList_CreateImage(), test_dibsections(), Test_GetDIBColorTable(), and WinGGetDIBColorTable().

127 {
128  if (cEntries)
129  return NtGdiDoPalette(hDC, iStartIndex, cEntries, pColors, GdiPalGetColorTable, FALSE);
130  return 0;
131 }
#define FALSE
Definition: types.h:117
HDC hDC
Definition: wglext.h:521
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
__kernel_entry LONG APIENTRY NtGdiDoPalette(_In_ HGDIOBJ hObj, _In_ WORD iStart, _In_ WORD cEntries, _When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID pUnsafeEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
Definition: palette.c:1074
UINT WINAPI GetPaletteEntries ( HPALETTE  hpal,
UINT  iStartIndex,
UINT  cEntries,
LPPALETTEENTRY  ppe 
)

Definition at line 64 of file palette.c.

Referenced by check_system_palette_entries(), ComponentFactory_CreateBitmapFromHBITMAP(), DECLARE_INTERFACE_(), GdipCreateBitmapFromHBITMAP(), get_default_color_table(), MFDRV_SelectPalette(), OleDuplicateData(), OleTranslateColor(), PaletteRGBFromAttrib(), test_GetDIBits(), test_halftone_palette(), test_handles_process(), test_mono_bitmap(), and test_palette_entries().

68 {
69  return NtGdiDoPalette(hpal, iStartIndex, cEntries, ppe, GdiPalGetEntries, FALSE);
70 }
#define FALSE
Definition: types.h:117
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
__kernel_entry LONG APIENTRY NtGdiDoPalette(_In_ HGDIOBJ hObj, _In_ WORD iStart, _In_ WORD cEntries, _When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID pUnsafeEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
Definition: palette.c:1074
UINT WINAPI GetSystemPaletteEntries ( HDC  hDC,
UINT  iStartIndex,
UINT  cEntries,
LPPALETTEENTRY  ppe 
)

Definition at line 84 of file palette.c.

Referenced by check_system_palette_entries().

88 {
89  PALETTEENTRY ippe[256];
90 
91  if ((INT)cEntries >= 0)
92  {
94  {
95  return NtGdiDoPalette(hDC,
96  iStartIndex,
97  cEntries,
98  ppe,
100  FALSE);
101  }
102  else if (ppe)
103  {
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));
107 
108  if (iStartIndex < 256)
109  {
110  RtlCopyMemory(ppe,
111  &ippe[iStartIndex],
112  min(256 - iStartIndex, cEntries) *
113  sizeof(PALETTEENTRY));
114  }
115  }
116  }
117 
118  return 0;
119 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define RASTERCAPS
Definition: wingdi.h:743
int32_t INT
Definition: typedefs.h:56
#define FALSE
Definition: types.h:117
HDC hDC
Definition: wglext.h:521
#define RC_PALETTE
Definition: wingdi.h:788
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
__kernel_entry LONG APIENTRY NtGdiDoPalette(_In_ HGDIOBJ hObj, _In_ WORD iStart, _In_ WORD cEntries, _When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID pUnsafeEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
Definition: palette.c:1074
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
static const PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS]
Definition: palette.c:9
#define min(a, b)
Definition: monoChain.cc:55
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
UINT WINAPI RealizePalette ( _In_ HDC  hdc)

Definition at line 138 of file palette.c.

Referenced by DrawDibRealize(), DrawDibSetPalette(), GuiSetActiveScreenBuffer(), GuiSetPalette(), InitBitmap(), OnPaletteChanged(), PlayEnhMetaFileRecord(), RealizeClipboardPalette(), START_TEST(), and UseNicePalette().

140 {
142 
144  {
145  return GDI_ERROR;
146  }
147 
148  return UserRealizePalette(hdc);
149 }
#define HANDLE_METADC0P(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:537
UINT WINAPI UserRealizePalette(HDC hDC)
Definition: painting.c:2357
HDC hdc
Definition: msvc.h:53
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
UINT WINAPI RealizePalette(_In_ HDC hdc)
Definition: palette.c:138
unsigned int UINT
Definition: ndis.h:50
#define GDI_ERROR
Definition: wingdi.h:1290
BOOL WINAPI ResizePalette ( HPALETTE  hPalette,
UINT  nEntries 
)

Definition at line 156 of file palette.c.

160 {
161  return NtGdiResizePalette(hPalette, nEntries);
162 }
BOOL APIENTRY NtGdiResizePalette(HPALETTE hpal, UINT Entries)
Definition: palette.c:592
UINT WINAPI SetDIBColorTable ( HDC  hDC,
UINT  iStartIndex,
UINT  cEntries,
const RGBQUAD pColors 
)

Definition at line 169 of file palette.c.

Referenced by wined3d_palette_apply_to_dc().

173 {
174  UINT retValue=0;
175 
176  if (cEntries)
177  {
178  retValue = NtGdiDoPalette(hDC, iStartIndex, cEntries, (RGBQUAD*)pColors, GdiPalSetColorTable, TRUE);
179  }
180 
181  return retValue;
182 }
#define TRUE
Definition: types.h:120
HDC hDC
Definition: wglext.h:521
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
__kernel_entry LONG APIENTRY NtGdiDoPalette(_In_ HGDIOBJ hObj, _In_ WORD iStart, _In_ WORD cEntries, _When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID pUnsafeEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
Definition: palette.c:1074
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI SetPaletteEntries ( HPALETTE  hpal,
UINT  iStartIndex,
UINT  cEntries,
const PALETTEENTRY ppe 
)

Definition at line 74 of file palette.c.

Referenced by test_palette_entries().

78 {
79  return NtGdiDoPalette(hpal, iStartIndex, cEntries, (PALETTEENTRY*)ppe, GdiPalSetEntries, TRUE);
80 }
#define TRUE
Definition: types.h:120
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
__kernel_entry LONG APIENTRY NtGdiDoPalette(_In_ HGDIOBJ hObj, _In_ WORD iStart, _In_ WORD cEntries, _When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID pUnsafeEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
Definition: palette.c:1074
BOOL WINAPI UpdateColors ( HDC  hdc)

Definition at line 189 of file palette.c.

192 {
193  ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
194  return NtGdiUpdateColors(hdc);
195 }
struct _W32CLIENTINFO * PW32CLIENTINFO
HDC hdc
Definition: msvc.h:53
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
BOOL APIENTRY NtGdiUpdateColors(HDC hDC)
Definition: palette.c:1207

Variable Documentation

const PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS]
static

Definition at line 9 of file palette.c.