diff options
Diffstat (limited to 'include/drawinglayer')
4 files changed, 95 insertions, 35 deletions
diff --git a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index 515d1f60934d..1bf2260327b0 100644 --- a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -55,8 +55,12 @@ namespace drawinglayer class DRAWINGLAYER_DLLPUBLIC FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D { private: - /// the geometric definition - basegfx::B2DRange maObjectRange; + /// the geometrically visible area + basegfx::B2DRange maOutputRange; + + /// the area the gradient definition is based on + /// in the simplest case identical to OutputRange + basegfx::B2DRange maDefinitionRange; /// the gradient definition attribute::FillGradientAttribute maFillGradient; @@ -64,14 +68,14 @@ namespace drawinglayer /// local helpers void generateMatricesAndColors( std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) const; + basegfx::BColor& rOuterColor) const; Primitive2DSequence createOverlappingFill( const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, - const basegfx::BColor& rOutmostColor, + const basegfx::BColor& rOuterColor, const basegfx::B2DPolygon& rUnitPolygon) const; Primitive2DSequence createNonOverlappingFill( const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, - const basegfx::BColor& rOutmostColor, + const basegfx::BColor& rOuterColor, const basegfx::B2DPolygon& rUnitPolygon) const; protected: @@ -82,13 +86,18 @@ namespace drawinglayer virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE; public: - /// constructor + /// constructors. The one without definition range will use output range as definition range + FillGradientPrimitive2D( + const basegfx::B2DRange& rOutputRange, + const attribute::FillGradientAttribute& rFillGradient); FillGradientPrimitive2D( - const basegfx::B2DRange& rObjectRange, + const basegfx::B2DRange& rOutputRange, + const basegfx::B2DRange& rDefinitionRange, const attribute::FillGradientAttribute& rFillGradient); /// data read access - const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } + const basegfx::B2DRange& getOutputRange() const { return maOutputRange; } + const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; } /// compare operator diff --git a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 9234cec15857..a7648a64f3e4 100644 --- a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -51,8 +51,12 @@ namespace drawinglayer class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D : public DiscreteMetricDependentPrimitive2D { private: - /// the geometric definition - basegfx::B2DRange maObjectRange; + /// the geometrically visible area + basegfx::B2DRange maOutputRange; + + /// the area the gradient definition is based on + /// in the simplest case identical to OutputRange + basegfx::B2DRange maDefinitionRange; /// the hatch definition attribute::FillHatchAttribute maFillHatch; @@ -65,14 +69,20 @@ namespace drawinglayer virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE; public: - /// constructor + /// constructors. The one without definition range will use output range as definition range + FillHatchPrimitive2D( + const basegfx::B2DRange& rOutputRange, + const basegfx::BColor& rBColor, + const attribute::FillHatchAttribute& rFillHatch); FillHatchPrimitive2D( - const basegfx::B2DRange& rObjectRange, + const basegfx::B2DRange& rOutputRange, + const basegfx::B2DRange& rDefinitionRange, const basegfx::BColor& rBColor, const attribute::FillHatchAttribute& rFillHatch); /// data read access - const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } + const basegfx::B2DRange& getOutputRange() const { return maOutputRange; } + const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; } const basegfx::BColor& getBColor() const { return maBColor; } diff --git a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 972972727f91..46579cb3b904 100644 --- a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -44,7 +44,7 @@ namespace drawinglayer This primitive defines a multi-PolygonHairlinePrimitive2D and is just for convenience. The definition is not different from the single - defined PolygonHairlinePrimitive2Ds. + defined PolygonHairlinePrimitive2Ds. */ class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D { @@ -255,6 +255,9 @@ namespace drawinglayer /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; + /// the definition range + basegfx::B2DRange maDefinitionRange; + /// the gradient definition attribute::FillGradientAttribute maFillGradient; @@ -263,13 +266,18 @@ namespace drawinglayer virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE; public: - /// constructor + /// constructors. The one without definition range will use output range as definition range + PolyPolygonGradientPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::FillGradientAttribute& rFillGradient); PolyPolygonGradientPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DRange& rDefinitionRange, const attribute::FillGradientAttribute& rFillGradient); /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; } /// compare operator @@ -300,6 +308,9 @@ namespace drawinglayer /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; + /// the definition range + basegfx::B2DRange maDefinitionRange; + /// the hatch background color (if used) basegfx::BColor maBackgroundColor; @@ -311,14 +322,20 @@ namespace drawinglayer virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE; public: - /// constructor + /// constructors. The one without definition range will use output range as definition range + PolyPolygonHatchPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::BColor& rBackgroundColor, + const attribute::FillHatchAttribute& rFillHatch); PolyPolygonHatchPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DRange& rDefinitionRange, const basegfx::BColor& rBackgroundColor, const attribute::FillHatchAttribute& rFillHatch); /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; } const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; } @@ -350,6 +367,9 @@ namespace drawinglayer /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; + /// the definition range + basegfx::B2DRange maDefinitionRange; + /// the bitmap fill definition (may include tiling) attribute::FillGraphicAttribute maFillGraphic; @@ -358,13 +378,18 @@ namespace drawinglayer virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE; public: - /// constructor + /// constructors. The one without definition range will use output range as definition range + PolyPolygonGraphicPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::FillGraphicAttribute& rFillGraphic); PolyPolygonGraphicPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DRange& rDefinitionRange, const attribute::FillGraphicAttribute& rFillGraphic); /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; } /// compare operator diff --git a/include/drawinglayer/texture/texture.hxx b/include/drawinglayer/texture/texture.hxx index 0fa666d19411..daa0348103a3 100644 --- a/include/drawinglayer/texture/texture.hxx +++ b/include/drawinglayer/texture/texture.hxx @@ -76,14 +76,14 @@ namespace drawinglayer { protected: basegfx::ODFGradientInfo maGradientInfo; - basegfx::B2DRange maTargetRange; + basegfx::B2DRange maDefinitionRange; basegfx::BColor maStart; basegfx::BColor maEnd; double mfBorder; public: GeoTexSvxGradient( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -96,7 +96,7 @@ namespace drawinglayer // virtual base methods virtual void appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) = 0; + basegfx::BColor& rOuterColor) = 0; // data access const basegfx::BColor& getStart() const { return maStart; } @@ -113,9 +113,15 @@ namespace drawinglayer { class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear : public GeoTexSvxGradient { + protected: + double mfUnitMinX; + double mfUnitWidth; + double mfUnitMaxY; + public: GeoTexSvxGradientLinear( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rOutputRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -125,7 +131,7 @@ namespace drawinglayer virtual void appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) SAL_OVERRIDE; + basegfx::BColor& rOuterColor) SAL_OVERRIDE; virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const SAL_OVERRIDE; }; } // end of namespace texture @@ -139,9 +145,14 @@ namespace drawinglayer { class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial : public GeoTexSvxGradient { + protected: + double mfUnitMinX; + double mfUnitWidth; + public: GeoTexSvxGradientAxial( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rOutputRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -151,7 +162,7 @@ namespace drawinglayer virtual void appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) SAL_OVERRIDE; + basegfx::BColor& rOuterColor) SAL_OVERRIDE; virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const SAL_OVERRIDE; }; } // end of namespace texture @@ -167,7 +178,7 @@ namespace drawinglayer { public: GeoTexSvxGradientRadial( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -178,7 +189,7 @@ namespace drawinglayer virtual void appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) SAL_OVERRIDE; + basegfx::BColor& rOuterColor) SAL_OVERRIDE; virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const SAL_OVERRIDE; }; } // end of namespace texture @@ -194,7 +205,7 @@ namespace drawinglayer { public: GeoTexSvxGradientElliptical( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -206,7 +217,7 @@ namespace drawinglayer virtual void appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) SAL_OVERRIDE; + basegfx::BColor& rOuterColor) SAL_OVERRIDE; virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const SAL_OVERRIDE; }; } // end of namespace texture @@ -222,7 +233,7 @@ namespace drawinglayer { public: GeoTexSvxGradientSquare( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -234,7 +245,7 @@ namespace drawinglayer virtual void appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) SAL_OVERRIDE; + basegfx::BColor& rOuterColor) SAL_OVERRIDE; virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const SAL_OVERRIDE; }; } // end of namespace texture @@ -250,7 +261,7 @@ namespace drawinglayer { public: GeoTexSvxGradientRect( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -262,7 +273,7 @@ namespace drawinglayer virtual void appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOutmostColor) SAL_OVERRIDE; + basegfx::BColor& rOuterColor) SAL_OVERRIDE; virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const SAL_OVERRIDE; }; } // end of namespace texture @@ -277,15 +288,20 @@ namespace drawinglayer class DRAWINGLAYER_DLLPUBLIC GeoTexSvxHatch : public GeoTexSvx { protected: + basegfx::B2DRange maOutputRange; basegfx::B2DHomMatrix maTextureTransform; basegfx::B2DHomMatrix maBackTextureTransform; double mfDistance; double mfAngle; sal_uInt32 mnSteps; + /// bitfield + bool mbDefinitionRangeEqualsOutputRange : 1; + public: GeoTexSvxHatch( - const basegfx::B2DRange& rTargetRange, + const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rOutputRange, double fDistance, double fAngle); virtual ~GeoTexSvxHatch(); @@ -293,7 +309,7 @@ namespace drawinglayer // compare operator virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const SAL_OVERRIDE; - virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); double getDistanceToHatch(const basegfx::B2DPoint& rUV) const; const basegfx::B2DHomMatrix& getBackTextureTransform() const; }; @@ -332,7 +348,7 @@ namespace drawinglayer // compare operator virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const SAL_OVERRIDE; - virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); }; } // end of namespace texture } // end of namespace drawinglayer |