summaryrefslogtreecommitdiff
path: root/include
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 21:53:11 +0200
commitb5fd2f9ff7c869065d424aa3b0632549480eb5b6 (patch)
tree20ac65ad6072178c0b7ca6fc91bbb79f7e36c7e4 /include
parent3750025d3290fd4db6b18dcc33c9c077b05af524 (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. Conflicts: filter/source/msfilter/msdffimp.cxx include/vcl/bitmap.hxx include/vcl/bitmapex.hxx include/vcl/gdimtf.hxx vcl/source/gdi/bitmap3.cxx vcl/source/gdi/bitmapex.cxx vcl/source/gdi/gdimtf.cxx Change-Id: I55fe8f395832685b90f024cf2f58b0797c1ba588
Diffstat (limited to 'include')
-rw-r--r--include/vcl/bitmap.hxx6
-rw-r--r--include/vcl/bitmapex.hxx7
-rw-r--r--include/vcl/gdimtf.hxx2
3 files changed, 12 insertions, 3 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index d555d04e0c1c..4759937e915a 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -796,6 +796,9 @@ public:
If sal_True, invert the channel values with the logical 'not' operator
@return sal_True, if the operation was completed successfully.
+
+ @param msoBrightness
+ Use the same formula for brightness as used by MSOffice.
*/
sal_Bool Adjust( short nLuminancePercent = 0,
short nContrastPercent = 0,
@@ -803,7 +806,8 @@ public:
short nChannelGPercent = 0,
short nChannelBPercent = 0,
double fGamma = 1.0,
- sal_Bool bInvert = sal_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 00a3c4e83886..b63c9d5f94d3 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -344,6 +344,10 @@ public:
If sal_True, invert the channel values with the logical 'not' operator
@return sal_True, if the operation was completed successfully.
+
+ @param msoFormula
+ Use the same formula for brightness as used by MSOffice.
+
*/
sal_Bool Adjust( short nLuminancePercent = 0,
short nContrastPercent = 0,
@@ -351,7 +355,8 @@ public:
short nChannelGPercent = 0,
short nChannelBPercent = 0,
double fGamma = 1.0,
- sal_Bool bInvert = sal_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 c790acdd7c43..6865001c2ca7 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,
- sal_Bool bInvert = sal_False
+ bool bInvert = false, bool msoBrightness = false
);
void Convert( MtfConversion eConversion );