Kaydet (Commit) 2afdea17 authored tarafından Bartosz Kosiorek's avatar Bartosz Kosiorek

tdf#114738 Add support for transparency for EMF+ records

With current EMF+ implementation all filled figures,
does not support transparency.
This patch add transparency support for following EMF+ records:
- DrawDriverString
- DrawString
- FillEllipse
- FillRects
- FillPolygon
- FillPie
- FillPath
- FillRegion

Change-Id: I1e59ea90bdf5fafc07ff9417fccace44872bbecd
Reviewed-on: https://gerrit.libreoffice.org/50609Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarBartosz Kosiorek <gang65@poczta.onet.pl>
üst 8a15416e
......@@ -237,10 +237,10 @@ namespace emfplushelper
// primitive creators
void EMFPPlusDrawPolygon(const ::basegfx::B2DPolyPolygon& polygon, sal_uInt32 penIndex);
void EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon& polygon, bool isColor, sal_uInt32 brushIndexOrColor);
void EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon& polygon, const bool isColor, const sal_uInt32 brushIndexOrColor);
// helper functions
::basegfx::BColor EMFPGetBrushColorOrARGBColor(sal_uInt16 flags, sal_uInt32 brushIndexOrColor) const;
Color EMFPGetBrushColorOrARGBColor(const sal_uInt16 flags, const sal_uInt32 brushIndexOrColor) const;
public:
EmfPlusHelperData(
......
......@@ -39,6 +39,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testWorking();
void TestDrawString();
void TestDrawStringTransparent();
void TestDrawLine();
Primitive2DSequence parseEmf(const OUString& aSource);
......@@ -47,6 +48,7 @@ public:
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testWorking);
CPPUNIT_TEST(TestDrawString);
CPPUNIT_TEST(TestDrawStringTransparent);
CPPUNIT_TEST(TestDrawLine);
CPPUNIT_TEST_SUITE_END();
};
......@@ -112,6 +114,30 @@ void Test::TestDrawString()
assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "familyname", "CALIBRI");
}
void Test::TestDrawStringTransparent()
{
// This unit checks for a correct import of an EMF+ file with one DrawString Record with transparency
// first, get the sequence of primitives and dump it
Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
Primitive2dXmlDump dumper;
xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
CPPUNIT_ASSERT (pDocument);
//TODO Strange that transparency is set to 0 even if it is not fully transparent
// check correct import of the DrawString: transparency, height, position, text, color and font
assertXPath(pDocument, "/primitive2D/metafile/transform/unifiedtransparence", "transparence", "0");
//TODO Where was textsimpleportion gone?
//assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "height", "276");
//assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "x", "25");
//assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "y", "323");
//assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "text", "Transparent Text");
//assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "fontcolor", "#000000");
//assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "familyname", "CALIBRI");
}
void Test::TestDrawLine()
{
// This unit checks for a correct import of an EMF+ file with only one DrawLine Record
......
......@@ -18,8 +18,6 @@
*/
#include <svganode.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
namespace svgio
{
......
......@@ -18,8 +18,6 @@
*/
#include <svggnode.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
namespace svgio
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment