openshot-audio  0.1.6
juce_RectanglePlacement.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_RECTANGLEPLACEMENT_H_INCLUDED
26 #define JUCE_RECTANGLEPLACEMENT_H_INCLUDED
27 
28 
29 //==============================================================================
38 {
39 public:
40  //==============================================================================
42  inline RectanglePlacement (int placementFlags) noexcept : flags (placementFlags) {}
43 
45  inline RectanglePlacement() noexcept : flags (centred) {}
46 
49 
51  RectanglePlacement& operator= (const RectanglePlacement&) noexcept;
52 
53  bool operator== (const RectanglePlacement&) const noexcept;
54  bool operator!= (const RectanglePlacement&) const noexcept;
55 
56  //==============================================================================
58  enum Flags
59  {
60  //==============================================================================
62  xLeft = 1,
63 
65  xRight = 2,
66 
69  xMid = 4,
70 
71  //==============================================================================
74  yTop = 8,
75 
78  yBottom = 16,
79 
82  yMid = 32,
83 
84  //==============================================================================
88  stretchToFit = 64,
89 
90  //==============================================================================
99  fillDestination = 128,
100 
104  onlyReduceInSize = 256,
105 
109  onlyIncreaseInSize = 512,
110 
113  doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
114 
115  //==============================================================================
117  centred = 4 + 32
118  };
119 
120  //==============================================================================
122  inline int getFlags() const noexcept { return flags; }
123 
128  inline bool testFlags (int flagsToTest) const noexcept { return (flags & flagsToTest) != 0; }
129 
130 
131  //==============================================================================
137  void applyTo (double& sourceX,
138  double& sourceY,
139  double& sourceW,
140  double& sourceH,
141  double destinationX,
142  double destinationY,
143  double destinationW,
144  double destinationH) const noexcept;
145 
149  template <typename ValueType>
151  const Rectangle<ValueType>& destination) const noexcept
152  {
153  double x = source.getX(), y = source.getY(), w = source.getWidth(), h = source.getHeight();
154  applyTo (x, y, w, h, static_cast <double> (destination.getX()), static_cast <double> (destination.getY()),
155  static_cast <double> (destination.getWidth()), static_cast <double> (destination.getHeight()));
156  return Rectangle<ValueType> (static_cast <ValueType> (x), static_cast <ValueType> (y),
157  static_cast <ValueType> (w), static_cast <ValueType> (h));
158  }
159 
163  AffineTransform getTransformToFit (const Rectangle<float>& source,
164  const Rectangle<float>& destination) const noexcept;
165 
166 
167 private:
168  //==============================================================================
169  int flags;
170 };
171 
172 #endif // JUCE_RECTANGLEPLACEMENT_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
Rectangle< ValueType > appliedTo(const Rectangle< ValueType > &source, const Rectangle< ValueType > &destination) const noexcept
Definition: juce_RectanglePlacement.h:150
int getFlags() const noexcept
Definition: juce_RectanglePlacement.h:122
bool testFlags(int flagsToTest) const noexcept
Definition: juce_RectanglePlacement.h:128
RectanglePlacement(int placementFlags) noexcept
Definition: juce_RectanglePlacement.h:42
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
Definition: juce_Rectangle.h:36
there are legal restrictions on arithmetic coding Invalid progressive parameters caller expects u Cannot quantize more than d color components Adobe APP14 flags
Definition: juce_JPEGLoader.cpp:127
Definition: juce_RectanglePlacement.h:37
Flags
Definition: juce_RectanglePlacement.h:58
RectanglePlacement() noexcept
Definition: juce_RectanglePlacement.h:45
Definition: juce_AffineTransform.h:40