Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
5984cc83
Kaydet (Commit)
5984cc83
authored
May 07, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add ability to change tint/shade of a color.
Change-Id: I6933393732d23fe9386cb8b768676887c026bd39
üst
6719b36a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
color.hxx
include/tools/color.hxx
+10
-0
color.cxx
tools/source/generic/color.cxx
+30
-0
No files found.
include/tools/color.hxx
Dosyayı görüntüle @
5984cc83
...
...
@@ -161,6 +161,16 @@ public:
void
IncreaseLuminance
(
sal_uInt8
cLumInc
);
void
DecreaseLuminance
(
sal_uInt8
cLumDec
);
/**
* 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.
**/
void
ApplyTintOrShade
(
sal_Int16
n100thPercent
);
void
DecreaseContrast
(
sal_uInt8
cContDec
);
void
Invert
();
...
...
tools/source/generic/color.cxx
Dosyayı görüntüle @
5984cc83
...
...
@@ -29,6 +29,8 @@
#include <tools/rcid.h>
#include <tools/resid.hxx>
#include <tools/rc.h>
#include <tools/helpers.hxx>
#include <basegfx/color/bcolortools.hxx>
static
inline
long
_FRound
(
double
fVal
)
{
...
...
@@ -113,6 +115,34 @@ bool Color::IsBright() const
return
GetLuminance
()
>=
245
;
}
void
Color
::
ApplyTintOrShade
(
sal_Int16
n100thPercent
)
{
if
(
n100thPercent
>
0
)
{
basegfx
::
BColor
aBColor
=
basegfx
::
tools
::
rgb2hsl
(
getBColor
());
double
fFactor
=
std
::
abs
(
n100thPercent
)
/
10000.0
;
aBColor
.
setBlue
(
aBColor
.
getBlue
()
*
fFactor
+
(
100.0
-
aBColor
.
getBlue
()));
aBColor
=
basegfx
::
tools
::
hsl2rgb
(
aBColor
);
SetRed
(
sal_uInt8
((
aBColor
.
getRed
()
*
255.0
)
+
0.5
));
SetGreen
(
sal_uInt8
((
aBColor
.
getGreen
()
*
255.0
)
+
0.5
));
SetBlue
(
sal_uInt8
((
aBColor
.
getBlue
()
*
255.0
)
+
0.5
));
}
else
if
(
n100thPercent
<
0
)
{
basegfx
::
BColor
aBColor
=
basegfx
::
tools
::
rgb2hsl
(
getBColor
());
double
fFactor
=
std
::
abs
(
n100thPercent
)
/
10000.0
;
aBColor
.
setBlue
(
aBColor
.
getBlue
()
*
fFactor
);
aBColor
=
basegfx
::
tools
::
hsl2rgb
(
aBColor
);
SetRed
(
sal_uInt8
((
aBColor
.
getRed
()
*
255.0
)
+
0.5
));
SetGreen
(
sal_uInt8
((
aBColor
.
getGreen
()
*
255.0
)
+
0.5
));
SetBlue
(
sal_uInt8
((
aBColor
.
getBlue
()
*
255.0
)
+
0.5
));
}
}
// color space conversion
void
Color
::
RGBtoHSB
(
sal_uInt16
&
nHue
,
sal_uInt16
&
nSat
,
sal_uInt16
&
nBri
)
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment