LibreOffice Module tools (master) 1
|
#include <color.hxx>
Public Member Functions | |
constexpr | Color () |
constexpr | Color (const sal_uInt32 nColor) |
constexpr | Color (enum ColorTransparencyTag, sal_uInt32 nColor) |
constexpr | Color (enum ColorAlphaTag, sal_uInt32 nColor) |
constexpr | Color (enum ColorTransparencyTag, sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue) |
constexpr | Color (enum ColorAlphaTag, sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue) |
constexpr | Color (sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue) |
Color (const basegfx::BColor &rBColor) | |
constexpr | operator sal_uInt32 () const |
Casts the color to corresponding uInt32. More... | |
constexpr | operator sal_Int32 () const |
Casts the color to corresponding iInt32. More... | |
sal_uInt8 | GetRed () const |
Gets the red value. More... | |
sal_uInt8 | GetGreen () const |
Gets the green value. More... | |
sal_uInt8 | GetBlue () const |
Gets the blue value. More... | |
sal_uInt8 | GetAlpha () const |
Gets the alpha value. More... | |
bool | IsTransparent () const |
Is the color transparent? More... | |
bool | IsFullyTransparent () const |
Is the color fully transparent i.e. More... | |
void | SetRed (sal_uInt8 nRed) |
Sets the red value. More... | |
void | SetGreen (sal_uInt8 nGreen) |
Sets the green value. More... | |
void | SetBlue (sal_uInt8 nBlue) |
Sets the blue value. More... | |
void | SetAlpha (sal_uInt8 nAlpha) |
Sets the alpha value. More... | |
Color | GetRGBColor () const |
Returns the same color but ignoring the transparency value. More... | |
bool | IsRGBEqual (const Color &rColor) const |
Check if the color RGB value is equal than rColor. More... | |
bool | operator< (const Color &aCompareColor) const |
Check if the color value is lower than aCompareColor. More... | |
bool | operator> (const Color &aCompareColor) const |
Check if the color value is greater than aCompareColor. More... | |
bool | operator== (const Color &rColor) const |
Check if the color value is equal than rColor. More... | |
bool | operator!= (const Color &rColor) const |
Check if the color value is unequal than rColor. More... | |
sal_uInt16 | GetColorError (const Color &rCompareColor) const |
Gets the color error compared to another. More... | |
sal_uInt8 | GetLuminance () const |
Gets the color luminance. More... | |
void | IncreaseLuminance (sal_uInt8 cLumInc) |
Increases the color luminance by cLumInc. More... | |
void | DecreaseLuminance (sal_uInt8 cLumDec) |
Decreases the color luminance by cLumDec. More... | |
void | DecreaseContrast (sal_uInt8 cContDec) |
Decreases color contrast with white by cContDec. More... | |
bool | IsDark () const |
Comparison with luminance thresholds. More... | |
bool | IsBright () const |
Comparison with luminance thresholds. More... | |
void | ApplyTintOrShade (sal_Int16 n100thPercent) |
Apply tint or shade to a color. More... | |
void | ApplyLumModOff (sal_Int16 nMod, sal_Int16 nOff) |
Apply luminance offset and/or modulation. More... | |
void | Invert () |
Inverts color. More... | |
void | Merge (const Color &rMergeColor, sal_uInt8 cTransparency) |
Merges color with rMergeColor. More... | |
void | RGBtoHSB (sal_uInt16 &nHue, sal_uInt16 &nSaturation, sal_uInt16 &nBrightness) const |
Color space conversion tools. More... | |
OUString | AsRGBHexString () const |
OUString | AsRGBHEXString () const |
basegfx::BColor | getBColor () const |
Static Public Member Functions | |
static Color | HSBtoRGB (sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness) |
Color space conversion tools The range for h/s/b is: More... | |
static Color | STRtoRGB (std::u16string_view colorname) |
Converts a string into a color. More... | |
Private Attributes | |
union { | |
sal_uInt32 mValue | |
struct { | |
sal_uInt8 B | |
sal_uInt8 G | |
sal_uInt8 R | |
sal_uInt8 T | |
} | |
}; | |
|
inlineconstexpr |
Definition at line 72 of file color.hxx.
Referenced by HSBtoRGB().
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineexplicit |
Definition at line 110 of file color.hxx.
References getBlue(), getGreen(), and getRed().
void Color::ApplyLumModOff | ( | sal_Int16 | nMod, |
sal_Int16 | nOff | ||
) |
Apply luminance offset and/or modulation.
The input values are in percentages (in 100th percents). 100% modulation and 0% offset results in no change.
Definition at line 234 of file color.cxx.
References B, G, getBColor(), basegfx::BColor::getBlue(), basegfx::BColor::getGreen(), basegfx::BColor::getRed(), basegfx::utils::hsl2rgb(), R, basegfx::utils::rgb2hsl(), basegfx::BColor::setBlue(), and basegfx::BColor::setGreen().
void Color::ApplyTintOrShade | ( | sal_Int16 | n100thPercent | ) |
Apply tint or shade to a color.
The input value is the percentage (in 100th of percent) of how much the color changes towards the black (shade) or white (tint). If the value is positive, the color is tinted, if the value is negative, the color is shaded.
Definition at line 208 of file color.cxx.
References abs(), B, G, getBColor(), basegfx::BColor::getBlue(), basegfx::BColor::getGreen(), basegfx::BColor::getRed(), basegfx::utils::hsl2rgb(), R, basegfx::utils::rgb2hsl(), and basegfx::BColor::setBlue().
OUString Color::AsRGBHexString | ( | ) | const |
Definition at line 194 of file color.cxx.
References GetRGBColor().
OUString Color::AsRGBHEXString | ( | ) | const |
Definition at line 201 of file color.cxx.
References GetRGBColor().
void Color::DecreaseContrast | ( | sal_uInt8 | cContDec | ) |
void Color::DecreaseLuminance | ( | sal_uInt8 | cLumDec | ) |
|
inline |
|
inline |
Definition at line 418 of file color.hxx.
Referenced by ApplyLumModOff(), and ApplyTintOrShade().
|
inline |
Gets the blue value.
Definition at line 156 of file color.hxx.
References B.
Referenced by GetColorError(), and tools::GenericTypeSerializer::writeColor().
|
inline |
|
inline |
Gets the green value.
Definition at line 148 of file color.hxx.
References G.
Referenced by GetColorError(), and tools::GenericTypeSerializer::writeColor().
|
inline |
|
inline |
Gets the red value.
Definition at line 140 of file color.hxx.
References R.
Referenced by GetColorError(), and tools::GenericTypeSerializer::writeColor().
|
inline |
Returns the same color but ignoring the transparency value.
Definition at line 218 of file color.hxx.
Referenced by AsRGBHexString(), and AsRGBHEXString().
|
static |
void Color::IncreaseLuminance | ( | sal_uInt8 | cLumInc | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
|
inline |
|
inline |
|
inline |
|
inline |
void Color::RGBtoHSB | ( | sal_uInt16 & | nHue, |
sal_uInt16 & | nSaturation, | ||
sal_uInt16 & | nBrightness | ||
) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
union { ... } Color::@4 |
sal_uInt8 Color::B |
Definition at line 63 of file color.hxx.
Referenced by ApplyLumModOff(), ApplyTintOrShade(), DecreaseContrast(), DecreaseLuminance(), IncreaseLuminance(), Merge(), and RGBtoHSB().
sal_uInt8 Color::G |
Definition at line 64 of file color.hxx.
Referenced by ApplyLumModOff(), ApplyTintOrShade(), DecreaseContrast(), DecreaseLuminance(), IncreaseLuminance(), Merge(), and RGBtoHSB().
sal_uInt32 Color::mValue |
Definition at line 54 of file color.hxx.
Referenced by IsRGBEqual(), operator!=(), operator<(), operator==(), and operator>().
sal_uInt8 Color::R |
Definition at line 65 of file color.hxx.
Referenced by ApplyLumModOff(), ApplyTintOrShade(), DecreaseContrast(), DecreaseLuminance(), IncreaseLuminance(), Merge(), and RGBtoHSB().