33#if !defined(COLOR_3DDKSHADOW)
34# define COLOR_3DDKSHADOW 21
36#if !defined(COLOR_3DLIGHT)
37# define COLOR_3DLIGHT 22
39#if !defined(COLOR_INFOTEXT)
40# define COLOR_INFOTEXT 23
42#if !defined(COLOR_INFOBK)
43# define COLOR_INFOBK 24
67#define Symbolic 0x80000000UL
190 if (bitCount == 1 || bitCount == 4 || bitCount == 8)
191 return 1 << bitCount;
192 if (bitCount == 16 || bitCount == 24 || bitCount == 32)
209 if (colors <= 65536L)
211 if (colors <= 16777216L)
229#if defined(UNIX) && !defined(WINELIB)
270 r = (r > (
uint)(255 - val)) ? 255 : r + val;
271 g = (g > (
uint)(255 - val)) ? 255 : g + val;
272 b = (b > (
uint)(255 - val)) ? 255 : b + val;
274 Value = RGB(r, g, b);
284 r = (r < (
uint)val) ? 0 : r - val;
285 g = (g < (
uint)val) ? 0 : g - val;
286 b = (b < (
uint)val) ? 0 : b - val;
288 Value = RGB(r, g, b);
295 (
static_cast<int>(
Red()) +
static_cast<int>(other.
Red())) / 2,
296 (
static_cast<int>(
Green()) +
static_cast<int>(other.
Green())) / 2,
297 (
static_cast<int>(
Blue()) +
static_cast<int>(other.
Blue())) / 2);
308 if (minval >
Green())
310 if (maxval <
Green())
318 float mdiff = float(maxval) - float(minval);
319 float msum = float(maxval) + float(minval);
321 float luminance = msum / 510.0f;
322 float saturation = 0.0f;
325 if (maxval != minval)
327 float rnorm = (maxval -
Red()) / mdiff;
328 float gnorm = (maxval -
Green()) / mdiff;
329 float bnorm = (maxval -
Blue()) / mdiff;
331 saturation = (luminance <= 0.5f) ? (mdiff / msum) : (mdiff / (510.0f - msum));
334 hue = 60.0f * (6.0f + bnorm - gnorm);
336 if (
Green() == maxval)
337 hue = 60.0f * (2.0f + rnorm - bnorm);
339 if (
Blue() == maxval)
340 hue = 60.0f * (4.0f + gnorm - rnorm);
346 return HLS ((hue * 255) / 360, luminance * 255, saturation * 255);
350_ToRgb(
float rm1,
float rm2,
float rh)
358 rm1 = rm1 + (rm2 - rm1) * rh / 60.0f;
359 else if (rh < 180.0f)
361 else if (rh < 240.0f)
362 rm1 = rm1 + (rm2 - rm1) * (240.0f - rh) / 60.0f;
364 return (BYTE)(rm1 * 255);
370 float hue = ((int)
HLS_H(hls)*360)/255.0f;
371 float luminance =
HLS_L(hls)/255.0f;
372 float saturation =
HLS_S(hls)/255.0f;
374 if (saturation == 0.0f)
382 if (luminance <= 0.5f)
383 rm2 = luminance + luminance * saturation;
385 rm2 = luminance + saturation - luminance * saturation;
387 rm1 = 2.0f * luminance - rm2;
388 BYTE red = _ToRgb(rm1, rm2, hue + 120.0f);
389 BYTE green = _ToRgb(rm1, rm2, hue);
390 BYTE blue = _ToRgb(rm1, rm2, hue - 120.0f);
405 l = BYTE(l + ((255 - l) * percent_L) / 100);
407 else if (percent_L < 0)
409 l = BYTE((l * (100 + percent_L)) / 100);
414 s = BYTE(s + ((255 - s) * percent_S) / 100);
416 else if (percent_S < 0)
418 s = BYTE((s * (100 + percent_S)) / 100);
static const TColor SysGrayText
The symbolic system color value for grayed (disabled) text.
COLORREF GetValue() const
Get a 32bit COLORREF type from this color object.
static const TColor LtBlue
Static TColor object with fixed Value set by RGB(0, 0, 255).
void Hls2Rgb(HLSCOLOR hls)
static const TColor SysInfoBk
The symbolic system color value for the background of tooltip controls.
static const TColor SysMenuText
The symbolic system color value for the text shown on menus.
static const TColor SysHighlightText
The symbolic system color value for text selected in a control.
static const TColor LtMagenta
Static TColor object with fixed Value set by RGB(255, 0, 255).
static const TColor SysBtnText
The symbolic system color value for the text on buttons.
static const TColor Transparent
a non-painting color
static const TColor SysHighlight
The symbolic system color value for items selected in a control.
static const TColor SysActiveCaption
The symbolic system color value for the caption of the active window.
static const TColor Sys3dHilight
The symbolic system color value for highlighted 3-dimensional display elements (for edges facing the ...
static const TColor SysCaptionText
The symbolic system color value for text in captions and size boxes, and for the arrow boxes on scrol...
static const TColor None
not-a-color
static const TColor SysActiveBorder
The symbolic system color value for the borders of the active window.
static const TColor LtCyan
Static TColor object with fixed Value set by RGB(0, 255, 255).
static const TColor SysDesktop
The symbolic system color value for the desktop.
static const TColor Sys3dDkShadow
The symbolic system color value for dark shadow regions of 3-dimensional display elements.
static const TColor SysInactiveCaption
The symbolic system color value for the caption background of every inactive window.
static const TColor SysInactiveCaptionText
The symbolic system color value for the caption text of every inactive window.
int Index() const
Return the index of the palette entry.
static const TColor SysWindowFrame
The symbolic system color value for the frame around each window.
void SetValue(const COLORREF &value)
Change the color after it has been constructed.
uint8 Blue() const
Return the color's blue component.
static const TColor SysScrollbar
The symbolic system color value for what is usually the gray area of scrollbars.
TColor()
Construct a null color.
void Merge(const TColor &other)
static const TColor LtYellow
Static TColor object with fixed Value set by RGB(255, 255, 0).
static const TColor SysInfoText
The symbolic system color value for text shown on tooltip controls.
bool IsSysColor() const
Return true if the color is a system color.
static const TColor LtGray
Static TColor object with fixed Value set by RGB(192, 192, 192).
static const TColor SysWindowText
The symbolic system color value for text in every window.
static const TColor Sys3dShadow
The symbolic system color value for the shadow regions of 3-dimensional display elements (for edges f...
static const TColor SysAppWorkspace
The symbolic system color value for the background of multiple document interface (MDI) applications.
void HlsTransform(int percent_L, int percent_S)
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
static const TColor LtGreen
Static TColor object with fixed Value set by RGB(0, 255, 0).
static const TColor SysMenu
The symbolic system color value for the background of menus.
static const TColor SysInactiveBorder
The symbolic system color value for the borders of every inactive window.
static const TColor Gray
Static TColor object with fixed Value set by RGB(128, 128, 128).
static const TColor Sys3dLight
The symbolic system color value for the light color for 3-dimensional display elements (for edges fac...
uint8 Red() const
Return the color's red component.
static const TColor White
Static TColor object with fixed Value set by RGB(255, 255, 255).
static const TColor SysWindow
The symbolic system color value for the background of each window.
static const TColor LtRed
Static TColor object with fixed Value set by RGB(255, 0, 0).
uint8 Green() const
Return the color's green component.
static const TColor Black
Static TColor object with fixed Value set by RGB(0, 0, 0).
Definition of windowing system color classes.
Object Windows Library (OWLNext Core).
COLORREF MkRGB(uint r, uint g, uint b)
long NColors(uint16 bitCount)
Functions to convert number of bits to number of palette colors and back, and build an RGB COLORREF.
uint16 NBits(long colors)
Return the number of bits required to represent a given number of colors.
General definitions used by all ObjectWindows programs.
Definition of TSystem, a system information provider class.