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 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
29 #include <basegfx/color/bcolor.hxx>
30 
31 //////////////////////////////////////////////////////////////////////////////
32 // BackgroundColorPrimitive2D class
33 
34 namespace drawinglayer
35 {
36 	namespace primitive2d
37 	{
38         /** BackgroundColorPrimitive2D class
39 
40             This primitive is defined to fill the whole visible Viewport with
41             the given color (and thus decomposes to a filled polygon). This
42             makes it a view-depnendent primitive by definition. It only has
43             a valid decomposition if a valid Viewport is given in the
44             ViewInformation2D at decomposition time.
45 
46             It will try to buffer it's last decomposition using maLastViewport
47             to detect changes in the get2DDecomposition call.
48          */
49 		class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D
50 		{
51 		private:
52             /// the fill color to use
53 			basegfx::BColor								maBColor;
54 
55 			/// the last used viewInformation, used from getDecomposition for buffering
56 			basegfx::B2DRange							maLastViewport;
57 
58 		protected:
59 			/// create local decomposition
60 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
61 
62 		public:
63             /// constructor
64 			BackgroundColorPrimitive2D(
65 				const basegfx::BColor& rBColor);
66 
67 			/// data read access
getBColor() const68 			const basegfx::BColor& getBColor() const { return maBColor; }
69 
70 			/// compare operator
71 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
72 
73 			/// get B2Drange
74 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
75 
76 			/// provide unique ID
77 			DeclPrimitrive2DIDBlock()
78 
79 			/// Overload standard getDecomposition call to be view-dependent here
80 			virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
81 		};
82 	} // end of namespace primitive2d
83 } // end of namespace drawinglayer
84 
85 //////////////////////////////////////////////////////////////////////////////
86 
87 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
88 
89 //////////////////////////////////////////////////////////////////////////////
90 // eof
91