1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
29 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
30 
31 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
32 #include <basegfx/matrix/b2dhommatrix.hxx>
33 #include <basegfx/color/bcolor.hxx>
34 
35 //////////////////////////////////////////////////////////////////////////////
36 
37 namespace drawinglayer
38 {
39 	namespace primitive2d
40 	{
41         /** ShadowPrimitive2D class
42 
43             This primitive defines a generic shadow geometry construction
44             for 2D objects. It decomposes to a TransformPrimitive2D embedded
45             into a ModifiedColorPrimitive2D.
46 
47             It's for primtive usage convenience, so that not everyone has
48             to implement the generic shadow construction by himself.
49 
50             The same geometry as sequence of primitives is used as geometry and
51             as shadow. Since these are RefCounted Uno-Api objects, no extra objects
52             are needed for the shadow itself; all the local decompositions of the
53             original geometry can be reused from the renderer for shadow visualisation.
54         */
55 		class ShadowPrimitive2D : public GroupPrimitive2D
56 		{
57 		private:
58             /// the shadow transformation, normally just an offset
59 			basegfx::B2DHomMatrix					maShadowTransform;
60 
61             /// the shadow color to which all geometry is to be forced
62 			basegfx::BColor							maShadowColor;
63 
64 		public:
65             /// constructor
66 			ShadowPrimitive2D(
67 				const basegfx::B2DHomMatrix& rShadowTransform,
68 				const basegfx::BColor& rShadowColor,
69 				const Primitive2DSequence& rChildren);
70 
71 			/// data read access
72 			const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
73 			const basegfx::BColor& getShadowColor() const { return maShadowColor; }
74 
75 			/// compare operator
76 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
77 
78 			/// get range
79 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
80 
81 			///  create decomposition
82 			virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
83 
84 			/// provide unique ID
85 			DeclPrimitrive2DIDBlock()
86 		};
87 	} // end of namespace primitive2d
88 } // end of namespace drawinglayer
89 
90 //////////////////////////////////////////////////////////////////////////////
91 
92 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
93 
94 //////////////////////////////////////////////////////////////////////////////
95 // eof
96