openshot-audio  0.1.2
juce_ColourGradient.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_COLOURGRADIENT_H_INCLUDED
26 #define JUCE_COLOURGRADIENT_H_INCLUDED
27 
28 
29 //==============================================================================
36 {
37 public:
38  //==============================================================================
56  ColourGradient (Colour colour1, float x1, float y1,
57  Colour colour2, float x2, float y2,
58  bool isRadial);
59 
66 
68  ~ColourGradient();
69 
70  //==============================================================================
76  void clearColours();
77 
89  int addColour (double proportionAlongGradient,
90  Colour colour);
91 
93  void removeColour (int index);
94 
96  void multiplyOpacity (float multiplier) noexcept;
97 
98  //==============================================================================
100  int getNumColours() const noexcept;
101 
106  double getColourPosition (int index) const noexcept;
107 
111  Colour getColour (int index) const noexcept;
112 
116  void setColour (int index, Colour newColour) noexcept;
117 
121  Colour getColourAtPosition (double position) const noexcept;
122 
123  //==============================================================================
129  int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const;
130 
136  void createLookupTable (PixelARGB* resultLookupTable, int numEntries) const noexcept;
137 
139  bool isOpaque() const noexcept;
140 
142  bool isInvisible() const noexcept;
143 
144  //==============================================================================
146 
152  bool isRadial;
153 
154  bool operator== (const ColourGradient&) const noexcept;
155  bool operator!= (const ColourGradient&) const noexcept;
156 
157 
158 private:
159  //==============================================================================
160  struct ColourPoint
161  {
162  ColourPoint() noexcept {}
163 
164  ColourPoint (const double pos, Colour col) noexcept
165  : position (pos), colour (col)
166  {}
167 
168  bool operator== (const ColourPoint&) const noexcept;
169  bool operator!= (const ColourPoint&) const noexcept;
170 
171  double position;
172  Colour colour;
173  };
174 
175  Array<ColourPoint> colours;
176 
178 };
179 
180 
181 #endif // JUCE_COLOURGRADIENT_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_Point.h:39
Definition: juce_ColourGradient.h:35
Point< float > point2
Definition: juce_ColourGradient.h:145
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
Definition: juce_Colour.h:35
bool operator==(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:565
Definition: juce_PixelFormats.h:56
Definition: juce_Array.h:60
Definition: juce_HeapBlock.h:90
Definition: juce_AffineTransform.h:40
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
bool operator!=(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:566
bool isRadial
Definition: juce_ColourGradient.h:152