diff options
author | Armin Le Grand <alg@apache.org> | 2012-10-16 08:44:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-11 20:00:34 +0100 |
commit | 37aa7d81aacaae12dfe0fd2ade2779235bbf72f1 (patch) | |
tree | baf84cf5f8fcf62221dd75869d507d2396ae690b /include/drawinglayer | |
parent | e72e1c110ad42b779afbe74b47ca35c1849e06b2 (diff) |
Resolves: #i121194# Better support for graphic fill styles...
which are not bitmaps (svg, metafiles, ..)
(cherry picked from commit 7a652a2b2ab5e0d37e32185c8c5fac3af482bb76)
Conflicts:
drawinglayer/Library_drawinglayer.mk
drawinglayer/Package_inc.mk
drawinglayer/inc/drawinglayer/attribute/fillgraphicattribute.hxx
drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx
drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
drawinglayer/inc/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx
drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx
drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
drawinglayer/inc/drawinglayer/texture/texture.hxx
drawinglayer/inc/drawinglayer/texture/texture3d.hxx
drawinglayer/source/attribute/fillbitmapattribute.cxx
drawinglayer/source/attribute/sdrfillattribute.cxx
drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx
drawinglayer/source/primitive2d/graphicprimitive2d.cxx
drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
drawinglayer/source/processor2d/canvasprocessor.cxx
svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
svx/source/sdr/contact/objectcontacttools.cxx
vcl/inc/vcl/graph.hxx
unused file _vclmetafileprocessor2d.cxx deleted, was added by error
(cherry picked from commit ed0d53f8283cd3ce579a90b599118884d0db6119)
Conflicts:
drawinglayer/source/processor2d/_vclmetafileprocessor2d.cxx
Corrected canvasProcessor usage
(cherry picked from commit 7903c33f31c457eb6ff506958c4233f2a5d39bcf)
Conflicts:
svx/source/sdr/contact/objectcontacttools.cxx
Change-Id: I80008050b98dafc92fde043524843c13a75fe22c
d2fa667d7c127b4d735334e56093d1d4553b0a5b
e20c60c7d6472da1295a162d9a629be998861f62
Diffstat (limited to 'include/drawinglayer')
-rw-r--r-- | include/drawinglayer/attribute/fillgraphicattribute.hxx | 85 | ||||
-rw-r--r-- | include/drawinglayer/attribute/sdrfillattribute.hxx | 6 | ||||
-rw-r--r-- | include/drawinglayer/attribute/sdrfillgraphicattribute.hxx (renamed from include/drawinglayer/attribute/sdrfillbitmapattribute.hxx) | 40 | ||||
-rw-r--r-- | include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx | 4 | ||||
-rw-r--r-- | include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx | 87 | ||||
-rw-r--r-- | include/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx | 54 | ||||
-rw-r--r-- | include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx | 18 | ||||
-rw-r--r-- | include/drawinglayer/primitive3d/textureprimitive3d.hxx | 8 | ||||
-rw-r--r-- | include/drawinglayer/processor2d/vclprocessor2d.hxx | 8 | ||||
-rw-r--r-- | include/drawinglayer/texture/texture.hxx | 19 | ||||
-rw-r--r-- | include/drawinglayer/texture/texture3d.hxx | 58 |
11 files changed, 316 insertions, 71 deletions
diff --git a/include/drawinglayer/attribute/fillgraphicattribute.hxx b/include/drawinglayer/attribute/fillgraphicattribute.hxx new file mode 100644 index 000000000000..55a8d8933f7d --- /dev/null +++ b/include/drawinglayer/attribute/fillgraphicattribute.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX + +#include <drawinglayer/drawinglayerdllapi.h> +#include <o3tl/cow_wrapper.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class Graphic; + +namespace basegfx { + class B2DRange; +} + +namespace drawinglayer { namespace attribute { + class ImpFillGraphicAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class DRAWINGLAYER_DLLPUBLIC FillGraphicAttribute + { + public: + typedef o3tl::cow_wrapper< ImpFillGraphicAttribute > ImplType; + + private: + ImplType mpFillGraphicAttribute; + + public: + /// constructors/assignmentoperator/destructor + FillGraphicAttribute( + const Graphic& rGraphic, + const basegfx::B2DRange& rGraphicRange, + bool bTiling = false, + double fOffsetX = 0.0, + double fOffsetY = 0.0); + FillGraphicAttribute(); + FillGraphicAttribute(const FillGraphicAttribute& rCandidate); + FillGraphicAttribute& operator=(const FillGraphicAttribute& rCandidate); + ~FillGraphicAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillGraphicAttribute& rCandidate) const; + + // data read access + const Graphic& getGraphic() const; + const basegfx::B2DRange& getGraphicRange() const; + bool getTiling() const; + double getOffsetX() const; + double getOffsetY() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/attribute/sdrfillattribute.hxx b/include/drawinglayer/attribute/sdrfillattribute.hxx index 7fd3d38c224e..a0dee88030bc 100644 --- a/include/drawinglayer/attribute/sdrfillattribute.hxx +++ b/include/drawinglayer/attribute/sdrfillattribute.hxx @@ -34,7 +34,7 @@ namespace drawinglayer { namespace attribute { class ImpSdrFillAttribute; class FillGradientAttribute; class FillHatchAttribute; - class SdrFillBitmapAttribute; + class SdrFillGraphicAttribute; }} ////////////////////////////////////////////////////////////////////////////// @@ -58,7 +58,7 @@ namespace drawinglayer const basegfx::BColor& rColor, const FillGradientAttribute& rGradient, const FillHatchAttribute& rHatch, - const SdrFillBitmapAttribute& rBitmap); + const SdrFillGraphicAttribute& rFillGraphic); SdrFillAttribute(); SdrFillAttribute(const SdrFillAttribute& rCandidate); SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate); @@ -75,7 +75,7 @@ namespace drawinglayer const basegfx::BColor& getColor() const; const FillGradientAttribute& getGradient() const; const FillHatchAttribute& getHatch() const; - const SdrFillBitmapAttribute& getBitmap() const; + const SdrFillGraphicAttribute& getFillGraphic() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx index 78417f3577c9..600db24f7cea 100644 --- a/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx +++ b/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx @@ -16,9 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLGRAPHICATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLGRAPHICATTRIBUTE_HXX #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> @@ -26,7 +25,7 @@ ////////////////////////////////////////////////////////////////////////////// // predefines -class BitmapEx; +class Graphic; namespace basegfx { class B2DRange; @@ -34,8 +33,8 @@ namespace basegfx { } namespace drawinglayer { namespace attribute { - class FillBitmapAttribute; - class ImpSdrFillBitmapAttribute; + class FillGraphicAttribute; + class ImpSdrFillGraphicAttribute; }} ////////////////////////////////////////////////////////////////////////////// @@ -44,18 +43,18 @@ namespace drawinglayer { namespace attribute { - class DRAWINGLAYER_DLLPUBLIC SdrFillBitmapAttribute + class DRAWINGLAYER_DLLPUBLIC SdrFillGraphicAttribute { public: - typedef o3tl::cow_wrapper< ImpSdrFillBitmapAttribute > ImplType; + typedef o3tl::cow_wrapper< ImpSdrFillGraphicAttribute > ImplType; private: - ImplType mpSdrFillBitmapAttribute; + ImplType mpSdrFillGraphicAttribute; public: /// constructors/assignmentoperator/destructor - SdrFillBitmapAttribute( - const BitmapEx& rBitmapEx, + SdrFillGraphicAttribute( + const Graphic& rFillGraphic, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, const basegfx::B2DVector& rOffsetPosition, @@ -63,34 +62,35 @@ namespace drawinglayer bool bTiling, bool bStretch, bool bLogSize); - SdrFillBitmapAttribute(); - SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate); - SdrFillBitmapAttribute& operator=(const SdrFillBitmapAttribute& rCandidate); - ~SdrFillBitmapAttribute(); + SdrFillGraphicAttribute(); + SdrFillGraphicAttribute(const SdrFillGraphicAttribute& rCandidate); + SdrFillGraphicAttribute& operator=(const SdrFillGraphicAttribute& rCandidate); + ~SdrFillGraphicAttribute(); // checks if the incarnation is default constructed bool isDefault() const; // compare operator - bool operator==(const SdrFillBitmapAttribute& rCandidate) const; + bool operator==(const SdrFillGraphicAttribute& rCandidate) const; // data read access - const BitmapEx& getBitmapEx() const; + const Graphic& getFillGraphic() const; const basegfx::B2DVector& getSize() const; const basegfx::B2DVector& getOffset() const; const basegfx::B2DVector& getOffsetPosition() const; const basegfx::B2DVector& getRectPoint() const; bool getTiling() const; bool getStretch() const; + bool getLogSize() const; - // FillBitmapAttribute generator - FillBitmapAttribute getFillBitmapAttribute(const basegfx::B2DRange& rRange) const; + // FillGraphicAttribute generator + FillGraphicAttribute createFillGraphicAttribute(const basegfx::B2DRange& rRange) const; }; } // end of namespace attribute } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLGRAPHICATTRIBUTE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index a3af5cbb04e1..c6467f482c70 100644 --- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -40,7 +40,7 @@ #define PRIMITIVE2D_ID_BITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 5) #define PRIMITIVE2D_ID_CONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 6) #define PRIMITIVE2D_ID_EMBEDDED3DPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 7) -#define PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 8) +#define PRIMITIVE2D_ID_FILLGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 8) #define PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 9) #define PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 10) #define PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 11) @@ -61,7 +61,7 @@ #define PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 26) #define PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 27) #define PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 28) -#define PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 29) +#define PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 29) #define PRIMITIVE2D_ID_SCENEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 30) #define PRIMITIVE2D_ID_SHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 31) #define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32) diff --git a/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx new file mode 100644 index 000000000000..17b8c5c6cac3 --- /dev/null +++ b/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRAPHICPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRAPHICPRIMITIVE2D_HXX + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/attribute/fillgraphicattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// FillbitmapPrimitive2D class + +namespace drawinglayer +{ + namespace primitive2d + { + /** FillGraphicPrimitive2D class + + This class defines a bitmap filling for a rectangular area. The + Range is defined by the Transformation, the fill by the FillGraphicAttribute. + There, the fill consists of a Bitmap (not transparent) defining the fill data + and a Point/Vector pair defining the relative position/size [0.0 .. 1.0] + inside the area where the bitmap is positioned. A flag defines then if this + is tiled or not. + + Renderers should handle this primitive; it has a geometrically correct + decomposition, but on pixel oututs the areas where the tiled pieces are + aligned tend to show up (one overlapping or empty pixel) + */ + class DRAWINGLAYER_DLLPUBLIC FillGraphicPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + /// the geometric definition + basegfx::B2DHomMatrix maTransformation; + + /// the fill attributes + attribute::FillGraphicAttribute maFillGraphic; + + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + FillGraphicPrimitive2D( + const basegfx::B2DHomMatrix& rTransformation, + const attribute::FillGraphicAttribute& rFillGraphic); + + /// data read access + const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } + const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + /// get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRAPHICPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx b/include/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx new file mode 100644 index 000000000000..9755a2dd21de --- /dev/null +++ b/include/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVEHELPER2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVEHELPER2D_HXX + +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class Graphic; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace 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. + */ + Primitive2DSequence create2DDecompositionOfGraphic( + const Graphic& rGraphic, + const basegfx::B2DHomMatrix& rTransform); + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVEHELPER2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 6284b8867eff..0679ce4deb8c 100644 --- a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -23,7 +23,7 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/attribute/fillbitmapattribute.hxx> +#include <drawinglayer/attribute/fillgraphicattribute.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <drawinglayer/attribute/lineattribute.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> @@ -331,26 +331,26 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -// PolyPolygonBitmapPrimitive2D class +// PolyPolygonGraphicPrimitive2D class namespace drawinglayer { namespace primitive2d { - /** PolyPolygonBitmapPrimitive2D class + /** PolyPolygonGraphicPrimitive2D class This primitive defines a PolyPolygon filled with bitmap data (including transparence). The decomosition will create a MaskPrimitive2D - containing a FillBitmapPrimitive2D. + containing a FillGraphicPrimitive2D. */ - class DRAWINGLAYER_DLLPUBLIC PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D + class DRAWINGLAYER_DLLPUBLIC PolyPolygonGraphicPrimitive2D : public BufferedDecompositionPrimitive2D { private: /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; /// the bitmap fill definition (may include tiling) - attribute::FillBitmapAttribute maFillBitmap; + attribute::FillGraphicAttribute maFillGraphic; protected: /// local decomposition. @@ -358,13 +358,13 @@ namespace drawinglayer public: /// constructor - PolyPolygonBitmapPrimitive2D( + PolyPolygonGraphicPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const attribute::FillBitmapAttribute& rFillBitmap); + const attribute::FillGraphicAttribute& rFillGraphic); /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } - const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; } + const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; } /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/include/drawinglayer/primitive3d/textureprimitive3d.hxx b/include/drawinglayer/primitive3d/textureprimitive3d.hxx index 4296f0fe5bbb..ab0798b0965b 100644 --- a/include/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/include/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -23,7 +23,7 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/primitive3d/groupprimitive3d.hxx> -#include <drawinglayer/attribute/fillbitmapattribute.hxx> +#include <drawinglayer/attribute/fillgraphicattribute.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/vector/b2dvector.hxx> #include <drawinglayer/attribute/fillgradientattribute.hxx> @@ -169,19 +169,19 @@ namespace drawinglayer { private: /// bitmap fill attribute - attribute::FillBitmapAttribute maFillBitmapAttribute; + attribute::FillGraphicAttribute maFillGraphicAttribute; public: /// constructor BitmapTexturePrimitive3D( - const attribute::FillBitmapAttribute& rFillBitmapAttribute, + const attribute::FillGraphicAttribute& rFillGraphicAttribute, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter); /// data read access - const attribute::FillBitmapAttribute& getFillBitmapAttribute() const { return maFillBitmapAttribute; } + const attribute::FillGraphicAttribute& getFillGraphicAttribute() const { return maFillGraphicAttribute; } /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; diff --git a/include/drawinglayer/processor2d/vclprocessor2d.hxx b/include/drawinglayer/processor2d/vclprocessor2d.hxx index 32dafbc42b0a..aa0d8782fa3c 100644 --- a/include/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/include/drawinglayer/processor2d/vclprocessor2d.hxx @@ -35,9 +35,9 @@ namespace drawinglayer { namespace primitive2d { class TextSimplePortionPrimitive2D; class PolygonHairlinePrimitive2D; class BitmapPrimitive2D; - class FillBitmapPrimitive2D; + class FillGraphicPrimitive2D; class PolyPolygonGradientPrimitive2D; - class PolyPolygonBitmapPrimitive2D; + class PolyPolygonGraphicPrimitive2D; class PolyPolygonColorPrimitive2D; class MetafilePrimitive2D; class MaskPrimitive2D; @@ -93,9 +93,9 @@ namespace drawinglayer void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased); void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); - void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate); + void RenderFillGraphicPrimitive2D(const primitive2d::FillGraphicPrimitive2D& rFillBitmapCandidate); void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate); - void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate); + void RenderPolyPolygonGraphicPrimitive2D(const primitive2d::PolyPolygonGraphicPrimitive2D& rPolygonCandidate); void RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate); void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate); diff --git a/include/drawinglayer/texture/texture.hxx b/include/drawinglayer/texture/texture.hxx index b22e61d12be8..994a04f89e57 100644 --- a/include/drawinglayer/texture/texture.hxx +++ b/include/drawinglayer/texture/texture.hxx @@ -306,16 +306,27 @@ namespace drawinglayer { namespace texture { + // 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 ofsetted 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 DRAWINGLAYER_DLLPUBLIC GeoTexSvxTiled : public GeoTexSvx { protected: - basegfx::B2DPoint maTopLeft; - basegfx::B2DVector maSize; + basegfx::B2DRange maRange; + double mfOffsetX; + double mfOffsetY; public: GeoTexSvxTiled( - const basegfx::B2DPoint& rTopLeft, - const basegfx::B2DVector& rSize); + const basegfx::B2DRange& rRange, + double fOffsetX = 0.0, + double fOffsetY = 0.0); virtual ~GeoTexSvxTiled(); // compare operator diff --git a/include/drawinglayer/texture/texture3d.hxx b/include/drawinglayer/texture/texture3d.hxx index 713cea76c928..c51845c52220 100644 --- a/include/drawinglayer/texture/texture3d.hxx +++ b/include/drawinglayer/texture/texture3d.hxx @@ -23,7 +23,7 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/texture/texture.hxx> -#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -45,7 +45,9 @@ namespace drawinglayer double mfOpacity; public: - GeoTexSvxMono(const basegfx::BColor& rSingleColor, double fOpacity); + GeoTexSvxMono( + const basegfx::BColor& rSingleColor, + double fOpacity); // compare operator virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const; @@ -61,22 +63,32 @@ namespace drawinglayer { namespace texture { - class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmap : public GeoTexSvx + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapEx : public GeoTexSvx { protected: - Bitmap maBitmap; - BitmapReadAccess* mpRead; + BitmapEx maBitmapEx; + BitmapReadAccess* mpReadBitmap; + Bitmap maTransparence; + BitmapReadAccess* mpReadTransparence; basegfx::B2DPoint maTopLeft; basegfx::B2DVector maSize; double mfMulX; double mfMulY; + /// bitfield + 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: - GeoTexSvxBitmap(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize); - virtual ~GeoTexSvxBitmap(); + GeoTexSvxBitmapEx( + const BitmapEx& rBitmapEx, + const basegfx::B2DRange& rRange); + virtual ~GeoTexSvxBitmapEx(); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; }; @@ -89,30 +101,26 @@ namespace drawinglayer { namespace texture { - class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapTiled : public GeoTexSvxBitmap + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapExTiled : public GeoTexSvxBitmapEx { protected: - // helpers - basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const - { - double fX(fmod(rUV.getX() - maTopLeft.getX(), maSize.getX())); - double fY(fmod(rUV.getY() - maTopLeft.getY(), maSize.getY())); + double mfOffsetX; + double mfOffsetY; - if(fX < 0.0) - { - fX += maSize.getX(); - } + /// bitfield + bool mbUseOffsetX : 1; + bool mbUseOffsetY : 1; - if(fY < 0.0) - { - fY += maSize.getY(); - } - - return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY()); - } + // helpers + basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const; public: - GeoTexSvxBitmapTiled(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize); + GeoTexSvxBitmapExTiled( + const BitmapEx& rBitmapEx, + const basegfx::B2DRange& rRange, + double fOffsetX = 0.0, + double fOffsetY = 0.0); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; }; |