You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/03/19 17:17:04 UTC
svn commit: r1579280 [2/8] - in /openoffice/trunk: ./ main/boost/
main/chart2/source/controller/main/ main/comphelper/inc/comphelper/
main/comphelper/source/property/ main/cui/source/factory/
main/cui/source/inc/ main/cui/source/tabpages/ main/drawingl...
Modified: openoffice/trunk/main/drawinglayer/inc/drawinglayer/texture/texture.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/inc/drawinglayer/texture/texture.hxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/inc/drawinglayer/texture/texture.hxx (original)
+++ openoffice/trunk/main/drawinglayer/inc/drawinglayer/texture/texture.hxx Wed Mar 19 16:17:02 2014
@@ -34,23 +34,23 @@
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC 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;
- };
- } // end of namespace texture
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC 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;
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
@@ -66,138 +66,149 @@ namespace drawinglayer
basegfx::B2DHomMatrix maB2DHomMatrix;
basegfx::BColor maBColor;
};
- } // end of namespace texture
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradient : public GeoTexSvx
- {
- protected:
- basegfx::ODFGradientInfo maGradientInfo;
- basegfx::B2DRange maTargetRange;
- basegfx::BColor maStart;
- basegfx::BColor maEnd;
- double mfBorder;
-
- public:
- GeoTexSvxGradient(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC 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,
sal_uInt32 nSteps,
double fBorder);
- virtual ~GeoTexSvxGradient();
+ virtual ~GeoTexSvxGradient();
- // compare operator
- virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
- // virtual base methods
- virtual void appendTransformationsAndColors(
+ // 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; }
- const basegfx::BColor& getEnd() const { return maEnd; }
- };
- } // end of namespace texture
+ // data access
+ const basegfx::BColor& getStart() const { return maStart; }
+ const basegfx::BColor& getEnd() const { return maEnd; }
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear : public GeoTexSvxGradient
- {
- public:
- GeoTexSvxGradientLinear(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear : public GeoTexSvxGradient
+ {
+ protected:
+ 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();
+ virtual ~GeoTexSvxGradientLinear();
- virtual void appendTransformationsAndColors(
+ 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
+ basegfx::BColor& rOuterColor);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial : public GeoTexSvxGradient
- {
- public:
- GeoTexSvxGradientAxial(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial : public GeoTexSvxGradient
+ {
+ protected:
+ 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();
+ virtual ~GeoTexSvxGradientAxial();
- virtual void appendTransformationsAndColors(
+ 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
+ basegfx::BColor& rOuterColor);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial : public GeoTexSvxGradient
- {
- public:
- GeoTexSvxGradientRadial(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial : 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();
+ virtual ~GeoTexSvxGradientRadial();
- virtual void appendTransformationsAndColors(
+ 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
+ basegfx::BColor& rOuterColor);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical : public GeoTexSvxGradient
- {
- public:
- GeoTexSvxGradientElliptical(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientElliptical(
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
@@ -205,27 +216,27 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY,
double fAngle);
- virtual ~GeoTexSvxGradientElliptical();
+ virtual ~GeoTexSvxGradientElliptical();
- virtual void appendTransformationsAndColors(
+ 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
+ basegfx::BColor& rOuterColor);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare : public GeoTexSvxGradient
- {
- public:
- GeoTexSvxGradientSquare(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientSquare(
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
@@ -233,27 +244,27 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY,
double fAngle);
- virtual ~GeoTexSvxGradientSquare();
+ virtual ~GeoTexSvxGradientSquare();
- virtual void appendTransformationsAndColors(
+ 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
+ basegfx::BColor& rOuterColor);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect : public GeoTexSvxGradient
- {
- public:
- GeoTexSvxGradientRect(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientRect(
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
@@ -261,54 +272,59 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY,
double fAngle);
- virtual ~GeoTexSvxGradientRect();
+ virtual ~GeoTexSvxGradientRect();
- virtual void appendTransformationsAndColors(
+ 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
+ basegfx::BColor& rOuterColor);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
- class DRAWINGLAYER_DLLPUBLIC GeoTexSvxHatch : public GeoTexSvx
- {
- protected:
- basegfx::B2DHomMatrix maTextureTransform;
- basegfx::B2DHomMatrix maBackTextureTransform;
- double mfDistance;
- double mfAngle;
- sal_uInt32 mnSteps;
-
- public:
- GeoTexSvxHatch(
- const basegfx::B2DRange& rTargetRange,
+ namespace texture
+ {
+ 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& rDefinitionRange,
+ const basegfx::B2DRange& rOutputRange,
double fDistance,
double fAngle);
- virtual ~GeoTexSvxHatch();
+ virtual ~GeoTexSvxHatch();
- // compare operator
- virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- double getDistanceToHatch(const basegfx::B2DPoint& rUV) const;
- const basegfx::B2DHomMatrix& getBackTextureTransform() const;
- };
- } // end of namespace texture
+ 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
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace texture
- {
+ 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
@@ -318,26 +334,26 @@ namespace drawinglayer
// 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::B2DRange maRange;
- double mfOffsetX;
- double mfOffsetY;
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxTiled : public GeoTexSvx
+ {
+ protected:
+ basegfx::B2DRange maRange;
+ double mfOffsetX;
+ double mfOffsetY;
- public:
- GeoTexSvxTiled(
+ public:
+ GeoTexSvxTiled(
const basegfx::B2DRange& rRange,
double fOffsetX = 0.0,
double fOffsetY = 0.0);
- virtual ~GeoTexSvxTiled();
+ virtual ~GeoTexSvxTiled();
- // compare operator
- virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
- virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
- };
- } // end of namespace texture
+ void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ };
+ } // end of namespace texture
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
Modified: openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx (original)
+++ openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx Wed Mar 19 16:17:02 2014
@@ -263,11 +263,11 @@ namespace drawinglayer
// get logical size of bitmap (before expanding eventually)
Graphic aGraphic(getFillGraphic());
- // init values with defaults
+ // init values with defaults for stretched
basegfx::B2DPoint aBitmapSize(1.0, 1.0);
basegfx::B2DVector aBitmapTopLeft(0.0, 0.0);
- // are changes needed?
+ //UUUU are changes needed? When streched we are already done, all other values will have no influence
if(getTiling() || !getStretch())
{
// init values with range sizes
@@ -312,34 +312,33 @@ namespace drawinglayer
aBitmapSize.setY(getGraphicLogicSize().getY());
}
- // get values, force to centered if necessary
- const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0));
-
// position changes X
- if(0.0 == aRectPoint.getX())
+ if(0.0 == getRectPoint().getX())
{
aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5);
}
- else if(1.0 == aRectPoint.getX())
+ else if(1.0 == getRectPoint().getX())
{
aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX());
}
+ // offset positions are only meaningful when tiled
if(getTiling() && 0.0 != getOffsetPosition().getX())
{
aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01)));
}
// position changes Y
- if(0.0 == aRectPoint.getY())
+ if(0.0 == getRectPoint().getY())
{
aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5);
}
- else if(1.0 == aRectPoint.getY())
+ else if(1.0 == getRectPoint().getY())
{
aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY());
}
+ // offset positions are only meaningful when tiled
if(getTiling() && 0.0 != getOffsetPosition().getY())
{
aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01)));
Modified: openoffice/trunk/main/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx (original)
+++ openoffice/trunk/main/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx Wed Mar 19 16:17:02 2014
@@ -40,79 +40,124 @@ using namespace com::sun::star;
namespace drawinglayer
{
- namespace primitive2d
- {
+ namespace primitive2d
+ {
void FillGradientPrimitive2D::generateMatricesAndColors(
std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor) const
+ basegfx::BColor& rOuterColor) const
{
rEntries.clear();
- // make sure steps is not too high/low
- const basegfx::BColor aStart(getFillGradient().getStartColor());
- const basegfx::BColor aEnd(getFillGradient().getEndColor());
- const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5));
- sal_uInt32 nSteps(getFillGradient().getSteps());
-
- if(nSteps == 0)
- {
- nSteps = nMaxSteps;
- }
-
- if(nSteps < 2)
- {
- nSteps = 2;
- }
-
- if(nSteps > nMaxSteps)
- {
- nSteps = nMaxSteps;
- }
-
- switch(getFillGradient().getStyle())
- {
- case attribute::GRADIENTSTYLE_LINEAR:
- {
- texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
- break;
- }
- case attribute::GRADIENTSTYLE_AXIAL:
- {
- texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
- break;
- }
- case attribute::GRADIENTSTYLE_RADIAL:
- {
- texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
- break;
- }
- case attribute::GRADIENTSTYLE_ELLIPTICAL:
- {
- texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
- break;
- }
- case attribute::GRADIENTSTYLE_SQUARE:
- {
- texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
- break;
- }
- case attribute::GRADIENTSTYLE_RECT:
- {
- texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
- break;
- }
- }
+ // make sure steps is not too high/low
+ const basegfx::BColor aStart(getFillGradient().getStartColor());
+ const basegfx::BColor aEnd(getFillGradient().getEndColor());
+ const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5));
+ sal_uInt32 nSteps(getFillGradient().getSteps());
+
+ if(nSteps == 0)
+ {
+ nSteps = nMaxSteps;
+ }
+
+ if(nSteps < 2)
+ {
+ nSteps = 2;
+ }
+
+ if(nSteps > nMaxSteps)
+ {
+ nSteps = nMaxSteps;
+ }
+
+ switch(getFillGradient().getStyle())
+ {
+ case attribute::GRADIENTSTYLE_LINEAR:
+ {
+ texture::GeoTexSvxGradientLinear aGradient(
+ getDefinitionRange(),
+ getOutputRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
+ break;
+ }
+ case attribute::GRADIENTSTYLE_AXIAL:
+ {
+ texture::GeoTexSvxGradientAxial aGradient(
+ getDefinitionRange(),
+ getOutputRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
+ break;
+ }
+ case attribute::GRADIENTSTYLE_RADIAL:
+ {
+ texture::GeoTexSvxGradientRadial aGradient(
+ getDefinitionRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getOffsetX(),
+ getFillGradient().getOffsetY());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
+ break;
+ }
+ case attribute::GRADIENTSTYLE_ELLIPTICAL:
+ {
+ texture::GeoTexSvxGradientElliptical aGradient(
+ getDefinitionRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getOffsetX(),
+ getFillGradient().getOffsetY(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
+ break;
+ }
+ case attribute::GRADIENTSTYLE_SQUARE:
+ {
+ texture::GeoTexSvxGradientSquare aGradient(
+ getDefinitionRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getOffsetX(),
+ getFillGradient().getOffsetY(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
+ break;
+ }
+ case attribute::GRADIENTSTYLE_RECT:
+ {
+ texture::GeoTexSvxGradientRect aGradient(
+ getDefinitionRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getOffsetX(),
+ getFillGradient().getOffsetY(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
+ break;
+ }
+ }
}
Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill(
const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
- const basegfx::BColor& rOutmostColor,
+ const basegfx::BColor& rOuterColor,
const basegfx::B2DPolygon& rUnitPolygon) const
{
// prepare return value
@@ -121,8 +166,9 @@ namespace drawinglayer
// create solid fill with outmost color
aRetval[0] = Primitive2DReference(
new PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())),
- rOutmostColor));
+ basegfx::B2DPolyPolygon(
+ basegfx::tools::createPolygonFromRect(getOutputRange())),
+ rOuterColor));
// create solid fill steps
for(sal_uInt32 a(0); a < rEntries.size(); a++)
@@ -144,14 +190,14 @@ namespace drawinglayer
Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill(
const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
- const basegfx::BColor& rOutmostColor,
+ const basegfx::BColor& rOuterColor,
const basegfx::B2DPolygon& rUnitPolygon) const
{
// prepare return value
Primitive2DSequence aRetval(rEntries.size() + 1);
- // get outmost range from object
- basegfx::B2DRange aOutmostRange(getObjectRange());
+ // get outmost viusible range from object
+ basegfx::B2DRange aOutmostRange(getOutputRange());
basegfx::B2DPolyPolygon aCombinedPolyPoly;
if(rEntries.size())
@@ -169,7 +215,7 @@ namespace drawinglayer
aRetval[0] = Primitive2DReference(
new PolyPolygonColorPrimitive2D(
aCombinedPolyPoly,
- rOutmostColor));
+ rOuterColor));
if(rEntries.size())
{
@@ -204,10 +250,10 @@ namespace drawinglayer
return aRetval;
}
- Primitive2DSequence FillGradientPrimitive2D::createFill(bool bOverlapping) const
- {
+ Primitive2DSequence FillGradientPrimitive2D::createFill(bool bOverlapping) const
+ {
// prepare shape of the Unit Polygon
- basegfx::B2DPolygon aUnitPolygon;
+ basegfx::B2DPolygon aUnitPolygon;
switch(getFillGradient().getStyle())
{
@@ -227,22 +273,22 @@ namespace drawinglayer
// get the transform matrices and colors (where colors
// will have one more entry that matrices)
std::vector< drawinglayer::texture::B2DHomMatrixAndBColor > aEntries;
- basegfx::BColor aOutmostColor;
+ basegfx::BColor aOuterColor;
- generateMatricesAndColors(aEntries, aOutmostColor);
+ generateMatricesAndColors(aEntries, aOuterColor);
if(bOverlapping)
{
- return createOverlappingFill(aEntries, aOutmostColor, aUnitPolygon);
+ return createOverlappingFill(aEntries, aOuterColor, aUnitPolygon);
}
else
{
- return createNonOverlappingFill(aEntries, aOutmostColor, aUnitPolygon);
+ return createNonOverlappingFill(aEntries, aOuterColor, aUnitPolygon);
}
}
- Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
+ Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
// default creates overlapping fill which works with AntiAliasing and without.
// The non-overlapping version does not create single filled polygons, but
// PolyPolygons where each one describes a 'ring' for the gradient such
@@ -254,46 +300,59 @@ namespace drawinglayer
{
static bool bOverlapping(true); // allow to test non-overlapping in the debugger
- return createFill(bOverlapping);
+ return createFill(bOverlapping);
}
else
{
return Primitive2DSequence();
}
- }
+ }
+
+ FillGradientPrimitive2D::FillGradientPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const attribute::FillGradientAttribute& rFillGradient)
+ : BufferedDecompositionPrimitive2D(),
+ maOutputRange(rOutputRange),
+ maDefinitionRange(rOutputRange),
+ maFillGradient(rFillGradient)
+ {
+ }
- FillGradientPrimitive2D::FillGradientPrimitive2D(
- const basegfx::B2DRange& rObjectRange,
- const attribute::FillGradientAttribute& rFillGradient)
- : BufferedDecompositionPrimitive2D(),
- maObjectRange(rObjectRange),
- maFillGradient(rFillGradient)
- {
- }
-
- bool FillGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive;
-
- return (getObjectRange() == rCompare.getObjectRange()
- && getFillGradient() == rCompare.getFillGradient());
- }
-
- return false;
- }
-
- basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- // return ObjectRange
- return getObjectRange();
- }
+ FillGradientPrimitive2D::FillGradientPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGradientAttribute& rFillGradient)
+ : BufferedDecompositionPrimitive2D(),
+ maOutputRange(rOutputRange),
+ maDefinitionRange(rDefinitionRange),
+ maFillGradient(rFillGradient)
+ {
+ }
+
+ bool FillGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive;
+
+ return (getOutputRange() == rCompare.getOutputRange()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getFillGradient() == rCompare.getFillGradient());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // return the geometrically visible area
+ return getOutputRange();
+ }
- // provide unique ID
- ImplPrimitrive2DIDBlock(FillGradientPrimitive2D, PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D)
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(FillGradientPrimitive2D, PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D)
- } // end of namespace primitive2d
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
Modified: openoffice/trunk/main/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx (original)
+++ openoffice/trunk/main/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx Wed Mar 19 16:17:02 2014
@@ -42,18 +42,18 @@ using namespace com::sun::star;
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- Primitive2DSequence aRetval;
+ namespace primitive2d
+ {
+ Primitive2DSequence FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
if(!getFillHatch().isDefault())
{
- // create hatch
- const basegfx::BColor aHatchColor(getFillHatch().getColor());
- const double fAngle(getFillHatch().getAngle());
- ::std::vector< basegfx::B2DHomMatrix > aMatrices;
+ // create hatch
+ const basegfx::BColor aHatchColor(getFillHatch().getColor());
+ const double fAngle(getFillHatch().getAngle());
+ ::std::vector< basegfx::B2DHomMatrix > aMatrices;
double fDistance(getFillHatch().getDistance());
const bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
@@ -68,103 +68,133 @@ namespace drawinglayer
}
}
- // get hatch transformations
- switch(getFillHatch().getStyle())
- {
- case attribute::HATCHSTYLE_TRIPLE:
- {
- // rotated 45 degrees
- texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI4);
- aHatch.appendTransformations(aMatrices);
-
- // fall-through by purpose
- }
- case attribute::HATCHSTYLE_DOUBLE:
- {
- // rotated 90 degrees
- texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI2);
- aHatch.appendTransformations(aMatrices);
-
- // fall-through by purpose
- }
- case attribute::HATCHSTYLE_SINGLE:
- {
- // angle as given
- texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle);
- aHatch.appendTransformations(aMatrices);
- }
- }
-
- // prepare return value
- const bool bFillBackground(getFillHatch().isFillBackground());
- aRetval.realloc(bFillBackground ? aMatrices.size() + 1L : aMatrices.size());
-
- // evtl. create filled background
- if(bFillBackground)
- {
- // create primitive for background
- const Primitive2DReference xRef(
+ // get hatch transformations
+ switch(getFillHatch().getStyle())
+ {
+ case attribute::HATCHSTYLE_TRIPLE:
+ {
+ // rotated 45 degrees
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle - F_PI4);
+
+ aHatch.appendTransformations(aMatrices);
+
+ // fall-through by purpose
+ }
+ case attribute::HATCHSTYLE_DOUBLE:
+ {
+ // rotated 90 degrees
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle - F_PI2);
+
+ aHatch.appendTransformations(aMatrices);
+
+ // fall-through by purpose
+ }
+ case attribute::HATCHSTYLE_SINGLE:
+ {
+ // angle as given
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle);
+
+ aHatch.appendTransformations(aMatrices);
+ }
+ }
+
+ // prepare return value
+ const bool bFillBackground(getFillHatch().isFillBackground());
+ aRetval.realloc(bFillBackground ? aMatrices.size() + 1L : aMatrices.size());
+
+ // evtl. create filled background
+ if(bFillBackground)
+ {
+ // create primitive for background
+ const Primitive2DReference xRef(
new PolyPolygonColorPrimitive2D(
basegfx::B2DPolyPolygon(
- basegfx::tools::createPolygonFromRect(getObjectRange())), getBColor()));
- aRetval[0] = xRef;
- }
-
- // create primitives
- const basegfx::B2DPoint aStart(0.0, 0.0);
- const basegfx::B2DPoint aEnd(1.0, 0.0);
-
- for(sal_uInt32 a(0L); a < aMatrices.size(); a++)
- {
- const basegfx::B2DHomMatrix& rMatrix = aMatrices[a];
- basegfx::B2DPolygon aNewLine;
-
- aNewLine.append(rMatrix * aStart);
- aNewLine.append(rMatrix * aEnd);
-
- // create hairline
- const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor));
- aRetval[bFillBackground ? (a + 1) : a] = xRef;
- }
+ basegfx::tools::createPolygonFromRect(getOutputRange())), getBColor()));
+ aRetval[0] = xRef;
+ }
+
+ // create primitives
+ const basegfx::B2DPoint aStart(0.0, 0.0);
+ const basegfx::B2DPoint aEnd(1.0, 0.0);
+
+ for(sal_uInt32 a(0L); a < aMatrices.size(); a++)
+ {
+ const basegfx::B2DHomMatrix& rMatrix = aMatrices[a];
+ basegfx::B2DPolygon aNewLine;
+
+ aNewLine.append(rMatrix * aStart);
+ aNewLine.append(rMatrix * aEnd);
+
+ // create hairline
+ const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor));
+ aRetval[bFillBackground ? (a + 1) : a] = xRef;
+ }
}
return aRetval;
- }
+ }
+
+ FillHatchPrimitive2D::FillHatchPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const basegfx::BColor& rBColor,
+ const attribute::FillHatchAttribute& rFillHatch)
+ : DiscreteMetricDependentPrimitive2D(),
+ maOutputRange(rOutputRange),
+ maDefinitionRange(rOutputRange),
+ maFillHatch(rFillHatch),
+ maBColor(rBColor)
+ {
+ }
+
+ FillHatchPrimitive2D::FillHatchPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const basegfx::BColor& rBColor,
+ const attribute::FillHatchAttribute& rFillHatch)
+ : DiscreteMetricDependentPrimitive2D(),
+ maOutputRange(rOutputRange),
+ maDefinitionRange(rDefinitionRange),
+ maFillHatch(rFillHatch),
+ maBColor(rBColor)
+ {
+ }
+
+ bool FillHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive;
+
+ return (getOutputRange() == rCompare.getOutputRange()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getFillHatch() == rCompare.getFillHatch()
+ && getBColor() == rCompare.getBColor());
+ }
+
+ return false;
+ }
- FillHatchPrimitive2D::FillHatchPrimitive2D(
- const basegfx::B2DRange& rObjectRange,
- const basegfx::BColor& rBColor,
- const attribute::FillHatchAttribute& rFillHatch)
- : DiscreteMetricDependentPrimitive2D(),
- maObjectRange(rObjectRange),
- maFillHatch(rFillHatch),
- maBColor(rBColor)
- {
- }
-
- bool FillHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
- {
- const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive;
-
- return (getObjectRange() == rCompare.getObjectRange()
- && getFillHatch() == rCompare.getFillHatch()
- && getBColor() == rCompare.getBColor());
- }
-
- return false;
- }
-
- basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- // return ObjectRange
- return getObjectRange();
- }
+ basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // return the geometrically visible area
+ return getOutputRange();
+ }
- Primitive2DSequence FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DSequence FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutex );
bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
if(bAdaptDistance)
@@ -180,9 +210,9 @@ namespace drawinglayer
}
// provide unique ID
- ImplPrimitrive2DIDBlock(FillHatchPrimitive2D, PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D)
+ ImplPrimitrive2DIDBlock(FillHatchPrimitive2D, PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D)
- } // end of namespace primitive2d
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
Modified: openoffice/trunk/main/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx (original)
+++ openoffice/trunk/main/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx Wed Mar 19 16:17:02 2014
@@ -47,433 +47,454 @@ using namespace com::sun::star;
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
- const sal_uInt32 nCount(aPolyPolygon.count());
-
- if(nCount)
- {
- Primitive2DSequence aRetval(nCount);
-
- for(sal_uInt32 a(0L); a < nCount; a++)
- {
- aRetval[a] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor()));
- }
-
- return aRetval;
- }
- else
- {
- return Primitive2DSequence();
- }
- }
-
- PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor)
- : BufferedDecompositionPrimitive2D(),
- maPolyPolygon(rPolyPolygon),
- maBColor(rBColor)
- {
- }
-
- bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonHairlinePrimitive2D& rCompare = (PolyPolygonHairlinePrimitive2D&)rPrimitive;
-
- return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
- && getBColor() == rCompare.getBColor());
- }
-
- return false;
- }
-
- basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- // return range
- return basegfx::tools::getRange(getB2DPolyPolygon());
- }
+ namespace primitive2d
+ {
+ Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
+ const sal_uInt32 nCount(aPolyPolygon.count());
+
+ if(nCount)
+ {
+ Primitive2DSequence aRetval(nCount);
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ aRetval[a] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor()));
+ }
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D)
+ return aRetval;
+ }
+ else
+ {
+ return Primitive2DSequence();
+ }
+ }
+
+ PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maBColor(rBColor)
+ {
+ }
+
+ bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonHairlinePrimitive2D& rCompare = (PolyPolygonHairlinePrimitive2D&)rPrimitive;
+
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getBColor() == rCompare.getBColor());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // return range
+ return basegfx::tools::getRange(getB2DPolyPolygon());
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D)
- } // end of namespace primitive2d
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
- const sal_uInt32 nCount(aPolyPolygon.count());
-
- if(nCount)
- {
- Primitive2DSequence aRetval(nCount);
-
- for(sal_uInt32 a(0L); a < nCount; a++)
- {
- aRetval[a] = Primitive2DReference(
+ namespace primitive2d
+ {
+ Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
+ const sal_uInt32 nCount(aPolyPolygon.count());
+
+ if(nCount)
+ {
+ Primitive2DSequence aRetval(nCount);
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ aRetval[a] = Primitive2DReference(
new PolygonMarkerPrimitive2D(
aPolyPolygon.getB2DPolygon(a),
getRGBColorA(),
getRGBColorB(),
getDiscreteDashLength()));
- }
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return Primitive2DSequence();
+ }
+ }
+
+ PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maRGBColorA(rRGBColorA),
+ maRGBColorB(rRGBColorB),
+ mfDiscreteDashLength(fDiscreteDashLength)
+ {
+ }
- return aRetval;
- }
- else
- {
- return Primitive2DSequence();
- }
- }
-
- PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const basegfx::BColor& rRGBColorA,
- const basegfx::BColor& rRGBColorB,
- double fDiscreteDashLength)
- : BufferedDecompositionPrimitive2D(),
- maPolyPolygon(rPolyPolygon),
- maRGBColorA(rRGBColorA),
- maRGBColorB(rRGBColorB),
- mfDiscreteDashLength(fDiscreteDashLength)
- {
- }
-
- bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonMarkerPrimitive2D& rCompare = (PolyPolygonMarkerPrimitive2D&)rPrimitive;
-
- return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
- && getRGBColorA() == rCompare.getRGBColorA()
- && getRGBColorB() == rCompare.getRGBColorB()
- && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
- }
-
- return false;
- }
-
- basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- // return range
- return basegfx::tools::getRange(getB2DPolyPolygon());
- }
+ bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonMarkerPrimitive2D& rCompare = (PolyPolygonMarkerPrimitive2D&)rPrimitive;
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D)
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // return range
+ return basegfx::tools::getRange(getB2DPolyPolygon());
+ }
- } // end of namespace primitive2d
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D)
+
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
- const sal_uInt32 nCount(aPolyPolygon.count());
-
- if(nCount)
- {
- Primitive2DSequence aRetval(nCount);
-
- for(sal_uInt32 a(0L); a < nCount; a++)
- {
- aRetval[a] = Primitive2DReference(
+ namespace primitive2d
+ {
+ Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
+ const sal_uInt32 nCount(aPolyPolygon.count());
+
+ if(nCount)
+ {
+ Primitive2DSequence aRetval(nCount);
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ aRetval[a] = Primitive2DReference(
new PolygonStrokePrimitive2D(
aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute()));
- }
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return Primitive2DSequence();
+ }
+ }
- return aRetval;
- }
- else
- {
- return Primitive2DSequence();
- }
- }
-
- PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::LineAttribute& rLineAttribute,
- const attribute::StrokeAttribute& rStrokeAttribute)
- : BufferedDecompositionPrimitive2D(),
- maPolyPolygon(rPolyPolygon),
+ PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
maLineAttribute(rLineAttribute),
- maStrokeAttribute(rStrokeAttribute)
- {
- }
-
- PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::LineAttribute& rLineAttribute)
- : BufferedDecompositionPrimitive2D(),
- maPolyPolygon(rPolyPolygon),
+ maStrokeAttribute(rStrokeAttribute)
+ {
+ }
+
+ PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
maLineAttribute(rLineAttribute),
- maStrokeAttribute()
- {
- }
-
- bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonStrokePrimitive2D& rCompare = (PolyPolygonStrokePrimitive2D&)rPrimitive;
-
- return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
- && getLineAttribute() == rCompare.getLineAttribute()
- && getStrokeAttribute() == rCompare.getStrokeAttribute());
- }
-
- return false;
- }
-
- basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- // get range of it (subdivided)
- basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon()));
-
- // if width, grow by line width
- if(getLineAttribute().getWidth())
- {
- aRetval.grow(getLineAttribute().getWidth() / 2.0);
- }
+ maStrokeAttribute()
+ {
+ }
+
+ bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonStrokePrimitive2D& rCompare = (PolyPolygonStrokePrimitive2D&)rPrimitive;
- return aRetval;
- }
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getLineAttribute() == rCompare.getLineAttribute()
+ && getStrokeAttribute() == rCompare.getStrokeAttribute());
+ }
+
+ return false;
+ }
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D)
+ basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // get range of it (subdivided)
+ basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon()));
- } // end of namespace primitive2d
+ // if width, grow by line width
+ if(getLineAttribute().getWidth())
+ {
+ aRetval.grow(getLineAttribute().getWidth() / 2.0);
+ }
+
+ return aRetval;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D)
+
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence PolyPolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
- const sal_uInt32 nCount(aPolyPolygon.count());
-
- if(nCount)
- {
- Primitive2DSequence aRetval(nCount);
-
- for(sal_uInt32 a(0L); a < nCount; a++)
- {
- const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a));
-
- if(aPolygon.isClosed())
- {
- // no need for PolygonStrokeArrowPrimitive2D when polygon is closed
- aRetval[a] = Primitive2DReference(
+ namespace primitive2d
+ {
+ Primitive2DSequence PolyPolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
+ const sal_uInt32 nCount(aPolyPolygon.count());
+
+ if(nCount)
+ {
+ Primitive2DSequence aRetval(nCount);
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a));
+
+ if(aPolygon.isClosed())
+ {
+ // no need for PolygonStrokeArrowPrimitive2D when polygon is closed
+ aRetval[a] = Primitive2DReference(
new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute()));
- }
- else
- {
- aRetval[a] = Primitive2DReference(
+ }
+ else
+ {
+ aRetval[a] = Primitive2DReference(
new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(),
getStrokeAttribute(), getStart(), getEnd()));
- }
- }
+ }
+ }
- return aRetval;
- }
- else
- {
- return Primitive2DSequence();
- }
- }
-
- PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::LineAttribute& rLineAttribute,
- const attribute::StrokeAttribute& rStrokeAttribute,
- const attribute::LineStartEndAttribute& rStart,
- const attribute::LineStartEndAttribute& rEnd)
- : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute, rStrokeAttribute),
- maStart(rStart),
- maEnd(rEnd)
- {
- }
-
- PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::LineAttribute& rLineAttribute,
- const attribute::LineStartEndAttribute& rStart,
- const attribute::LineStartEndAttribute& rEnd)
- : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute),
- maStart(rStart),
- maEnd(rEnd)
- {
- }
-
- bool PolyPolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(PolyPolygonStrokePrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonStrokeArrowPrimitive2D& rCompare = (PolyPolygonStrokeArrowPrimitive2D&)rPrimitive;
-
- return (getStart() == rCompare.getStart()
- && getEnd() == rCompare.getEnd());
- }
-
- return false;
- }
-
- basegfx::B2DRange PolyPolygonStrokeArrowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
- {
- basegfx::B2DRange aRetval;
-
- if(getStart().isActive() || getEnd().isActive())
- {
- // use decomposition when line start/end is used
- return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
- }
- else
- {
- // get range from parent
- return PolyPolygonStrokePrimitive2D::getB2DRange(rViewInformation);
- }
- }
+ return aRetval;
+ }
+ else
+ {
+ return Primitive2DSequence();
+ }
+ }
+
+ PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ const attribute::LineStartEndAttribute& rStart,
+ const attribute::LineStartEndAttribute& rEnd)
+ : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute, rStrokeAttribute),
+ maStart(rStart),
+ maEnd(rEnd)
+ {
+ }
+
+ PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::LineStartEndAttribute& rStart,
+ const attribute::LineStartEndAttribute& rEnd)
+ : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute),
+ maStart(rStart),
+ maEnd(rEnd)
+ {
+ }
+
+ bool PolyPolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(PolyPolygonStrokePrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonStrokeArrowPrimitive2D& rCompare = (PolyPolygonStrokeArrowPrimitive2D&)rPrimitive;
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D)
+ return (getStart() == rCompare.getStart()
+ && getEnd() == rCompare.getEnd());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange PolyPolygonStrokeArrowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ basegfx::B2DRange aRetval;
+
+ if(getStart().isActive() || getEnd().isActive())
+ {
+ // use decomposition when line start/end is used
+ return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
+ }
+ else
+ {
+ // get range from parent
+ return PolyPolygonStrokePrimitive2D::getB2DRange(rViewInformation);
+ }
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D)
- } // end of namespace primitive2d
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace primitive2d
- {
- PolyPolygonColorPrimitive2D::PolyPolygonColorPrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const basegfx::BColor& rBColor)
- : BasePrimitive2D(),
- maPolyPolygon(rPolyPolygon),
- maBColor(rBColor)
- {
- }
-
- bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BasePrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonColorPrimitive2D& rCompare = (PolyPolygonColorPrimitive2D&)rPrimitive;
-
- return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
- && getBColor() == rCompare.getBColor());
- }
-
- return false;
- }
-
- basegfx::B2DRange PolyPolygonColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- // return range
- return basegfx::tools::getRange(getB2DPolyPolygon());
- }
+ namespace primitive2d
+ {
+ PolyPolygonColorPrimitive2D::PolyPolygonColorPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBColor)
+ : BasePrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maBColor(rBColor)
+ {
+ }
+
+ bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BasePrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonColorPrimitive2D& rCompare = (PolyPolygonColorPrimitive2D&)rPrimitive;
+
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getBColor() == rCompare.getBColor());
+ }
+
+ return false;
+ }
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonColorPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D)
+ basegfx::B2DRange PolyPolygonColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // return range
+ return basegfx::tools::getRange(getB2DPolyPolygon());
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonColorPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D)
- } // end of namespace primitive2d
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
+ namespace primitive2d
+ {
+ Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
if(!getFillGradient().isDefault())
{
- // create SubSequence with FillGradientPrimitive2D
- const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
- FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient());
- const Primitive2DReference xSubRef(pNewGradient);
- const Primitive2DSequence aSubSequence(&xSubRef, 1L);
-
- // create mask primitive
- MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
- const Primitive2DReference xRef(pNewMask);
-
+ // create SubSequence with FillGradientPrimitive2D
+ const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
+ FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(
+ aPolyPolygonRange,
+ getDefinitionRange(),
+ getFillGradient());
+ const Primitive2DReference xSubRef(pNewGradient);
+ const Primitive2DSequence aSubSequence(&xSubRef, 1L);
+
+ // create mask primitive
+ MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
+ const Primitive2DReference xRef(pNewMask);
+
return Primitive2DSequence(&xRef, 1);
}
else
{
return Primitive2DSequence();
}
- }
+ }
+
+ PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::FillGradientAttribute& rFillGradient)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rPolyPolygon.getB2DRange()),
+ maFillGradient(rFillGradient)
+ {
+ }
+
+ PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGradientAttribute& rFillGradient)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rDefinitionRange),
+ maFillGradient(rFillGradient)
+ {
+ }
- PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::FillGradientAttribute& rFillGradient)
- : BufferedDecompositionPrimitive2D(),
- maPolyPolygon(rPolyPolygon),
- maFillGradient(rFillGradient)
- {
- }
-
- bool PolyPolygonGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive;
-
- return (getFillGradient() == rCompare.getFillGradient());
- }
+ bool PolyPolygonGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive;
- return false;
- }
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getFillGradient() == rCompare.getFillGradient());
+ }
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D)
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D)
- } // end of namespace primitive2d
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
+ namespace primitive2d
+ {
+ Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
if(!getFillHatch().isDefault())
{
- // create SubSequence with FillHatchPrimitive2D
- const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
- FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch());
- const Primitive2DReference xSubRef(pNewHatch);
- const Primitive2DSequence aSubSequence(&xSubRef, 1L);
-
- // create mask primitive
- MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
- const Primitive2DReference xRef(pNewMask);
+ // create SubSequence with FillHatchPrimitive2D
+ const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
+ FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(
+ aPolyPolygonRange,
+ getDefinitionRange(),
+ getBackgroundColor(),
+ getFillHatch());
+ const Primitive2DReference xSubRef(pNewHatch);
+ const Primitive2DSequence aSubSequence(&xSubRef, 1L);
+
+ // create mask primitive
+ MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
+ const Primitive2DReference xRef(pNewMask);
return Primitive2DSequence(&xRef, 1);
}
@@ -481,46 +502,62 @@ namespace drawinglayer
{
return Primitive2DSequence();
}
- }
+ }
+
+ PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBackgroundColor,
+ const attribute::FillHatchAttribute& rFillHatch)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rPolyPolygon.getB2DRange()),
+ maBackgroundColor(rBackgroundColor),
+ maFillHatch(rFillHatch)
+ {
+ }
+
+ PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DRange& rDefinitionRange,
+ const basegfx::BColor& rBackgroundColor,
+ const attribute::FillHatchAttribute& rFillHatch)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rDefinitionRange),
+ maBackgroundColor(rBackgroundColor),
+ maFillHatch(rFillHatch)
+ {
+ }
+
+ bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive;
- PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const basegfx::BColor& rBackgroundColor,
- const attribute::FillHatchAttribute& rFillHatch)
- : BufferedDecompositionPrimitive2D(),
- maPolyPolygon(rPolyPolygon),
- maBackgroundColor(rBackgroundColor),
- maFillHatch(rFillHatch)
- {
- }
-
- bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive;
-
- return (getBackgroundColor() == rCompare.getBackgroundColor()
- && getFillHatch() == rCompare.getFillHatch());
- }
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getBackgroundColor() == rCompare.getBackgroundColor()
+ && getFillHatch() == rCompare.getFillHatch());
+ }
- return false;
- }
+ return false;
+ }
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D)
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D)
- } // end of namespace primitive2d
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
- namespace primitive2d
- {
- Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
+ namespace primitive2d
+ {
+ Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
if(!getFillGraphic().isDefault())
{
const Graphic& rGraphic = getFillGraphic().getGraphic();
@@ -535,15 +572,56 @@ namespace drawinglayer
if(aPrefSize.Width() && aPrefSize.Height())
{
// create SubSequence with FillGraphicPrimitive2D based on polygon range
- const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
+ const basegfx::B2DRange aOutRange(getB2DPolyPolygon().getB2DRange());
const basegfx::B2DHomMatrix aNewObjectTransform(
basegfx::tools::createScaleTranslateB2DHomMatrix(
- aPolyPolygonRange.getRange(),
- aPolyPolygonRange.getMinimum()));
- const Primitive2DReference xSubRef(
- new FillGraphicPrimitive2D(
+ aOutRange.getRange(),
+ aOutRange.getMinimum()));
+ Primitive2DReference xSubRef;
+
+ if(aOutRange != getDefinitionRange())
+ {
+ // we want to paint (tiled) content which is defined relative to DefinitionRange
+ // with the same tiling and offset(s) in the traget range of the geometry (the
+ // polygon). The range given in the local FillGraphicAttribute defines the position
+ // of the graphic in unit coordinates relative to the DefinitionRange. Transform
+ // this using DefinitionRange to get to the global definition and then with the
+ // inverse transformation from the target range to go to unit coordinates relative
+ // to that traget coordinate system.
+ basegfx::B2DRange aAdaptedRange(getFillGraphic().getGraphicRange());
+
+ const basegfx::B2DHomMatrix aFromDefinitionRangeToGlobal(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ getDefinitionRange().getRange(),
+ getDefinitionRange().getMinimum()));
+
+ aAdaptedRange.transform(aFromDefinitionRangeToGlobal);
+
+ basegfx::B2DHomMatrix aFromGlobalToOutRange(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aOutRange.getRange(),
+ aOutRange.getMinimum()));
+ aFromGlobalToOutRange.invert();
+
+ aAdaptedRange.transform(aFromGlobalToOutRange);
+
+ const drawinglayer::attribute::FillGraphicAttribute aAdaptedFillGraphicAttribute(
+ getFillGraphic().getGraphic(),
+ aAdaptedRange,
+ getFillGraphic().getTiling(),
+ getFillGraphic().getOffsetX(),
+ getFillGraphic().getOffsetY());
+
+ xSubRef = new FillGraphicPrimitive2D(
aNewObjectTransform,
- getFillGraphic()));
+ aAdaptedFillGraphicAttribute);
+ }
+ else
+ {
+ xSubRef = new FillGraphicPrimitive2D(
+ aNewObjectTransform,
+ getFillGraphic());
+ }
// embed to mask primitive
const Primitive2DReference xRef(
@@ -557,33 +635,47 @@ namespace drawinglayer
}
return Primitive2DSequence();
- }
+ }
+
+ PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::FillGraphicAttribute& rFillGraphic)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rPolyPolygon.getB2DRange()),
+ maFillGraphic(rFillGraphic)
+ {
+ }
- PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::FillGraphicAttribute& rFillGraphic)
- : BufferedDecompositionPrimitive2D(),
- maPolyPolygon(rPolyPolygon),
- maFillGraphic(rFillGraphic)
- {
- }
-
- bool PolyPolygonGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive;
-
- return (getFillGraphic() == rCompare.getFillGraphic());
- }
+ PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGraphicAttribute& rFillGraphic)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rDefinitionRange),
+ maFillGraphic(rFillGraphic)
+ {
+ }
- return false;
- }
+ bool PolyPolygonGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive;
+
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getFillGraphic() == rCompare.getFillGraphic());
+ }
- // provide unique ID
- ImplPrimitrive2DIDBlock(PolyPolygonGraphicPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D)
+ return false;
+ }
- } // end of namespace primitive2d
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(PolyPolygonGraphicPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D)
+
+ } // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////