Kaydet (Commit) 217ad59a authored tarafından Bartosz Kosiorek's avatar Bartosz Kosiorek Kaydeden (comit) Noel Grandin

tdf#111486 Removed not used EMF+ code

Change-Id: I708876fecab1bd6b0c37892efa9c4ab180457d6b
Reviewed-on: https://gerrit.libreoffice.org/64366
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 74e12819
......@@ -50,20 +50,11 @@ $(eval $(call gb_Library_use_libraries,cppcanvas,\
$(eval $(call gb_Library_add_exception_objects,cppcanvas,\
cppcanvas/source/mtfrenderer/bitmapaction \
cppcanvas/source/mtfrenderer/cachedprimitivebase \
cppcanvas/source/mtfrenderer/emfpbrush \
cppcanvas/source/mtfrenderer/emfpcustomlinecap \
cppcanvas/source/mtfrenderer/emfpfont \
cppcanvas/source/mtfrenderer/emfpimage \
cppcanvas/source/mtfrenderer/emfplus \
cppcanvas/source/mtfrenderer/emfppen \
cppcanvas/source/mtfrenderer/emfppath \
cppcanvas/source/mtfrenderer/emfpregion \
cppcanvas/source/mtfrenderer/implrenderer \
cppcanvas/source/mtfrenderer/lineaction \
cppcanvas/source/mtfrenderer/mtftools \
cppcanvas/source/mtfrenderer/pointaction \
cppcanvas/source/mtfrenderer/polypolyaction \
cppcanvas/source/mtfrenderer/emfpstringformat \
cppcanvas/source/mtfrenderer/textaction \
cppcanvas/source/mtfrenderer/textlineshelper \
cppcanvas/source/mtfrenderer/transparencygroupaction \
......
......@@ -196,15 +196,6 @@ namespace cppcanvas
// (externally not visible)
typedef std::vector< MtfAction > ActionVector;
/* EMF+ */
static void ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false);
static void ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags);
void MapToDevice (double &x, double &y) const;
::basegfx::B2DPoint Map (double ix, double iy) const;
::basegfx::B2DSize MapSize (double iwidth, double iheight) const;
void GraphicStatePush (GraphicStateMap& map, sal_Int32 index, OutDevState const & rState);
void GraphicStatePop (GraphicStateMap& map, sal_Int32 index, OutDevState& rState);
private:
ImplRenderer(const ImplRenderer&) = delete;
ImplRenderer& operator=( const ImplRenderer& ) = delete;
......@@ -257,20 +248,6 @@ namespace cppcanvas
void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream = false);
/* EMF+ */
void processEMFPlus( MetaCommentAction const * pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
double setFont(css::rendering::FontRequest& aFontRequest, sal_uInt8 fontObjectId, const ActionFactoryParameters& rParms, OutDevState& rState );
/// Render LineCap, like the start or end arrow of a polygon.
/// @return how much we should shorten the original polygon.
double EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon& rPolygon, double fPolyLength,
const ::basegfx::B2DPolyPolygon& rLineCap, bool isFilled, bool bStart,
const css::rendering::StrokeAttributes& rAttributes,
const ActionFactoryParameters& rParms, OutDevState& rState);
void EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon & polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex);
void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon const & polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
ActionVector maActions;
/* EMF+ */
......
This diff is collapsed.
/* -*- 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 .
*/
#ifndef INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPBRUSH_HXX
#define INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPBRUSH_HXX
namespace cppcanvas
{
namespace internal
{
enum EmfPlusHatchStyle
{
HatchStyleHorizontal = 0x00000000,
HatchStyleVertical = 0x00000001,
HatchStyleForwardDiagonal = 0x00000002,
HatchStyleBackwardDiagonal = 0x00000003,
HatchStyleLargeGrid = 0x00000004,
HatchStyleDiagonalCross = 0x00000005,
HatchStyle05Percent = 0x00000006,
HatchStyle10Percent = 0x00000007,
HatchStyle20Percent = 0x00000008,
HatchStyle25Percent = 0x00000009,
HatchStyle30Percent = 0x0000000A,
HatchStyle40Percent = 0x0000000B,
HatchStyle50Percent = 0x0000000C,
HatchStyle60Percent = 0x0000000D,
HatchStyle70Percent = 0x0000000E,
HatchStyle75Percent = 0x0000000F,
HatchStyle80Percent = 0x00000010,
HatchStyle90Percent = 0x00000011,
HatchStyleLightDownwardDiagonal = 0x00000012,
HatchStyleLightUpwardDiagonal = 0x00000013,
HatchStyleDarkDownwardDiagonal = 0x00000014,
HatchStyleDarkUpwardDiagonal = 0x00000015,
HatchStyleWideDownwardDiagonal = 0x00000016,
HatchStyleWideUpwardDiagonal = 0x00000017,
HatchStyleLightVertical = 0x00000018,
HatchStyleLightHorizontal = 0x00000019,
HatchStyleNarrowVertical = 0x0000001A,
HatchStyleNarrowHorizontal = 0x0000001B,
HatchStyleDarkVertical = 0x0000001C,
HatchStyleDarkHorizontal = 0x0000001D,
HatchStyleDashedDownwardDiagonal = 0x0000001E,
HatchStyleDashedUpwardDiagonal = 0x0000001F,
HatchStyleDashedHorizontal = 0x00000020,
HatchStyleDashedVertical = 0x00000021,
HatchStyleSmallConfetti = 0x00000022,
HatchStyleLargeConfetti = 0x00000023,
HatchStyleZigZag = 0x00000024,
HatchStyleWave = 0x00000025,
HatchStyleDiagonalBrick = 0x00000026,
HatchStyleHorizontalBrick = 0x00000027,
HatchStyleWeave = 0x00000028,
HatchStylePlaid = 0x00000029,
HatchStyleDivot = 0x0000002A,
HatchStyleDottedGrid = 0x0000002B,
HatchStyleDottedDiamond = 0x0000002C,
HatchStyleShingle = 0x0000002D,
HatchStyleTrellis = 0x0000002E,
HatchStyleSphere = 0x0000002F,
HatchStyleSmallGrid = 0x00000030,
HatchStyleSmallCheckerBoard = 0x00000031,
HatchStyleLargeCheckerBoard = 0x00000032,
HatchStyleOutlinedDiamond = 0x00000033,
HatchStyleSolidDiamond = 0x00000034
};
enum EmfPlusBrushType
{
BrushTypeSolidColor = 0x00000000,
BrushTypeHatchFill = 0x00000001,
BrushTypeTextureFill = 0x00000002,
BrushTypePathGradient = 0x00000003,
BrushTypeLinearGradient = 0x00000004
};
struct EMFPPath;
struct EMFPBrush : public EMFPObject
{
::Color solidColor;
sal_uInt32 type;
sal_uInt32 additionalFlags;
/* linear gradient */
sal_Int32 wrapMode;
float areaX, areaY, areaWidth, areaHeight;
::Color secondColor; // first color is stored in solidColor;
XForm brush_transformation;
bool hasTransformation;
sal_Int32 blendPoints;
std::unique_ptr<float[]> blendPositions;
float* blendFactors;
sal_Int32 colorblendPoints;
std::unique_ptr<float[]> colorblendPositions;
std::unique_ptr<::Color[]> colorblendColors;
sal_Int32 surroundColorsNumber;
std::unique_ptr<::Color[]> surroundColors;
std::unique_ptr<EMFPPath> path;
EmfPlusHatchStyle hatchStyle;
EMFPBrush();
virtual ~EMFPBrush() override;
sal_uInt32 GetType() const { return type; }
const ::Color& GetColor() const { return solidColor; }
void Read(SvStream& s, ImplRenderer const & rR);
};
}
}
#endif // INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPBRUSH_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <com/sun/star/rendering/PathCapType.hpp>
#include <com/sun/star/rendering/PathJoinType.hpp>
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <com/sun/star/rendering/XCanvas.hpp>
#include <basegfx/utils/canvastools.hxx>
#include <basegfx/utils/gradienttools.hxx>
#include <basegfx/utils/tools.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <sal/log.hxx>
#include <vcl/canvastools.hxx>
#include <implrenderer.hxx>
#include "emfpcustomlinecap.hxx"
#include "emfppath.hxx"
#include "emfppen.hxx"
using namespace ::com::sun::star;
using namespace ::basegfx;
namespace cppcanvas
{
namespace internal
{
const sal_uInt32 EmfPlusCustomLineCapDataTypeDefault = 0x00000000;
const sal_uInt32 EmfPlusCustomLineCapDataTypeAdjustableArrow = 0x00000001;
const sal_uInt32 EmfPlusCustomLineCapDataFillPath = 0x00000001;
const sal_uInt32 EmfPlusCustomLineCapDataLinePath = 0x00000002;
EMFPCustomLineCap::EMFPCustomLineCap()
: EMFPObject()
, type(0)
, strokeStartCap(0)
, strokeEndCap(0)
, strokeJoin(0)
, miterLimit(0.0)
, mbIsFilled(false)
{
}
void EMFPCustomLineCap::SetAttributes(rendering::StrokeAttributes& aAttributes)
{
aAttributes.StartCapType = EMFPPen::lcl_convertStrokeCap(strokeStartCap);
aAttributes.EndCapType = EMFPPen::lcl_convertStrokeCap(strokeEndCap);
aAttributes.JoinType = EMFPPen::lcl_convertLineJoinType(strokeJoin);
aAttributes.MiterLimit = miterLimit;
}
void EMFPCustomLineCap::ReadPath(SvStream& s, ImplRenderer const & rR, bool bFill)
{
sal_Int32 pathLength;
s.ReadInt32(pathLength);
SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength);
sal_uInt32 pathHeader;
sal_Int32 pathPoints, pathFlags;
s.ReadUInt32(pathHeader).ReadInt32(pathPoints).ReadInt32(pathFlags);
SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap line path)");
SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec);
EMFPPath path(pathPoints);
path.Read(s, pathFlags, rR);
polygon = path.GetPolygon(rR, false);
mbIsFilled = bFill;
// transformation to convert the path to what LibreOffice
// expects
B2DHomMatrix aMatrix;
aMatrix.scale(1.0, -1.0);
polygon.transform(aMatrix);
};
void EMFPCustomLineCap::Read(SvStream& s, ImplRenderer const & rR)
{
sal_uInt32 header;
s.ReadUInt32(header).ReadUInt32(type);
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustom cap");
SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << header << " type: " << type << std::dec);
if (type == EmfPlusCustomLineCapDataTypeDefault)
{
sal_uInt32 customLineCapDataFlags, baseCap;
float baseInset;
float widthScale;
float fillHotSpotX, fillHotSpotY, strokeHotSpotX, strokeHotSpotY;
s.ReadUInt32(customLineCapDataFlags).ReadUInt32(baseCap).ReadFloat(baseInset)
.ReadUInt32(strokeStartCap).ReadUInt32(strokeEndCap).ReadUInt32(strokeJoin)
.ReadFloat(miterLimit).ReadFloat(widthScale)
.ReadFloat(fillHotSpotX).ReadFloat(fillHotSpotY).ReadFloat(strokeHotSpotX).ReadFloat(strokeHotSpotY);
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomLineCapDataFlags: 0x" << std::hex << customLineCapDataFlags);
SAL_INFO("cppcanvas.emf", "EMF+\t\tbaseCap: 0x" << std::hex << baseCap);
SAL_INFO("cppcanvas.emf", "EMF+\t\tbaseInset: " << baseInset);
SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeStartCap: 0x" << std::hex << strokeStartCap);
SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeEndCap: 0x" << std::hex << strokeEndCap);
SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeJoin: 0x" << std::hex << strokeJoin);
SAL_INFO("cppcanvas.emf", "EMF+\t\tmiterLimit: " << miterLimit);
SAL_INFO("cppcanvas.emf", "EMF+\t\twidthScale: " << widthScale);
if (customLineCapDataFlags & EmfPlusCustomLineCapDataFillPath)
{
ReadPath(s, rR, true);
}
if (customLineCapDataFlags & EmfPlusCustomLineCapDataLinePath)
{
ReadPath(s, rR, false);
}
}
else if (type == EmfPlusCustomLineCapDataTypeAdjustableArrow)
{
// TODO only reads the data, does not use them [I've had
// no test document to be able to implement it]
sal_Int32 width, height, middleInset, fillState, lineStartCap;
sal_Int32 lineEndCap, lineJoin, widthScale;
float fillHotSpotX, fillHotSpotY, lineHotSpotX, lineHotSpotY;
s.ReadInt32(width).ReadInt32(height).ReadInt32(middleInset).ReadInt32(fillState).ReadInt32(lineStartCap)
.ReadInt32(lineEndCap).ReadInt32(lineJoin).ReadFloat(miterLimit).ReadInt32(widthScale)
.ReadFloat(fillHotSpotX).ReadFloat(fillHotSpotY).ReadFloat(lineHotSpotX).ReadFloat(lineHotSpotY);
SAL_INFO("cppcanvas.emf", "EMF+\t\tTODO - actually read EmfPlusCustomLineCapArrowData object (section 2.2.2.12)");
}
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPCUSTOMLINECAP_HXX
#define INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPCUSTOMLINECAP_HXX
namespace cppcanvas
{
namespace internal
{
struct EMFPCustomLineCap : public EMFPObject
{
sal_uInt32 type;
sal_uInt32 strokeStartCap, strokeEndCap, strokeJoin;
float miterLimit;
basegfx::B2DPolyPolygon polygon;
bool mbIsFilled;
EMFPCustomLineCap();
void SetAttributes(com::sun::star::rendering::StrokeAttributes& aAttributes);
void ReadPath(SvStream& s, ImplRenderer const & rR, bool bFill);
void Read(SvStream& s, ImplRenderer const & rR);
};
}
}
#endif // INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPCUSTOMLINECAP_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <com/sun/star/rendering/PathCapType.hpp>
#include <com/sun/star/rendering/PathJoinType.hpp>
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <com/sun/star/rendering/XCanvas.hpp>
#include <basegfx/utils/canvastools.hxx>
#include <basegfx/utils/gradienttools.hxx>
#include <basegfx/utils/tools.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <sal/log.hxx>
#include <vcl/canvastools.hxx>
#include <implrenderer.hxx>
#include "emfpfont.hxx"
namespace cppcanvas
{
namespace internal
{
void EMFPFont::Read(SvMemoryStream &s)
{
sal_uInt32 header;
sal_uInt32 reserved;
sal_uInt32 length;
s.ReadUInt32(header).ReadFloat(emSize).ReadUInt32(sizeUnit).ReadInt32(fontFlags).ReadUInt32(reserved).ReadUInt32(length);
SAL_WARN_IF((header >> 12) != 0xdbc01, "cppcanvas.emf", "Invalid header - not 0xdbc01");
SAL_INFO("cppcanvas.emf", "EMF+\tfont\nEMF+\theader: 0x" << std::hex << (header >> 12) << " version: 0x" << (header & 0x1fff) << " size: " << std::dec << emSize << " unit: 0x" << std::hex << sizeUnit << std::dec);
SAL_INFO("cppcanvas.emf", "EMF+\tflags: 0x" << std::hex << fontFlags << " reserved: 0x" << reserved << " length: 0x" << std::hex << length << std::dec);
if (length > 0 && length < 0x4000)
{
rtl_uString *pStr = rtl_uString_alloc(length);
sal_Unicode *chars = pStr->buffer;
for (sal_uInt32 i = 0; i < length; ++i)
s.ReadUtf16(chars[i]);
family = OUString(pStr, SAL_NO_ACQUIRE);
SAL_INFO("cppcanvas.emf", "EMF+\tfamily: " << family);
}
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPFONT_HXX
#define INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPFONT_HXX
namespace cppcanvas
{
namespace internal
{
struct EMFPFont : public EMFPObject
{
float emSize;
sal_uInt32 sizeUnit;
sal_Int32 fontFlags;
OUString family;
void Read(SvMemoryStream &s);
};
}
}
#endif // INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPFONT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <com/sun/star/rendering/PathCapType.hpp>
#include <com/sun/star/rendering/PathJoinType.hpp>
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <com/sun/star/rendering/XCanvas.hpp>
#include <basegfx/utils/canvastools.hxx>
#include <basegfx/utils/gradienttools.hxx>
#include <basegfx/utils/tools.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <vcl/canvastools.hxx>
#include <implrenderer.hxx>
#include <vcl/graphicfilter.hxx>
#include "emfpimage.hxx"
#include <sal/log.hxx>
namespace cppcanvas
{
namespace internal
{
void EMFPImage::Read(SvMemoryStream &s, sal_uInt32 dataSize, bool bUseWholeStream)
{
sal_uInt32 header, bitmapType;
s.ReadUInt32(header).ReadUInt32(type);
SAL_INFO("cppcanvas.emf", "EMF+\timage\nEMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec);
if (type == 1) { // bitmap
s.ReadInt32(width).ReadInt32(height).ReadInt32(stride).ReadInt32(pixelFormat).ReadUInt32(bitmapType);
SAL_INFO("cppcanvas.emf", "EMF+\tbitmap width: " << width << " height: " << height << " stride: " << stride << " pixelFormat: 0x" << std::hex << pixelFormat << std::dec);
if ((bitmapType != 0) || (width == 0)) { // non native formats
GraphicFilter filter;
filter.ImportGraphic(graphic, OUString(), s);
SAL_INFO("cppcanvas.emf", "EMF+\tbitmap width: " << graphic.GetSizePixel().Width() << " height: " << graphic.GetSizePixel().Height());
}
}
else if (type == 2) { // metafile
sal_Int32 mfType, mfSize;
s.ReadInt32(mfType).ReadInt32(mfSize);
if (bUseWholeStream)
dataSize = s.remainingSize();
else
dataSize -= 16;
SAL_INFO("cppcanvas.emf", "EMF+\tmetafile type: " << mfType << " dataSize: " << mfSize << " real size calculated from record dataSize: " << dataSize);
GraphicFilter filter;
// workaround buggy metafiles, which have wrong mfSize set (n#705956 for example)
SvMemoryStream mfStream(const_cast<char *>(static_cast<char const *>(s.GetData()) + s.Tell()), dataSize, StreamMode::READ);
filter.ImportGraphic(graphic, OUString(), mfStream);
// debug code - write the stream to debug file /tmp/emf-stream.emf
#if OSL_DEBUG_LEVEL > 1
mfStream.Seek(0);
static sal_Int32 emfp_debug_stream_number = 0;
OUString emfp_debug_filename = "/tmp/emf-embedded-stream" +
OUString::number(emfp_debug_stream_number++) + ".emf";
SvFileStream file(emfp_debug_filename, StreamMode::WRITE | StreamMode::TRUNC);
mfStream.WriteStream(file);
file.Flush();
file.Close();
#endif
}
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPIMAGE_HXX
#define INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPIMAGE_HXX
namespace cppcanvas
{
namespace internal
{
struct EMFPImage : public EMFPObject
{
sal_uInt32 type;
sal_Int32 width;
sal_Int32 height;
sal_Int32 stride;
sal_Int32 pixelFormat;
Graphic graphic;
void Read(SvMemoryStream &s, sal_uInt32 dataSize, bool bUseWholeStream);
};
}
}
#endif // INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPIMAGE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
/* -*- 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 <com/sun/star/rendering/PathCapType.hpp>
#include <com/sun/star/rendering/PathJoinType.hpp>
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <com/sun/star/rendering/XCanvas.hpp>
#include <basegfx/utils/canvastools.hxx>
#include <basegfx/utils/gradienttools.hxx>
#include <basegfx/utils/tools.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2drectangle.hxx>