Просмотр исходного кода

+ added the win16api palette functions

git-svn-id: trunk@31619 -
nickysn 10 лет назад
Родитель
Сommit
5900db62ce
3 измененных файлов с 89 добавлено и 0 удалено
  1. 10 0
      rtl/win16/winprocs.inc
  2. 39 0
      rtl/win16/winprocsh.inc
  3. 40 0
      rtl/win16/wintypes.inc

+ 10 - 0
rtl/win16/winprocs.inc

@@ -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;

+ 39 - 0
rtl/win16/winprocsh.inc

@@ -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';

+ 40 - 0
rtl/win16/wintypes.inc

@@ -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;