summaryrefslogtreecommitdiff
path: root/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx')
-rw-r--r--drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx27
1 files changed, 23 insertions, 4 deletions
diff --git a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
index 31a7acb03d7c..7853709b9541 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
@@ -34,21 +34,36 @@ namespace drawinglayer::primitive2d
Primitive2DReference PolyPolygonGraphicPrimitive2D::create2DDecomposition(
const geometry::ViewInformation2D& /*rViewInformation*/) const
{
+ if (basegfx::fTools::equal(getTransparency(), 1.0))
+ {
+ // completely transparent, done
+ return nullptr;
+ }
+
if (getFillGraphic().isDefault())
+ {
+ // no geometry data, done
return nullptr;
+ }
const Graphic& rGraphic = getFillGraphic().getGraphic();
const GraphicType aType(rGraphic.GetType());
// is there a bitmap or a metafile (do we have content)?
if (GraphicType::Bitmap != aType && GraphicType::GdiMetafile != aType)
+ {
+ // no geometry data, done
return nullptr;
+ }
const Size aPrefSize(rGraphic.GetPrefSize());
// does content have a size?
if (!(aPrefSize.Width() && aPrefSize.Height()))
+ {
+ // no geometry data with size, done
return nullptr;
+ }
// create SubSequence with FillGraphicPrimitive2D based on polygon range
const basegfx::B2DRange aOutRange(getB2DPolyPolygon().getB2DRange());
@@ -85,11 +100,13 @@ Primitive2DReference PolyPolygonGraphicPrimitive2D::create2DDecomposition(
getFillGraphic().getGraphic(), aAdaptedRange, getFillGraphic().getTiling(),
getFillGraphic().getOffsetX(), getFillGraphic().getOffsetY());
- xSubRef = new FillGraphicPrimitive2D(aNewObjectTransform, aAdaptedFillGraphicAttribute);
+ xSubRef = new FillGraphicPrimitive2D(aNewObjectTransform, aAdaptedFillGraphicAttribute,
+ getTransparency());
}
else
{
- xSubRef = new FillGraphicPrimitive2D(aNewObjectTransform, getFillGraphic());
+ xSubRef
+ = new FillGraphicPrimitive2D(aNewObjectTransform, getFillGraphic(), getTransparency());
}
// embed to mask primitive
@@ -98,10 +115,11 @@ Primitive2DReference PolyPolygonGraphicPrimitive2D::create2DDecomposition(
PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
basegfx::B2DPolyPolygon aPolyPolygon, const basegfx::B2DRange& rDefinitionRange,
- const attribute::FillGraphicAttribute& rFillGraphic)
+ const attribute::FillGraphicAttribute& rFillGraphic, double fTransparency)
: maPolyPolygon(std::move(aPolyPolygon))
, maDefinitionRange(rDefinitionRange)
, maFillGraphic(rFillGraphic)
+ , mfTransparency(std::max(0.0, std::min(1.0, fTransparency)))
{
}
@@ -114,7 +132,8 @@ bool PolyPolygonGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive
return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
&& getDefinitionRange() == rCompare.getDefinitionRange()
- && getFillGraphic() == rCompare.getFillGraphic());
+ && getFillGraphic() == rCompare.getFillGraphic()
+ && basegfx::fTools::equal(getTransparency(), rCompare.getTransparency()));
}
return false;