1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
26 #include <basegfx/color/bcolor.hxx>
29 namespace drawinglayer::primitive2d
31 /** ShadowPrimitive2D class
33 This primitive defines a generic shadow geometry construction
34 for 2D objects. It decomposes to a TransformPrimitive2D embedded
35 into a ModifiedColorPrimitive2D.
37 It's for primitive usage convenience, so that not everyone has
38 to implement the generic shadow construction by himself.
40 The same geometry as sequence of primitives is used as geometry and
41 as shadow. Since these are RefCounted Uno-Api objects, no extra objects
42 are needed for the shadow itself; all the local decompositions of the
43 original geometry can be reused from the renderer for shadow visualisation.
45 class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive2D final
: public GroupPrimitive2D
48 /// the shadow transformation, normally just an offset
49 basegfx::B2DHomMatrix maShadowTransform
;
51 /// the shadow color to which all geometry is to be forced
52 basegfx::BColor maShadowColor
;
54 /// the blur radius of the shadow
61 const basegfx::B2DHomMatrix
& rShadowTransform
,
62 const basegfx::BColor
& rShadowColor
,
64 const Primitive2DContainer
& rChildren
);
67 const basegfx::B2DHomMatrix
& getShadowTransform() const { return maShadowTransform
; }
68 const basegfx::BColor
& getShadowColor() const { return maShadowColor
; }
69 double getShadowBlur() const { return mfShadowBlur
; }
71 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
74 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
76 /// create decomposition
77 virtual void get2DDecomposition(Primitive2DDecompositionVisitor
& rVisitor
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
80 virtual sal_uInt32
getPrimitive2DID() const override
;
82 } // end of namespace drawinglayer::primitive2d
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */