+ added the win16api color functions

git-svn-id: trunk@31602 -
This commit is contained in:
nickysn 2015-09-11 15:33:09 +00:00
parent 00f776ef76
commit c65af63459
4 changed files with 69 additions and 0 deletions

View File

@ -186,6 +186,10 @@ const
DCB_ENABLE = $0004;
DCB_DISABLE = $0008;
{ Color support }
COLOR_INACTIVECAPTIONTEXT = 19;
COLOR_BTNHIGHLIGHT = 20;
function GetFreeSystemResources(SysResource: UINT): UINT; external 'USER';
procedure LogError(err: UINT; lpInfo: FarPointer); external 'KERNEL';

View File

@ -74,3 +74,22 @@ begin
UnlockResource := GlobalUnlock(hResData);
end;
function RGB(cRed, cGreen, cBlue: BYTE): COLORREF;
begin
RGB := COLORREF(cRed or (WORD(cGreen) shl 8) or (DWORD(cBlue) shl 16));
end;
function GetRValue(rgb: DWORD): BYTE;
begin
GetRValue := Byte(rgb);
end;
function GetGValue(rgb: DWORD): BYTE;
begin
GetGValue := Byte((Word(rgb) shr 8));
end;
function GetBValue(rgb: DWORD): BYTE;
begin
GetBValue := Byte(rgb shr 16);
end;

View File

@ -340,3 +340,19 @@ function LPtoDP(hdc: HDC; lppt: LPPOINT; cPoints: SmallInt): BOOL; external 'GDI
function DPtoLP(hdc: HDC; var pt; cPoints: SmallInt): BOOL; external 'GDI';
function LPtoDP(hdc: HDC; var pt; cPoints: SmallInt): BOOL; external 'GDI';
{$endif}
{ Color support }
function RGB(cRed, cGreen, cBlue: BYTE): COLORREF; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
function GetRValue(rgb: DWORD): BYTE; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
function GetGValue(rgb: DWORD): BYTE; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
function GetBValue(rgb: DWORD): BYTE; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
function GetNearestColor(hdc: HDC; clrref: COLORREF): COLORREF; external 'GDI';
function GetSysColor(nDspElement: SmallInt): COLORREF; external 'USER';
procedure SetSysColors(cDspElements: SmallInt; lpnDspElements: LPINT; lpdwRgbValues: LPCOLORREF); external 'USER';
{$ifdef VAR_PARAMS_ARE_FAR}
procedure SetSysColors(cDspElements: SmallInt; var DspElements; var RgbValues); external 'USER';
{$endif}

View File

@ -501,3 +501,33 @@ const
{ Coordinate Modes }
ABSOLUTE = 1;
RELATIVE = 2;
{ Color support }
type
PCOLORREF = ^COLORREF;
LPCOLORREF = ^COLORREF; far;
COLORREF = DWORD;
TColorRef = COLORREF;
const
COLOR_SCROLLBAR = 0;
COLOR_BACKGROUND = 1;
COLOR_ACTIVECAPTION = 2;
COLOR_INACTIVECAPTION = 3;
COLOR_MENU = 4;
COLOR_WINDOW = 5;
COLOR_WINDOWFRAME = 6;
COLOR_MENUTEXT = 7;
COLOR_WINDOWTEXT = 8;
COLOR_CAPTIONTEXT = 9;
COLOR_ACTIVEBORDER = 10;
COLOR_INACTIVEBORDER = 11;
COLOR_APPWORKSPACE = 12;
COLOR_HIGHLIGHT = 13;
COLOR_HIGHLIGHTTEXT = 14;
COLOR_BTNFACE = 15;
COLOR_BTNSHADOW = 16;
COLOR_GRAYTEXT = 17;
COLOR_BTNTEXT = 18;
WM_SYSCOLORCHANGE = $0015;