openshot-audio  0.1.2
juce_DrawableImage.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_DRAWABLEIMAGE_H_INCLUDED
26 #define JUCE_DRAWABLEIMAGE_H_INCLUDED
27 
28 
29 //==============================================================================
36 {
37 public:
38  //==============================================================================
39  DrawableImage();
41 
43  ~DrawableImage();
44 
45  //==============================================================================
47  void setImage (const Image& imageToUse);
48 
50  const Image& getImage() const noexcept { return image; }
51 
53  void setOpacity (float newOpacity);
54 
56  float getOpacity() const noexcept { return opacity; }
57 
67  void setOverlayColour (Colour newOverlayColour);
68 
70  Colour getOverlayColour() const noexcept { return overlayColour; }
71 
73  void setBoundingBox (const RelativeParallelogram& newBounds);
74 
79  const RelativeParallelogram& getBoundingBox() const noexcept { return bounds; }
80 
81  //==============================================================================
83  void paint (Graphics&) override;
85  bool hitTest (int x, int y) override;
87  Drawable* createCopy() const override;
89  Rectangle<float> getDrawableBounds() const override;
91  void refreshFromValueTree (const ValueTree& tree, ComponentBuilder&);
95  static const Identifier valueTreeType;
96 
97  //==============================================================================
100  {
101  public:
102  ValueTreeWrapper (const ValueTree& state);
103 
104  var getImageIdentifier() const;
105  void setImageIdentifier (const var&, UndoManager*);
106  Value getImageIdentifierValue (UndoManager*);
107 
108  float getOpacity() const;
109  void setOpacity (float newOpacity, UndoManager*);
110  Value getOpacityValue (UndoManager*);
111 
112  Colour getOverlayColour() const;
113  void setOverlayColour (Colour newColour, UndoManager*);
114  Value getOverlayColourValue (UndoManager*);
115 
116  RelativeParallelogram getBoundingBox() const;
117  void setBoundingBox (const RelativeParallelogram&, UndoManager*);
118 
119  static const Identifier opacity, overlay, image, topLeft, topRight, bottomLeft;
120  };
121 
122 private:
123  //==============================================================================
124  Image image;
125  float opacity;
126  Colour overlayColour;
127  RelativeParallelogram bounds;
128 
131  void recalculateCoordinates (Expression::Scope*);
132 
133  DrawableImage& operator= (const DrawableImage&);
135 };
136 
137 
138 #endif // JUCE_DRAWABLEIMAGE_H_INCLUDED
Definition: juce_Variant.h:46
#define noexcept
Definition: juce_CompilerSupport.h:141
static const Identifier topRight
Definition: juce_DrawableImage.h:119
const RelativeParallelogram & getBoundingBox() const noexcept
Definition: juce_DrawableImage.h:79
Definition: juce_Expression.h:113
float getOpacity() const noexcept
Definition: juce_DrawableImage.h:56
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_Drawable.h:222
Definition: juce_Rectangle.h:36
Definition: juce_Colour.h:35
Definition: juce_DrawableImage.h:35
virtual void paint(Graphics &g)
Definition: juce_Component.cpp:1929
const Image & getImage() const noexcept
Definition: juce_DrawableImage.h:50
Definition: juce_RelativeCoordinatePositioner.h:33
virtual Drawable * createCopy() const =0
virtual ValueTree createValueTree(ComponentBuilder::ImageProvider *imageProvider) const =0
Definition: juce_RelativeParallelogram.h:35
bool registerCoordinates() override
Definition: juce_Drawable.h:230
Definition: juce_ComponentBuilder.h:45
Definition: juce_DrawableImage.h:99
Definition: juce_Drawable.h:35
Definition: juce_Value.h:44
Colour getOverlayColour() const noexcept
Definition: juce_DrawableImage.h:70
Definition: juce_GraphicsContext.h:42
Definition: juce_Image.h:54
Definition: juce_Drawable.h:185
static const Identifier valueTreeType
Definition: juce_DrawableImage.h:95
Definition: juce_ValueTree.h:64
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
Definition: juce_UndoManager.h:49
virtual Rectangle< float > getDrawableBounds() const =0
Definition: juce_Identifier.h:43
virtual bool hitTest(int x, int y)
Definition: juce_Component.cpp:1365
Definition: juce_ComponentBuilder.h:183