diff options
author | Armin Le Grand <alg@apache.org> | 2012-10-16 08:44:02 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-10-16 08:44:02 +0000 |
commit | 7a652a2b2ab5e0d37e32185c8c5fac3af482bb76 (patch) | |
tree | 3cf859e86a5d4ba2a39e75d1f5bc65a5d8bc10b2 /drawinglayer/inc | |
parent | 9d483a7b084404ed9df6525f09a3bb600a5859f8 (diff) |
#121194# Better support for graphic fill styles which are not bitmaps (svg, metafiles, ..)
Notes
Notes:
merged as: 37aa7d81aacaae12dfe0fd2ade2779235bbf72f1
Diffstat (limited to 'drawinglayer/inc')
12 files changed, 182 insertions, 227 deletions
diff --git a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillgraphicattribute.hxx index 776b3483b791..9e70ef79b026 100644..100755 --- a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fillgraphicattribute.hxx @@ -21,22 +21,21 @@ -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX #include <drawinglayer/drawinglayerdllapi.h> ////////////////////////////////////////////////////////////////////////////// // predefines -class BitmapEx; +class Graphic; namespace basegfx { - class B2DPoint; - class B2DVector; + class B2DRange; } namespace drawinglayer { namespace attribute { - class ImpFillBitmapAttribute; + class ImpFillGraphicAttribute; }} ////////////////////////////////////////////////////////////////////////////// @@ -45,40 +44,42 @@ namespace drawinglayer { namespace attribute { - class DRAWINGLAYER_DLLPUBLIC FillBitmapAttribute + class DRAWINGLAYER_DLLPUBLIC FillGraphicAttribute { private: - ImpFillBitmapAttribute* mpFillBitmapAttribute; + ImpFillGraphicAttribute* mpFillGraphicAttribute; public: /// constructors/assignmentoperator/destructor - FillBitmapAttribute( - const BitmapEx& rBitmapEx, - const basegfx::B2DPoint& rTopLeft, - const basegfx::B2DVector& rSize, - bool bTiling); - FillBitmapAttribute(); - FillBitmapAttribute(const FillBitmapAttribute& rCandidate); - FillBitmapAttribute& operator=(const FillBitmapAttribute& rCandidate); - ~FillBitmapAttribute(); + 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 FillBitmapAttribute& rCandidate) const; + bool operator==(const FillGraphicAttribute& rCandidate) const; // data read access - const BitmapEx& getBitmapEx() const; - const basegfx::B2DPoint& getTopLeft() const; - const basegfx::B2DVector& getSize() const; + 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_FILLBITMAPATTRIBUTE_HXX +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX // eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx index bb1576023172..ecf15e0c80ae 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx @@ -34,7 +34,7 @@ namespace drawinglayer { namespace attribute { class ImpSdrFillAttribute; class FillGradientAttribute; class FillHatchAttribute; - class SdrFillBitmapAttribute; + class SdrFillGraphicAttribute; }} ////////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,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); @@ -72,7 +72,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/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx index 6a9e9c4a9121..3a4acac21a80 100644..100755 --- a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx @@ -21,15 +21,15 @@ -#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> ////////////////////////////////////////////////////////////////////////////// // predefines -class BitmapEx; +class Graphic; namespace basegfx { class B2DRange; @@ -37,8 +37,8 @@ namespace basegfx { } namespace drawinglayer { namespace attribute { - class FillBitmapAttribute; - class ImpSdrFillBitmapAttribute; + class FillGraphicAttribute; + class ImpSdrFillGraphicAttribute; }} ////////////////////////////////////////////////////////////////////////////// @@ -47,15 +47,15 @@ namespace drawinglayer { namespace attribute { - class DRAWINGLAYER_DLLPUBLIC SdrFillBitmapAttribute + class DRAWINGLAYER_DLLPUBLIC SdrFillGraphicAttribute { private: - ImpSdrFillBitmapAttribute* mpSdrFillBitmapAttribute; + ImpSdrFillGraphicAttribute* 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,19 +63,19 @@ 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; @@ -84,14 +84,14 @@ namespace drawinglayer 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 // eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index aac9dfb7e170..bc80af9cb3f3 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -44,7 +44,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) @@ -65,7 +65,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/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx index 0ce8a3683bda..6658e6d01b43 100644..100755 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx @@ -21,13 +21,13 @@ -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX +#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/fillbitmapattribute.hxx> +#include <drawinglayer/attribute/fillgraphicattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // FillbitmapPrimitive2D class @@ -36,10 +36,10 @@ namespace drawinglayer { namespace primitive2d { - /** FillBitmapPrimitive2D class + /** FillGraphicPrimitive2D class This class defines a bitmap filling for a rectangular area. The - Range is defined by the Transformation, the fill by the FillBitmapAttribute. + 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 @@ -49,14 +49,14 @@ namespace drawinglayer 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 FillBitmapPrimitive2D : public BufferedDecompositionPrimitive2D + class DRAWINGLAYER_DLLPUBLIC FillGraphicPrimitive2D : public BufferedDecompositionPrimitive2D { private: /// the geometric definition basegfx::B2DHomMatrix maTransformation; /// the fill attributes - attribute::FillBitmapAttribute maFillBitmap; + attribute::FillGraphicAttribute maFillGraphic; protected: /// local decomposition. @@ -64,13 +64,13 @@ namespace drawinglayer public: /// constructor - FillBitmapPrimitive2D( + FillGraphicPrimitive2D( const basegfx::B2DHomMatrix& rTransformation, - const attribute::FillBitmapAttribute& rFillBitmap); + const attribute::FillGraphicAttribute& rFillGraphic); /// data read access const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } - const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; } + const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; } /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; @@ -86,7 +86,7 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRAPHICPRIMITIVE2D_HXX ////////////////////////////////////////////////////////////////////////////// // eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx new file mode 100755 index 000000000000..e47ad3e331d7 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx @@ -0,0 +1,60 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + + + +#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. + + #121194# 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 + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index ebd3a7361506..1fd133d3f629 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -26,7 +26,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> @@ -391,26 +391,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. @@ -418,13 +418,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/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index 8dc7cbe66d09..0422251837ca 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -26,7 +26,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> @@ -172,19 +172,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/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx deleted file mode 100644 index 2b3851899448..000000000000 --- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX -#define _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX - -#include <drawinglayer/drawinglayerdllapi.h> -#include <drawinglayer/processor2d/baseprocessor2d.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/color/bcolormodifier.hxx> -#include <svtools/optionsdrawinglayer.hxx> -#include <com/sun/star/rendering/ViewState.hpp> -#include <com/sun/star/rendering/RenderState.hpp> -#include <i18npool/lang.h> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <vcl/mapmod.hxx> - -////////////////////////////////////////////////////////////////////////////// -// forward declaration - -namespace basegfx { - class BColor; - class B2DPolygon; -} - -namespace com { namespace sun { namespace star { namespace rendering { - class XCanvas; - class XPolyPolygon2D; -}}}} - -namespace drawinglayer { namespace primitive2d { - class MaskPrimitive2D; - class MetafilePrimitive2D; - class TextSimplePortionPrimitive2D; - class BitmapPrimitive2D; - class TransparencePrimitive2D; - class PolygonStrokePrimitive2D; - class FillBitmapPrimitive2D; - class UnifiedTransparencePrimitive2D; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace processor2d - { - /** canvasProcessor2D class - - A basic implementation of a renderer for com::sun::star::rendering::XCanvas - as a target - */ - class DRAWINGLAYER_DLLPUBLIC canvasProcessor2D : public BaseProcessor2D - { - private: - // the (current) destination OutDev and canvas - OutputDevice* mpOutputDevice; - com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > mxCanvas; - com::sun::star::rendering::ViewState maViewState; - com::sun::star::rendering::RenderState maRenderState; - - // the modifiedColorPrimitive stack - basegfx::BColorModifierStack maBColorModifierStack; - - // SvtOptionsDrawinglayer incarnation to react on diverse settings - const SvtOptionsDrawinglayer maDrawinglayerOpt; - - // the current clipping PolyPolygon from MaskPrimitive2D, always in - // object coordinates - basegfx::B2DPolyPolygon maClipPolyPolygon; - - // determined LanguageType - LanguageType meLang; - - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive2D-based. - virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); - - // direct primitive renderer support - void impRenderMaskPrimitive2D(const primitive2d::MaskPrimitive2D& rMaskCandidate); - void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate); - void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); - void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); - void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate); - void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive); - void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D); - void impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate); - - public: - canvasProcessor2D( - const geometry::ViewInformation2D& rViewInformation, - OutputDevice& rOutDev); - virtual ~canvasProcessor2D(); - - // access to Drawinglayer configuration options - const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; } - }; - } // end of namespace processor2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //_DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index 41fc262299e4..286995436b9a 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -38,9 +38,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; @@ -96,9 +96,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/drawinglayer/inc/drawinglayer/texture/texture.hxx b/drawinglayer/inc/drawinglayer/texture/texture.hxx index d5a4721f6112..aa62d1eb3d58 100644 --- a/drawinglayer/inc/drawinglayer/texture/texture.hxx +++ b/drawinglayer/inc/drawinglayer/texture/texture.hxx @@ -309,16 +309,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/drawinglayer/inc/drawinglayer/texture/texture3d.hxx b/drawinglayer/inc/drawinglayer/texture/texture3d.hxx index bda0b17b4c77..33173fc2cf43 100644 --- a/drawinglayer/inc/drawinglayer/texture/texture3d.hxx +++ b/drawinglayer/inc/drawinglayer/texture/texture3d.hxx @@ -26,7 +26,7 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/texture/texture.hxx> -#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -48,7 +48,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; @@ -64,22 +66,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; }; @@ -92,30 +104,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; }; |