summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2014-04-18 20:46:34 +0200
committerLuboš Luňák <l.lunak@collabora.com>2014-04-18 20:53:01 +0200
commit1139d618b8bc6ab823a96184bd0f0257980aad24 (patch)
tree763931577dbadbc3e6853950a3df099b1f69a4f4 /include/vcl
parent8afabd394214bb7c772c88b08ec3cadb56771cce (diff)
handle strange brightness+contrast adjustment from msoffice (fdo#38410)
LO uses basically the formula "newpixel=(oldpixel-128)*contrast+128+brightness", i.e. contrast is applied first. It looks like there's no "oficial" formula for this, so a formula that applies brightness first would be ok too. MSO for some weird reason apparently uses a formula that applies half of brightness before contrast and half afterwards (insert funny political correctness or compromise joke here). While the result is the same like with the LO formula if only either brightness or contrast is adjusted, the result is different if both are involved. Just modify the image using the MSO algorithm if this is the case. Change-Id: I55fe8f395832685b90f024cf2f58b0797c1ba588
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/bitmap.hxx6
-rw-r--r--include/vcl/bitmapex.hxx6
-rw-r--r--include/vcl/gdimtf.hxx2
3 files changed, 11 insertions, 3 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 9485a5a22b54..222cffae31b0 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -778,6 +778,9 @@ public:
@param bInvert
If true, invert the channel values with the logical 'not' operator
+ @param msoBrightness
+ Use the same formula for brightness as used by MSOffice.
+
@return true, if the operation was completed successfully.
*/
bool Adjust( short nLuminancePercent = 0,
@@ -786,7 +789,8 @@ public:
short nChannelGPercent = 0,
short nChannelBPercent = 0,
double fGamma = 1.0,
- bool bInvert = false );
+ bool bInvert = false,
+ bool msoBrightness = false );
/** Apply specified filter to the bitmap
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 5fa7c81e7f3b..5571ee41ca5f 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -348,6 +348,9 @@ public:
@param bInvert
If true, invert the channel values with the logical 'not' operator
+ @param msoFormula
+ Use the same formula for brightness as used by MSOffice.
+
@return true, if the operation was completed successfully.
*/
bool Adjust( short nLuminancePercent = 0,
@@ -356,7 +359,8 @@ public:
short nChannelGPercent = 0,
short nChannelBPercent = 0,
double fGamma = 1.0,
- bool bInvert = false );
+ bool bInvert = false,
+ bool msoBrightness = false );
/** Apply specified filter to the bitmap
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 0e22e9853320..4d863aa548b3 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -150,7 +150,7 @@ public:
void Adjust( short nLuminancePercent = 0, short nContrastPercent = 0,
short nChannelRPercent = 0, short nChannelGPercent = 0,
short nChannelBPercent = 0, double fGamma = 1.0,
- bool bInvert = false
+ bool bInvert = false, bool msoBrightness = false
);
void Convert( MtfConversion eConversion );