ReactOS  0.4.14-dev-77-gd9e7c48
palette.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PALETTE
 

Macros

#define PALETTE_UnlockPalette(pPalette)   GDIOBJ_vUnlockObject((POBJ)pPalette)
 
#define PALETTE_ShareLockPalette(hpal)   ((PPALETTE)GDIOBJ_ShareLockObj((HGDIOBJ)hpal, GDI_OBJECT_TYPE_PALETTE))
 
#define PALETTE_ShareUnlockPalette(ppal)   GDIOBJ_vDereferenceObject(&ppal->BaseObject)
 

Typedefs

typedef struct _PALETTE PALETTE
 
typedef struct _PALETTEPPALETTE
 

Enumerations

enum  _PALFLAGS {
  PAL_INDEXED = 0x00000001, PAL_BITFIELDS = 0x00000002, PAL_RGB = 0x00000004, PAL_BGR = 0x00000008,
  PAL_CMYK = 0x00000010, PAL_DC = 0x00000100, PAL_FIXED = 0x00000200, PAL_FREE = 0x00000400,
  PAL_MANAGED = 0x00000800, PAL_NOSTATIC = 0x00001000, PAL_MONOCHROME = 0x00002000, PAL_BRUSHHACK = 0x00004000,
  PAL_DIBSECTION = 0x00008000, PAL_NOSTATIC256 = 0x00010000, PAL_HT = 0x00100000, PAL_RGB16_555 = 0x00200000,
  PAL_RGB16_565 = 0x00400000, PAL_GAMMACORRECTION = 0x00800000
}
 

Functions

INIT_FUNCTION NTSTATUS NTAPI InitPaletteImpl (VOID)
 
