Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/gradient.hxx
Line
Count
Source
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_VCL_GRADIENT_HXX
21
#define INCLUDED_VCL_GRADIENT_HXX
22
23
#include <sal/types.h>
24
#include <tools/degree.hxx>
25
#include <tools/long.hxx>
26
#include <o3tl/cow_wrapper.hxx>
27
28
#include <vcl/dllapi.h>
29
30
namespace com::sun::star::awt { enum class GradientStyle; }
31
namespace tools { class Rectangle; }
32
33
class Color;
34
class Point;
35
class GDIMetaFile;
36
37
class VCL_DLLPUBLIC Gradient
38
{
39
private:
40
    class Impl;
41
    ::o3tl::cow_wrapper<Impl>  mpImplGradient;
42
43
public:
44
                    Gradient();
45
                    Gradient( const Gradient& rGradient );
46
                    Gradient( Gradient&& rGradient );
47
                    Gradient( css::awt::GradientStyle eStyle,
48
                              const Color& rStartColor,
49
                              const Color& rEndColor );
50
                    ~Gradient();
51
52
    void            SetStyle( css::awt::GradientStyle eStyle );
53
    css::awt::GradientStyle   GetStyle() const;
54
55
    void            SetStartColor( const Color& rColor );
56
    const Color&    GetStartColor() const;
57
    void            SetEndColor( const Color& rColor );
58
    const Color&    GetEndColor() const;
59
    SAL_DLLPRIVATE void MakeGrayscale();
60
61
    void            SetAngle( Degree10 nAngle );
62
    Degree10        GetAngle() const;
63
64
    void            SetBorder( sal_uInt16 nBorder );
65
    sal_uInt16      GetBorder() const;
66
    void            SetOfsX( sal_uInt16 nOfsX );
67
    sal_uInt16      GetOfsX() const;
68
    void            SetOfsY( sal_uInt16 nOfsY );
69
    sal_uInt16      GetOfsY() const;
70
71
    void            SetStartIntensity( sal_uInt16 nIntens );
72
    sal_uInt16      GetStartIntensity() const;
73
    void            SetEndIntensity( sal_uInt16 nIntens );
74
    sal_uInt16      GetEndIntensity() const;
75
76
    void            SetSteps( sal_uInt16 nSteps );
77
    sal_uInt16      GetSteps() const;
78
79
    void            GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle &rBoundRect, Point& rCenter ) const;
80
81
    void AddGradientActions(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile);
82
83
    Gradient&       operator=( const Gradient& rGradient );
84
    Gradient&       operator=( Gradient&& rGradient );
85
    bool            operator==( const Gradient& rGradient ) const;
86
    bool            operator!=( const Gradient& rGradient ) const
87
0
                        { return !(Gradient::operator==( rGradient )); }
88
89
private:
90
    SAL_DLLPRIVATE tools::Long GetMetafileSteps(tools::Rectangle const& rRect) const;
91
92
    SAL_DLLPRIVATE void DrawComplexGradientToMetafile(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile) const;
93
    SAL_DLLPRIVATE void DrawLinearGradientToMetafile(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile) const;
94
};
95
96
#endif // INCLUDED_VCL_GRADIENT_HXX
97
98
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */