Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETESHADOWPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETESHADOWPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/primitivetools2d.hxx>
26 : #include <vcl/bitmapex.hxx>
27 : #include <basegfx/matrix/b2dhommatrix.hxx>
28 :
29 :
30 : // DiscreteShadowPrimitive2D class
31 :
32 : namespace drawinglayer
33 : {
34 : namespace primitive2d
35 : {
36 : /** DiscreteShadow data class
37 :
38 : */
39 3523 : class DRAWINGLAYER_DLLPUBLIC DiscreteShadow
40 : {
41 : private:
42 : /// the original shadow BitmapEx in a special form
43 : BitmapEx maBitmapEx;
44 :
45 : /// buffered extracted parts of CombinedShadow for easier usage
46 : BitmapEx maTopLeft;
47 : BitmapEx maTop;
48 : BitmapEx maTopRight;
49 : BitmapEx maRight;
50 : BitmapEx maBottomRight;
51 : BitmapEx maBottom;
52 : BitmapEx maBottomLeft;
53 : BitmapEx maLeft;
54 :
55 : public:
56 : /// constructor
57 : explicit DiscreteShadow(const BitmapEx& rBitmapEx);
58 :
59 : /// data read access
60 14217 : const BitmapEx& getBitmapEx() const { return maBitmapEx; }
61 :
62 : /// compare operator
63 2117 : bool operator==(const DiscreteShadow& rCompare) const
64 : {
65 2117 : return getBitmapEx() == rCompare.getBitmapEx();
66 : }
67 :
68 : /// helper accesses which create on-demand needed segments
69 : const BitmapEx& getTopLeft() const;
70 : const BitmapEx& getTop() const;
71 : const BitmapEx& getTopRight() const;
72 : const BitmapEx& getRight() const;
73 : const BitmapEx& getBottomRight() const;
74 : const BitmapEx& getBottom() const;
75 : const BitmapEx& getBottomLeft() const;
76 : const BitmapEx& getLeft() const;
77 : };
78 :
79 : /** DiscreteShadowPrimitive2D class
80 :
81 : */
82 3404 : class DRAWINGLAYER_DLLPUBLIC DiscreteShadowPrimitive2D : public DiscreteMetricDependentPrimitive2D
83 : {
84 : private:
85 : // the object transformation of the rectangular object
86 : basegfx::B2DHomMatrix maTransform;
87 :
88 : // the bitmap shadow data
89 : DiscreteShadow maDiscreteShadow;
90 :
91 : protected:
92 : /// create local decomposition
93 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
94 :
95 : public:
96 : /// constructor
97 : DiscreteShadowPrimitive2D(
98 : const basegfx::B2DHomMatrix& rTransform,
99 : const DiscreteShadow& rDiscreteShadow);
100 :
101 : /// data read access
102 9781 : const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
103 12154 : const DiscreteShadow& getDiscreteShadow() const { return maDiscreteShadow; }
104 :
105 : /// compare operator
106 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
107 :
108 : /// get range
109 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
110 :
111 : /// provide unique ID
112 : DeclPrimitive2DIDBlock()
113 : };
114 : } // end of namespace primitive2d
115 : } // end of namespace drawinglayer
116 :
117 :
118 :
119 : #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETESHADOWPRIMITIVE2D_HXX
120 :
121 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|