Add wxColour::GetLuminance()

This method can be used to return the perceived brightness of the
colour.

Closes https://github.com/wxWidgets/wxWidgets/pull/1300
This commit is contained in:
Vadim Zeitlin
2019-04-18 18:52:50 +02:00
parent b6477e0b9c
commit d662a2223e
4 changed files with 29 additions and 0 deletions

View File

@@ -158,6 +158,19 @@ public:
wxUint32 GetRGBA() const;
//@}
/**
Return the perceived brightness of the colour.
This value is computed using the simple @code 0.299*R + 0.587*G +
0.114*B @endcode formula with the coefficients taken from the RGB to
YIQ conversion formula and @c R, @c G and @c B being the values of the
corresponding colour channels normalized to 0..1 range, so that the
return value is 0 for black and 1 for white.
@since 3.1.3
*/
double GetLuminance() const;
/**
Returns a pixel value which is platform-dependent.
On Windows, a COLORREF is returned.