diff options
Diffstat (limited to 'include')
4 files changed, 50 insertions, 1 deletions
diff --git a/include/basegfx/utils/bgradient.hxx b/include/basegfx/utils/bgradient.hxx index f54b8763d87f..2ac8eba41d61 100644 --- a/include/basegfx/utils/bgradient.hxx +++ b/include/basegfx/utils/bgradient.hxx @@ -264,6 +264,10 @@ public: // Apply BColorModifierStack changes void tryToApplyBColorModifierStack(const BColorModifierStack& rBColorModifierStack); + + // check if local and given BColorStops have same count and distances, + // ignore colors + bool sameSizeAndDistances(const BColorStops& rComp) const; }; class BASEGFX_DLLPUBLIC BGradient final diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx index 462d7fc8151e..62b890b5f0c1 100644 --- a/include/drawinglayer/attribute/fillgradientattribute.hxx +++ b/include/drawinglayer/attribute/fillgradientattribute.hxx @@ -83,6 +83,10 @@ public: // cannot do at all) bool cannotBeHandledByVCL() const; + // check if local and given FillGradientAttribute are identical, + // do take care of exceptions (e.g. no offset for linear/axial, ...) + bool sameDefinitionThanAlpha(const FillGradientAttribute& rAlpha) const; + // compare operator bool operator==(const FillGradientAttribute& rCandidate) const; diff --git a/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx index 1d4495806d15..07ec3460101e 100644 --- a/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx +++ b/include/drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx @@ -33,7 +33,7 @@ namespace drawinglayer::primitive2d decomosition will create a MaskPrimitive2D containing a FillGradientPrimitive2D. */ -class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D final +class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D { private: @@ -70,6 +70,45 @@ public: virtual sal_uInt32 getPrimitive2DID() const override; }; +// helper primitive that can be used to directly express RGBA +// gradient definitions. It will be decomposed to a combined +// TransparencePrimitive2D if not handled directly. Use the +// already existing PolyPolygonGradientPrimitive2D as base class, +// only the additional FillGradientAlpha needs to be added. +// NOTE: FillGradientAlpha *has* to fulfil the +// 'sameDefinitionThanAlpha' coindition defined by the check +// method with the same name +class DRAWINGLAYER_DLLPUBLIC PolyPolygonRGBAGradientPrimitive2D final + : public PolyPolygonGradientPrimitive2D +{ +private: + /// the gradient alpha definition + attribute::FillGradientAttribute maFillGradientAlpha; + + /// local decomposition. + virtual Primitive2DReference + create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; + +public: + /// constructors. The one without definition range will use output range as definition range + PolyPolygonRGBAGradientPrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon, + const basegfx::B2DRange& rDefinitionRange, + attribute::FillGradientAttribute aFillGradient, + attribute::FillGradientAttribute aFillGradientAlpha); + + /// data read access + const attribute::FillGradientAttribute& getFillGradientAlpha() const + { + return maFillGradientAlpha; + } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; +}; + } // end of namespace primitive2d::drawinglayer /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index f276caa8ec04..2345a4b86071 100644 --- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -108,6 +108,8 @@ #define PRIMITIVE2D_ID_FILLEDRECTANGLEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 74) #define PRIMITIVE2D_ID_SINGLELINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 75) #define PRIMITIVE2D_ID_EXCLUSIVEEDITVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 76) +#define PRIMITIVE2D_ID_POLYPOLYGONRGBAGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 77) + // When you add a new primitive, please update the drawinglayer::primitive2d::idToString() function // in drawinglayer/source/primitive2d/Tools.cxx. |