Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / drawinglayer / primitive2d / shadowprimitive2d.hxx
blobb216aca24b8c1f7723ec11d6fa3f353ea3aa4751
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
27 #include <basegfx/color/bcolor.hxx>
30 namespace drawinglayer
32 namespace primitive2d
34 /** ShadowPrimitive2D class
36 This primitive defines a generic shadow geometry construction
37 for 2D objects. It decomposes to a TransformPrimitive2D embedded
38 into a ModifiedColorPrimitive2D.
40 It's for primtive usage convenience, so that not everyone has
41 to implement the generic shadow construction by himself.
43 The same geometry as sequence of primitives is used as geometry and
44 as shadow. Since these are RefCounted Uno-Api objects, no extra objects
45 are needed for the shadow itself; all the local decompositions of the
46 original geometry can be reused from the renderer for shadow visualisation.
48 class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive2D : public GroupPrimitive2D
50 private:
51 /// the shadow transformation, normally just an offset
52 basegfx::B2DHomMatrix maShadowTransform;
54 /// the shadow color to which all geometry is to be forced
55 basegfx::BColor maShadowColor;
57 public:
58 /// constructor
59 ShadowPrimitive2D(
60 const basegfx::B2DHomMatrix& rShadowTransform,
61 const basegfx::BColor& rShadowColor,
62 const Primitive2DContainer& rChildren);
64 /// data read access
65 const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
66 const basegfx::BColor& getShadowColor() const { return maShadowColor; }
68 /// compare operator
69 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
71 /// get range
72 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
74 /// create decomposition
75 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
77 /// provide unique ID
78 DeclPrimitive2DIDBlock()
80 } // end of namespace primitive2d
81 } // end of namespace drawinglayer
84 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */