LibreOffice Module vcl (master)  1
gradient.hxx
Go to the documentation of this file.
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/color.hxx>
25 #include <tools/degree.hxx>
26 #include <tools/long.hxx>
27 #include <o3tl/cow_wrapper.hxx>
28 
29 #include <vcl/dllapi.h>
30 #include <vcl/vclenum.hxx>
31 
32 namespace tools { class Rectangle; }
33 
34 class Point;
35 class SvStream;
36 class GDIMetaFile;
37 
39 {
40 private:
41  class Impl;
43 
44 public:
45  Gradient();
46  Gradient( const Gradient& rGradient );
47  Gradient( Gradient&& rGradient );
48  Gradient( GradientStyle eStyle,
49  const Color& rStartColor,
50  const Color& rEndColor );
51  ~Gradient();
52 
53  void SetStyle( GradientStyle eStyle );
54  GradientStyle GetStyle() const;
55 
56  void SetStartColor( const Color& rColor );
57  const Color& GetStartColor() const;
58  void SetEndColor( const Color& rColor );
59  const Color& GetEndColor() const;
60  void MakeGrayscale();
61 
62  void SetAngle( Degree10 nAngle );
63  Degree10 GetAngle() const;
64 
65  void SetBorder( sal_uInt16 nBorder );
66  sal_uInt16 GetBorder() const;
67  void SetOfsX( sal_uInt16 nOfsX );
68  sal_uInt16 GetOfsX() const;
69  void SetOfsY( sal_uInt16 nOfsY );
70  sal_uInt16 GetOfsY() const;
71 
72  void SetStartIntensity( sal_uInt16 nIntens );
73  sal_uInt16 GetStartIntensity() const;
74  void SetEndIntensity( sal_uInt16 nIntens );
75  sal_uInt16 GetEndIntensity() const;
76 
77  void SetSteps( sal_uInt16 nSteps );
78  sal_uInt16 GetSteps() const;
79 
80  void GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle &rBoundRect, Point& rCenter ) const;
81 
82  void AddGradientActions(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile);
83 
84  Gradient& operator=( const Gradient& rGradient );
85  Gradient& operator=( Gradient&& rGradient );
86  bool operator==( const Gradient& rGradient ) const;
87  bool operator!=( const Gradient& rGradient ) const
88  { return !(Gradient::operator==( rGradient )); }
89 
90 private:
91  tools::Long GetMetafileSteps(tools::Rectangle const& rRect) const;
92 
93  void DrawComplexGradientToMetafile(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile) const;
94  void DrawLinearGradientToMetafile(tools::Rectangle const& rRect, GDIMetaFile& rMetaFile) const;
95 };
96 
97 #endif // INCLUDED_VCL_GRADIENT_HXX
98 
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
bool operator!=(const Gradient &rGradient) const
Definition: gradient.hxx:87
GradientStyle
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:203
Degree100 GetAngle(const Point &rPnt)
bool operator==(const Gradient &rGradient) const
::o3tl::cow_wrapper< Impl > mpImplGradient
Definition: gradient.hxx:41