PPALETTE NTAPI PALETTE_AllocPalette (_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
 
PPALETTE NTAPI PALETTE_AllocPalWithHandle (_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
 
VOID FASTCALL PALETTE_ValidateFlags (PALETTEENTRY *lpPalE, INT size)
 
INT FASTCALL PALETTE_GetObject (PPALETTE pGdiObject, INT cbCount, LPLOGBRUSH lpBuffer)
 
ULONG NTAPI PALETTE_ulGetNearestPaletteIndex (PPALETTE ppal, ULONG iColor)
 
ULONG NTAPI PALETTE_ulGetNearestIndex (PPALETTE ppal, ULONG iColor)
 
ULONG NTAPI PALETTE_ulGetNearestBitFieldsIndex (PPALETTE ppal, ULONG ulColor)
 
VOID NTAPI PALETTE_vGetBitMasks (PPALETTE ppal, PULONG pulColors)
 
VOID NTAPI PALETTE_vCleanup (PVOID ObjectBody)
 
FORCEINLINE ULONG CalculateShift (ULONG ulMask1, ULONG ulMask2)
 
FORCEINLINE ULONG PALETTE_ulGetRGBColorFromIndex (PPALETTE ppal, ULONG ulIndex)
 
FORCEINLINE VOID PALETTE_vSetRGBColorForIndex (PPALETTE ppal, ULONG ulIndex, COLORREF crColor)
 
HPALETTE NTAPI GreCreatePaletteInternal (IN LPLOGPALETTE pLogPal, IN UINT cEntries)
 

Variables

PALETTE gpalRGB
 
PALETTE gpalBGR
 
PALETTE gpalRGB555
 
PALETTE gpalRGB565
 
PALETTEgppalMono
 
PALETTEgppalDefault
 
PPALETTE appalSurfaceDefault []
 

Macro Definition Documentation

◆ PALETTE_ShareLockPalette

#define PALETTE_ShareLockPalette (   hpal)    ((PPALETTE)GDIOBJ_ShareLockObj((HGDIOBJ)hpal, GDI_OBJECT_TYPE_PALETTE))

Definition at line 57 of file palette.h.

◆ PALETTE_ShareUnlockPalette

#define PALETTE_ShareUnlockPalette (   ppal)    GDIOBJ_vDereferenceObject(&ppal->BaseObject)

Definition at line 59 of file palette.h.

◆ PALETTE_UnlockPalette

#define PALETTE_UnlockPalette (   pPalette)    GDIOBJ_vUnlockObject((POBJ)pPalette)

Definition at line 56 of file palette.h.

Typedef Documentation

◆ PALETTE

◆ PPALETTE

Enumeration Type Documentation

◆ _PALFLAGS

Enumerator
PAL_INDEXED 
PAL_BITFIELDS 
PAL_RGB 
PAL_BGR 
PAL_CMYK 
PAL_DC 
PAL_FIXED 
PAL_FREE 
PAL_MANAGED 
PAL_NOSTATIC 
PAL_MONOCHROME 
PAL_BRUSHHACK 
PAL_DIBSECTION 
PAL_NOSTATIC256 
PAL_HT 
PAL_RGB16_555 
PAL_RGB16_565 
PAL_GAMMACORRECTION 

Definition at line 8 of file palette.h.

9 {
10 #ifndef _WINDDI_ // Defined in ddk/winddi.h
11  PAL_INDEXED = 0x00000001, // Indexed palette
12  PAL_BITFIELDS = 0x00000002, // Bit fields used for DIB, DIB section
13  PAL_RGB = 0x00000004, // Red, green, blue
14  PAL_BGR = 0x00000008, // Blue, green, red
15  PAL_CMYK = 0x00000010, // Cyan, magenta, yellow, black
16 #endif
17  PAL_DC = 0x00000100,
18  PAL_FIXED = 0x00000200, // Can't be changed
19  PAL_FREE = 0x00000400,
20  PAL_MANAGED = 0x00000800,
21  PAL_NOSTATIC = 0x00001000,
22  PAL_MONOCHROME = 0x00002000, // Two colors only
23  PAL_BRUSHHACK = 0x00004000,
24  PAL_DIBSECTION = 0x00008000, // Used for a DIB section
25  PAL_NOSTATIC256 = 0x00010000,
26  PAL_HT = 0x00100000, // Halftone palette
27  PAL_RGB16_555 = 0x00200000, // 16-bit RGB in 555 format
28  PAL_RGB16_565 = 0x00400000, // 16-bit RGB in 565 format
29  PAL_GAMMACORRECTION = 0x00800000, // Correct colors
30 };
Definition: palette.h:26
Definition: palette.h:17

Function Documentation

◆ CalculateShift()

FORCEINLINE ULONG CalculateShift ( ULONG  ulMask1,
ULONG  ulMask2 
)

Definition at line 130 of file palette.h.

131 {
132  ULONG ulShift1, ulShift2;
133  BitScanReverse(&ulShift1, ulMask1);
134  BitScanReverse(&ulShift2, ulMask2);
135  ulShift2 -= ulShift1;
136  if ((INT)ulShift2 < 0) ulShift2 += 32;
137  return ulShift2;
138 }
int32_t INT
Definition: typedefs.h:56
#define BitScanReverse
Definition: interlocked.h:6
unsigned int ULONG
Definition: retypes.h:1

Referenced by EXLATEOBJ_vInitialize(), and PALETTE_ulGetNearestBitFieldsIndex().

◆ GreCreatePaletteInternal()

HPALETTE NTAPI GreCreatePaletteInternal ( IN LPLOGPALETTE  pLogPal,
IN UINT  cEntries 
)

Systemcall Interface

Definition at line 448 of file palette.c.

451 {
452  HPALETTE hpal = NULL;
453  PPALETTE ppal;
454 
455  pLogPal->palNumEntries = cEntries;
457  cEntries,
458  pLogPal->palPalEntry,
459  0, 0, 0);
460 
461  if (ppal != NULL)
462  {
464 
465  hpal = ppal->BaseObject.hHmgr;
466  PALETTE_UnlockPalette(ppal);
467  }
468 
469  return hpal;
470 }
PALETTEENTRY * IndexedColors
Definition: palette.h:42
VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY *lpPalE, INT size)
Definition: palette.c:125
#define PALETTE_UnlockPalette(pPalette)
Definition: palette.h:56
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:416
PPALETTE NTAPI PALETTE_AllocPalWithHandle(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:209
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3615
BASEOBJECT BaseObject
Definition: palette.h:36
ULONG NumColors
Definition: palette.h:41

◆ InitPaletteImpl()

INIT_FUNCTION NTSTATUS NTAPI InitPaletteImpl ( VOID  )

Definition at line 66 of file palette.c.

67 {
68  // Create default palette (20 system colors)
70  20,
72  0, 0, 0);
75 
76  /* palette_size = visual->map_entries; */
77 
79  gpalRGB.RedMask = RGB(0xFF, 0x00, 0x00);
80  gpalRGB.GreenMask = RGB(0x00, 0xFF, 0x00);
81  gpalRGB.BlueMask = RGB(0x00, 0x00, 0xFF);
84 
86  gpalBGR.RedMask = RGB(0x00, 0x00, 0xFF);
87  gpalBGR.GreenMask = RGB(0x00, 0xFF, 0x00);
88  gpalBGR.BlueMask = RGB(0xFF, 0x00, 0x00);
91 
93  gpalRGB555.RedMask = 0x7C00;
94  gpalRGB555.GreenMask = 0x3E0;
95  gpalRGB555.BlueMask = 0x1F;
98 
100  gpalRGB565.RedMask = 0xF800;
101  gpalRGB565.GreenMask = 0x7E0;
102  gpalRGB565.BlueMask = 0x1F;
105 
109 
110  /* Initialize default surface palettes */
121 
122  return STATUS_SUCCESS;
123 }
#define BMF_24BPP
Definition: winddi.h:359
PALETTE gpalRGB565
Definition: palette.c:20
PALETTE gpalBGR
Definition: palette.c:20
ULONG ulShareCount
Definition: gdiobj.h:42
#define BMF_32BPP
Definition: winddi.h:360
PALETTE * gppalMono
Definition: palette.c:20
#define BMF_8RLE
Definition: winddi.h:362
PALETTE * gppalDefault
Definition: palette.c:20
USHORT BaseFlags
Definition: gdiobj.h:46
FORCEINLINE VOID PALETTE_vSetRGBColorForIndex(PPALETTE ppal, ULONG ulIndex, COLORREF crColor)
Definition: palette.h:152
Definition: xlate.c:10
PPALETTE NTAPI PALETTE_AllocPalette(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:135
#define BMF_PNG
Definition: winddi.h:364
ULONG RedMask
Definition: palette.h:43
#define PALETTE_UnlockPalette(pPalette)
Definition: palette.h:56
#define BMF_4RLE
Definition: winddi.h:361
smooth NULL
Definition: ftsmooth.c:416
#define BMF_16BPP
Definition: winddi.h:358
ULONG BlueMask
Definition: palette.h:45
ULONG GreenMask
Definition: palette.h:44
#define RGB(r, g, b)
Definition: wingdi.h:2935
PPALETTE NTAPI PALETTE_AllocPalWithHandle(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:209
BASEOBJECT BaseObject
Definition: palette.h:36
FLONG flFlags
Definition: palette.h:40
Definition: xlate.c:8
Definition: xlate.c:9
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:731
PPALETTE appalSurfaceDefault[11]
Definition: palette.c:21
PALETTE gpalRGB
Definition: palette.c:20
return STATUS_SUCCESS
Definition: btrfs.c:2966
PALETTE gpalRGB555
Definition: palette.c:20
#define BMF_JPEG
Definition: winddi.h:363
const PALETTEENTRY g_sysPalTemplate[NB_RESERVED_COLORS]
Definition: palette.c:23

Referenced by DriverEntry().

◆ PALETTE_AllocPalette()

PPALETTE NTAPI PALETTE_AllocPalette ( _In_ ULONG  iMode,
_In_ ULONG  cColors,
_In_opt_ const PALETTEENTRY pEntries,
_In_ FLONG  flRed,
_In_ FLONG  flGreen,
_In_ FLONG  flBlue 
)

Definition at line 135 of file palette.c.

142 {
143  PPALETTE ppal;
144  ULONG fl = 0, cjSize = sizeof(PALETTE);
145 
146  /* Check if the palette has entries */
147  if (iMode & PAL_INDEXED)
148  {
149  /* Check color count */
150  if ((cColors == 0) || (cColors > 1024)) return NULL;
151 
152  /* Allocate enough space for the palete entries */
153  cjSize += cColors * sizeof(PALETTEENTRY);
154  }
155  else
156  {
157  /* There are no palette entries */
158  cColors = 0;
159 
160  /* We can use the lookaside list */
162  }
163 
164  /* Allocate the object (without a handle!) */
166  if (!ppal)
167  {
168  return NULL;
169  }
170 
171  /* Set mode, color count and entry pointer */
172  ppal->flFlags = iMode;
173  ppal->NumColors = cColors;
174  ppal->IndexedColors = ppal->apalColors;
175 
176  /* Check what kind of palette this is */
177  if (iMode & PAL_INDEXED)
178  {
179  /* Check if we got a color array */
180  if (pEntries)
181  {
182  /* Copy the entries */
183  RtlCopyMemory(ppal->IndexedColors, pEntries, cColors * sizeof(pEntries[0]));
184  }
185  }
186  else if (iMode & PAL_BITFIELDS)
187  {
188  /* Copy the color masks */
189  ppal->RedMask = flRed;
190  ppal->GreenMask = flGreen;
191  ppal->BlueMask = flBlue;
192 
193  /* Check what masks we have and set optimization flags */
194  if ((flRed == 0x7c00) && (flGreen == 0x3E0) && (flBlue == 0x1F))
195  ppal->flFlags |= PAL_RGB16_555;
196  else if ((flRed == 0xF800) && (flGreen == 0x7E0) && (flBlue == 0x1F))
197  ppal->flFlags |= PAL_RGB16_565;
198  else if ((flRed == 0xFF0000) && (flGreen == 0xFF00) && (flBlue == 0xFF))
199  ppal->flFlags |= PAL_BGR;
200  else if ((flRed == 0xFF) && (flGreen == 0xFF00) && (flBlue == 0xFF0000))
201  ppal->flFlags |= PAL_RGB;
202  }
203 
204  return ppal;
205 }
struct _PALETTE * PPALETTE
PALETTEENTRY apalColors[0]
Definition: palette.h:50
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _PALETTE PALETTE
_In_ ULONG iMode
Definition: winddi.h:3520
PALETTEENTRY * IndexedColors
Definition: palette.h:42
_In_ FLONG fl
Definition: winddi.h:1279
ULONG RedMask
Definition: palette.h:43
smooth NULL
Definition: ftsmooth.c:416
ULONG BlueMask
Definition: palette.h:45
ULONG GreenMask
Definition: palette.h:44
ULONG NumColors
Definition: palette.h:41
FLONG flFlags
Definition: palette.h:40
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjSize
Definition: winddi.h:3634
struct tagPALETTEENTRY PALETTEENTRY
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:559

Referenced by CreateDIBPalette(), EngCreatePalette(), FixupDIBBrushPalette(), InitPaletteImpl(), NtGdiDdDDICreateDCFromMemory(), and PALETTE_AllocPalWithHandle().

◆ PALETTE_AllocPalWithHandle()

PPALETTE NTAPI PALETTE_AllocPalWithHandle ( _In_ ULONG  iMode,
_In_ ULONG  cColors,
_In_opt_ const PALETTEENTRY pEntries,
_In_ FLONG  flRed,
_In_ FLONG  flGreen,
_In_ FLONG  flBlue 
)

Definition at line 209 of file palette.c.

216 {
217  PPALETTE ppal;
218 
219  /* Allocate the palette without a handle */
220  ppal = PALETTE_AllocPalette(iMode, cColors, pEntries, flRed, flGreen, flBlue);
221  if (!ppal) return NULL;
222 
223  /* Insert the palette into the handle table */
225  {
226  DPRINT1("Could not insert palette into handle table.\n");
228  return NULL;
229  }
230 
231  return ppal;
232 }
_In_ ULONG iMode
Definition: winddi.h:3520
PPALETTE NTAPI PALETTE_AllocPalette(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:135
smooth NULL
Definition: ftsmooth.c:416
BASEOBJECT BaseObject
Definition: palette.h:36
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define DPRINT1
Definition: precomp.h:8
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:593
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:909

Referenced by DIB_MapPaletteColors(), GreCreatePaletteInternal(), InitPaletteImpl(), NtGdiCreateHalftonePalette(), and NtGdiCreatePaletteInternal().

◆ PALETTE_GetObject()

INT FASTCALL PALETTE_GetObject ( PPALETTE  pGdiObject,
INT  cbCount,
LPLOGBRUSH  lpBuffer 
)

Definition at line 247 of file palette.c.

248 {
249  if (!lpBuffer)
250  {
251  return sizeof(WORD);
252  }
253 
254  if ((UINT)cbCount < sizeof(WORD)) return 0;
255  *((WORD*)lpBuffer) = (WORD)ppal->NumColors;
256  return sizeof(WORD);
257 }
static int cbCount
Definition: fiber.c:42
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int UINT
Definition: ndis.h:50

Referenced by GreGetObject().

◆ PALETTE_ulGetNearestBitFieldsIndex()

ULONG NTAPI PALETTE_ulGetNearestBitFieldsIndex ( PPALETTE  ppal,
ULONG  ulColor 
)

◆ PALETTE_ulGetNearestIndex()

ULONG NTAPI PALETTE_ulGetNearestIndex ( PPALETTE  ppal,
ULONG  iColor 
)

◆ PALETTE_ulGetNearestPaletteIndex()

ULONG NTAPI PALETTE_ulGetNearestPaletteIndex ( PPALETTE  ppal,
ULONG  iColor 
)

◆ PALETTE_ulGetRGBColorFromIndex()

FORCEINLINE ULONG PALETTE_ulGetRGBColorFromIndex ( PPALETTE  ppal,
ULONG  ulIndex 
)

Definition at line 142 of file palette.h.

143 {
144  if (ulIndex >= ppal->NumColors) return 0;
145  return RGB(ppal->IndexedColors[ulIndex].peRed,
147  ppal->IndexedColors[ulIndex].peBlue);
148 }
PALETTEENTRY * IndexedColors
Definition: palette.h:42
#define RGB(r, g, b)
Definition: wingdi.h:2935
ULONG NumColors
Definition: palette.h:41
ULONG ulIndex
Definition: symbols.c:92

Referenced by CreateDIBPalette(), FixupDIBBrushPalette(), and TranslateCOLORREF().

◆ PALETTE_ValidateFlags()

VOID FASTCALL PALETTE_ValidateFlags ( PALETTEENTRY lpPalE,
INT  size 
)

Definition at line 125 of file palette.c.

126 {
127  int i = 0;
128  for (; i<size ; i++)
129  lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07);
130 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizeiptr size
Definition: glext.h:5919
#define PC_SYS_USED
Definition: color.h:3

Referenced by GreCreatePaletteInternal(), IntAnimatePalette(), and NtGdiCreatePaletteInternal().

◆ PALETTE_vCleanup()

VOID NTAPI PALETTE_vCleanup ( PVOID  ObjectBody)

Definition at line 236 of file palette.c.

237 {
238  PPALETTE pPal = (PPALETTE)ObjectBody;
239  if (pPal->IndexedColors && pPal->IndexedColors != pPal->apalColors)
240  {
242  }
243 }
struct _PALETTE * PPALETTE
PALETTEENTRY apalColors[0]
Definition: palette.h:50
PALETTEENTRY * IndexedColors
Definition: palette.h:42
#define TAG_PALETTE
Definition: tags.h:26
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ PALETTE_vGetBitMasks()

VOID NTAPI PALETTE_vGetBitMasks ( PPALETTE  ppal,
PULONG  pulColors 
)

Definition at line 322 of file palette.c.

323 {
324  ASSERT(pulColors);
325 
326  if (ppal->flFlags & PAL_INDEXED || ppal->flFlags & PAL_RGB)
327  {
328  pulColors[0] = RGB(0xFF, 0x00, 0x00);
329  pulColors[1] = RGB(0x00, 0xFF, 0x00);
330  pulColors[2] = RGB(0x00, 0x00, 0xFF);
331  }
332  else if (ppal->flFlags & PAL_BGR)
333  {
334  pulColors[0] = RGB(0x00, 0x00, 0xFF);
335  pulColors[1] = RGB(0x00, 0xFF, 0x00);
336  pulColors[2] = RGB(0xFF, 0x00, 0x00);
337  }
338  else if (ppal->flFlags & PAL_BITFIELDS)
339  {
340  pulColors[0] = ppal->RedMask;
341  pulColors[1] = ppal->GreenMask;
342  pulColors[2] = ppal->BlueMask;
343  }
344 }
ULONG RedMask
Definition: palette.h:43
ULONG BlueMask
Definition: palette.h:45
ULONG GreenMask
Definition: palette.h:44
#define RGB(r, g, b)
Definition: wingdi.h:2935
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
FLONG flFlags
Definition: palette.h:40

Referenced by EXLATEOBJ_vInitialize().

◆ PALETTE_vSetRGBColorForIndex()

FORCEINLINE VOID PALETTE_vSetRGBColorForIndex ( PPALETTE  ppal,
ULONG  ulIndex,
COLORREF  crColor 
)

Definition at line 152 of file palette.h.

153 {
154  if (ulIndex >= ppal->NumColors) return;
155  ppal->IndexedColors[ulIndex].peRed = GetRValue(crColor);
156  ppal->IndexedColors[ulIndex].peGreen = GetGValue(crColor);
157  ppal->IndexedColors[ulIndex].peBlue = GetBValue(crColor);
158 }
#define GetRValue(rgb)
Definition: wingdi.h:2930
PALETTEENTRY * IndexedColors
Definition: palette.h:42
#define GetGValue(rgb)
Definition: wingdi.h:2931
ULONG NumColors
Definition: palette.h:41
ULONG ulIndex
Definition: symbols.c:92
#define GetBValue(rgb)
Definition: wingdi.h:2932

Referenced by CreateDIBPalette(), FixupDIBBrushPalette(), and InitPaletteImpl().

Variable Documentation

◆ appalSurfaceDefault

PPALETTE appalSurfaceDefault[]

Definition at line 21 of file palette.c.

Referenced by InitPaletteImpl(), and SURFACE_AllocSurface().

◆ gpalBGR

PALETTE gpalBGR

Definition at line 20 of file palette.c.

Referenced by InitPaletteImpl().

◆ gpalRGB

◆ gpalRGB555

PALETTE gpalRGB555

Definition at line 20 of file palette.c.

Referenced by InitPaletteImpl().

◆ gpalRGB565

PALETTE gpalRGB565

Definition at line 20 of file palette.c.

Referenced by InitPaletteImpl().

◆ gppalDefault

PALETTE * gppalDefault

Definition at line 20 of file palette.c.

Referenced by CreateDIBPalette(), CreateStockObjects(), EBRUSHOBJ_vInit(), and InitPaletteImpl().

◆ gppalMono