openshot-audio  0.1.6
juce_DrawablePath.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_DRAWABLEPATH_H_INCLUDED
26 #define JUCE_DRAWABLEPATH_H_INCLUDED
27 
28 
29 //==============================================================================
38 {
39 public:
40  //==============================================================================
42  DrawablePath();
43  DrawablePath (const DrawablePath&);
44 
46  ~DrawablePath();
47 
48  //==============================================================================
52  void setPath (const Path& newPath);
53 
58  void setPath (const RelativePointPath& newPath);
59 
61  const Path& getPath() const;
62 
64  const Path& getStrokePath() const;
65 
66  //==============================================================================
68  Drawable* createCopy() const;
70  void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder);
74  static const Identifier valueTreeType;
75 
76  //==============================================================================
79  {
80  public:
81  ValueTreeWrapper (const ValueTree& state);
82 
83  bool usesNonZeroWinding() const;
84  void setUsesNonZeroWinding (bool b, UndoManager* undoManager);
85 
86  class Element
87  {
88  public:
89  explicit Element (const ValueTree& state);
90  ~Element();
91 
92  const Identifier getType() const noexcept { return state.getType(); }
93  int getNumControlPoints() const noexcept;
94 
95  RelativePoint getControlPoint (int index) const;
96  Value getControlPointValue (int index, UndoManager*);
97  RelativePoint getStartPoint() const;
98  RelativePoint getEndPoint() const;
99  void setControlPoint (int index, const RelativePoint& point, UndoManager*);
100  float getLength (Expression::Scope*) const;
101 
102  ValueTreeWrapper getParent() const;
103  Element getPreviousElement() const;
104 
105  String getModeOfEndPoint() const;
106  void setModeOfEndPoint (const String& newMode, UndoManager*);
107 
108  void convertToLine (UndoManager*);
109  void convertToCubic (Expression::Scope*, UndoManager*);
110  void convertToPathBreak (UndoManager* undoManager);
111  ValueTree insertPoint (Point<float> targetPoint, Expression::Scope*, UndoManager*);
112  void removePoint (UndoManager* undoManager);
113  float findProportionAlongLine (Point<float> targetPoint, Expression::Scope*) const;
114 
115  static const Identifier mode, startSubPathElement, closeSubPathElement,
116  lineToElement, quadraticToElement, cubicToElement;
117  static const char* cornerMode;
118  static const char* roundedMode;
119  static const char* symmetricMode;
120 
121  ValueTree state;
122  };
123 
124  ValueTree getPathState();
125 
126  void readFrom (const RelativePointPath& path, UndoManager* undoManager);
127  void writeTo (RelativePointPath& path) const;
128 
129  static const Identifier nonZeroWinding, point1, point2, point3;
130  };
131 
132 private:
133  //==============================================================================
134  ScopedPointer<RelativePointPath> relativePath;
135 
137  friend class RelativePositioner;
138  void applyRelativePath (const RelativePointPath&, Expression::Scope*);
139 
140  DrawablePath& operator= (const DrawablePath&);
141  JUCE_LEAK_DETECTOR (DrawablePath)
142 };
143 
144 
145 #endif // JUCE_DRAWABLEPATH_H_INCLUDED
Definition: juce_DrawableShape.h:36
const Identifier getType() const noexcept
Definition: juce_DrawablePath.h:92
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_Point.h:39
Definition: juce_String.h:43
long b
Definition: jpegint.h:371
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_DrawablePath.cpp:77
Identifier getType() const
Definition: juce_ValueTree.cpp:710
Definition: juce_RelativePoint.h:35
#define const
Definition: juce_Expression.h:48
png_structrp int mode
Definition: juce_PNGLoader.cpp:1243
Definition: juce_DrawableShape.h:127
Definition: juce_Path.h:62
Definition: juce_DrawablePath.h:78
Definition: juce_ScopedPointer.h:70
Definition: juce_DrawablePath.h:86
virtual Drawable * createCopy() const =0
virtual ValueTree createValueTree(ComponentBuilder::ImageProvider *imageProvider) const =0
Definition: juce_ComponentBuilder.h:45
Definition: juce_DrawablePath.h:37
Definition: juce_Drawable.h:35
Definition: juce_Value.h:44
Definition: juce_RelativePointPath.h:38
Definition: juce_ValueTree.h:64
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
Definition: juce_UndoManager.h:49
Definition: juce_Identifier.h:43
static const Identifier valueTreeType
Definition: juce_DrawablePath.h:74
Definition: juce_ComponentBuilder.h:183