xref: /AOO41X/main/drawinglayer/inc/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx (revision 4f506f19cd544df9572ed8c88b6bdbc6c8f33210)
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_QUADRATICSHADOWPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
29 #include <vcl/bitmapex.hxx>
30 #include <basegfx/matrix/b2dhommatrix.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 // DiscreteShadowPrimitive2D class
34 
35 namespace drawinglayer
36 {
37     namespace primitive2d
38     {
39         /** DiscreteShadow data class
40 
41          */
42         class DRAWINGLAYER_DLLPUBLIC DiscreteShadow
43         {
44         private:
45             /// the original shadow BitmapEx in a special form
46             BitmapEx                    maBitmapEx;
47 
48             /// buffered extracted parts of CombinedShadow for easier usage
49             BitmapEx                    maTopLeft;
50             BitmapEx                    maTop;
51             BitmapEx                    maTopRight;
52             BitmapEx                    maRight;
53             BitmapEx                    maBottomRight;
54             BitmapEx                    maBottom;
55             BitmapEx                    maBottomLeft;
56             BitmapEx                    maLeft;
57 
58         public:
59             /// constructor
60             DiscreteShadow(const BitmapEx& rBitmapEx);
61 
62             /// data read access
getBitmapEx() const63             const BitmapEx& getBitmapEx() const { return maBitmapEx; }
64 
65             /// compare operator
operator ==(const DiscreteShadow & rCompare) const66             bool operator==(const DiscreteShadow& rCompare) const
67             {
68                 return getBitmapEx() == rCompare.getBitmapEx();
69             }
70 
71             /// helper accesses which create on-demand needed segments
72             const BitmapEx& getTopLeft() const;
73             const BitmapEx& getTop() const;
74             const BitmapEx& getTopRight() const;
75             const BitmapEx& getRight() const;
76             const BitmapEx& getBottomRight() const;
77             const BitmapEx& getBottom() const;
78             const BitmapEx& getBottomLeft() const;
79             const BitmapEx& getLeft() const;
80         };
81 
82         /** DiscreteShadowPrimitive2D class
83 
84          */
85         class DRAWINGLAYER_DLLPUBLIC DiscreteShadowPrimitive2D : public DiscreteMetricDependentPrimitive2D
86         {
87         private:
88             // the object transformation of the rectangular object
89             basegfx::B2DHomMatrix       maTransform;
90 
91             // the bitmap shadow data
92             DiscreteShadow              maDiscreteShadow;
93 
94         protected:
95             /// create local decomposition
96             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
97 
98         public:
99             /// constructor
100             DiscreteShadowPrimitive2D(
101                 const basegfx::B2DHomMatrix& rTransform,
102                 const DiscreteShadow& rDiscreteShadow);
103 
104             /// data read access
getTransform() const105             const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
getDiscreteShadow() const106             const DiscreteShadow& getDiscreteShadow() const { return maDiscreteShadow; }
107 
108             /// compare operator
109             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
110 
111             /// get range
112             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
113 
114             /// provide unique ID
115             DeclPrimitrive2DIDBlock()
116         };
117     } // end of namespace primitive2d
118 } // end of namespace drawinglayer
119 
120 //////////////////////////////////////////////////////////////////////////////
121 
122 #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
123 
124 //////////////////////////////////////////////////////////////////////////////
125 // eof
126