+ added the win16api palette functions

git-svn-id: trunk@31619 -
This commit is contained in:
nickysn 2015-09-12 14:05:38 +00:00
parent df0ae96738
commit 5900db62ce
3 changed files with 89 additions and 0 deletions

View File

@ -93,3 +93,13 @@ function GetBValue(rgb: DWORD): BYTE;
begin
GetBValue := Byte(rgb shr 16);
end;
function PALETTERGB(cRed, cGreen, cBlue: BYTE): COLORREF;
begin
PALETTERGB := $02000000 or RGB(cRed, cGreen, cBlue);
end;
function PALETTEINDEX(wPaletteIndex: WORD): COLORREF;
begin
PALETTEINDEX := COLORREF(DWORD($01000000) or DWORD(wPaletteIndex));
end;

View File

@ -432,3 +432,42 @@ function RectInRegion(hrgn: HRGN; lprc: LPRECT): BOOL; external 'GDI';
function RectInRegion(hrgn: HRGN; var rc: RECT): BOOL; external 'GDI';
{$endif}
function PtInRegion(hrgn: HRGN; nXPos, nYPos: SmallInt): BOOL; external 'GDI';
{ Color palette Support }
function PALETTERGB(cRed, cGreen, cBlue: BYTE): COLORREF; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
function PALETTEINDEX(wPaletteIndex: WORD): COLORREF; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
function CreatePalette(lplgpl: LPLOGPALETTE): HPALETTE; external 'GDI';
{$ifdef VAR_PARAMS_ARE_FAR}
function CreatePalette(var lgpl: LOGPALETTE): HPALETTE; external 'GDI';
{$endif}
function SelectPalette(hdc: HDC; hpal: HPALETTE; fPalBack: BOOL): HPALETTE; external 'USER';
function RealizePalette(hdc: HDC): UINT; external 'USER';
function UpdateColors(hdc: HDC): SmallInt; external 'GDI';
procedure AnimatePalette(hpal: HPALETTE; iStart, cEntries: UINT; lppe: LPPALETTEENTRY); external 'GDI';
{$ifdef VAR_PARAMS_ARE_FAR}
procedure AnimatePalette(hpal: HPALETTE; iStart, cEntries: UINT; var pe); external 'GDI';
{$endif}
function SetPaletteEntries(hpal: HPALETTE; iStart, cEntries: UINT; lppe: LPPALETTEENTRY): UINT; external 'GDI';
function GetPaletteEntries(hpal: HPALETTE; iStart, cEntries: UINT; lppe: LPPALETTEENTRY): UINT; external 'GDI';
{$ifdef VAR_PARAMS_ARE_FAR}
function SetPaletteEntries(hpal: HPALETTE; iStart, cEntries: UINT; var pe): UINT; external 'GDI';
function GetPaletteEntries(hpal: HPALETTE; iStart, cEntries: UINT; var pe): UINT; external 'GDI';
{$endif}
function GetNearestPaletteIndex(hpal: HPALETTE; clrref: COLORREF): UINT; external 'GDI';
function ResizePalette(hpal: HPALETTE; cEntries: UINT): BOOL; external 'GDI';
function GetSystemPaletteEntries(hdc: HDC; iStart, cEntries: UINT; lppe: LPPALETTEENTRY): UINT; external 'GDI';
{$ifdef VAR_PARAMS_ARE_FAR}
function GetSystemPaletteEntries(hdc: HDC; iStart, cEntries: UINT; var pe): UINT; external 'GDI';
{$endif}
function GetSystemPaletteUse(hdc: HDC): UINT; external 'GDI';
function SetSystemPaletteUse(hdc: HDC; fuStatic: UINT): UINT; external 'GDI';

View File

@ -633,3 +633,43 @@ const
RGN_XOR = 3;
RGN_DIFF = 4;
RGN_COPY = 5;
{ Color palette Support }
type
PPALETTEENTRY = ^PALETTEENTRY;
LPPALETTEENTRY = ^PALETTEENTRY; far;
PALETTEENTRY = record
peRed: BYTE;
peGreen: BYTE;
peBlue: BYTE;
peFlags: BYTE;
end;
TPaletteEntry = PALETTEENTRY;
{ Palette entry flags }
const
PC_RESERVED = $01; { palette index used for animation }
PC_EXPLICIT = $02; { palette index is explicit to device }
PC_NOCOLLAPSE = $04; { do not match color to system palette }
{ Logical Palette }
type
PLOGPALETTE = ^LOGPALETTE;
NPLOGPALETTE = ^LOGPALETTE; near;
LPLOGPALETTE = ^LOGPALETTE; far;
LOGPALETTE = record
palVersion: WORD;
palNumEntries: WORD;
palPalEntry: array [0..0] of PALETTEENTRY;
end;
TLogPalette = LOGPALETTE;
{ Get/SetSystemPaletteUse() values }
const
SYSPAL_STATIC = 1;
SYSPAL_NOSTATIC = 2;
{ Palette window messages }
WM_QUERYNEWPALETTE = $030F;
WM_PALETTEISCHANGING = $0310;
WM_PALETTECHANGED = $0311;