1*ddde725dSArmin Le Grand /**************************************************************
2*ddde725dSArmin Le Grand  *
3*ddde725dSArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
4*ddde725dSArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
5*ddde725dSArmin Le Grand  * distributed with this work for additional information
6*ddde725dSArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
7*ddde725dSArmin Le Grand  * to you under the Apache License, Version 2.0 (the
8*ddde725dSArmin Le Grand  * "License"); you may not use this file except in compliance
9*ddde725dSArmin Le Grand  * with the License.  You may obtain a copy of the License at
10*ddde725dSArmin Le Grand  *
11*ddde725dSArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
12*ddde725dSArmin Le Grand  *
13*ddde725dSArmin Le Grand  * Unless required by applicable law or agreed to in writing,
14*ddde725dSArmin Le Grand  * software distributed under the License is distributed on an
15*ddde725dSArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ddde725dSArmin Le Grand  * KIND, either express or implied.  See the License for the
17*ddde725dSArmin Le Grand  * specific language governing permissions and limitations
18*ddde725dSArmin Le Grand  * under the License.
19*ddde725dSArmin Le Grand  *
20*ddde725dSArmin Le Grand  *************************************************************/
21*ddde725dSArmin Le Grand 
22*ddde725dSArmin Le Grand #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
23*ddde725dSArmin Le Grand #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
24*ddde725dSArmin Le Grand 
25*ddde725dSArmin Le Grand #include <drawinglayer/drawinglayerdllapi.h>
26*ddde725dSArmin Le Grand #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
27*ddde725dSArmin Le Grand #include <basegfx/matrix/b2dhommatrix.hxx>
28*ddde725dSArmin Le Grand #include <basegfx/polygon/b2dpolypolygon.hxx>
29*ddde725dSArmin Le Grand 
30*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
31*ddde725dSArmin Le Grand 
32*ddde725dSArmin Le Grand namespace drawinglayer
33*ddde725dSArmin Le Grand {
34*ddde725dSArmin Le Grand     namespace primitive2d
35*ddde725dSArmin Le Grand     {
36*ddde725dSArmin Le Grand         /** PatternFillPrimitive2D class
37*ddde725dSArmin Le Grand 
38*ddde725dSArmin Le Grand             This primitive allows filling a given PolyPolygon with a pattern
39*ddde725dSArmin Le Grand             defined by a sequence of primitives which are mapped to  the unit range.
40*ddde725dSArmin Le Grand             The pattern is defined using a reference range which defines a rectangular
41*ddde725dSArmin Le Grand             area relative to the PolyPolygon (in unit coordinates) which is virtually
42*ddde725dSArmin Le Grand             infinitely repeated.
43*ddde725dSArmin Le Grand          */
44*ddde725dSArmin Le Grand         class DRAWINGLAYER_DLLPUBLIC PatternFillPrimitive2D : public BufferedDecompositionPrimitive2D
45*ddde725dSArmin Le Grand         {
46*ddde725dSArmin Le Grand         private:
47*ddde725dSArmin Le Grand             const basegfx::B2DPolyPolygon       maMask;
48*ddde725dSArmin Le Grand             const Primitive2DSequence           maChildren;
49*ddde725dSArmin Le Grand             const basegfx::B2DRange             maReferenceRange;
50*ddde725dSArmin Le Grand 
51*ddde725dSArmin Le Grand         protected:
52*ddde725dSArmin Le Grand             /// create local decomposition
53*ddde725dSArmin Le Grand             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
54*ddde725dSArmin Le Grand 
55*ddde725dSArmin Le Grand         public:
56*ddde725dSArmin Le Grand             /// constructor
57*ddde725dSArmin Le Grand             PatternFillPrimitive2D(
58*ddde725dSArmin Le Grand                 const basegfx::B2DPolyPolygon& rMask,
59*ddde725dSArmin Le Grand                 const Primitive2DSequence& rChildren,
60*ddde725dSArmin Le Grand                 const basegfx::B2DRange& rReferenceRange);
61*ddde725dSArmin Le Grand 
62*ddde725dSArmin Le Grand             /// data read access
getMask() const63*ddde725dSArmin Le Grand             const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
getChildren() const64*ddde725dSArmin Le Grand             const Primitive2DSequence& getChildren() const { return maChildren; }
getReferenceRange() const65*ddde725dSArmin Le Grand             const basegfx::B2DRange& getReferenceRange() const { return maReferenceRange; }
66*ddde725dSArmin Le Grand 
67*ddde725dSArmin Le Grand             /// compare operator
68*ddde725dSArmin Le Grand             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
69*ddde725dSArmin Le Grand 
70*ddde725dSArmin Le Grand             /// get range
71*ddde725dSArmin Le Grand             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
72*ddde725dSArmin Le Grand 
73*ddde725dSArmin Le Grand             /// provide unique ID
74*ddde725dSArmin Le Grand             DeclPrimitrive2DIDBlock()
75*ddde725dSArmin Le Grand         };
76*ddde725dSArmin Le Grand     } // end of namespace primitive2d
77*ddde725dSArmin Le Grand } // end of namespace drawinglayer
78*ddde725dSArmin Le Grand 
79*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
80*ddde725dSArmin Le Grand 
81*ddde725dSArmin Le Grand #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
82*ddde725dSArmin Le Grand 
83*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
84*ddde725dSArmin Le Grand // eof
85