diff options
Diffstat (limited to 'drawinglayer/inc')
23 files changed, 2504 insertions, 0 deletions
diff --git a/drawinglayer/inc/converters.hxx b/drawinglayer/inc/converters.hxx new file mode 100644 index 000000000..4f585d5d0 --- /dev/null +++ b/drawinglayer/inc/converters.hxx @@ -0,0 +1,36 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/bitmapex.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +namespace drawinglayer +{ + BitmapEx convertToBitmapEx( + const drawinglayer::primitive2d::Primitive2DContainer& rSeq, + const geometry::ViewInformation2D& rViewInformation2D, + sal_uInt32 nDiscreteWidth, + sal_uInt32 nDiscreteHeight, + sal_uInt32 nMaxQuadratPixels); + +} // end of namespace drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/emfplushelper.hxx b/drawinglayer/inc/emfplushelper.hxx new file mode 100644 index 000000000..22b9acb60 --- /dev/null +++ b/drawinglayer/inc/emfplushelper.hxx @@ -0,0 +1,52 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> +#include <memory> +#include "wmfemfhelper.hxx" + +namespace emfplushelper { struct EmfPlusHelperData; } +namespace wmfemfhelper { class TargetHolders; } +namespace drawinglayer::geometry { class ViewInformation2D; } +class SvMemoryStream; + +namespace emfplushelper +{ + /// EMF+ data holder + class EmfPlusHelper + { + private: + const std::unique_ptr<EmfPlusHelperData> mpD; + + public: + EmfPlusHelper( + SvMemoryStream& rMemoryStream, + wmfemfhelper::TargetHolders& rTargetHolders, + wmfemfhelper::PropertyHolders& rPropertyHolders); + ~EmfPlusHelper(); + + void processEmfPlusData( + SvMemoryStream& rMemoryStream, + const drawinglayer::geometry::ViewInformation2D& rViewInformation); + }; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/pch/precompiled_drawinglayer.cxx b/drawinglayer/inc/pch/precompiled_drawinglayer.cxx new file mode 100644 index 000000000..fc906a313 --- /dev/null +++ b/drawinglayer/inc/pch/precompiled_drawinglayer.cxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "precompiled_drawinglayer.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx new file mode 100644 index 000000000..9aaf7bace --- /dev/null +++ b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx @@ -0,0 +1,186 @@ +/* -*- 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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-04-25 20:54:59 using: + ./bin/update_pch drawinglayer drawinglayer --cutoff=4 --exclude:system --exclude:module --exclude:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./drawinglayer/inc/pch/precompiled_drawinglayer.hxx "make drawinglayer.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <cassert> +#include <cstddef> +#include <cstring> +#include <deque> +#include <limits.h> +#include <limits> +#include <memory> +#include <new> +#include <ostream> +#include <string.h> +#include <string_view> +#include <utility> +#include <vector> +#include <boost/property_tree/ptree_fwd.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/diagnose.h> +#include <osl/interlck.h> +#include <osl/mutex.hxx> +#include <rtl/alloc.h> +#include <rtl/instance.hxx> +#include <rtl/math.hxx> +#include <rtl/ref.hxx> +#include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/textenc.h> +#include <rtl/unload.h> +#include <rtl/ustrbuf.h> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <sal/config.h> +#include <sal/detail/log.h> +#include <sal/log.hxx> +#include <sal/types.h> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/canvastools.hxx> +#include <vcl/dllapi.h> +#include <vcl/graph.hxx> +#include <vcl/outdev.hxx> +#include <vcl/svapp.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/virdev.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/color/bcolormodifier.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> +#include <basegfx/point/b3dpoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygonclipper.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/polygon/b3dpolygon.hxx> +#include <basegfx/polygon/b3dpolygontools.hxx> +#include <basegfx/polygon/b3dpolypolygon.hxx> +#include <basegfx/polygon/b3dpolypolygontools.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/b3drange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/utils/canvastools.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <basegfx/vector/b3dvector.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/LineCap.hpp> +#include <com/sun/star/drawing/NormalsKind.hpp> +#include <com/sun/star/drawing/TextureKind2.hpp> +#include <com/sun/star/drawing/TextureMode.hpp> +#include <com/sun/star/drawing/TextureProjectionMode.hpp> +#include <com/sun/star/graphic/XPrimitive3D.hpp> +#include <com/sun/star/util/XAccounting.hpp> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/color.hxx> +#include <tools/fontenum.hxx> +#include <tools/gen.hxx> +#include <tools/link.hxx> +#include <tools/stream.hxx> +#include <tools/toolsdllapi.h> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <drawinglayer/attribute/fontattribute.hxx> +#include <drawinglayer/attribute/lineattribute.hxx> +#include <drawinglayer/attribute/materialattribute3d.hxx> +#include <drawinglayer/attribute/sdrallattribute3d.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> +#include <drawinglayer/attribute/sdrobjectattribute3d.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include <drawinglayer/geometry/viewinformation3d.hxx> +#include <drawinglayer/primitive2d/CommonTypes.hxx> +#include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> +#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx> +#include <drawinglayer/primitive2d/Tools.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> +#include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx> +#include <drawinglayer/primitive2d/groupprimitive2d.hxx> +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> +#include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx> +#include <drawinglayer/primitive2d/maskprimitive2d.hxx> +#include <drawinglayer/primitive2d/metafileprimitive2d.hxx> +#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> +#include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx> +#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/primitivetools2d.hxx> +#include <drawinglayer/primitive2d/svggradientprimitive2d.hxx> +#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx> +#include <drawinglayer/primitive2d/textlayoutdevice.hxx> +#include <drawinglayer/primitive2d/textprimitive2d.hxx> +#include <drawinglayer/primitive2d/transformprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> +#include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> +#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx> +#include <drawinglayer/primitive3d/polygonprimitive3d.hxx> +#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> +#include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx> +#include <drawinglayer/primitive3d/sdrprimitive3d.hxx> +#include <drawinglayer/primitive3d/transformprimitive3d.hxx> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive2d/cropprimitive2d.hxx b/drawinglayer/inc/primitive2d/cropprimitive2d.hxx new file mode 100644 index 000000000..ba427eb6f --- /dev/null +++ b/drawinglayer/inc/primitive2d/cropprimitive2d.hxx @@ -0,0 +1,96 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/primitive2d/groupprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + + +namespace drawinglayer +{ + namespace primitive2d + { + /** CropPrimitive2D class + + Caution: Due to old constraints (old core definitions) the + crop distances describe how the uncropped content is defined + relative to the current object size. This means that maTransformation + describes the current object size (the part of the object visible + with the crop applied). To get the original size and orientation + of the uncropped content it is necessary to calc back from the + current situation (maTransformation) using the crop values + to get to the uncropped original content. + + Thus a transformation has to be calculated which will be applied + to the already existing content to get it to the uncropped state + and then this is masked with the current state (mask polygon + created from unit polygon and maTransformation). + + At least in this primitive the units of the crop values are + already in the local coordinate system; in the core these distances + are defined relative to the object content size (PrefMapMode + and PrefSize of the content)... + + Of course this is a primitive, so feel free to just ignore all that + stuff and use the automatically generated decomposition. Sigh. + */ + class CropPrimitive2D final : public GroupPrimitive2D + { + private: + // the transformation already applied to the child geometry + basegfx::B2DHomMatrix maTransformation; + + // the crop offsets relative to the range of the unrotated content + double mfCropLeft; + double mfCropTop; + double mfCropRight; + double mfCropBottom; + + public: + /// constructor + CropPrimitive2D( + const Primitive2DContainer& rChildren, + const basegfx::B2DHomMatrix& rTransformation, + double fCropLeft, + double fCropTop, + double fCropRight, + double fCropBottom); + + /// data read access + const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } + double getCropLeft() const { return mfCropLeft; } + double getCropTop() const { return mfCropTop; } + double getCropRight() const { return mfCropRight; } + double getCropBottom() const { return mfCropBottom; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// local decomposition + virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx b/drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx new file mode 100644 index 000000000..fb1431152 --- /dev/null +++ b/drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx @@ -0,0 +1,59 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <vcl/GraphicObject.hxx> + +class Graphic; + +namespace drawinglayer::primitive2d +{ + /** Helper method with supports decomposing a Graphic with all + possible contents to lower level primitives. + + #i121194# Unified to use this helper for FillGraphicPrimitive2D + and GraphicPrimitive2D at the same time. It is able to handle + Bitmaps (with the sub-categories animated bitmap, and SVG), + and Metafiles. + */ + void create2DDecompositionOfGraphic( + Primitive2DContainer& rContainer, + const Graphic& rGraphic, + const basegfx::B2DHomMatrix& rTransform); + + /** Helper to embed given sequence of primitives to evtl. a stack + of ModifiedColorPrimitive2D's to get all the needed modifications + applied. + */ + Primitive2DContainer create2DColorModifierEmbeddingsAsNeeded( + const Primitive2DContainer& rChildren, + GraphicDrawMode aGraphicDrawMode, + double fLuminance = 0.0, // [-1.0 .. 1.0] + double fContrast = 0.0, // [-1.0 .. 1.0] + double fRed = 0.0, // [-1.0 .. 1.0] + double fGreen = 0.0, // [-1.0 .. 1.0] + double fBlue = 0.0, // [-1.0 .. 1.0] + double fGamma = 1.0, // ]0.0 .. 10.0] + bool bInvert = false); + +} // end of namespace drawinglayer::primitive2d + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx new file mode 100644 index 000000000..a39256453 --- /dev/null +++ b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx @@ -0,0 +1,100 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + + +namespace drawinglayer +{ + namespace primitive2d + { + /** TextEffectStyle2D definition */ + enum class TextEffectStyle2D + { + ReliefEmbossedDefault, + ReliefEngravedDefault, + ReliefEmbossed, + ReliefEngraved, + Outline + }; + + /** TextEffectPrimitive2D class + + This primitive embeds text primitives (normally, as can be seen can + also be used for any other primitives) which have some TextEffect applied + and create the needed geometry and embedding on decomposition. + */ + class TextEffectPrimitive2D final : public BufferedDecompositionPrimitive2D + { + private: + /// the text (or other) content + Primitive2DContainer maTextContent; + + /// the style to apply, the direction and the rotation center + const basegfx::B2DPoint maRotationCenter; + double mfDirection; + TextEffectStyle2D meTextEffectStyle2D; + + /** the last used object to view transformtion used from getDecomposition + for decide buffering + */ + basegfx::B2DHomMatrix maLastObjectToViewTransformation; + + /// create local decomposition + virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + + public: + /// constructor + TextEffectPrimitive2D( + const Primitive2DContainer& rTextContent, + const basegfx::B2DPoint& rRotationCenter, + double fDirection, + TextEffectStyle2D eTextEffectStyle2D); + + /// data read access + const Primitive2DContainer& getTextContent() const { return maTextContent; } + const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; } + double getDirection() const { return mfDirection; } + TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /** own get range implementation to solve more effective. Content is by definition displaced + by a fixed discrete unit, thus the contained geometry needs only once be asked for its + own basegfx::B2DRange + */ + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + + /// Override standard getDecomposition to be view-dependent here + virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx b/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx new file mode 100644 index 000000000..059c69bd7 --- /dev/null +++ b/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx @@ -0,0 +1,78 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/color/bcolor.hxx> + + +namespace drawinglayer +{ + namespace primitive2d + { + class TextLinePrimitive2D final : public BufferedDecompositionPrimitive2D + { + private: + /// geometric definitions + basegfx::B2DHomMatrix maObjectTransformation; + double mfWidth; + double mfOffset; + double mfHeight; + + /// decoration definitions + TextLine meTextLine; + basegfx::BColor maLineColor; + + /// local decomposition. + virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + + public: + /// constructor + TextLinePrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + double fOffset, + double fHeight, + TextLine eTextLine, + const basegfx::BColor& rLineColor); + + /// data read access + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + double getWidth() const { return mfWidth; } + double getOffset() const { return mfOffset; } + double getHeight() const { return mfHeight; } + TextLine getTextLine() const { return meTextLine; } + const basegfx::BColor& getLineColor() const { return maLineColor; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx b/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx new file mode 100644 index 000000000..1e1e75f7c --- /dev/null +++ b/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx @@ -0,0 +1,143 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/color/bcolor.hxx> +#include <drawinglayer/attribute/fontattribute.hxx> +#include <com/sun/star/lang/Locale.hpp> + + +namespace drawinglayer +{ + namespace primitive2d + { + class BaseTextStrikeoutPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + /// geometric definitions + basegfx::B2DHomMatrix maObjectTransformation; + double mfWidth; + + /// decoration definitions + basegfx::BColor maFontColor; + + public: + /// constructor + BaseTextStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor); + + /// data read access + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + double getWidth() const { return mfWidth; } + const basegfx::BColor& getFontColor() const { return maFontColor; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + + +namespace drawinglayer +{ + namespace primitive2d + { + class TextCharacterStrikeoutPrimitive2D final : public BaseTextStrikeoutPrimitive2D + { + private: + sal_Unicode maStrikeoutChar; + attribute::FontAttribute maFontAttribute; + css::lang::Locale maLocale; + + /// local decomposition. + virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + + public: + /// constructor + TextCharacterStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor, + sal_Unicode aStrikeoutChar, + const attribute::FontAttribute& rFontAttribute, + const css::lang::Locale& rLocale); + + /// data read access + sal_Unicode getStrikeoutChar() const { return maStrikeoutChar; } + const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; } + const css::lang::Locale& getLocale() const { return maLocale; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + + +namespace drawinglayer +{ + namespace primitive2d + { + class TextGeometryStrikeoutPrimitive2D final : public BaseTextStrikeoutPrimitive2D + { + private: + double mfHeight; + double mfOffset; + TextStrikeout meTextStrikeout; + + /// local decomposition. + virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + + public: + /// constructor + TextGeometryStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor, + double fHeight, + double fOffset, + TextStrikeout eTextStrikeout); + + /// data read access + double getHeight() const { return mfHeight; } + double getOffset() const { return mfOffset; } + TextStrikeout getTextStrikeout() const { return meTextStrikeout; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx b/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx new file mode 100644 index 000000000..a8e4b158f --- /dev/null +++ b/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/primitivetools2d.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/wall.hxx> + + +namespace drawinglayer +{ + namespace primitive2d + { + /** WallpaperBitmapPrimitive2D class + + This is a specialized primitive for the Wallpaper definitions included in + VCL and Metafiles. The extraordinary about the bitmap definition part of + the Wallpaper is that it uses PIXEL size of the given Bitmap and not + the logic and/or discrete size derived by PrefMapMode/PrefSize methods. + To emulate this, a ViewTransformation dependent primitive is needed which + takes over the correct scaling(s). + + Since a specialized primitive is needed anyways, i opted to also add the + layouting which is dependent from WallpaperStyle; thus it does not need + to be handled anywhere else in the future. + */ + class WallpaperBitmapPrimitive2D final : public ViewTransformationDependentPrimitive2D + { + private: + basegfx::B2DRange maObjectRange; + BitmapEx maBitmapEx; + WallpaperStyle meWallpaperStyle; + + /// create local decomposition + virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + + public: + /// constructor + WallpaperBitmapPrimitive2D( + const basegfx::B2DRange& rObjectRange, + const BitmapEx& rBitmapEx, + WallpaperStyle eWallpaperStyle); + + /// data read access + const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; } + const BitmapEx& getBitmapEx() const { return maBitmapEx ; } + WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// get B2Drange + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive3d/hatchtextureprimitive3d.hxx b/drawinglayer/inc/primitive3d/hatchtextureprimitive3d.hxx new file mode 100644 index 000000000..1329bf706 --- /dev/null +++ b/drawinglayer/inc/primitive3d/hatchtextureprimitive3d.hxx @@ -0,0 +1,78 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <primitive3d/textureprimitive3d.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> + + +namespace drawinglayer +{ + namespace primitive3d + { + /** HatchTexturePrimitive3D class + + HatchTexturePrimitive3D is derived from GroupPrimitive3D, but implements + a decomposition which is complicated enough for buffering. Since the group + primitive has no default buffering, it is necessary here to add a local + buffering mechanism for the decomposition + */ + class HatchTexturePrimitive3D final : public TexturePrimitive3D + { + /// the hatch definition + attribute::FillHatchAttribute maHatch; + + /// the buffered decomposed hatch + Primitive3DContainer maBuffered3DDecomposition; + + /// helper: local decomposition + Primitive3DContainer impCreate3DDecomposition() const; + + /// local access methods to maBufferedDecomposition + const Primitive3DContainer& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; } + + public: + /// constructor + HatchTexturePrimitive3D( + const attribute::FillHatchAttribute& rHatch, + const Primitive3DContainer& rChildren, + const basegfx::B2DVector& rTextureSize, + bool bModulate, + bool bFilter); + + /// data read access + const attribute::FillHatchAttribute& getHatch() const { return maHatch; } + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + + /// local decomposition. + virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override; + + /// provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive3d/hiddengeometryprimitive3d.hxx b/drawinglayer/inc/primitive3d/hiddengeometryprimitive3d.hxx new file mode 100644 index 000000000..246abe38a --- /dev/null +++ b/drawinglayer/inc/primitive3d/hiddengeometryprimitive3d.hxx @@ -0,0 +1,61 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive3d/groupprimitive3d.hxx> + + +namespace drawinglayer +{ + namespace primitive3d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a 3D cube without fill attributes. To still be able to use + // primitives for HitTest functionality, the 3d decompositions produce + // an as much as possible simplified fill geometry encapsulated in this + // primitive when there is no fill geometry. Currently, the 3d hit test + // uses only areas, so maybe in a further enhanced version this will change + // to 'if neither filled nor lines' creation criteria. The whole primitive + // decomposes to nothing, so no one not knowing it will be influenced. Only + // helper processors for hit test (and maybe BoundRect extractors) will + // use it and its children subcontent. + class HiddenGeometryPrimitive3D final : public GroupPrimitive3D + { + public: + explicit HiddenGeometryPrimitive3D(const Primitive3DContainer& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use hidden geometry, so + // the local implementation will return the children's range + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override; + + /// The default implementation returns an empty sequence + virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override; + + // provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive3d/polygontubeprimitive3d.hxx b/drawinglayer/inc/primitive3d/polygontubeprimitive3d.hxx new file mode 100644 index 000000000..e27201ad6 --- /dev/null +++ b/drawinglayer/inc/primitive3d/polygontubeprimitive3d.hxx @@ -0,0 +1,92 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive3d/polygonprimitive3d.hxx> + + +namespace drawinglayer +{ + namespace primitive3d + { + /** PolygonStrokePrimitive3D class + + This 3D primitive extends a 3D hairline to a 3D tube which is + e.g. used for fat lines in 3D. It's decomposition will create all + 3D objects needed for the line tubes and the edge roundings + in full 3D. + */ + class PolygonTubePrimitive3D final : public PolygonHairlinePrimitive3D + { + /// hold the last decomposition since it's expensive + Primitive3DContainer maLast3DDecomposition; + + /// visualisation parameters + double mfRadius; + double mfDegreeStepWidth; + double mfMiterMinimumAngle; + basegfx::B2DLineJoin maLineJoin; + css::drawing::LineCap maLineCap; + + /** access methods to maLast3DDecomposition. The usage of this methods may allow + later thread-safe stuff to be added if needed. Only to be used by getDecomposition() + implementations for buffering the last decomposition. + */ + const Primitive3DContainer& getLast3DDecomposition() const { return maLast3DDecomposition; } + + /// local decomposition. + Primitive3DContainer impCreate3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + + public: + /// constructor + PolygonTubePrimitive3D( + const basegfx::B3DPolygon& rPolygon, + const basegfx::BColor& rBColor, + double fRadius, + basegfx::B2DLineJoin aLineJoin, + css::drawing::LineCap aLineCap, + double fDegreeStepWidth = basegfx::deg2rad(10.0), + double fMiterMinimumAngle = basegfx::deg2rad(15.0)); + + /// data read access + double getRadius() const { return mfRadius; } + double getDegreeStepWidth() const { return mfDegreeStepWidth; } + double getMiterMinimumAngle() const { return mfMiterMinimumAngle; } + basegfx::B2DLineJoin getLineJoin() const { return maLineJoin; } + css::drawing::LineCap getLineCap() const { return maLineCap; } + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + + /** local decomposition. Use own buffering since we are not derived from + BufferedDecompositionPrimitive3D + */ + virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override; + + /// provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive3d/sdrdecompositiontools3d.hxx b/drawinglayer/inc/primitive3d/sdrdecompositiontools3d.hxx new file mode 100644 index 000000000..9a4d62cbc --- /dev/null +++ b/drawinglayer/inc/primitive3d/sdrdecompositiontools3d.hxx @@ -0,0 +1,92 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <com/sun/star/drawing/TextureProjectionMode.hpp> +#include <vector> + + +// predefines + +namespace basegfx { + class B3DPolyPolygon; + class B3DHomMatrix; + class B2DVector; +} + +namespace drawinglayer::attribute { + class SdrLineAttribute; + class SdrFillAttribute; + class Sdr3DObjectAttribute; + class FillGradientAttribute; + class SdrShadowAttribute; +} + + +namespace drawinglayer +{ + namespace primitive3d + { + // #i98295# + basegfx::B3DRange getRangeFrom3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + void applyNormalsKindSphereTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill, const basegfx::B3DRange& rRange); + void applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + void applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + + // #i98314# + void applyTextureTo3DGeometry( + css::drawing::TextureProjectionMode eModeX, + css::drawing::TextureProjectionMode eModeY, + ::std::vector< basegfx::B3DPolyPolygon >& rFill, + const basegfx::B3DRange& rRange, + const basegfx::B2DVector& rTextureSize); + + Primitive3DContainer create3DPolyPolygonLinePrimitives( + const basegfx::B3DPolyPolygon& rUnitPolyPolygon, + const basegfx::B3DHomMatrix& rObjectTransform, + const attribute::SdrLineAttribute& rLine); + + Primitive3DContainer create3DPolyPolygonFillPrimitives( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, + const attribute::SdrFillAttribute& rFill, + const attribute::FillGradientAttribute& rFillGradient); + + Primitive3DContainer createShadowPrimitive3D( + const Primitive3DContainer& rSource, + const attribute::SdrShadowAttribute& rShadow, + bool bShadow3D); + + Primitive3DContainer createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute); + + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive3d/shadowprimitive3d.hxx b/drawinglayer/inc/primitive3d/shadowprimitive3d.hxx new file mode 100644 index 000000000..60ec61fe7 --- /dev/null +++ b/drawinglayer/inc/primitive3d/shadowprimitive3d.hxx @@ -0,0 +1,77 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive3d/groupprimitive3d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/color/bcolor.hxx> + + +namespace drawinglayer +{ + namespace primitive3d + { + /** ShadowPrimitive3D class + + This 3D grouping primitive is used to define a shadow for + 3d geometry by embedding it. The shadow of 3D objects are + 2D polygons, so the shadow transformation is a 2D transformation. + + If the Shadow3D flag is set, the shadow definition has to be + combined with the scene and camera definition to create the correct + projected shadow 2D-Polygons. + */ + class ShadowPrimitive3D final : public GroupPrimitive3D + { + /// 2D shadow definition + basegfx::B2DHomMatrix maShadowTransform; + basegfx::BColor maShadowColor; + double mfShadowTransparence; + + bool mbShadow3D : 1; + + public: + /// constructor + ShadowPrimitive3D( + const basegfx::B2DHomMatrix& rShadowTransform, + const basegfx::BColor& rShadowColor, + double fShadowTransparence, + bool bShadow3D, + const Primitive3DContainer& rChildren); + + /// data read access + const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; } + const basegfx::BColor& getShadowColor() const { return maShadowColor; } + double getShadowTransparence() const { return mfShadowTransparence; } + bool getShadow3D() const { return mbShadow3D; } + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + + /// provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/primitive3d/textureprimitive3d.hxx new file mode 100644 index 000000000..0dc3ed4d3 --- /dev/null +++ b/drawinglayer/inc/primitive3d/textureprimitive3d.hxx @@ -0,0 +1,219 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive3d/groupprimitive3d.hxx> +#include <drawinglayer/attribute/fillgraphicattribute.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> + + +namespace drawinglayer +{ + namespace primitive3d + { + /** TexturePrimitive3D class + + This 3D grouping primitive is used to define a texture for + 3d geometry by embedding it. It is used as base class for + extended texture definitions + */ + class TexturePrimitive3D : public GroupPrimitive3D + { + private: + /// texture geometry definition + basegfx::B2DVector maTextureSize; + + /// flag if texture shall be modulated with white interpolated color + bool mbModulate : 1; + + /// flag if texture shall be filtered + bool mbFilter : 1; + + public: + /// constructor + TexturePrimitive3D( + const Primitive3DContainer& rChildren, + const basegfx::B2DVector& rTextureSize, + bool bModulate, + bool bFilter); + + /// data read access + const basegfx::B2DVector& getTextureSize() const { return maTextureSize; } + bool getModulate() const { return mbModulate; } + bool getFilter() const { return mbFilter; } + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +namespace drawinglayer +{ + namespace primitive3d + { + /** UnifiedTransparenceTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a unified + transparence texture definition. All 3D primitives + embedded here will be shown with the given transparency. + */ + class UnifiedTransparenceTexturePrimitive3D final : public TexturePrimitive3D + { + private: + /// transparency definition + double mfTransparence; + + public: + /// constructor + UnifiedTransparenceTexturePrimitive3D( + double fTransparence, + const Primitive3DContainer& rChildren); + + /// data read access + double getTransparence() const { return mfTransparence; } + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + + /// own getB3DRange implementation to include transparent geometries to BoundRect calculations + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override; + + /// local decomposition. + virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override; + + /// provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +namespace drawinglayer +{ + namespace primitive3d + { + /** GradientTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a gradient texture + definition. All 3D primitives embedded here will be shown with the + defined gradient. + */ + class GradientTexturePrimitive3D : public TexturePrimitive3D + { + private: + /// the gradient definition + attribute::FillGradientAttribute maGradient; + + public: + /// constructor + GradientTexturePrimitive3D( + const attribute::FillGradientAttribute& rGradient, + const Primitive3DContainer& rChildren, + const basegfx::B2DVector& rTextureSize, + bool bModulate, + bool bFilter); + + /// data read access + const attribute::FillGradientAttribute& getGradient() const { return maGradient; } + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + + /// provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +namespace drawinglayer +{ + namespace primitive3d + { + /** BitmapTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a bitmap texture + definition. All 3D primitives embedded here will be shown with the + defined bitmap (maybe tiled if defined). + */ + class BitmapTexturePrimitive3D final : public TexturePrimitive3D + { + private: + /// bitmap fill attribute + attribute::FillGraphicAttribute maFillGraphicAttribute; + + public: + /// constructor + BitmapTexturePrimitive3D( + const attribute::FillGraphicAttribute& rFillGraphicAttribute, + const Primitive3DContainer& rChildren, + const basegfx::B2DVector& rTextureSize, + bool bModulate, + bool bFilter); + + /// data read access + const attribute::FillGraphicAttribute& getFillGraphicAttribute() const { return maFillGraphicAttribute; } + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + + /// provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +namespace drawinglayer +{ + namespace primitive3d + { + /** TransparenceTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a transparence texture + definition. For transparence definition, a gradient is used. The values in + that gradient will be interpreted as luminance Transparence-Values. All 3D + primitives embedded here will be shown with the defined transparence. + */ + class TransparenceTexturePrimitive3D final : public GradientTexturePrimitive3D + { + public: + /// constructor + TransparenceTexturePrimitive3D( + const attribute::FillGradientAttribute& rGradient, + const Primitive3DContainer& rChildren, + const basegfx::B2DVector& rTextureSize); + + /// compare operator + virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; + + /// provide unique ID + DeclPrimitive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/processor3d/defaultprocessor3d.hxx new file mode 100644 index 000000000..f23a826a6 --- /dev/null +++ b/drawinglayer/inc/processor3d/defaultprocessor3d.hxx @@ -0,0 +1,146 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/color/bcolormodifier.hxx> +#include <svtools/optionsdrawinglayer.hxx> + +// predefines + +namespace basegfx { + class B3DPolygon; + class B3DPolyPolygon; +} + +namespace drawinglayer::attribute { + class SdrSceneAttribute; + class SdrLightingAttribute; + class MaterialAttribute3D; +} + +namespace drawinglayer::primitive3d { + class PolygonHairlinePrimitive3D; + class PolyPolygonMaterialPrimitive3D; + class GradientTexturePrimitive3D; + class HatchTexturePrimitive3D; + class BitmapTexturePrimitive3D; + class TransformPrimitive3D; + class ModifiedColorPrimitive3D; +} + +namespace drawinglayer::texture { + class GeoTexSvx; +} + + +namespace drawinglayer +{ + namespace processor3d + { + /** DefaultProcessor3D class + + This processor renders all fed primitives to a 2D raster where for all + primitives the two basic methods rasterconvertB3DPolygon for hairlines and + rasterconvertB3DPolyPolygon for filled geometry is called. It is a baseclass to + e.g. base a Z-Buffer supported renderer on the 3D primitive processing. + */ + class DefaultProcessor3D : public BaseProcessor3D + { + protected: + /// read-only scene infos (normal handling, etc...) + const attribute::SdrSceneAttribute& mrSdrSceneAttribute; + + /// read-only light infos (lights, etc...) + const attribute::SdrLightingAttribute& mrSdrLightingAttribute; + + /// renderer range. Need to be correctly set by the derived implementations + /// normally the (0, 0, W, H) range from mpBZPixelRaster + basegfx::B2DRange maRasterRange; + + /// the modifiedColorPrimitive stack + basegfx::BColorModifierStack maBColorModifierStack; + + /// the current active texture + std::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx; + + /// the current active transparence texture + std::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx; + + /// SvtOptionsDrawinglayer incarnation to react on diverse settings + const SvtOptionsDrawinglayer maDrawinglayerOpt; + + /// counter for entered transparence textures + sal_uInt32 mnTransparenceCounter; + + bool mbModulate : 1; + bool mbFilter : 1; + bool mbSimpleTextureActive : 1; + + + // rendering support + + void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence); + void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive); + void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive); + void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate); + void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive) const; + void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive) const; + void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate); + + + // rasterconversions for filled and non-filled polygons. These NEED to be + // implemented from derivations + + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0; + virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0; + + // the processing method for a single, known primitive + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) override; + + public: + DefaultProcessor3D( + const geometry::ViewInformation3D& rViewInformation, + const attribute::SdrSceneAttribute& rSdrSceneAttribute, + const attribute::SdrLightingAttribute& rSdrLightingAttribute); + virtual ~DefaultProcessor3D() override; + + /// data read access + const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; } + const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; } + + /// data read access renderer stuff + const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } + const std::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const std::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; } + bool getModulate() const { return mbModulate; } + bool getFilter() const { return mbFilter; } + bool getSimpleTextureActive() const { return mbSimpleTextureActive; } + + /// access to Drawinglayer configuration options + const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/processor3d/geometry2dextractor.hxx new file mode 100644 index 000000000..ae3050fb2 --- /dev/null +++ b/drawinglayer/inc/processor3d/geometry2dextractor.hxx @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/color/bcolormodifier.hxx> + + +namespace drawinglayer +{ + namespace processor3d + { + /** Geometry2DExtractingProcessor class + + This processor extracts the 2D geometry (projected geometry) of all fed primitives. + It is e.g. used as sub-processor for contour extraction where 3D geometry is only + useful as 2D projected geometry. + */ + class Geometry2DExtractingProcessor final : public BaseProcessor3D + { + private: + /// result holding vector (2D) + primitive2d::Primitive2DContainer maPrimitive2DSequence; + + /// object transformation for scene for 2d definition + basegfx::B2DHomMatrix maObjectTransformation; + + /// the modifiedColorPrimitive stack + basegfx::BColorModifierStack maBColorModifierStack; + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) override; + + public: + Geometry2DExtractingProcessor( + const geometry::ViewInformation3D& rViewInformation, + const basegfx::B2DHomMatrix& rObjectTransformation); + + // data read access + const primitive2d::Primitive2DContainer& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/processor3d/shadow3dextractor.hxx new file mode 100644 index 000000000..37c1c0f0e --- /dev/null +++ b/drawinglayer/inc/processor3d/shadow3dextractor.hxx @@ -0,0 +1,99 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + +namespace basegfx { class B3DPolyPolygon; } +namespace basegfx { class B3DPolygon; } + + +namespace drawinglayer +{ + namespace processor3d + { + /** Shadow3DExtractingProcessor class + + This processor extracts the 2D shadow geometry (projected geometry) of all fed primitives. + It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite + some data to do so since we do not only offer flat projected 2D shadow, but also projections + dependent on the light source + */ + class Shadow3DExtractingProcessor final : public BaseProcessor3D + { + private: + /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) + primitive2d::Primitive2DContainer maPrimitive2DSequence; + primitive2d::Primitive2DContainer* mpPrimitive2DSequence; + + /// object transformation for scene for 2d definition + basegfx::B2DHomMatrix maObjectTransformation; + + /// prepared data (transformations) for 2D/3D shadow calculations + basegfx::B3DHomMatrix maWorldToEye; + basegfx::B3DHomMatrix maEyeToView; + basegfx::B3DVector maLightNormal; + basegfx::B3DVector maShadowPlaneNormal; + basegfx::B3DPoint maPlanePoint; + double mfLightPlaneScalar; + + /// flag if shadow plane projection preparation led to valid results + bool mbShadowProjectionIsValid : 1; + + /// flag if conversion is switched on + bool mbConvert : 1; + + /// flag if conversion shall use projection + bool mbUseProjection : 1; + + /// local helpers + basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource); + basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource); + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) override; + + public: + Shadow3DExtractingProcessor( + const geometry::ViewInformation3D& rViewInformation, + const basegfx::B2DHomMatrix& rObjectTransformation, + const basegfx::B3DVector& rLightNormal, + double fShadowSlant, + const basegfx::B3DRange& rContained3DRange); + virtual ~Shadow3DExtractingProcessor() override; + + /// data read access + const primitive2d::Primitive2DContainer& getPrimitive2DSequence() const; + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/processor3d/zbufferprocessor3d.hxx new file mode 100644 index 000000000..9a0b422ac --- /dev/null +++ b/drawinglayer/inc/processor3d/zbufferprocessor3d.hxx @@ -0,0 +1,96 @@ +/* -*- 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 . + */ + +#pragma once + +#include <processor3d/defaultprocessor3d.hxx> +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <memory> + +namespace basegfx { + class BZPixelRaster; +} + +namespace drawinglayer { + namespace attribute { + class SdrSceneAttribute; + class SdrLightingAttribute; + class MaterialAttribute3D; + } +} + +class ZBufferRasterConverter3D; +class RasterPrimitive3D; + +namespace drawinglayer +{ + namespace processor3d + { + /** + This 3D renderer derived from DefaultProcessor3D renders all fed primitives to a 2D + raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle + transparent content. + */ + class ZBufferProcessor3D final : public DefaultProcessor3D + { + private: + /// inverse of EyeToView for rasterconversion with evtl. Phong shading + basegfx::B3DHomMatrix maInvEyeToView; + + /// The raster converter for Z-Buffer + std::unique_ptr<ZBufferRasterConverter3D> mpZBufferRasterConverter3D; + + /* AA value. Defines how many oversamples will be used in X and Y. Values 0, 1 + will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + */ + sal_uInt16 mnAntiAlialize; + + /* remembered RasterPrimitive3D's which need to be painted back to front + for transparent 3D parts + */ + std::unique_ptr<std::vector< RasterPrimitive3D >> mpRasterPrimitive3Ds; + + sal_uInt32 mnStartLine; + sal_uInt32 mnStopLine; + + // rasterconversions for filled and non-filled polygons + + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const override; + virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const override; + + public: + ZBufferProcessor3D( + const geometry::ViewInformation3D& rViewInformation3D, + const attribute::SdrSceneAttribute& rSdrSceneAttribute, + const attribute::SdrLightingAttribute& rSdrLightingAttribute, + const basegfx::B2DRange& rVisiblePart, + sal_uInt16 nAntiAlialize, + double fFullViewSizeX, + double fFullViewSizeY, + basegfx::BZPixelRaster& rBZPixelRaster, + sal_uInt32 nStartLine, + sal_uInt32 nStopLine); + virtual ~ZBufferProcessor3D() override; + + void finish(); + }; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/texture/texture.hxx b/drawinglayer/inc/texture/texture.hxx new file mode 100644 index 000000000..24e23a4b2 --- /dev/null +++ b/drawinglayer/inc/texture/texture.hxx @@ -0,0 +1,267 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/utils/gradienttools.hxx> +#include <vector> +#include <functional> + +namespace drawinglayer::texture +{ + class GeoTexSvx + { + public: + GeoTexSvx(); + virtual ~GeoTexSvx(); + + // compare operator + virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const; + bool operator!=(const GeoTexSvx& rGeoTexSvx) const { return !operator==(rGeoTexSvx); } + + // virtual base methods + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; + }; + + /// helper class for processing equal number of matrices and colors + /// for texture processing + struct B2DHomMatrixAndBColor + { + basegfx::B2DHomMatrix maB2DHomMatrix; + basegfx::BColor maBColor; + }; + + class GeoTexSvxGradient : public GeoTexSvx + { + protected: + basegfx::ODFGradientInfo maGradientInfo; + basegfx::B2DRange maDefinitionRange; + basegfx::BColor maStart; + basegfx::BColor maEnd; + double mfBorder; + + public: + GeoTexSvxGradient( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + double fBorder); + virtual ~GeoTexSvxGradient() override; + + // compare operator + virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const override; + + // virtual base methods + virtual void appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOuterColor) = 0; + }; + + class GeoTexSvxGradientLinear final : public GeoTexSvxGradient + { + double mfUnitMinX; + double mfUnitWidth; + double mfUnitMaxY; + + public: + GeoTexSvxGradientLinear( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rOutputRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fAngle); + virtual ~GeoTexSvxGradientLinear() override; + + virtual void appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOuterColor) override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + }; + + class GeoTexSvxGradientAxial final : public GeoTexSvxGradient + { + double mfUnitMinX; + double mfUnitWidth; + + public: + GeoTexSvxGradientAxial( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rOutputRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fAngle); + virtual ~GeoTexSvxGradientAxial() override; + + virtual void appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOuterColor) override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + }; + + class GeoTexSvxGradientRadial final : public GeoTexSvxGradient + { + public: + GeoTexSvxGradientRadial( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY); + virtual ~GeoTexSvxGradientRadial() override; + + virtual void appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOuterColor) override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + }; + + class GeoTexSvxGradientElliptical final : public GeoTexSvxGradient + { + public: + GeoTexSvxGradientElliptical( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle); + virtual ~GeoTexSvxGradientElliptical() override; + + virtual void appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOuterColor) override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + }; + + class GeoTexSvxGradientSquare final : public GeoTexSvxGradient + { + public: + GeoTexSvxGradientSquare( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle); + virtual ~GeoTexSvxGradientSquare() override; + + virtual void appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOuterColor) override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + }; + + class GeoTexSvxGradientRect final : public GeoTexSvxGradient + { + public: + GeoTexSvxGradientRect( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle); + virtual ~GeoTexSvxGradientRect() override; + + virtual void appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOuterColor) override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + }; + + class GeoTexSvxHatch final : public GeoTexSvx + { + basegfx::B2DRange maOutputRange; + basegfx::B2DHomMatrix maTextureTransform; + basegfx::B2DHomMatrix maBackTextureTransform; + double mfDistance; + double mfAngle; + sal_uInt32 mnSteps; + + bool mbDefinitionRangeEqualsOutputRange : 1; + + public: + GeoTexSvxHatch( + const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rOutputRange, + double fDistance, + double fAngle); + virtual ~GeoTexSvxHatch() override; + + // compare operator + virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const override; + + void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + double getDistanceToHatch(const basegfx::B2DPoint& rUV) const; + const basegfx::B2DHomMatrix& getBackTextureTransform() const; + }; + + // This class applies a tiling to the unit range. The given range + // will be repeated inside the unit range in X and Y and for each + // tile a matrix will be created (by appendTransformations) that + // represents the needed transformation to map a filling in unit + // coordinates to that tile. + // When offsetX is given, every 2nd line will be offsetted by the + // given percentage value (offsetX has to be 0.0 <= offsetX <= 1.0). + // Accordingly to offsetY. If both are given, offsetX is preferred + // and offsetY is ignored. + class GeoTexSvxTiled final : public GeoTexSvx + { + basegfx::B2DRange maRange; + double mfOffsetX; + double mfOffsetY; + + public: + GeoTexSvxTiled( + const basegfx::B2DRange& rRange, + double fOffsetX = 0.0, + double fOffsetY = 0.0); + virtual ~GeoTexSvxTiled() override; + + // compare operator + virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const override; + + // Iterate over created tiles with callback provided. + void iterateTiles(std::function<void(double fPosX, double fPosY)> aFunc) const; + + void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) const; + sal_uInt32 getNumberOfTiles() const; + }; +} // end of namespace drawinglayer::texture + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/texture/texture3d.hxx b/drawinglayer/inc/texture/texture3d.hxx new file mode 100644 index 000000000..47ef9ff45 --- /dev/null +++ b/drawinglayer/inc/texture/texture3d.hxx @@ -0,0 +1,143 @@ +/* -*- 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 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <texture/texture.hxx> +#include <vcl/bitmapex.hxx> + +namespace drawinglayer::primitive3d { + class HatchTexturePrimitive3D; +} + +namespace drawinglayer +{ + namespace texture + { + class GeoTexSvxMono final : public GeoTexSvx + { + basegfx::BColor maSingleColor; + double mfOpacity; + + public: + GeoTexSvxMono( + const basegfx::BColor& rSingleColor, + double fOpacity); + + // compare operator + virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +namespace drawinglayer +{ + namespace texture + { + class GeoTexSvxBitmapEx : public GeoTexSvx + { + protected: + BitmapEx maBitmapEx; + Bitmap maBitmap; // Bitmap held within maBitmapEx, to exist during mpReadBitmap scope + Bitmap::ScopedReadAccess mpReadBitmap; + Bitmap maTransparence; + Bitmap::ScopedReadAccess mpReadTransparence; + basegfx::B2DPoint maTopLeft; + basegfx::B2DVector maSize; + double mfMulX; + double mfMulY; + + bool mbIsAlpha : 1; + bool mbIsTransparent : 1; + + // helpers + bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const; + sal_uInt8 impGetTransparence(sal_Int32 rX, sal_Int32 rY) const; + + public: + GeoTexSvxBitmapEx( + const BitmapEx& rBitmapEx, + const basegfx::B2DRange& rRange); + virtual ~GeoTexSvxBitmapEx() override; + + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +namespace drawinglayer +{ + namespace texture + { + class GeoTexSvxBitmapExTiled final : public GeoTexSvxBitmapEx + { + double mfOffsetX; + double mfOffsetY; + + bool mbUseOffsetX : 1; + bool mbUseOffsetY : 1; + + // helpers + basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const; + + public: + GeoTexSvxBitmapExTiled( + const BitmapEx& rBitmapEx, + const basegfx::B2DRange& rRange, + double fOffsetX, + double fOffsetY); + + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +namespace drawinglayer +{ + namespace texture + { + class GeoTexSvxMultiHatch final : public GeoTexSvx + { + basegfx::BColor maColor; + double mfLogicPixelSize; + std::unique_ptr<GeoTexSvxHatch> mp0; + std::unique_ptr<GeoTexSvxHatch> mp1; + std::unique_ptr<GeoTexSvxHatch> mp2; + + bool mbFillBackground : 1; + + // helpers + bool impIsOnHatch(const basegfx::B2DPoint& rUV) const; + + public: + GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize); + virtual ~GeoTexSvxMultiHatch() override; + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; + virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/inc/wmfemfhelper.hxx b/drawinglayer/inc/wmfemfhelper.hxx new file mode 100644 index 000000000..214d2a5d7 --- /dev/null +++ b/drawinglayer/inc/wmfemfhelper.hxx @@ -0,0 +1,222 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <vcl/font.hxx> +#include <vcl/outdevstate.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <memory> + +// predefines +namespace drawinglayer::geometry { class ViewInformation2D; } +class GDIMetaFile; +namespace wmfemfhelper { class PropertyHolder; } + +namespace wmfemfhelper +{ + /** Helper class to buffer and hold a Primitive target vector. It + encapsulates the new/delete functionality and allows to work + on pointers of the implementation classes. All data will + be converted to uno sequences of uno references when accessing the + data. + */ + class TargetHolder + { + private: + std::vector< std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> > aTargets; + + public: + TargetHolder(); + ~TargetHolder(); + sal_uInt32 size() const; + void append(std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> pCandidate); + drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequence(const PropertyHolder& rPropertyHolder); + }; +} + +namespace wmfemfhelper +{ + /** Helper class which builds a stack on the TargetHolder class */ + class TargetHolders + { + private: + std::vector< TargetHolder* > maTargetHolders; + + public: + TargetHolders(); + sal_uInt32 size() const; + void Push(); + void Pop(); + TargetHolder& Current(); + ~TargetHolders(); + }; +} + +namespace wmfemfhelper +{ + /** helper class for graphic context + + This class allows to hold a complete representation of classic + VCL OutputDevice state. This data is needed for correct + interpretation of the MetaFile action flow. + */ + class PropertyHolder + { + private: + /// current transformation (aka MapMode) + basegfx::B2DHomMatrix maTransformation; + MapUnit maMapUnit; + + /// current colors + basegfx::BColor maLineColor; + basegfx::BColor maFillColor; + basegfx::BColor maTextColor; + basegfx::BColor maTextFillColor; + basegfx::BColor maTextLineColor; + basegfx::BColor maOverlineColor; + + /// clipping + basegfx::B2DPolyPolygon maClipPolyPoygon; + + /// font, etc. + vcl::Font maFont; + RasterOp maRasterOp; + ComplexTextLayoutFlags mnLayoutMode; + LanguageType maLanguageType; + PushFlags mnPushFlags; + + /// contains all active markers + bool mbLineColor : 1; + bool mbFillColor : 1; + bool mbTextColor : 1; + bool mbTextFillColor : 1; + bool mbTextLineColor : 1; + bool mbOverlineColor : 1; + bool mbClipPolyPolygonActive : 1; + + public: + PropertyHolder(); + + /// read/write accesses + const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } + void setTransformation(const basegfx::B2DHomMatrix& rNew) { if (rNew != maTransformation) maTransformation = rNew; } + + MapUnit getMapUnit() const { return maMapUnit; } + void setMapUnit(MapUnit eNew) { if (eNew != maMapUnit) maMapUnit = eNew; } + + const basegfx::BColor& getLineColor() const { return maLineColor; } + void setLineColor(const basegfx::BColor& rNew) { if (rNew != maLineColor) maLineColor = rNew; } + bool getLineColorActive() const { return mbLineColor; } + void setLineColorActive(bool bNew) { if (bNew != mbLineColor) mbLineColor = bNew; } + + const basegfx::BColor& getFillColor() const { return maFillColor; } + void setFillColor(const basegfx::BColor& rNew) { if (rNew != maFillColor) maFillColor = rNew; } + bool getFillColorActive() const { return mbFillColor; } + void setFillColorActive(bool bNew) { if (bNew != mbFillColor) mbFillColor = bNew; } + + const basegfx::BColor& getTextColor() const { return maTextColor; } + void setTextColor(const basegfx::BColor& rNew) { if (rNew != maTextColor) maTextColor = rNew; } + bool getTextColorActive() const { return mbTextColor; } + void setTextColorActive(bool bNew) { if (bNew != mbTextColor) mbTextColor = bNew; } + + const basegfx::BColor& getTextFillColor() const { return maTextFillColor; } + void setTextFillColor(const basegfx::BColor& rNew) { if (rNew != maTextFillColor) maTextFillColor = rNew; } + bool getTextFillColorActive() const { return mbTextFillColor; } + void setTextFillColorActive(bool bNew) { if (bNew != mbTextFillColor) mbTextFillColor = bNew; } + + const basegfx::BColor& getTextLineColor() const { return maTextLineColor; } + void setTextLineColor(const basegfx::BColor& rNew) { if (rNew != maTextLineColor) maTextLineColor = rNew; } + bool getTextLineColorActive() const { return mbTextLineColor; } + void setTextLineColorActive(bool bNew) { if (bNew != mbTextLineColor) mbTextLineColor = bNew; } + + const basegfx::BColor& getOverlineColor() const { return maOverlineColor; } + void setOverlineColor(const basegfx::BColor& rNew) { if (rNew != maOverlineColor) maOverlineColor = rNew; } + bool getOverlineColorActive() const { return mbOverlineColor; } + void setOverlineColorActive(bool bNew) { if (bNew != mbOverlineColor) mbOverlineColor = bNew; } + + const basegfx::B2DPolyPolygon& getClipPolyPolygon() const { return maClipPolyPoygon; } + void setClipPolyPolygon(const basegfx::B2DPolyPolygon& rNew) { if (rNew != maClipPolyPoygon) maClipPolyPoygon = rNew; } + bool getClipPolyPolygonActive() const { return mbClipPolyPolygonActive; } + void setClipPolyPolygonActive(bool bNew) { if (bNew != mbClipPolyPolygonActive) mbClipPolyPolygonActive = bNew; } + + const vcl::Font& getFont() const { return maFont; } + void setFont(const vcl::Font& rFont) { if (rFont != maFont) maFont = rFont; } + + const RasterOp& getRasterOp() const { return maRasterOp; } + void setRasterOp(const RasterOp& rRasterOp) { if (rRasterOp != maRasterOp) maRasterOp = rRasterOp; } + bool isRasterOpInvert() const { return (RasterOp::Xor == maRasterOp || RasterOp::Invert == maRasterOp); } + bool isRasterOpForceBlack() const { return RasterOp::N0 == maRasterOp; } + bool isRasterOpActive() const { return isRasterOpInvert() || isRasterOpForceBlack(); } + + ComplexTextLayoutFlags getLayoutMode() const { return mnLayoutMode; } + void setLayoutMode(ComplexTextLayoutFlags nNew) { if (nNew != mnLayoutMode) mnLayoutMode = nNew; } + + LanguageType getLanguageType() const { return maLanguageType; } + void setLanguageType(LanguageType aNew) { if (aNew != maLanguageType) maLanguageType = aNew; } + + PushFlags getPushFlags() const { return mnPushFlags; } + void setPushFlags(PushFlags nNew) { if (nNew != mnPushFlags) mnPushFlags = nNew; } + + bool getLineOrFillActive() const { return (mbLineColor || mbFillColor); } + }; +} + +namespace wmfemfhelper +{ + /** stack for properties + + This class builds a stack based on the PropertyHolder + class. It encapsulates the pointer/new/delete usage to + make it safe and implements the push/pop as needed by a + VCL Metafile interpreter. The critical part here are the + flag values VCL OutputDevice uses here; not all stuff is + pushed and thus needs to be copied at pop. + */ + class PropertyHolders + { + private: + std::vector< PropertyHolder* > maPropertyHolders; + + public: + PropertyHolders(); + void PushDefault(); + void Push(PushFlags nPushFlags); + void Pop(); + PropertyHolder& Current(); + ~PropertyHolders(); + }; +} + +namespace wmfemfhelper +{ + drawinglayer::primitive2d::Primitive2DContainer interpretMetafile( + const GDIMetaFile& rMetaFile, + const drawinglayer::geometry::ViewInformation2D& rViewInformation); + + void HandleNewClipRegion( + const basegfx::B2DPolyPolygon& rClipPolyPolygon, + TargetHolders& rTargetHolders, + PropertyHolders& rPropertyHolders); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |