uLib  User mode C/C++ extended API library for Win32 programmers.

Module Description

Color modification APIs.

Functions

COLORREF WINAPI ScaleColorRef (COLORREF color, BYTE mul, BYTE div)
 
COLORREF WINAPI GradientColor (COLORREF c1, COLORREF c2, WORD Ix, WORD Length)
 
COLORREF WINAPI GrayScaleColor (COLORREF rgb)
 
DWORD __cdecl _swapRGB (DWORD rgba)
 
DWORD __cdecl _swapRGB2 (DWORD rgb)
 

Function Documentation

◆ ScaleColorRef()

COLORREF WINAPI ScaleColorRef ( COLORREF  color,
BYTE  mul,
BYTE  div 
)

ScaleColorRef scales the R/G/B values of color by a ratio.
The resulting R/G/B components are constrained to byte range.

Definition at line 558 of file GdiUtil.cpp.

◆ GradientColor()

COLORREF WINAPI GradientColor ( COLORREF  c1,
COLORREF  c2,
WORD  Ix,
WORD  Length 
)

GradientColor produces a smooth color crossfade from c1 to c2.

Parameters
c1,c2Starting and ending color.
LengthThe desired run length from c1 to c2, inclusive.
IxZero-based step nr.

Returns the color at step Ix.

◆ GrayScaleColor()

COLORREF WINAPI GrayScaleColor ( COLORREF  rgb)

GrayScaleColor converts an RGB value to grayscale.
The luminance of the return value is an sRGB weighted combination of R/G/B.

Definition at line 596 of file GdiUtil.cpp.

◆ _swapRGB()

DWORD __cdecl _swapRGB ( DWORD  rgba)

_swapRGB swaps the RGB order of rgba, preserving the alpha/flag value.
Used to convert between e.g COLORREF <-> RGBQUAD.
Example

LITERAL( DWORD, rgbQuad ) = _swapRGB( colorRef );
colorRef = _swapRGB( LITERAL( DWORD, rgbQuad ));

Defined in _bswap.asm

◆ _swapRGB2()

DWORD __cdecl _swapRGB2 ( DWORD  rgb)

_swapRGB2 swaps the RGB order of rgb, clearing the alpha/flag value.
See also _swapRGB() Defined in _bswap.asm