LMMS
Loading...
Searching...
No Matches
juce_Drawable.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
38{
39protected:
40 //==============================================================================
45 Drawable();
46
47public:
49 ~Drawable() override;
50
51 //==============================================================================
56 virtual std::unique_ptr<Drawable> createCopy() const = 0;
57
59 virtual Path getOutlineAsPath() const = 0;
60
61 //==============================================================================
70 void draw (Graphics& g, float opacity,
71 const AffineTransform& transform = AffineTransform()) const;
72
86 void drawAt (Graphics& g, float x, float y, float opacity) const;
87
104 void drawWithin (Graphics& g,
105 Rectangle<float> destArea,
106 RectanglePlacement placement,
107 float opacity) const;
108
109
110 //==============================================================================
114 void setOriginWithOriginalSize (Point<float> originWithinParent);
115
119 void setTransformToFit (const Rectangle<float>& areaInParent, RectanglePlacement placement);
120
123
127 void setClipPath (std::unique_ptr<Drawable> drawableClipPath);
128
129 //==============================================================================
135 static std::unique_ptr<Drawable> createFromImageData (const void* data, size_t numBytes);
136
142 static std::unique_ptr<Drawable> createFromImageDataStream (InputStream& dataSource);
143
149 static std::unique_ptr<Drawable> createFromImageFile (const File& file);
150
159 static std::unique_ptr<Drawable> createFromSVG (const XmlElement& svgDocument);
160
172 static std::unique_ptr<Drawable> createFromSVGFile (const File& svgFile);
173
175 static Path parseSVGPath (const String& svgPath);
176
177 //==============================================================================
183
187 virtual bool replaceColour (Colour originalColour, Colour replacementColour);
188
189protected:
190 //==============================================================================
191 friend class DrawableComposite;
192 friend class DrawableShape;
193
197 void parentHierarchyChanged() override;
202
204 std::unique_ptr<Drawable> drawableClipPath;
205
206 void nonConstDraw (Graphics&, float opacity, const AffineTransform&);
207
208 Drawable (const Drawable&);
209 Drawable& operator= (const Drawable&);
211};
212
213} // namespace juce
Definition juce_AffineTransform.h:43
Definition juce_Colour.h:38
Component() noexcept
Definition juce_Component.cpp:517
static std::unique_ptr< Drawable > createFromSVGFile(const File &svgFile)
Definition juce_SVGParser.cpp:1766
void draw(Graphics &g, float opacity, const AffineTransform &transform=AffineTransform()) const
Definition juce_Drawable.cpp:66
std::unique_ptr< Drawable > drawableClipPath
Definition juce_Drawable.h:204
void setBoundsToEnclose(Rectangle< float >)
Definition juce_Drawable.cpp:133
virtual std::unique_ptr< Drawable > createCopy() const =0
void applyDrawableClipPath(Graphics &)
Definition juce_Drawable.cpp:54
friend class DrawableShape
Definition juce_Drawable.h:192
virtual Path getOutlineAsPath() const =0
static std::unique_ptr< Drawable > createFromImageData(const void *data, size_t numBytes)
Definition juce_Drawable.cpp:170
static Path parseSVGPath(const String &svgPath)
Definition juce_SVGParser.cpp:1774
void drawAt(Graphics &g, float x, float y, float opacity) const
Definition juce_Drawable.cpp:97
static std::unique_ptr< Drawable > createFromSVG(const XmlElement &svgDocument)
Definition juce_SVGParser.cpp:1757
DrawableComposite * getParent() const
Definition juce_Drawable.cpp:109
void parentHierarchyChanged() override
Definition juce_Drawable.cpp:128
Point< int > originRelativeToComponent
Definition juce_Drawable.h:203
Drawable()
Definition juce_Drawable.cpp:29
static std::unique_ptr< Drawable > createFromImageFile(const File &file)
Definition juce_Drawable.cpp:191
void drawWithin(Graphics &g, Rectangle< float > destArea, RectanglePlacement placement, float opacity) const
Definition juce_Drawable.cpp:102
void setOriginWithOriginalSize(Point< float > originWithinParent)
Definition juce_Drawable.cpp:158
friend class DrawableComposite
Definition juce_Drawable.h:191
static std::unique_ptr< Drawable > createFromImageDataStream(InputStream &dataSource)
Definition juce_Drawable.cpp:183
void setClipPath(std::unique_ptr< Drawable > drawableClipPath)
Definition juce_Drawable.cpp:114
void setTransformToFit(const Rectangle< float > &areaInParent, RectanglePlacement placement)
Definition juce_Drawable.cpp:163
void transformContextToCorrectOrigin(Graphics &)
Definition juce_Drawable.cpp:123
void nonConstDraw(Graphics &, float opacity, const AffineTransform &)
Definition juce_Drawable.cpp:71
virtual bool replaceColour(Colour originalColour, Colour replacementColour)
Definition juce_Drawable.cpp:146
virtual Rectangle< float > getDrawableBounds() const =0
Definition juce_File.h:45
Definition juce_GraphicsContext.h:45
Definition juce_InputStream.h:37
Definition juce_Path.h:65
Definition juce_Point.h:42
Definition juce_Rectangle.h:67
Definition juce_RectanglePlacement.h:40
Definition juce_String.h:53
Definition juce_XmlElement.h:83
int y
Definition inflate.c:1588
int g
Definition inflate.c:1573
unsigned x[BMAX+1]
Definition inflate.c:1586
JSAMPIMAGE data
Definition jpeglib.h:945
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition juce_LeakedObjectDetector.h:138
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
struct zdirent * file
Definition win32.c:1500