summaryrefslogtreecommitdiff
path: root/include/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-02 08:23:25 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-11 10:32:54 +0100
commit385bb4547359027bca6d5158e00e541f094b277e (patch)
treea160b457cc7f649669e5eaddf9b8731ebe64e910 /include/drawinglayer
parent0de49e5d365a0ca3e667bcdd68630296b5e840d6 (diff)
Resolves: #i120604# unified and secured gradient tooling for primitives
(cherry picked from commit 05785d283e718aab182a5ea848de72e4a4b2efe3) Conflicts: basegfx/inc/basegfx/tools/gradienttools.hxx basegfx/source/tools/gradienttools.cxx cppcanvas/source/mtfrenderer/implrenderer.cxx drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx drawinglayer/inc/drawinglayer/texture/texture.hxx drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx drawinglayer/source/processor2d/vclhelpergradient.cxx Change-Id: I21f94e7b4eede094171a83a009ae19213e77f22c Unname unused argument to prevent warnings. (cherry picked from commit f7d4af835cf308bc9ece6fd84cbd14ba5be0adcd) Change-Id: I44381f1e417c39dfbd1d4051079bbd09f0c61848
Diffstat (limited to 'include/drawinglayer')
-rw-r--r--include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx13
-rw-r--r--include/drawinglayer/texture/texture.hxx127
2 files changed, 107 insertions, 33 deletions
diff --git a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
index f953f9c01507..a15e4547bcda 100644
--- a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
@@ -24,6 +24,7 @@
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <drawinglayer/texture/texture.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -62,15 +63,15 @@ namespace drawinglayer
/// local helpers
void generateMatricesAndColors(
- std::vector< basegfx::B2DHomMatrix >& rMatrices,
- std::vector< basegfx::BColor >& rColors) const;
+ std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor) const;
Primitive2DSequence createOverlappingFill(
- const std::vector< basegfx::B2DHomMatrix >& rMatrices,
- const std::vector< basegfx::BColor >& rColors,
+ const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
+ const basegfx::BColor& rOutmostColor,
const basegfx::B2DPolygon& rUnitPolygon) const;
Primitive2DSequence createNonOverlappingFill(
- const std::vector< basegfx::B2DHomMatrix >& rMatrices,
- const std::vector< basegfx::BColor >& rColors,
+ const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
+ const basegfx::BColor& rOutmostColor,
const basegfx::B2DPolygon& rUnitPolygon) const;
protected:
diff --git a/include/drawinglayer/texture/texture.hxx b/include/drawinglayer/texture/texture.hxx
index 5d1751d70889..b22e61d12be8 100644
--- a/include/drawinglayer/texture/texture.hxx
+++ b/include/drawinglayer/texture/texture.hxx
@@ -44,7 +44,6 @@ namespace drawinglayer
bool operator!=(const GeoTexSvx& rGeoTexSvx) const { return !operator==(rGeoTexSvx); }
// virtual base methods
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
};
@@ -57,6 +56,22 @@ namespace drawinglayer
{
namespace texture
{
+ /// helper class for processing equal number of matrices and colors
+ /// for texture processing
+ struct B2DHomMatrixAndBColor
+ {
+ basegfx::B2DHomMatrix maB2DHomMatrix;
+ basegfx::BColor maBColor;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradient : public GeoTexSvx
{
protected:
@@ -66,19 +81,22 @@ namespace drawinglayer
basegfx::BColor maEnd;
double mfBorder;
- // helpers
- void impAppendMatrix(::std::vector< basegfx::B2DHomMatrix >& rMatrices, const basegfx::B2DRange& rRange);
- void impAppendColorsRadial(::std::vector< basegfx::BColor >& rColors);
-
public:
- GeoTexSvxGradient(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder);
+ GeoTexSvxGradient(
+ const basegfx::B2DRange& rTargetRange,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
+ sal_uInt32 nSteps,
+ double fBorder);
virtual ~GeoTexSvxGradient();
// compare operator
virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
// virtual base methods
- virtual void appendColors(::std::vector< basegfx::BColor >& rColors) = 0;
+ virtual void appendTransformationsAndColors(
+ std::vector< B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor) = 0;
// data access
const basegfx::BColor& getStart() const { return maStart; }
@@ -96,11 +114,18 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear : public GeoTexSvxGradient
{
public:
- GeoTexSvxGradientLinear(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle);
+ GeoTexSvxGradientLinear(
+ const basegfx::B2DRange& rTargetRange,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
virtual ~GeoTexSvxGradientLinear();
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void appendTransformationsAndColors(
+ std::vector< B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor);
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
};
} // end of namespace texture
@@ -115,11 +140,18 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial : public GeoTexSvxGradient
{
public:
- GeoTexSvxGradientAxial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle);
+ GeoTexSvxGradientAxial(
+ const basegfx::B2DRange& rTargetRange,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
virtual ~GeoTexSvxGradientAxial();
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void appendTransformationsAndColors(
+ std::vector< B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor);
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
};
} // end of namespace texture
@@ -134,11 +166,19 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial : public GeoTexSvxGradient
{
public:
- GeoTexSvxGradientRadial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY);
+ GeoTexSvxGradientRadial(
+ const basegfx::B2DRange& rTargetRange,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fOffsetX,
+ double fOffsetY);
virtual ~GeoTexSvxGradientRadial();
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void appendTransformationsAndColors(
+ std::vector< B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor);
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
};
} // end of namespace texture
@@ -153,11 +193,20 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical : public GeoTexSvxGradient
{
public:
- GeoTexSvxGradientElliptical(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ GeoTexSvxGradientElliptical(
+ const basegfx::B2DRange& rTargetRange,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fOffsetX,
+ double fOffsetY,
+ double fAngle);
virtual ~GeoTexSvxGradientElliptical();
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void appendTransformationsAndColors(
+ std::vector< B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor);
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
};
} // end of namespace texture
@@ -172,11 +221,20 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare : public GeoTexSvxGradient
{
public:
- GeoTexSvxGradientSquare(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ GeoTexSvxGradientSquare(
+ const basegfx::B2DRange& rTargetRange,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fOffsetX,
+ double fOffsetY,
+ double fAngle);
virtual ~GeoTexSvxGradientSquare();
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void appendTransformationsAndColors(
+ std::vector< B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor);
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
};
} // end of namespace texture
@@ -191,11 +249,20 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect : public GeoTexSvxGradient
{
public:
- GeoTexSvxGradientRect(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ GeoTexSvxGradientRect(
+ const basegfx::B2DRange& rTargetRange,
+ const basegfx::BColor& rStart,
+ const basegfx::BColor& rEnd,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fOffsetX,
+ double fOffsetY,
+ double fAngle);
virtual ~GeoTexSvxGradientRect();
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void appendTransformationsAndColors(
+ std::vector< B2DHomMatrixAndBColor >& rEntries,
+ basegfx::BColor& rOutmostColor);
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
};
} // end of namespace texture
@@ -217,7 +284,10 @@ namespace drawinglayer
sal_uInt32 mnSteps;
public:
- GeoTexSvxHatch(const basegfx::B2DRange& rTargetRange, double fDistance, double fAngle);
+ GeoTexSvxHatch(
+ const basegfx::B2DRange& rTargetRange,
+ double fDistance,
+ double fAngle);
virtual ~GeoTexSvxHatch();
// compare operator
@@ -225,6 +295,7 @@ namespace drawinglayer
virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
double getDistanceToHatch(const basegfx::B2DPoint& rUV) const;
+ const basegfx::B2DHomMatrix& getBackTextureTransform() const;
};
} // end of namespace texture
} // end of namespace drawinglayer
@@ -242,7 +313,9 @@ namespace drawinglayer
basegfx::B2DVector maSize;
public:
- GeoTexSvxTiled(const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
+ GeoTexSvxTiled(
+ const basegfx::B2DPoint& rTopLeft,
+ const basegfx::B2DVector& rSize);
virtual ~GeoTexSvxTiled();
// compare operator