summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-03-19 16:17:02 +0000
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-28 14:31:08 +0100
commit6e61ecd09679a66060f932835622821d39e92f01 (patch)
tree4ce71adaa6da133cab09660b3efc1341104022a2 /drawinglayer
parentc7190108f02921868cb617040aebdb2d22c02c1f (diff)
Merge back branch alg_writerframes to trunk
(cherry picked from commit b635b4fa4e42053d30ab639643d2236a20243f62) Conflicts: comphelper/inc/comphelper/TypeGeneration.hxx comphelper/source/property/TypeGeneration.cxx cui/source/factory/dlgfact.hxx cui/source/inc/cuitabarea.hxx cui/source/tabpages/tabarea.cxx cui/source/tabpages/tabarea.hrc cui/source/tabpages/tabarea.src cui/source/tabpages/tparea.cxx drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx drawinglayer/source/texture/texture.cxx editeng/inc/editeng/unotext.hxx editeng/source/items/frmitems.cxx include/drawinglayer/texture/texture.hxx include/editeng/brushitem.hxx include/svx/sdr/primitive2d/sdrdecompositiontools.hxx include/svx/svxids.hrc include/xmloff/xmltypes.hxx reportdesign/source/ui/misc/UITools.cxx sc/source/ui/drawfunc/drawsh.cxx sfx2/source/dialog/tabdlg.cxx svl/source/undo/undo.cxx svx/inc/svx/unoshprp.hxx sw/Library_sw.mk sw/inc/doc.hxx sw/inc/format.hxx sw/inc/frmfmt.hxx sw/inc/swatrset.hxx sw/inc/unomap.hxx sw/inc/unoprnms.hxx sw/source/core/access/accpara.cxx sw/source/core/attr/format.cxx sw/source/core/attr/swatrset.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfly.cxx sw/source/core/doc/notxtfrm.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/porfld.cxx sw/source/core/text/txtfly.cxx sw/source/core/txtnode/fntcache.cxx sw/source/core/uibase/app/docst.cxx sw/source/core/uibase/app/docstyle.cxx sw/source/core/uibase/shells/drawdlg.cxx sw/source/core/uibase/shells/frmsh.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/ui/frmdlg/frmdlg.cxx sw/source/ui/frmdlg/frmpage.src sw/source/ui/inc/frmsh.hxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx Change-Id: Id3ffaa83bb5594d287f1ac8f2c1c9cf55c70946d
Diffstat (limited to 'drawinglayer')
-rwxr-xr-xdrawinglayer/source/attribute/sdrfillgraphicattribute.cxx17
-rw-r--r--drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx117
-rw-r--r--drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx48
-rw-r--r--drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx118
-rw-r--r--drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx21
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx65
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx2
-rw-r--r--drawinglayer/source/processor3d/defaultprocessor3d.cxx63
-rw-r--r--drawinglayer/source/texture/texture.cxx230
-rw-r--r--drawinglayer/source/texture/texture3d.cxx18
10 files changed, 537 insertions, 162 deletions
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
index 669ee49a4d40..2e7f05ed1dc9 100755
--- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -209,11 +209,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
@@ -258,34 +258,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)));
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index 575c6b329305..f5be906e6a2a 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -37,7 +37,7 @@ namespace drawinglayer
{
void FillGradientPrimitive2D::generateMatricesAndColors(
std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor) const
+ basegfx::BColor& rOuterColor) const
{
rEntries.clear();
@@ -68,38 +68,83 @@ namespace drawinglayer
{
case attribute::GRADIENTSTYLE_LINEAR:
{
- texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+ texture::GeoTexSvxGradientLinear aGradient(
+ getDefinitionRange(),
+ getOutputRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
break;
}
case attribute::GRADIENTSTYLE_AXIAL:
{
- texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+ texture::GeoTexSvxGradientAxial aGradient(
+ getDefinitionRange(),
+ getOutputRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
break;
}
case attribute::GRADIENTSTYLE_RADIAL:
{
- texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+ 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(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+ 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(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+ 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(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
- aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+ texture::GeoTexSvxGradientRect aGradient(
+ getDefinitionRange(),
+ aStart,
+ aEnd,
+ nSteps,
+ getFillGradient().getBorder(),
+ getFillGradient().getOffsetX(),
+ getFillGradient().getOffsetY(),
+ getFillGradient().getAngle());
+ aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
break;
}
}
@@ -107,7 +152,7 @@ namespace drawinglayer
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
@@ -116,8 +161,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++)
@@ -139,14 +185,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())
@@ -164,7 +210,7 @@ namespace drawinglayer
aRetval[0] = Primitive2DReference(
new PolyPolygonColorPrimitive2D(
aCombinedPolyPoly,
- rOutmostColor));
+ rOuterColor));
if(rEntries.size())
{
@@ -222,17 +268,17 @@ 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);
}
}
@@ -258,10 +304,22 @@ namespace drawinglayer
}
FillGradientPrimitive2D::FillGradientPrimitive2D(
- const basegfx::B2DRange& rObjectRange,
+ const basegfx::B2DRange& rOutputRange,
const attribute::FillGradientAttribute& rFillGradient)
: BufferedDecompositionPrimitive2D(),
- maObjectRange(rObjectRange),
+ maOutputRange(rOutputRange),
+ maDefinitionRange(rOutputRange),
+ maFillGradient(rFillGradient)
+ {
+ }
+
+ FillGradientPrimitive2D::FillGradientPrimitive2D(
+ const basegfx::B2DRange& rOutputRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGradientAttribute& rFillGradient)
+ : BufferedDecompositionPrimitive2D(),
+ maOutputRange(rOutputRange),
+ maDefinitionRange(rDefinitionRange),
maFillGradient(rFillGradient)
{
}
@@ -272,7 +330,8 @@ namespace drawinglayer
{
const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive;
- return (getObjectRange() == rCompare.getObjectRange()
+ return (getOutputRange() == rCompare.getOutputRange()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
&& getFillGradient() == rCompare.getFillGradient());
}
@@ -281,8 +340,8 @@ namespace drawinglayer
basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- // return ObjectRange
- return getObjectRange();
+ // return the geometrically visible area
+ return getOutputRange();
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index 1f941d0e6d11..cbad4a13acef 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -67,7 +67,12 @@ namespace drawinglayer
case attribute::HATCHSTYLE_TRIPLE:
{
// rotated 45 degrees
- texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI4);
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle - F_PI4);
+
aHatch.appendTransformations(aMatrices);
// fall-through by purpose
@@ -75,7 +80,12 @@ namespace drawinglayer
case attribute::HATCHSTYLE_DOUBLE:
{
// rotated 90 degrees
- texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI2);
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle - F_PI2);
+
aHatch.appendTransformations(aMatrices);
// fall-through by purpose
@@ -83,7 +93,12 @@ namespace drawinglayer
case attribute::HATCHSTYLE_SINGLE:
{
// angle as given
- texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle);
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle);
+
aHatch.appendTransformations(aMatrices);
}
}
@@ -99,7 +114,7 @@ namespace drawinglayer
const Primitive2DReference xRef(
new PolyPolygonColorPrimitive2D(
basegfx::B2DPolyPolygon(
- basegfx::tools::createPolygonFromRect(getObjectRange())), getBColor()));
+ basegfx::tools::createPolygonFromRect(getOutputRange())), getBColor()));
aRetval[0] = xRef;
}
@@ -125,11 +140,25 @@ namespace drawinglayer
}
FillHatchPrimitive2D::FillHatchPrimitive2D(
- const basegfx::B2DRange& rObjectRange,
+ 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(),
- maObjectRange(rObjectRange),
+ maOutputRange(rOutputRange),
+ maDefinitionRange(rDefinitionRange),
maFillHatch(rFillHatch),
maBColor(rBColor)
{
@@ -141,7 +170,8 @@ namespace drawinglayer
{
const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive;
- return (getObjectRange() == rCompare.getObjectRange()
+ return (getOutputRange() == rCompare.getOutputRange()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
&& getFillHatch() == rCompare.getFillHatch()
&& getBColor() == rCompare.getBColor());
}
@@ -151,8 +181,8 @@ namespace drawinglayer
basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- // return ObjectRange
- return getObjectRange();
+ // return the geometrically visible area
+ return getOutputRange();
}
Primitive2DSequence FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
index 0f33f9c0d48f..1fe0a6f7eb8a 100644
--- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
@@ -201,7 +201,7 @@ namespace drawinglayer
PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::LineAttribute& rLineAttribute,
+ const attribute::LineAttribute& rLineAttribute,
const attribute::StrokeAttribute& rStrokeAttribute)
: BufferedDecompositionPrimitive2D(),
maPolyPolygon(rPolyPolygon),
@@ -212,7 +212,7 @@ namespace drawinglayer
PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
const basegfx::B2DPolyPolygon& rPolyPolygon,
- const attribute::LineAttribute& rLineAttribute)
+ const attribute::LineAttribute& rLineAttribute)
: BufferedDecompositionPrimitive2D(),
maPolyPolygon(rPolyPolygon),
maLineAttribute(rLineAttribute),
@@ -306,7 +306,10 @@ namespace drawinglayer
{
// create SubSequence with FillGradientPrimitive2D
const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
- FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient());
+ FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(
+ aPolyPolygonRange,
+ getDefinitionRange(),
+ getFillGradient());
const Primitive2DReference xSubRef(pNewGradient);
const Primitive2DSequence aSubSequence(&xSubRef, 1L);
@@ -327,6 +330,18 @@ namespace drawinglayer
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)
{
}
@@ -337,7 +352,9 @@ namespace drawinglayer
{
const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive;
- return (getFillGradient() == rCompare.getFillGradient());
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getFillGradient() == rCompare.getFillGradient());
}
return false;
@@ -361,7 +378,11 @@ namespace drawinglayer
{
// create SubSequence with FillHatchPrimitive2D
const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
- FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch());
+ FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(
+ aPolyPolygonRange,
+ getDefinitionRange(),
+ getBackgroundColor(),
+ getFillHatch());
const Primitive2DReference xSubRef(pNewHatch);
const Primitive2DSequence aSubSequence(&xSubRef, 1L);
@@ -383,6 +404,20 @@ namespace drawinglayer
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)
{
@@ -394,7 +429,9 @@ namespace drawinglayer
{
const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive;
- return (getBackgroundColor() == rCompare.getBackgroundColor()
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getBackgroundColor() == rCompare.getBackgroundColor()
&& getFillHatch() == rCompare.getFillHatch());
}
@@ -429,15 +466,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,
+ aAdaptedFillGraphicAttribute);
+ }
+ else
+ {
+ xSubRef = new FillGraphicPrimitive2D(
aNewObjectTransform,
- getFillGraphic()));
+ getFillGraphic());
+ }
// embed to mask primitive
const Primitive2DReference xRef(
@@ -458,6 +536,18 @@ namespace drawinglayer
const attribute::FillGraphicAttribute& rFillGraphic)
: BufferedDecompositionPrimitive2D(),
maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rPolyPolygon.getB2DRange()),
+ maFillGraphic(rFillGraphic)
+ {
+ }
+
+ PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DRange& rDefinitionRange,
+ const attribute::FillGraphicAttribute& rFillGraphic)
+ : BufferedDecompositionPrimitive2D(),
+ maPolyPolygon(rPolyPolygon),
+ maDefinitionRange(rDefinitionRange),
maFillGraphic(rFillGraphic)
{
}
@@ -468,7 +558,9 @@ namespace drawinglayer
{
const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive;
- return (getFillGraphic() == rCompare.getFillGraphic());
+ return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+ && getDefinitionRange() == rCompare.getDefinitionRange()
+ && getFillGraphic() == rCompare.getFillGraphic());
}
return false;
diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
index 20169cbdf065..24162d698d43 100644
--- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
@@ -145,19 +145,34 @@ namespace drawinglayer
case attribute::HATCHSTYLE_TRIPLE:
{
// rotated 45 degrees
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI4);
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle - F_PI4);
+
aHatch.appendTransformations(aMatrices);
}
case attribute::HATCHSTYLE_DOUBLE:
{
// rotated 90 degrees
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI2);
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle - F_PI2);
+
aHatch.appendTransformations(aMatrices);
}
case attribute::HATCHSTYLE_SINGLE:
{
// angle as given
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle);
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle);
+
aHatch.appendTransformations(aMatrices);
}
}
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 38248be9f91b..353466e9bc46 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1453,6 +1453,15 @@ namespace drawinglayer
const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch();
basegfx::B2DPolyPolygon aLocalPolyPolygon(rHatchCandidate.getB2DPolyPolygon());
+ if(aLocalPolyPolygon.getB2DRange() != rHatchCandidate.getDefinitionRange())
+ {
+ // the range which defines the hatch is different from the range of the
+ // geometry (used for writer frames). This cannot be done calling vcl, thus use
+ // decomposition here
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
+
// #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
// per polygon. Split polygon until there are less than that
while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
@@ -1575,11 +1584,20 @@ namespace drawinglayer
// BTW: One more example how useful the principles of primitives are; the decomposition
// is by definition a simpler, maybe more expensive representation of the same content.
process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
}
- else
+
+ const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
+ basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
+
+ if(aLocalPolyPolygon.getB2DRange() != rGradientCandidate.getDefinitionRange())
{
- const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
- basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
+ // the range which defines the gradient is different from the range of the
+ // geometry (used for writer frames). This cannot be done calling vcl, thus use
+ // decomposition here
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
// #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
// per polygon. Split polygon until there are less than that
@@ -1627,29 +1645,28 @@ namespace drawinglayer
break;
}
- pSvtGraphicFill = new SvtGraphicFill(
- aToolsPolyPolygon,
- Color(),
- 0.0,
- SvtGraphicFill::fillEvenOdd,
- SvtGraphicFill::fillGradient,
- SvtGraphicFill::Transform(),
- false,
- SvtGraphicFill::hatchSingle,
- Color(),
- eGrad,
- aVCLGradient.GetStartColor(),
- aVCLGradient.GetEndColor(),
- aVCLGradient.GetSteps(),
- Graphic());
- }
-
- // call VCL directly; encapsulate with SvtGraphicFill
- impStartSvtGraphicFill(pSvtGraphicFill);
- mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient);
- impEndSvtGraphicFill(pSvtGraphicFill);
+ pSvtGraphicFill = new SvtGraphicFill(
+ aToolsPolyPolygon,
+ Color(),
+ 0.0,
+ SvtGraphicFill::fillEvenOdd,
+ SvtGraphicFill::fillGradient,
+ SvtGraphicFill::Transform(),
+ false,
+ SvtGraphicFill::hatchSingle,
+ Color(),
+ eGrad,
+ aVCLGradient.GetStartColor(),
+ aVCLGradient.GetEndColor(),
+ aVCLGradient.GetSteps(),
+ Graphic());
}
+ // call VCL directly; encapsulate with SvtGraphicFill
+ impStartSvtGraphicFill(pSvtGraphicFill);
+ mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient);
+ impEndSvtGraphicFill(pSvtGraphicFill);
+
break;
}
case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index a701c2a93ee1..9fcc25a4c94b 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1089,7 +1089,7 @@ namespace drawinglayer
const attribute::FillHatchAttribute& rFillHatchAttributes = rFillHatchPrimitive.getFillHatch();
// create hatch polygon in range size and discrete coordinates
- basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getObjectRange());
+ basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getOutputRange());
aHatchRange.transform(maCurrentTransformation);
const basegfx::B2DPolygon aHatchPolygon(basegfx::tools::createPolygonFromRect(aHatchRange));
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
index 3808210f95de..38028b27f71e 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -91,32 +91,83 @@ namespace drawinglayer
{
case attribute::GRADIENTSTYLE_LINEAR:
{
- pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
+ pNewTex.reset(
+ new texture::GeoTexSvxGradientLinear(
+ aOutlineRange,
+ aOutlineRange,
+ aStart,
+ aEnd,
+ nSteps,
+ rFillGradient.getBorder(),
+ rFillGradient.getAngle()));
break;
}
case attribute::GRADIENTSTYLE_AXIAL:
{
- pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
+ pNewTex.reset(
+ new texture::GeoTexSvxGradientAxial(
+ aOutlineRange,
+ aOutlineRange,
+ aStart,
+ aEnd,
+ nSteps,
+ rFillGradient.getBorder(),
+ rFillGradient.getAngle()));
break;
}
case attribute::GRADIENTSTYLE_RADIAL:
{
- pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()));
+ pNewTex.reset(
+ new texture::GeoTexSvxGradientRadial(
+ aOutlineRange,
+ aStart,
+ aEnd,
+ nSteps,
+ rFillGradient.getBorder(),
+ rFillGradient.getOffsetX(),
+ rFillGradient.getOffsetY()));
break;
}
case attribute::GRADIENTSTYLE_ELLIPTICAL:
{
- pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
+ pNewTex.reset(
+ new texture::GeoTexSvxGradientElliptical(
+ aOutlineRange,
+ aStart,
+ aEnd,
+ nSteps,
+ rFillGradient.getBorder(),
+ rFillGradient.getOffsetX(),
+ rFillGradient.getOffsetY(),
+ rFillGradient.getAngle()));
break;
}
case attribute::GRADIENTSTYLE_SQUARE:
{
- pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
+ pNewTex.reset(
+ new texture::GeoTexSvxGradientSquare(
+ aOutlineRange,
+ aStart,
+ aEnd,
+ nSteps,
+ rFillGradient.getBorder(),
+ rFillGradient.getOffsetX(),
+ rFillGradient.getOffsetY(),
+ rFillGradient.getAngle()));
break;
}
case attribute::GRADIENTSTYLE_RECT:
{
- pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
+ pNewTex.reset(
+ new texture::GeoTexSvxGradientRect(
+ aOutlineRange,
+ aStart,
+ aEnd,
+ nSteps,
+ rFillGradient.getBorder(),
+ rFillGradient.getOffsetX(),
+ rFillGradient.getOffsetY(),
+ rFillGradient.getAngle()));
break;
}
}
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index d468f708d400..e1f8f92a3a5a 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -67,14 +67,14 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxGradient::GeoTexSvxGradient(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 /* nSteps */,
double fBorder)
: GeoTexSvx(),
maGradientInfo(),
- maTargetRange(rTargetRange),
+ maDefinitionRange(rDefinitionRange),
maStart(rStart),
maEnd(rEnd),
mfBorder(fBorder)
@@ -91,7 +91,7 @@ namespace drawinglayer
return (pCompare
&& maGradientInfo == pCompare->maGradientInfo
- && maTargetRange == pCompare->maTargetRange
+ && maDefinitionRange == pCompare->maDefinitionRange
&& mfBorder == pCompare->mfBorder);
}
} // end of namespace texture
@@ -104,19 +104,33 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxGradientLinear::GeoTexSvxGradientLinear(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const basegfx::B2DRange& rOutputRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
double fBorder,
double fAngle)
- : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+ : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder),
+ mfUnitMinX(0.0),
+ mfUnitWidth(1.0),
+ mfUnitMaxY(1.0)
{
maGradientInfo = basegfx::tools::createLinearODFGradientInfo(
- rTargetRange,
+ rDefinitionRange,
nSteps,
fBorder,
fAngle);
+
+ if(rDefinitionRange != rOutputRange)
+ {
+ basegfx::B2DRange aInvOutputRange(rOutputRange);
+
+ aInvOutputRange.transform(maGradientInfo.getBackTextureTransform());
+ mfUnitMinX = aInvOutputRange.getMinX();
+ mfUnitWidth = aInvOutputRange.getWidth();
+ mfUnitMaxY = aInvOutputRange.getMaxY();
+ }
}
GeoTexSvxGradientLinear::~GeoTexSvxGradientLinear()
@@ -125,29 +139,46 @@ namespace drawinglayer
void GeoTexSvxGradientLinear::appendTransformationsAndColors(
std::vector< B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor)
+ basegfx::BColor& rOuterColor)
{
- rOutmostColor = maStart;
+ rOuterColor = maStart;
if(maGradientInfo.getSteps())
{
const double fStripeWidth(1.0 / maGradientInfo.getSteps());
B2DHomMatrixAndBColor aB2DHomMatrixAndBColor;
+ basegfx::B2DHomMatrix aPattern;
+
+ // bring from unit circle [-1, -1, 1, 1] to unit range [0, 0, 1, 1]
+ aPattern.scale(0.5, 0.5);
+ aPattern.translate(0.5, 0.5);
+
+ // scale and translate in X
+ aPattern.scale(mfUnitWidth, 1.0);
+ aPattern.translate(mfUnitMinX, 0.0);
for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++)
{
const double fPos(fStripeWidth * a);
- // optimized below...
-
- // basegfx::B2DHomMatrix aNew;
- // aNew.scale(0.5, 0.5);
- // aNew.translate(0.5, 0.5);
- // aNew.scale(1.0, (1.0 - fPos));
- // aNew.translate(0.0, fPos);
- // aNew = maGradientInfo.getTextureTransform() * aNew;
- aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() *
- basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5 * (1.0 - fPos), 0.5, 0.5 * (1.0 + fPos));
+ basegfx::B2DHomMatrix aNew(aPattern);
+
+ // scale and translate in Y
+ double fHeight(1.0 - fPos);
+
+ if(a + 1 == maGradientInfo.getSteps() && mfUnitMaxY > 1.0)
+ {
+ fHeight += mfUnitMaxY - 1.0;
+ }
+
+ aNew.scale(1.0, fHeight);
+ aNew.translate(0.0, fPos);
+
+ // set at target
+ aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * aNew;
+
+ // interpolate and set color
aB2DHomMatrixAndBColor.maBColor = interpolate(maStart, maEnd, double(a) / double(maGradientInfo.getSteps() - 1));
+
rEntries.push_back(aB2DHomMatrixAndBColor);
}
}
@@ -169,19 +200,31 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxGradientAxial::GeoTexSvxGradientAxial(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const basegfx::B2DRange& rOutputRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
double fBorder,
double fAngle)
- : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+ : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder),
+ mfUnitMinX(0.0),
+ mfUnitWidth(1.0)
{
maGradientInfo = basegfx::tools::createAxialODFGradientInfo(
- rTargetRange,
+ rDefinitionRange,
nSteps,
fBorder,
fAngle);
+
+ if(rDefinitionRange != rOutputRange)
+ {
+ basegfx::B2DRange aInvOutputRange(rOutputRange);
+
+ aInvOutputRange.transform(maGradientInfo.getBackTextureTransform());
+ mfUnitMinX = aInvOutputRange.getMinX();
+ mfUnitWidth = aInvOutputRange.getWidth();
+ }
}
GeoTexSvxGradientAxial::~GeoTexSvxGradientAxial()
@@ -190,9 +233,9 @@ namespace drawinglayer
void GeoTexSvxGradientAxial::appendTransformationsAndColors(
std::vector< B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor)
+ basegfx::BColor& rOuterColor)
{
- rOutmostColor = maEnd;
+ rOuterColor = maEnd;
if(maGradientInfo.getSteps())
{
@@ -201,16 +244,26 @@ namespace drawinglayer
for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++)
{
- // const double fPos(fStripeWidth * a);
- // optimized below...
-
- // basegfx::B2DHomMatrix aNew;
- // aNew.scale(0.50, (1.0 - fPos));
- // aNew.translate(0.5, 0.0);
- // aNew = maGradientInfo.getTextureTransform() * aNew;
- aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() *
- basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 1.0 - (fStripeWidth * a), 0.5, 0.0);
+ const double fPos(fStripeWidth * a);
+ basegfx::B2DHomMatrix aNew;
+
+ // bring in X from unit circle [-1, -1, 1, 1] to unit range [0, 0, 1, 1]
+ aNew.scale(0.5, 1.0);
+ aNew.translate(0.5, 0.0);
+
+ // scale/translate in X
+ aNew.scale(mfUnitWidth, 1.0);
+ aNew.translate(mfUnitMinX, 0.0);
+
+ // already centerd in Y on X-Axis, just scale in Y
+ aNew.scale(1.0, 1.0 - fPos);
+
+ // set at target
+ aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * aNew;
+
+ // interpolate and set color
aB2DHomMatrixAndBColor.maBColor = interpolate(maEnd, maStart, double(a) / double(maGradientInfo.getSteps() - 1));
+
rEntries.push_back(aB2DHomMatrixAndBColor);
}
}
@@ -232,17 +285,17 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxGradientRadial::GeoTexSvxGradientRadial(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
double fBorder,
double fOffsetX,
double fOffsetY)
- : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+ : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
{
maGradientInfo = basegfx::tools::createRadialODFGradientInfo(
- rTargetRange,
+ rDefinitionRange,
basegfx::B2DVector(fOffsetX,fOffsetY),
nSteps,
fBorder);
@@ -254,9 +307,9 @@ namespace drawinglayer
void GeoTexSvxGradientRadial::appendTransformationsAndColors(
std::vector< B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor)
+ basegfx::BColor& rOuterColor)
{
- rOutmostColor = maStart;
+ rOuterColor = maStart;
if(maGradientInfo.getSteps())
{
@@ -289,7 +342,7 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxGradientElliptical::GeoTexSvxGradientElliptical(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
@@ -297,10 +350,10 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY,
double fAngle)
- : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+ : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
{
maGradientInfo = basegfx::tools::createEllipticalODFGradientInfo(
- rTargetRange,
+ rDefinitionRange,
basegfx::B2DVector(fOffsetX,fOffsetY),
nSteps,
fBorder,
@@ -313,9 +366,9 @@ namespace drawinglayer
void GeoTexSvxGradientElliptical::appendTransformationsAndColors(
std::vector< B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor)
+ basegfx::BColor& rOuterColor)
{
- rOutmostColor = maStart;
+ rOuterColor = maStart;
if(maGradientInfo.getSteps())
{
@@ -366,7 +419,7 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxGradientSquare::GeoTexSvxGradientSquare(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
@@ -374,10 +427,10 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY,
double fAngle)
- : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+ : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
{
maGradientInfo = basegfx::tools::createSquareODFGradientInfo(
- rTargetRange,
+ rDefinitionRange,
basegfx::B2DVector(fOffsetX,fOffsetY),
nSteps,
fBorder,
@@ -390,9 +443,9 @@ namespace drawinglayer
void GeoTexSvxGradientSquare::appendTransformationsAndColors(
std::vector< B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor)
+ basegfx::BColor& rOuterColor)
{
- rOutmostColor = maStart;
+ rOuterColor = maStart;
if(maGradientInfo.getSteps())
{
@@ -425,7 +478,7 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxGradientRect::GeoTexSvxGradientRect(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
const basegfx::BColor& rStart,
const basegfx::BColor& rEnd,
sal_uInt32 nSteps,
@@ -433,10 +486,10 @@ namespace drawinglayer
double fOffsetX,
double fOffsetY,
double fAngle)
- : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+ : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
{
maGradientInfo = basegfx::tools::createRectangularODFGradientInfo(
- rTargetRange,
+ rDefinitionRange,
basegfx::B2DVector(fOffsetX,fOffsetY),
nSteps,
fBorder,
@@ -449,9 +502,9 @@ namespace drawinglayer
void GeoTexSvxGradientRect::appendTransformationsAndColors(
std::vector< B2DHomMatrixAndBColor >& rEntries,
- basegfx::BColor& rOutmostColor)
+ basegfx::BColor& rOuterColor)
{
- rOutmostColor = maStart;
+ rOuterColor = maStart;
if(maGradientInfo.getSteps())
{
@@ -502,17 +555,22 @@ namespace drawinglayer
namespace texture
{
GeoTexSvxHatch::GeoTexSvxHatch(
- const basegfx::B2DRange& rTargetRange,
+ const basegfx::B2DRange& rDefinitionRange,
+ const basegfx::B2DRange& rOutputRange,
double fDistance,
double fAngle)
- : mfDistance(0.1),
+ : maOutputRange(rOutputRange),
+ maTextureTransform(),
+ maBackTextureTransform(),
+ mfDistance(0.1),
mfAngle(fAngle),
- mnSteps(10L)
+ mnSteps(10),
+ mbDefinitionRangeEqualsOutputRange(rDefinitionRange == rOutputRange)
{
- double fTargetSizeX(rTargetRange.getWidth());
- double fTargetSizeY(rTargetRange.getHeight());
- double fTargetOffsetX(rTargetRange.getMinX());
- double fTargetOffsetY(rTargetRange.getMinY());
+ double fTargetSizeX(rDefinitionRange.getWidth());
+ double fTargetSizeY(rDefinitionRange.getHeight());
+ double fTargetOffsetX(rDefinitionRange.getMinX());
+ double fTargetOffsetY(rDefinitionRange.getMinY());
fAngle = -fAngle;
@@ -559,6 +617,7 @@ namespace drawinglayer
{
const GeoTexSvxHatch* pCompare = dynamic_cast< const GeoTexSvxHatch* >(&rGeoTexSvx);
return (pCompare
+ && maOutputRange == pCompare->maOutputRange
&& maTextureTransform == pCompare->maTextureTransform
&& mfDistance == pCompare->mfDistance
&& mfAngle == pCompare->mfAngle
@@ -567,13 +626,54 @@ namespace drawinglayer
void GeoTexSvxHatch::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices)
{
- for(sal_uInt32 a(1L); a < mnSteps; a++)
+ if(mbDefinitionRangeEqualsOutputRange)
{
- // create matrix
- const double fOffset(mfDistance * (double)a);
- basegfx::B2DHomMatrix aNew;
- aNew.set(1, 2, fOffset);
- rMatrices.push_back(maTextureTransform * aNew);
+ // simple hatch where the definition area equals the output area
+ for(sal_uInt32 a(1); a < mnSteps; a++)
+ {
+ // create matrix
+ const double fOffset(mfDistance * (double)a);
+ basegfx::B2DHomMatrix aNew;
+ aNew.set(1, 2, fOffset);
+ rMatrices.push_back(maTextureTransform * aNew);
+ }
+ }
+ else
+ {
+ // output area is different from definition area, back-transform to get
+ // the output area in unit coordinates and fill this with hatch lines
+ // using the settings derived from the definition area
+ basegfx::B2DRange aBackUnitRange(maOutputRange);
+
+ aBackUnitRange.transform(getBackTextureTransform());
+
+ // calculate vertical start value and a security maximum integer value to avoid death loops
+ double fStart(basegfx::snapToNearestMultiple(aBackUnitRange.getMinY(), mfDistance));
+ const sal_uInt32 nNeededIntegerSteps(basegfx::fround((aBackUnitRange.getHeight() / mfDistance) + 0.5));
+ sal_uInt32 nMaxIntegerSteps(::std::min(nNeededIntegerSteps, sal_uInt32(10000)));
+
+ while(fStart < aBackUnitRange.getMaxY() && nMaxIntegerSteps)
+ {
+ // create new transform for
+ basegfx::B2DHomMatrix aNew;
+
+ // adapt x scale and position
+ //aNew.scale(aBackUnitRange.getWidth(), 1.0);
+ //aNew.translate(aBackUnitRange.getMinX(), 0.0);
+ aNew.set(0, 0, aBackUnitRange.getWidth());
+ aNew.set(0, 2, aBackUnitRange.getMinX());
+
+ // adapt y position to current step
+ aNew.set(1, 2, fStart);
+ //aNew.translate(0.0, fStart);
+
+ // add new transformation
+ rMatrices.push_back(maTextureTransform * aNew);
+
+ // next step
+ fStart += mfDistance;
+ nMaxIntegerSteps--;
+ }
}
}
diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx
index b08a024032d4..5902188068c1 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -334,16 +334,28 @@ namespace drawinglayer
const double fAngleA(rHatch.getAngle());
maColor = rHatch.getColor();
mbFillBackground = rHatch.isFillBackground();
- mp0 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA);
+ mp0 = new GeoTexSvxHatch(
+ aOutlineRange,
+ aOutlineRange,
+ rHatch.getDistance(),
+ fAngleA);
if(attribute::HATCHSTYLE_DOUBLE == rHatch.getStyle() || attribute::HATCHSTYLE_TRIPLE == rHatch.getStyle())
{
- mp1 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA + F_PI2);
+ mp1 = new GeoTexSvxHatch(
+ aOutlineRange,
+ aOutlineRange,
+ rHatch.getDistance(),
+ fAngleA + F_PI2);
}
if(attribute::HATCHSTYLE_TRIPLE == rHatch.getStyle())
{
- mp2 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA + F_PI4);
+ mp2 = new GeoTexSvxHatch(
+ aOutlineRange,
+ aOutlineRange,
+ rHatch.getDistance(),
+ fAngleA + F_PI4);
}
}