summaryrefslogtreecommitdiff
path: root/include/drawinglayer/primitive2d
diff options
context:
space:
mode:
authorArmin Le Grand (Collabora) <Armin.Le.Grand@me.com>2024-07-25 20:25:31 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2024-07-26 10:56:33 +0200
commit4461173a4d0dff82e6223bdc1376230a9cd6b1cc (patch)
treeedc84d2a3882a8da075b016073f127fbaafa8a91 /include/drawinglayer/primitive2d
parent2a9ae694832202bec6c966a1ec8015c1ae215908 (diff)
CairoSDPR: Support direct transparency for gradients
FillGradientPrimitive2D/ and PolyPolygonGradientPrimitive2D now support both alphas, a gradientAlpha and a unified one. This allows a processor to directly handle a gradient with a unifiedAlpha if he wants. Adapted other places accordingly. NOTE: In VclMetafileProcessor2D handling of the primitive PolyPolygonGradientPrimitive2D has to do a local compromize, see comment there. Change-Id: I536f4935dafde0369f768dbd281d547b7bb08eb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171052 Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com> Tested-by: Jenkins
Diffstat (limited to 'include/drawinglayer/primitive2d')
-rw-r--r--include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx11
-rw-r--r--include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx9
2 files changed, 17 insertions, 3 deletions
diff --git a/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx
index 13afc0616016..31b4374dbc00 100644
--- a/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx
+++ b/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx
@@ -49,6 +49,9 @@ private:
/// evtl. fitting alphaGradient definition
attribute::FillGradientAttribute maAlphaGradient;
+ /// the transparency in range [0.0 .. 1.0]
+ double mfTransparency;
+
/// local decomposition.
virtual Primitive2DReference
create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
@@ -60,16 +63,20 @@ public:
PolyPolygonGradientPrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon,
const basegfx::B2DRange& rDefinitionRange,
const attribute::FillGradientAttribute& rFillGradient,
- const attribute::FillGradientAttribute* pAlphaGradient
- = nullptr);
+ const attribute::FillGradientAttribute* pAlphaGradient = nullptr,
+ double fTransparency = 0.0);
/// data read access
const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
const attribute::FillGradientAttribute& getAlphaGradient() const { return maAlphaGradient; }
bool hasAlphaGradient() const { return !maAlphaGradient.isDefault(); }
+ double getTransparency() const { return mfTransparency; }
+ bool hasTransparency() const { return !basegfx::fTools::equalZero(mfTransparency); }
+
/// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
diff --git a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
index 41b8c91f507f..0654801e8ef8 100644
--- a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
@@ -70,6 +70,8 @@ namespace drawinglayer::primitive2d
/// evtl. fitting alphaGradient definition
attribute::FillGradientAttribute maAlphaGradient;
+ /// the transparency in range [0.0 .. 1.0]
+ double mfTransparency;
protected:
/// local helper
@@ -93,15 +95,20 @@ namespace drawinglayer::primitive2d
const basegfx::B2DRange& rOutputRange,
const basegfx::B2DRange& rDefinitionRange,
const attribute::FillGradientAttribute& rFillGradient,
- const attribute::FillGradientAttribute* pAlphaGradient = nullptr);
+ const attribute::FillGradientAttribute* pAlphaGradient = nullptr,
+ double fTransparency = 0.0);
/// data read access
const basegfx::B2DRange& getOutputRange() const { return maOutputRange; }
const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
const attribute::FillGradientAttribute& getAlphaGradient() const { return maAlphaGradient; }
bool hasAlphaGradient() const { return !maAlphaGradient.isDefault(); }
+ double getTransparency() const { return mfTransparency; }
+ bool hasTransparency() const { return !basegfx::fTools::equalZero(mfTransparency); }
+
/// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override final;