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