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