[Libreoffice-commits] libmspub.git: src/lib
Franz Schmid
franz at linux-hp-i7.site
Thu May 9 12:32:20 PDT 2013
src/lib/EscherFieldIds.h | 2 ++
src/lib/MSPUBCollector.cpp | 16 ++++++++++++++++
src/lib/MSPUBCollector.h | 2 ++
src/lib/MSPUBParser.cpp | 10 ++++++++++
src/lib/ShapeInfo.h | 4 +++-
5 files changed, 33 insertions(+), 1 deletion(-)
New commits:
commit c58756ed453281af92970b88ab1b8ee9432b56b2
Author: Franz Schmid <franz at linux-hp-i7.site>
Date: Thu May 9 20:42:32 2013 +0200
Brightness patch, better implementation
diff --git a/src/lib/EscherFieldIds.h b/src/lib/EscherFieldIds.h
index 7b3ff22..5dd354a 100644
--- a/src/lib/EscherFieldIds.h
+++ b/src/lib/EscherFieldIds.h
@@ -93,6 +93,8 @@
#define FIELDID_END_ARROW_STYLE 0x01D1
#define FIELDID_END_ARROW_WIDTH 0x01D4
#define FIELDID_END_ARROW_HEIGHT 0x01D5
+#define FIELDID_PICTURE_CONTRAST 0x0108
+#define FIELDID_PICTURE_BRIGHTNESS 0x0109
#define FIELDID_PICTURE_RECOLOR 0x011A
#define FIELDID_SHADOW_TYPE 0x0200
#define FIELDID_SHADOW_COLOR 0x0201
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index a23c713..b863b50 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -55,6 +55,18 @@ void libmspub::MSPUBCollector::setShapePictureRecolor(unsigned seqNum,
m_shapeInfosBySeqNum[seqNum].m_pictureRecolor = recolor;
}
+void libmspub::MSPUBCollector::setShapePictureBrightness(unsigned seqNum,
+ int brightness)
+{
+ m_shapeInfosBySeqNum[seqNum].m_pictureBrightness = brightness;
+}
+
+void libmspub::MSPUBCollector::setShapePictureContrast(unsigned seqNum,
+ int contrast)
+{
+ m_shapeInfosBySeqNum[seqNum].m_pictureContrast = contrast;
+}
+
void libmspub::MSPUBCollector::setShapeBeginArrow(unsigned seqNum,
const Arrow &arrow)
{
@@ -471,6 +483,8 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
graphicsProps.insert("draw:green",
static_cast<double>(obc.g) / 255.0, WPX_PERCENT);
}
+ if (!!info.m_pictureBrightness)
+ graphicsProps.insert("draw:luminance", static_cast<double>(info.m_pictureBrightness.get() + 32768.0) / 65536.0, WPX_PERCENT);
bool shadowPropsInserted = false;
if (!!info.m_shadow)
{
@@ -503,6 +517,8 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
graphicsProps.remove("draw:blue");
graphicsProps.remove("draw:green");
}
+ if (!!info.m_pictureBrightness)
+ graphicsProps.remove("draw:luminance");
if (shadowPropsInserted)
{
graphicsProps.remove("draw:shadow");
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index fd8fd3e..56bf28d 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -90,6 +90,8 @@ public:
void setShapeType(unsigned seqNum, ShapeType type);
void setShapeCropType(unsigned seqNum, ShapeType cropType);
void setShapePictureRecolor(unsigned seqNum, const ColorReference &recolor);
+ void setShapePictureBrightness(unsigned seqNum, int brightness);
+ void setShapePictureContrast(unsigned seqNum, int contrast);
void setShapeTableInfo(unsigned seqNum, const TableInfo &ti);
void setShapeBorderImageId(unsigned seqNum, unsigned borderImageId);
void setShapeCoordinatesInEmu(unsigned seqNum, int xs, int ys, int xe, int ye);
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index c23fe71..6404db8 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1543,6 +1543,16 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
{
MSPUB_DEBUG_MSG(("Couldn't find corresponding escherDelay index\n"));
}
+ unsigned *ptr_pictureBrightness = getIfExists(foptValues.m_scalarValues, FIELDID_PICTURE_BRIGHTNESS);
+ if (ptr_pictureBrightness)
+ {
+ m_collector->setShapePictureBrightness(*shapeSeqNum, (int)(*ptr_pictureBrightness));
+ }
+ unsigned *ptr_pictureContrast = getIfExists(foptValues.m_scalarValues, FIELDID_PICTURE_CONTRAST);
+ if (ptr_pictureContrast)
+ {
+ m_collector->setShapePictureContrast(*shapeSeqNum, (int)(*ptr_pictureContrast));
+ }
}
unsigned *ptr_lineBackColor =
getIfExists(foptValues.m_scalarValues, FIELDID_LINE_BACK_COLOR);
diff --git a/src/lib/ShapeInfo.h b/src/lib/ShapeInfo.h
index 1604ee5..1afe020 100644
--- a/src/lib/ShapeInfo.h
+++ b/src/lib/ShapeInfo.h
@@ -81,6 +81,8 @@ struct ShapeInfo
boost::optional<Shadow> m_shadow;
boost::optional<int> m_innerRotation;
std::vector<libmspub::Vertex> m_clipPath;
+ boost::optional<int> m_pictureBrightness;
+ boost::optional<int> m_pictureContrast;
ShapeInfo() : m_type(), m_cropType(), m_imgIndex(), m_borderImgIndex(),
m_coordinates(), m_lines(), m_pageSeqNum(),
m_textId(), m_adjustValuesByIndex(), m_adjustValues(),
@@ -89,7 +91,7 @@ struct ShapeInfo
m_lineBackColor(), m_dash(), m_tableInfo(),
m_tableCellTextEnds(), m_numColumns(),
m_columnSpacing(0), m_beginArrow(), m_endArrow(),
- m_verticalAlign(), m_pictureRecolor(), m_shadow(), m_innerRotation(), m_clipPath()
+ m_verticalAlign(), m_pictureRecolor(), m_shadow(), m_innerRotation(), m_clipPath(), m_pictureBrightness(), m_pictureContrast()
{
}
boost::shared_ptr<const CustomShape> getCustomShape() const
More information about the Libreoffice-commits
mailing list