1464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5464702f4SAndrew Rist  * distributed with this work for additional information
6464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10464702f4SAndrew Rist  *
11464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12464702f4SAndrew Rist  *
13464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14464702f4SAndrew Rist  * software distributed under the License is distributed on an
15464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17464702f4SAndrew Rist  * specific language governing permissions and limitations
18464702f4SAndrew Rist  * under the License.
19464702f4SAndrew Rist  *
20464702f4SAndrew Rist  *************************************************************/
21464702f4SAndrew Rist 
22464702f4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
28cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
29cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
30cdf0e10cSrcweir #include <drawinglayer/texture/texture.hxx>
31cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
32cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx>
33cdf0e10cSrcweir #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
36cdf0e10cSrcweir 
37cdf0e10cSrcweir using namespace com::sun::star;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace drawinglayer
42cdf0e10cSrcweir {
43*64b14621SArmin Le Grand     namespace primitive2d
44*64b14621SArmin Le Grand     {
generateMatricesAndColors(std::vector<drawinglayer::texture::B2DHomMatrixAndBColor> & rEntries,basegfx::BColor & rOuterColor) const45cdf0e10cSrcweir         void FillGradientPrimitive2D::generateMatricesAndColors(
4696fc4b33SArmin Le Grand             std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
47*64b14621SArmin Le Grand             basegfx::BColor& rOuterColor) const
48cdf0e10cSrcweir         {
4996fc4b33SArmin Le Grand             rEntries.clear();
50cdf0e10cSrcweir 
51*64b14621SArmin Le Grand             // make sure steps is not too high/low
52*64b14621SArmin Le Grand             const basegfx::BColor aStart(getFillGradient().getStartColor());
53*64b14621SArmin Le Grand             const basegfx::BColor aEnd(getFillGradient().getEndColor());
54*64b14621SArmin Le Grand             const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5));
55*64b14621SArmin Le Grand             sal_uInt32 nSteps(getFillGradient().getSteps());
56*64b14621SArmin Le Grand 
57*64b14621SArmin Le Grand             if(nSteps == 0)
58*64b14621SArmin Le Grand             {
59*64b14621SArmin Le Grand                 nSteps = nMaxSteps;
60*64b14621SArmin Le Grand             }
61*64b14621SArmin Le Grand 
62*64b14621SArmin Le Grand             if(nSteps < 2)
63*64b14621SArmin Le Grand             {
64*64b14621SArmin Le Grand                 nSteps = 2;
65*64b14621SArmin Le Grand             }
66*64b14621SArmin Le Grand 
67*64b14621SArmin Le Grand             if(nSteps > nMaxSteps)
68*64b14621SArmin Le Grand             {
69*64b14621SArmin Le Grand                 nSteps = nMaxSteps;
70*64b14621SArmin Le Grand             }
71*64b14621SArmin Le Grand 
72*64b14621SArmin Le Grand             switch(getFillGradient().getStyle())
73*64b14621SArmin Le Grand             {
74*64b14621SArmin Le Grand                 case attribute::GRADIENTSTYLE_LINEAR:
75*64b14621SArmin Le Grand                 {
76*64b14621SArmin Le Grand                     texture::GeoTexSvxGradientLinear aGradient(
77*64b14621SArmin Le Grand                         getDefinitionRange(),
78*64b14621SArmin Le Grand                         getOutputRange(),
79*64b14621SArmin Le Grand                         aStart,
80*64b14621SArmin Le Grand                         aEnd,
81*64b14621SArmin Le Grand                         nSteps,
82*64b14621SArmin Le Grand                         getFillGradient().getBorder(),
83*64b14621SArmin Le Grand                         getFillGradient().getAngle());
84*64b14621SArmin Le Grand                     aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
85*64b14621SArmin Le Grand                     break;
86*64b14621SArmin Le Grand                 }
87*64b14621SArmin Le Grand                 case attribute::GRADIENTSTYLE_AXIAL:
88*64b14621SArmin Le Grand                 {
89*64b14621SArmin Le Grand                     texture::GeoTexSvxGradientAxial aGradient(
90*64b14621SArmin Le Grand                         getDefinitionRange(),
91*64b14621SArmin Le Grand                         getOutputRange(),
92*64b14621SArmin Le Grand                         aStart,
93*64b14621SArmin Le Grand                         aEnd,
94*64b14621SArmin Le Grand                         nSteps,
95*64b14621SArmin Le Grand                         getFillGradient().getBorder(),
96*64b14621SArmin Le Grand                         getFillGradient().getAngle());
97*64b14621SArmin Le Grand                     aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
98*64b14621SArmin Le Grand                     break;
99*64b14621SArmin Le Grand                 }
100*64b14621SArmin Le Grand                 case attribute::GRADIENTSTYLE_RADIAL:
101*64b14621SArmin Le Grand                 {
102*64b14621SArmin Le Grand                     texture::GeoTexSvxGradientRadial aGradient(
103*64b14621SArmin Le Grand                         getDefinitionRange(),
104*64b14621SArmin Le Grand                         aStart,
105*64b14621SArmin Le Grand                         aEnd,
106*64b14621SArmin Le Grand                         nSteps,
107*64b14621SArmin Le Grand                         getFillGradient().getBorder(),
108*64b14621SArmin Le Grand                         getFillGradient().getOffsetX(),
109*64b14621SArmin Le Grand                         getFillGradient().getOffsetY());
110*64b14621SArmin Le Grand                     aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
111*64b14621SArmin Le Grand                     break;
112*64b14621SArmin Le Grand                 }
113*64b14621SArmin Le Grand                 case attribute::GRADIENTSTYLE_ELLIPTICAL:
114*64b14621SArmin Le Grand                 {
115*64b14621SArmin Le Grand                     texture::GeoTexSvxGradientElliptical aGradient(
116*64b14621SArmin Le Grand                         getDefinitionRange(),
117*64b14621SArmin Le Grand                         aStart,
118*64b14621SArmin Le Grand                         aEnd,
119*64b14621SArmin Le Grand                         nSteps,
120*64b14621SArmin Le Grand                         getFillGradient().getBorder(),
121*64b14621SArmin Le Grand                         getFillGradient().getOffsetX(),
122*64b14621SArmin Le Grand                         getFillGradient().getOffsetY(),
123*64b14621SArmin Le Grand                         getFillGradient().getAngle());
124*64b14621SArmin Le Grand                     aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
125*64b14621SArmin Le Grand                     break;
126*64b14621SArmin Le Grand                 }
127*64b14621SArmin Le Grand                 case attribute::GRADIENTSTYLE_SQUARE:
128*64b14621SArmin Le Grand                 {
129*64b14621SArmin Le Grand                     texture::GeoTexSvxGradientSquare aGradient(
130*64b14621SArmin Le Grand                         getDefinitionRange(),
131*64b14621SArmin Le Grand                         aStart,
132*64b14621SArmin Le Grand                         aEnd,
133*64b14621SArmin Le Grand                         nSteps,
134*64b14621SArmin Le Grand                         getFillGradient().getBorder(),
135*64b14621SArmin Le Grand                         getFillGradient().getOffsetX(),
136*64b14621SArmin Le Grand                         getFillGradient().getOffsetY(),
137*64b14621SArmin Le Grand                         getFillGradient().getAngle());
138*64b14621SArmin Le Grand                     aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
139*64b14621SArmin Le Grand                     break;
140*64b14621SArmin Le Grand                 }
141*64b14621SArmin Le Grand                 case attribute::GRADIENTSTYLE_RECT:
142*64b14621SArmin Le Grand                 {
143*64b14621SArmin Le Grand                     texture::GeoTexSvxGradientRect aGradient(
144*64b14621SArmin Le Grand                         getDefinitionRange(),
145*64b14621SArmin Le Grand                         aStart,
146*64b14621SArmin Le Grand                         aEnd,
147*64b14621SArmin Le Grand                         nSteps,
148*64b14621SArmin Le Grand                         getFillGradient().getBorder(),
149*64b14621SArmin Le Grand                         getFillGradient().getOffsetX(),
150*64b14621SArmin Le Grand                         getFillGradient().getOffsetY(),
151*64b14621SArmin Le Grand                         getFillGradient().getAngle());
152*64b14621SArmin Le Grand                     aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
153*64b14621SArmin Le Grand                     break;
154*64b14621SArmin Le Grand                 }
155*64b14621SArmin Le Grand             }
156cdf0e10cSrcweir         }
157cdf0e10cSrcweir 
createOverlappingFill(const std::vector<drawinglayer::texture::B2DHomMatrixAndBColor> & rEntries,const basegfx::BColor & rOuterColor,const basegfx::B2DPolygon & rUnitPolygon) const158cdf0e10cSrcweir         Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill(
15996fc4b33SArmin Le Grand             const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
160*64b14621SArmin Le Grand             const basegfx::BColor& rOuterColor,
161cdf0e10cSrcweir             const basegfx::B2DPolygon& rUnitPolygon) const
162cdf0e10cSrcweir         {
16396fc4b33SArmin Le Grand             // prepare return value
16496fc4b33SArmin Le Grand             Primitive2DSequence aRetval(rEntries.size() + 1);
16596fc4b33SArmin Le Grand 
16696fc4b33SArmin Le Grand             // create solid fill with outmost color
16796fc4b33SArmin Le Grand             aRetval[0] = Primitive2DReference(
16896fc4b33SArmin Le Grand                 new PolyPolygonColorPrimitive2D(
169*64b14621SArmin Le Grand                     basegfx::B2DPolyPolygon(
170*64b14621SArmin Le Grand                         basegfx::tools::createPolygonFromRect(getOutputRange())),
171*64b14621SArmin Le Grand                     rOuterColor));
17296fc4b33SArmin Le Grand 
17396fc4b33SArmin Le Grand             // create solid fill steps
17496fc4b33SArmin Le Grand             for(sal_uInt32 a(0); a < rEntries.size(); a++)
17596fc4b33SArmin Le Grand             {
17696fc4b33SArmin Le Grand                 // create part polygon
17796fc4b33SArmin Le Grand                 basegfx::B2DPolygon aNewPoly(rUnitPolygon);
17896fc4b33SArmin Le Grand 
17996fc4b33SArmin Le Grand                 aNewPoly.transform(rEntries[a].maB2DHomMatrix);
18096fc4b33SArmin Le Grand 
18196fc4b33SArmin Le Grand                 // create solid fill
18296fc4b33SArmin Le Grand                 aRetval[a + 1] = Primitive2DReference(
183cdf0e10cSrcweir                     new PolyPolygonColorPrimitive2D(
184cdf0e10cSrcweir                         basegfx::B2DPolyPolygon(aNewPoly),
18596fc4b33SArmin Le Grand                         rEntries[a].maBColor));
18696fc4b33SArmin Le Grand             }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir             return aRetval;
189cdf0e10cSrcweir         }
190cdf0e10cSrcweir 
createNonOverlappingFill(const std::vector<drawinglayer::texture::B2DHomMatrixAndBColor> & rEntries,const basegfx::BColor & rOuterColor,const basegfx::B2DPolygon & rUnitPolygon) const191cdf0e10cSrcweir         Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill(
19296fc4b33SArmin Le Grand             const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
193*64b14621SArmin Le Grand             const basegfx::BColor& rOuterColor,
194cdf0e10cSrcweir             const basegfx::B2DPolygon& rUnitPolygon) const
195cdf0e10cSrcweir         {
19696fc4b33SArmin Le Grand             // prepare return value
19796fc4b33SArmin Le Grand             Primitive2DSequence aRetval(rEntries.size() + 1);
19896fc4b33SArmin Le Grand 
199*64b14621SArmin Le Grand             // get outmost viusible range from object
200*64b14621SArmin Le Grand             basegfx::B2DRange aOutmostRange(getOutputRange());
20196fc4b33SArmin Le Grand             basegfx::B2DPolyPolygon aCombinedPolyPoly;
202cdf0e10cSrcweir 
20396fc4b33SArmin Le Grand             if(rEntries.size())
204cdf0e10cSrcweir             {
20596fc4b33SArmin Le Grand                 // extend aOutmostRange with first polygon
20696fc4b33SArmin Le Grand                 basegfx::B2DPolygon aFirstPoly(rUnitPolygon);
207cdf0e10cSrcweir 
20896fc4b33SArmin Le Grand                 aFirstPoly.transform(rEntries[0].maB2DHomMatrix);
20996fc4b33SArmin Le Grand                 aCombinedPolyPoly.append(aFirstPoly);
21096fc4b33SArmin Le Grand                 aOutmostRange.expand(aFirstPoly.getB2DRange());
21196fc4b33SArmin Le Grand             }
21296fc4b33SArmin Le Grand 
21396fc4b33SArmin Le Grand             // add outmost range to combined polypolygon (in 1st place), create first primitive
21496fc4b33SArmin Le Grand             aCombinedPolyPoly.insert(0, basegfx::tools::createPolygonFromRect(aOutmostRange));
21596fc4b33SArmin Le Grand             aRetval[0] = Primitive2DReference(
21696fc4b33SArmin Le Grand                 new PolyPolygonColorPrimitive2D(
21796fc4b33SArmin Le Grand                     aCombinedPolyPoly,
218*64b14621SArmin Le Grand                     rOuterColor));
21996fc4b33SArmin Le Grand 
22096fc4b33SArmin Le Grand             if(rEntries.size())
22196fc4b33SArmin Le Grand             {
22296fc4b33SArmin Le Grand                 // reuse first polygon, it's the second one
22396fc4b33SArmin Le Grand                 aCombinedPolyPoly.remove(0);
22496fc4b33SArmin Le Grand 
22596fc4b33SArmin Le Grand                 for(sal_uInt32 a(0); a < rEntries.size() - 1; a++)
22696fc4b33SArmin Le Grand                 {
22796fc4b33SArmin Le Grand                     // create next inner polygon, combinbe with last one
22896fc4b33SArmin Le Grand                     basegfx::B2DPolygon aNextPoly(rUnitPolygon);
22996fc4b33SArmin Le Grand 
23096fc4b33SArmin Le Grand                     aNextPoly.transform(rEntries[a + 1].maB2DHomMatrix);
23196fc4b33SArmin Le Grand                     aCombinedPolyPoly.append(aNextPoly);
232cdf0e10cSrcweir 
23396fc4b33SArmin Le Grand                     // create primitive with correct color
23496fc4b33SArmin Le Grand                     aRetval[a + 1] = Primitive2DReference(
23596fc4b33SArmin Le Grand                         new PolyPolygonColorPrimitive2D(
23696fc4b33SArmin Le Grand                             aCombinedPolyPoly,
23796fc4b33SArmin Le Grand                             rEntries[a].maBColor));
23896fc4b33SArmin Le Grand 
23996fc4b33SArmin Le Grand                     // reuse inner polygon, it's the 2nd one
24096fc4b33SArmin Le Grand                     aCombinedPolyPoly.remove(0);
241cdf0e10cSrcweir                 }
24296fc4b33SArmin Le Grand 
24396fc4b33SArmin Le Grand                 // add last inner polygon with last color
24496fc4b33SArmin Le Grand                 aRetval[rEntries.size()] = Primitive2DReference(
24596fc4b33SArmin Le Grand                     new PolyPolygonColorPrimitive2D(
24696fc4b33SArmin Le Grand                         aCombinedPolyPoly,
24796fc4b33SArmin Le Grand                         rEntries[rEntries.size() - 1].maBColor));
248cdf0e10cSrcweir             }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir             return aRetval;
251cdf0e10cSrcweir         }
252cdf0e10cSrcweir 
createFill(bool bOverlapping) const253*64b14621SArmin Le Grand         Primitive2DSequence FillGradientPrimitive2D::createFill(bool bOverlapping) const
254*64b14621SArmin Le Grand         {
255cdf0e10cSrcweir             // prepare shape of the Unit Polygon
256*64b14621SArmin Le Grand             basegfx::B2DPolygon aUnitPolygon;
257cdf0e10cSrcweir 
25896fc4b33SArmin Le Grand             switch(getFillGradient().getStyle())
25996fc4b33SArmin Le Grand             {
26096fc4b33SArmin Le Grand                 case attribute::GRADIENTSTYLE_RADIAL:
26196fc4b33SArmin Le Grand                 case attribute::GRADIENTSTYLE_ELLIPTICAL:
26296fc4b33SArmin Le Grand                 {
26396fc4b33SArmin Le Grand                     aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 1.0);
26496fc4b33SArmin Le Grand                     break;
26596fc4b33SArmin Le Grand                 }
26696fc4b33SArmin Le Grand                 default: // GRADIENTSTYLE_LINEAR, attribute::GRADIENTSTYLE_AXIAL, attribute::GRADIENTSTYLE_SQUARE, attribute::GRADIENTSTYLE_RECT
26796fc4b33SArmin Le Grand                 {
26896fc4b33SArmin Le Grand                     aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1.0, -1.0, 1.0, 1.0));
26996fc4b33SArmin Le Grand                     break;
27096fc4b33SArmin Le Grand                 }
27196fc4b33SArmin Le Grand             }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir             // get the transform matrices and colors (where colors
274cdf0e10cSrcweir             // will have one more entry that matrices)
27596fc4b33SArmin Le Grand             std::vector< drawinglayer::texture::B2DHomMatrixAndBColor > aEntries;
276*64b14621SArmin Le Grand             basegfx::BColor aOuterColor;
27796fc4b33SArmin Le Grand 
278*64b14621SArmin Le Grand             generateMatricesAndColors(aEntries, aOuterColor);
279cdf0e10cSrcweir 
280cdf0e10cSrcweir             if(bOverlapping)
281cdf0e10cSrcweir             {
282*64b14621SArmin Le Grand                 return createOverlappingFill(aEntries, aOuterColor, aUnitPolygon);
283cdf0e10cSrcweir             }
284cdf0e10cSrcweir             else
285cdf0e10cSrcweir             {
286*64b14621SArmin Le Grand                 return createNonOverlappingFill(aEntries, aOuterColor, aUnitPolygon);
287cdf0e10cSrcweir             }
288cdf0e10cSrcweir         }
289cdf0e10cSrcweir 
create2DDecomposition(const geometry::ViewInformation2D &) const290*64b14621SArmin Le Grand         Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
291*64b14621SArmin Le Grand         {
292cdf0e10cSrcweir             // default creates overlapping fill which works with AntiAliasing and without.
293cdf0e10cSrcweir             // The non-overlapping version does not create single filled polygons, but
294cdf0e10cSrcweir             // PolyPolygons where each one describes a 'ring' for the gradient such
295cdf0e10cSrcweir             // that the rings will not overlap. This is useful fir the old XOR-paint
296cdf0e10cSrcweir             // 'trick' of VCL which is recorded in Metafiles; so this version may be
297cdf0e10cSrcweir             // used from the MetafilePrimitive2D in it's decomposition.
298cdf0e10cSrcweir 
299cdf0e10cSrcweir             if(!getFillGradient().isDefault())
300cdf0e10cSrcweir             {
30196fc4b33SArmin Le Grand                 static bool bOverlapping(true); // allow to test non-overlapping in the debugger
30296fc4b33SArmin Le Grand 
303*64b14621SArmin Le Grand                 return createFill(bOverlapping);
304cdf0e10cSrcweir             }
305cdf0e10cSrcweir             else
306cdf0e10cSrcweir             {
307cdf0e10cSrcweir                 return Primitive2DSequence();
308cdf0e10cSrcweir             }
309*64b14621SArmin Le Grand         }
310*64b14621SArmin Le Grand 
FillGradientPrimitive2D(const basegfx::B2DRange & rOutputRange,const attribute::FillGradientAttribute & rFillGradient)311*64b14621SArmin Le Grand         FillGradientPrimitive2D::FillGradientPrimitive2D(
312*64b14621SArmin Le Grand             const basegfx::B2DRange& rOutputRange,
313*64b14621SArmin Le Grand             const attribute::FillGradientAttribute& rFillGradient)
314*64b14621SArmin Le Grand         :   BufferedDecompositionPrimitive2D(),
315*64b14621SArmin Le Grand             maOutputRange(rOutputRange),
316*64b14621SArmin Le Grand             maDefinitionRange(rOutputRange),
317*64b14621SArmin Le Grand             maFillGradient(rFillGradient)
318*64b14621SArmin Le Grand         {
319*64b14621SArmin Le Grand         }
320*64b14621SArmin Le Grand 
FillGradientPrimitive2D(const basegfx::B2DRange & rOutputRange,const basegfx::B2DRange & rDefinitionRange,const attribute::FillGradientAttribute & rFillGradient)321*64b14621SArmin Le Grand         FillGradientPrimitive2D::FillGradientPrimitive2D(
322*64b14621SArmin Le Grand             const basegfx::B2DRange& rOutputRange,
323*64b14621SArmin Le Grand             const basegfx::B2DRange& rDefinitionRange,
324*64b14621SArmin Le Grand             const attribute::FillGradientAttribute& rFillGradient)
325*64b14621SArmin Le Grand         :   BufferedDecompositionPrimitive2D(),
326*64b14621SArmin Le Grand             maOutputRange(rOutputRange),
327*64b14621SArmin Le Grand             maDefinitionRange(rDefinitionRange),
328*64b14621SArmin Le Grand             maFillGradient(rFillGradient)
329*64b14621SArmin Le Grand         {
330*64b14621SArmin Le Grand         }
331*64b14621SArmin Le Grand 
operator ==(const BasePrimitive2D & rPrimitive) const332*64b14621SArmin Le Grand         bool FillGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
333*64b14621SArmin Le Grand         {
334*64b14621SArmin Le Grand             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
335*64b14621SArmin Le Grand             {
336*64b14621SArmin Le Grand                 const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive;
337*64b14621SArmin Le Grand 
338*64b14621SArmin Le Grand                 return (getOutputRange() == rCompare.getOutputRange()
339*64b14621SArmin Le Grand                     && getDefinitionRange() == rCompare.getDefinitionRange()
340*64b14621SArmin Le Grand                     && getFillGradient() == rCompare.getFillGradient());
341*64b14621SArmin Le Grand             }
342*64b14621SArmin Le Grand 
343*64b14621SArmin Le Grand             return false;
344*64b14621SArmin Le Grand         }
345*64b14621SArmin Le Grand 
getB2DRange(const geometry::ViewInformation2D &) const346*64b14621SArmin Le Grand         basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
347*64b14621SArmin Le Grand         {
348*64b14621SArmin Le Grand             // return the geometrically visible area
349*64b14621SArmin Le Grand             return getOutputRange();
350*64b14621SArmin Le Grand         }
351*64b14621SArmin Le Grand 
352*64b14621SArmin Le Grand         // provide unique ID
353*64b14621SArmin Le Grand         ImplPrimitrive2DIDBlock(FillGradientPrimitive2D, PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D)
354*64b14621SArmin Le Grand 
355*64b14621SArmin Le Grand     } // end of namespace primitive2d
356cdf0e10cSrcweir } // end of namespace drawinglayer
357cdf0e10cSrcweir 
358cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
359cdf0e10cSrcweir // eof
360