[Libreoffice-commits] core.git: drawinglayer/Library_drawinglayer.mk drawinglayer/source

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 6 08:21:21 UTC 2019


 drawinglayer/Library_drawinglayer.mk              |    1 
 drawinglayer/source/tools/emfphelperdata.cxx      |    5 +
 drawinglayer/source/tools/emfpimageattributes.cxx |   74 ++++++++++++++++++++++
 drawinglayer/source/tools/emfpimageattributes.hxx |   37 +++++++++++
 4 files changed, 116 insertions(+), 1 deletion(-)

New commits:
commit 95c6d45800347609fd8ef70365d888df763dbc18
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Mon Nov 18 05:04:14 2019 +1100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Dec 6 09:19:54 2019 +0100

    drawinglayer: add EMFPImageAttributes
    
    This is used by EmfPlusDrawImage and EmfPlusDrawImagePoints, basically
    these reference the object via the ImageAttributesID.
    
    Change-Id: I7fd852e7e419c9ef622bb0122fdccd66cb814cd2
    Reviewed-on: https://gerrit.libreoffice.org/83031
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 63f52c27fb09..189959e51017 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -169,6 +169,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/tools/emfppen \
     drawinglayer/source/tools/emfpregion \
     drawinglayer/source/tools/emfpimage \
+    drawinglayer/source/tools/emfpimageattributes \
     drawinglayer/source/tools/emfpfont \
     drawinglayer/source/tools/emfpstringformat \
     drawinglayer/source/tools/emfpcustomlinecap \
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 647347dab194..a0bcf61592fe 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -24,6 +24,7 @@
 #include "emfppath.hxx"
 #include "emfpregion.hxx"
 #include "emfpimage.hxx"
+#include "emfpimageattributes.hxx"
 #include "emfpfont.hxx"
 #include "emfpstringformat.hxx"
 #include <basegfx/curve/b2dcubicbezier.hxx>
@@ -216,7 +217,9 @@ namespace emfplushelper
             }
             case EmfPlusObjectTypeImageAttributes:
             {
-                SAL_WARN("drawinglayer", "EMF+\t TODO Object type 'image attributes' not yet implemented");
+                EMFPImageAttributes *imageAttributes = new EMFPImageAttributes();
+                maEMFPObjects[index].reset(imageAttributes);
+                imageAttributes->Read(rObjectStream);
                 break;
             }
             case EmfPlusObjectTypeCustomLineCap:
diff --git a/drawinglayer/source/tools/emfpimageattributes.cxx b/drawinglayer/source/tools/emfpimageattributes.cxx
new file mode 100644
index 000000000000..8508172fe6a5
--- /dev/null
+++ b/drawinglayer/source/tools/emfpimageattributes.cxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/log.hxx>
+
+#include "emfpimageattributes.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::basegfx;
+
+namespace emfplushelper
+{
+EMFPImageAttributes::EMFPImageAttributes()
+    : EMFPObject()
+    , wrapMode(0)
+    , clampColor(Color())
+    , objectClamp(0)
+{
+}
+
+EMFPImageAttributes::~EMFPImageAttributes() {}
+
+void EMFPImageAttributes::Read(SvStream& s)
+{
+    sal_uInt32 graphicsVersion, reserved1, reserved2, tempClampColor;
+    sal_uInt8 clampColorBlue, clampColorGreen, clampColorRed, clampColorAlpha;
+
+    s.ReadUInt32(graphicsVersion)
+        .ReadUInt32(reserved1)
+        .ReadUInt32(wrapMode)
+        .ReadUInt32(tempClampColor)
+        .ReadUInt32(objectClamp)
+        .ReadUInt32(reserved2);
+
+    clampColorBlue = tempClampColor >> 24;
+    clampColorGreen = (tempClampColor & 0x00FFFFFF) >> 16;
+    clampColorRed = (tempClampColor & 0x0000FFFF) >> 8;
+    clampColorAlpha = tempClampColor & 0x000000FF;
+
+    clampColor.SetRed(clampColorRed);
+    clampColor.SetGreen(clampColorGreen);
+    clampColor.SetBlue(clampColorBlue);
+    clampColor.SetTransparency(clampColorAlpha);
+
+    SAL_INFO("drawinglayer", "EMF+\timage attributes");
+    SAL_WARN_IF((reserved1 != 0) || (reserved2 != 0), "drawinglayer",
+                "Reserved field(s) not zero - reserved1: " << std::hex << reserved1
+                                                           << " reserved2: " << reserved2);
+    SAL_WARN_IF((objectClamp != EmpPlusRectClamp) && (objectClamp != EmpPlusBitmapClamp),
+                "drawinglayer", "Invalid object clamp - set to" << std::hex << objectClamp);
+    SAL_INFO("drawinglayer", "EMF+\t image graphics version: 0x"
+                                 << std::hex << graphicsVersion << " wrap mode: " << wrapMode
+                                 << " clamp color: " << clampColor
+                                 << " object clamp: " << objectClamp);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/tools/emfpimageattributes.hxx b/drawinglayer/source/tools/emfpimageattributes.hxx
new file mode 100644
index 000000000000..0ac76938c9e7
--- /dev/null
+++ b/drawinglayer/source/tools/emfpimageattributes.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPIMAGEATTRIBUTES_HXX
+#define INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPIMAGEATTRIBUTES_HXX
+
+#include "emfphelperdata.hxx"
+#include <vector>
+
+namespace emfplushelper
+{
+const sal_uInt32 EmpPlusRectClamp = 0x00000000;
+const sal_uInt32 EmpPlusBitmapClamp = 0x00000001;
+
+struct EMFPImageAttributes : public EMFPObject
+{
+    sal_uInt32 wrapMode;
+    Color clampColor;
+    sal_uInt32 objectClamp;
+
+    EMFPImageAttributes();
+
+    virtual ~EMFPImageAttributes() override;
+
+    void Read(SvStream& s);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list