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_SHADOWPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
30 #include <basegfx/color/bcolor.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 
34 namespace drawinglayer
35 {
36 	namespace primitive2d
37 	{
38         /** ShadowPrimitive2D class
39 
40             This primitive defines a generic shadow geometry construction
41             for 2D objects. It decomposes to a TransformPrimitive2D embedded
42             into a ModifiedColorPrimitive2D.
43 
44             It's for primtive usage convenience, so that not everyone has
45             to implement the generic shadow construction by himself.
46 
47             The same geometry as sequence of primitives is used as geometry and
48             as shadow. Since these are RefCounted Uno-Api objects, no extra objects
49             are needed for the shadow itself; all the local decompositions of the
50             original geometry can be reused from the renderer for shadow visualisation.
51         */
52 		class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive2D : public GroupPrimitive2D
53 		{
54 		private:
55             /// the shadow transformation, normally just an offset
56 			basegfx::B2DHomMatrix					maShadowTransform;
57 
58             /// the shadow color to which all geometry is to be forced
59 			basegfx::BColor							maShadowColor;
60 
61 		public:
62             /// constructor
63 			ShadowPrimitive2D(
64 				const basegfx::B2DHomMatrix& rShadowTransform,
65 				const basegfx::BColor& rShadowColor,
66 				const Primitive2DSequence& rChildren);
67 
68 			/// data read access
getShadowTransform() const69 			const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
getShadowColor() const70 			const basegfx::BColor& getShadowColor() const { return maShadowColor; }
71 
72 			/// compare operator
73 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
74 
75 			/// get range
76 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
77 
78 			///  create decomposition
79 			virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
80 
81 			/// provide unique ID
82 			DeclPrimitrive2DIDBlock()
83 		};
84 	} // end of namespace primitive2d
85 } // end of namespace drawinglayer
86 
87 //////////////////////////////////////////////////////////////////////////////
88 
89 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
90 
91 //////////////////////////////////////////////////////////////////////////////
92 // eof
93