Add a more convenient wxColour::MakeDisabled() overload.
Allow creating a disabled version of the colour without having to manually break it into RGB components and then recreating it from them. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -167,6 +167,7 @@ public:
|
|||||||
static void ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, int ialpha);
|
static void ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, int ialpha);
|
||||||
|
|
||||||
wxColour ChangeLightness(int ialpha) const;
|
wxColour ChangeLightness(int ialpha) const;
|
||||||
|
wxColour& MakeDisabled(unsigned char brightness = 255);
|
||||||
|
|
||||||
// old, deprecated
|
// old, deprecated
|
||||||
// ---------------
|
// ---------------
|
||||||
|
@@ -236,6 +236,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char brightness = 255);
|
static void MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char brightness = 255);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make a disabled version of this colour.
|
||||||
|
|
||||||
|
This method modifies the object in place and returns the object itself.
|
||||||
|
|
||||||
|
@since 2.9.5
|
||||||
|
*/
|
||||||
|
wxColour& MakeDisabled(unsigned char brightness = 255);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a grey colour from (in/out) rgb parameters using integer arithmetic.
|
Create a grey colour from (in/out) rgb parameters using integer arithmetic.
|
||||||
@since 2.9.0
|
@since 2.9.0
|
||||||
|
@@ -273,6 +273,16 @@ void wxColourBase::MakeDisabled(unsigned char* r, unsigned char* g, unsigned cha
|
|||||||
*b = AlphaBlend(*b, brightness, 0.4);
|
*b = AlphaBlend(*b, brightness, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxColour& wxColourBase::MakeDisabled(unsigned char brightness)
|
||||||
|
{
|
||||||
|
unsigned char r = Red(),
|
||||||
|
g = Green(),
|
||||||
|
b = Blue();
|
||||||
|
MakeDisabled(&r, &g, &b, brightness);
|
||||||
|
Set(r, g, b, Alpha());
|
||||||
|
return static_cast<wxColour&>(*this);
|
||||||
|
}
|
||||||
|
|
||||||
// AlphaBlend is used by ChangeLightness and MakeDisabled
|
// AlphaBlend is used by ChangeLightness and MakeDisabled
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
Reference in New Issue
Block a user