51 const double fM = (128.0 - 0.4985 * nContDec) / 128.0;
52 const double fOff = 128.0 - fM * 128.0;
78 nBri = cMax * 100 / 255;
90 nSat = cDelta * 100 / cMax;
102 dHue =
static_cast<double>( c[1] - c[2] ) /
static_cast<double>(cDelta);
104 else if( c[1] == cMax )
106 dHue = 2.0 +
static_cast<double>( c[2] - c[0] ) /
static_cast<double>(cDelta);
108 else if ( c[2] == cMax )
110 dHue = 4.0 +
static_cast<double>( c[0] - c[1] ) /
static_cast<double>(cDelta);
117 nHue =
static_cast<sal_uInt16
>(dHue);
141 n =
static_cast<sal_uInt16
>(dH);
145 sal_uInt8 b =
static_cast<sal_uInt8>( nB * ( 100 - (
static_cast<double>(nSat) * f ) ) / 100 );
146 sal_uInt8 c =
static_cast<sal_uInt8>( nB * ( 100 - (
static_cast<double>(nSat) * ( 1.0 - f ) ) ) / 100 );
150 case 0: cR = nB; cG = c; cB =
a;
break;
151 case 1: cR = b; cG = nB; cB =
a;
break;
152 case 2: cR =
a; cG = nB; cB = c;
break;
153 case 3: cR =
a; cG = b; cB = nB;
break;
154 case 4: cR = c; cG =
a; cB = nB;
break;
155 case 5: cR = nB; cG =
a; cB = b;
break;
159 return Color( cR, cG, cB );
165 if(colorname.empty())
return col;
167 switch(colorname.size()){
176 sal_Unicode data[6] = { colorname[1], colorname[1], colorname[2],
177 colorname[2], colorname[3], colorname[3] };
183 sal_Unicode data[6] = { colorname[0], colorname[0], colorname[1],
184 colorname[1], colorname[2], colorname[2] };
196 std::stringstream ss;
197 ss << std::hex << std::setfill (
'0') << std::setw(6) << sal_uInt32(
GetRGBColor());
198 return OUString::createFromAscii(ss.str());
203 std::stringstream ss;
204 ss << std::hex << std::uppercase << std::setfill (
'0') << std::setw(6) << sal_uInt32(
GetRGBColor());
205 return OUString::createFromAscii(ss.str());
210 if (n100thPercent == 0)
214 double fFactor = 1.0 - (
std::abs(
double(n100thPercent)) / 10000.0);
217 if (n100thPercent > 0)
219 fResult = aBColor.
getBlue() * fFactor + (1.0 - fFactor);
223 fResult = aBColor.
getBlue() * fFactor;
236 if (nMod == 10000 && nOff == 0)
244 aBColor.
setBlue(std::clamp(aBColor.
getBlue() * nMod / 10000, 0.0, 1.0));
252 aBColor.
setBlue(std::clamp(aBColor.
getBlue() +
static_cast<double>(nOff) / 10000, 0.0, 1.0));
Color GetRGBColor() const
Returns the same color but ignoring the transparency value.
void DecreaseContrast(sal_uInt8 cContDec)
Decreases color contrast with white by cContDec.
OUString AsRGBHEXString() const
void DecreaseLuminance(sal_uInt8 cLumDec)
Decreases the color luminance by cLumDec.
void RGBtoHSB(sal_uInt16 &nHue, sal_uInt16 &nSaturation, sal_uInt16 &nBrightness) const
Color space conversion tools.
basegfx::BColor getBColor() const
static Color STRtoRGB(std::u16string_view colorname)
Converts a string into a color.
OUString AsRGBHexString() const
void IncreaseLuminance(sal_uInt8 cLumInc)
Increases the color luminance by cLumInc.
void ApplyTintOrShade(sal_Int16 n100thPercent)
Apply tint or shade to a color.
static Color HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness)
Color space conversion tools The range for h/s/b is:
void ApplyLumModOff(sal_Int16 nMod, sal_Int16 nOff)
Apply luminance offset and/or modulation.
void setBlue(double fNew)
void setGreen(double fNew)
Degree100 abs(Degree100 x)
tools::Long FRound(double fVal)
RttiCompleteObjectLocator col
BColor rgb2hsl(const BColor &rRGBColor)
BColor hsl2rgb(const BColor &rHSLColor)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)