mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:56:00 +00:00
[SHLWAPI] Implement SHCreateShellPalette (#8123)
Implementing missing features... JIRA issue: CORE-19278 Implement SHCreateShellPalette function.
This commit is contained in:
parent
62ad2403a0
commit
b39cb1229a
1 changed files with 48 additions and 0 deletions
|
@ -4426,14 +4426,62 @@ VOID WINAPI ColorRGBToHLS(COLORREF cRGB, LPWORD pwHue,
|
|||
*pwSaturation = wSaturation;
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
typedef struct tagLOGPALETTEMAX /* Compatible with LOGPALETTE but extended */
|
||||
{
|
||||
WORD palVersion;
|
||||
WORD palNumEntries;
|
||||
PALETTEENTRY palPalEntry[256];
|
||||
} LOGPALETTEMAX, *PLOGPALETTEMAX;
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* SHCreateShellPalette [SHLWAPI.@]
|
||||
*/
|
||||
#ifdef __REACTOS__
|
||||
HPALETTE WINAPI
|
||||
SHCreateShellPalette(_In_opt_ HDC hdc)
|
||||
{
|
||||
HDC hdcMem;
|
||||
HPALETTE hHalftonePalette;
|
||||
LOGPALETTEMAX data;
|
||||
const UINT nExtractCount = 10;
|
||||
const UINT nSecondBlockStart = _countof(data.palPalEntry) - nExtractCount;
|
||||
|
||||
TRACE("(%p)\n", hdc);
|
||||
|
||||
/* Get the colors of the halftone palette */
|
||||
hHalftonePalette = CreateHalftonePalette(hdc);
|
||||
if (!hHalftonePalette)
|
||||
return NULL;
|
||||
data.palVersion = 0x300;
|
||||
data.palNumEntries = GetPaletteEntries(hHalftonePalette, 0,
|
||||
_countof(data.palPalEntry), data.palPalEntry);
|
||||
DeleteObject(hHalftonePalette);
|
||||
|
||||
hdcMem = (hdc ? hdc : CreateCompatibleDC(NULL));
|
||||
|
||||
if (hdcMem)
|
||||
{
|
||||
/* The first 10 and last 10 entries in the system colors are considered important */
|
||||
GetSystemPaletteEntries(hdcMem, 0, nExtractCount, data.palPalEntry);
|
||||
GetSystemPaletteEntries(hdcMem, nSecondBlockStart, nExtractCount,
|
||||
&data.palPalEntry[nSecondBlockStart]);
|
||||
}
|
||||
|
||||
if (hdcMem && hdc != hdcMem)
|
||||
DeleteDC(hdcMem);
|
||||
|
||||
/* Create a palette from the modified color entries */
|
||||
return CreatePalette((PLOGPALETTE)&data);
|
||||
}
|
||||
#else
|
||||
HPALETTE WINAPI SHCreateShellPalette(HDC hdc)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return CreateHalftonePalette(hdc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* SHGetInverseCMAP (SHLWAPI.@)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue