Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/drawinglayer/attribute/ReflectionAttribute.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
10
#pragma once
11
12
#include <drawinglayer/drawinglayerdllapi.h>
13
#include <sal/types.h>
14
15
namespace drawinglayer::attribute
16
{
17
/** The values of a reflection effect. A reflection is a vertically flipped copy of an object,
18
    placed under the object, and the copy becomes more transparent the further it gets from the
19
    object.
20
21
    The distance and the blur radius are in the units of the object geometry. A distance of 0
22
    makes the reflection touch the object, and a blur radius of 0 keeps the reflection sharp. The
23
    transparencies go from 0.0 (opaque) to 1.0 (invisible). The positions are fractions of the
24
    reflection height from 0.0 to 1.0, measured from the edge next to the object, and the end
25
    position is never before the start position. Before the start position the reflection has the
26
    start transparency, after the end position it has the end transparency, and in between the
27
    transparency changes linearly.
28
29
    A default constructed attribute is invisible along its whole height, which is the same as no
30
    reflection.
31
*/
32
class DRAWINGLAYER_DLLPUBLIC ReflectionAttribute
33
{
34
private:
35
    sal_Int32 mnDistance = 0;
36
    sal_Int32 mnBlurRadius = 0;
37
    double mfStartTransparency = 1.0;
38
    double mfStartPosition = 0.0;
39
    double mfEndTransparency = 1.0;
40
    double mfEndPosition = 1.0;
41
42
public:
43
    /// The transparencies and the start position are clamped to the range from 0.0 to 1.0, the
44
    /// end position to the range from the start position to 1.0, and the blur radius to 0 or more.
45
    ReflectionAttribute(sal_Int32 nDistance, sal_Int32 nBlurRadius, double fStartTransparency,
46
                        double fStartPosition, double fEndTransparency, double fEndPosition);
47
2.42k
    ReflectionAttribute() = default;
48
49
4.57k
    bool operator==(const ReflectionAttribute&) const = default;
50
51
0
    sal_Int32 getDistance() const { return mnDistance; }
52
0
    sal_Int32 getBlurRadius() const { return mnBlurRadius; }
53
0
    double getStartTransparency() const { return mfStartTransparency; }
54
0
    double getStartPosition() const { return mfStartPosition; }
55
0
    double getEndTransparency() const { return mfEndTransparency; }
56
0
    double getEndPosition() const { return mfEndPosition; }
57
1.16k
    bool isDefault() const { return mfStartTransparency >= 1.0 && mfEndTransparency >= 1.0; }
58
};
59
60
} // end of namespace drawinglayer::attribute
61
62
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */