ReactOS 0.4.15-dev-8227-g32d615f
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

◆ NB_RESERVED_COLORS

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

Definition at line 7 of file palette.c.

◆ NDEBUG

#define NDEBUG

Definition at line 3 of file palette.c.

Function Documentation

◆ AnimatePalette()

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
__kernel_entry W32KAPI 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 pEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
Definition: palette.c:1072
@ GdiPalAnimate
Definition: ntgdityp.h:28
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3621

◆ ColorCorrectPalette()

BOOL WINAPI ColorCorrectPalette ( HDC  hDC,
HPALETTE  hPalette,
DWORD  dwFirstEntry,
DWORD  dwNumOfEntries 
)

Definition at line 205 of file palette.c.

206{
209 return 0;
210}
#define UNIMPLEMENTED
Definition: debug.h:118
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752

◆ CreatePalette()

HPALETTE WINAPI CreatePalette ( CONST LOGPALETTE plpal)

Definition at line 54 of file palette.c.

55{
57}
__kernel_entry W32KAPI HPALETTE APIENTRY NtGdiCreatePaletteInternal(_In_reads_bytes_(cEntries *4+4) LPLOGPALETTE pLogPal, _In_ UINT cEntries)
WORD palNumEntries
Definition: wingdi.h:1834

◆ GetDIBColorTable()

UINT WINAPI GetDIBColorTable ( HDC  hDC,
UINT  iStartIndex,
UINT  cEntries,
RGBQUAD pColors 
)

Definition at line 123 of file palette.c.

127{
128 if (cEntries)
129 return NtGdiDoPalette(hDC, iStartIndex, cEntries, pColors, GdiPalGetColorTable, FALSE);
130 return 0;
131}
static HDC hDC
Definition: 3dtext.c:33
#define FALSE
Definition: types.h:117
@ GdiPalGetColorTable
Definition: ntgdityp.h:33

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

◆ GetPaletteEntries()

◆ GetSystemPaletteEntries()

UINT WINAPI GetSystemPaletteEntries ( HDC  hDC,
UINT  iStartIndex,
UINT  cEntries,
LPPALETTEENTRY  ppe 
)

Definition at line 84 of file palette.c.

88{
89 PALETTEENTRY ippe[256];
90
91 if ((INT)cEntries >= 0)
92 {
94 {
95 return NtGdiDoPalette(hDC,
96 iStartIndex,
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}
#define min(a, b)
Definition: monoChain.cc:55
@ GdiPalGetSystemEntries
Definition: ntgdityp.h:31
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
static const PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS]
Definition: palette.c:9
#define RASTERCAPS
Definition: wingdi.h:745
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define RC_PALETTE
Definition: wingdi.h:790

◆ RealizePalette()

UINT WINAPI RealizePalette ( _In_ HDC  hdc)

Definition at line 138 of file palette.c.

140{
142 {
144 }
145
147 {
148 return GDI_ERROR;
149 }
150
151 return UserRealizePalette(hdc);
152}
BOOL METADC_RealizePalette(HDC hdc) DECLSPEC_HIDDEN
Definition: metadc.c:1247
UINT WINAPI UserRealizePalette(HDC hDC)
Definition: painting.c:2345
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
@ GDILoObjType_LO_METADC16_TYPE
Definition: gdi_private.h:49
@ GDILoObjType_LO_DC_TYPE
Definition: gdi_private.h:34
HDC hdc
Definition: main.c:9
#define GDI_ERROR
Definition: wingdi.h:1309

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

◆ ResizePalette()

BOOL WINAPI ResizePalette ( HPALETTE  hPalette,
UINT  nEntries 
)

Definition at line 159 of file palette.c.

163{
164 return NtGdiResizePalette(hPalette, nEntries);
165}
__kernel_entry W32KAPI BOOL APIENTRY NtGdiResizePalette(_In_ HPALETTE hpal, _In_ UINT cEntry)

◆ SetDIBColorTable()

UINT WINAPI SetDIBColorTable ( HDC  hDC,
UINT  iStartIndex,
UINT  cEntries,
const RGBQUAD pColors 
)

Definition at line 172 of file palette.c.

176{
177 UINT retValue=0;
178
179 if (cEntries)
180 {
181 retValue = NtGdiDoPalette(hDC, iStartIndex, cEntries, (RGBQUAD*)pColors, GdiPalSetColorTable, TRUE);
182 }
183
184 return retValue;
185}
ULONG RGBQUAD
Definition: precomp.h:59
unsigned int UINT
Definition: ndis.h:50
@ GdiPalSetColorTable
Definition: ntgdityp.h:32

◆ SetPaletteEntries()

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

Definition at line 74 of file palette.c.

78{
79 return NtGdiDoPalette(hpal, iStartIndex, cEntries, (PALETTEENTRY*)ppe, GdiPalSetEntries, TRUE);
80}
@ GdiPalSetEntries
Definition: ntgdityp.h:29

◆ UpdateColors()

BOOL WINAPI UpdateColors ( HDC  hdc)

Definition at line 192 of file palette.c.

195{
196 ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
197 return NtGdiUpdateColors(hdc);
198}
#define NtCurrentTeb
__kernel_entry W32KAPI BOOL APIENTRY NtGdiUpdateColors(_In_ HDC hdc)
struct _W32CLIENTINFO * PW32CLIENTINFO

Variable Documentation

◆ sys_pal_template

const PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS]
static

Definition at line 9 of file palette.c.

Referenced by GetSystemPaletteEntries().