Defines the method used to position some kind of rectangular object within a rectangular viewport. More...
#include <juce_RectanglePlacement.h>
Public Types | |
enum | Flags { xLeft = 1, xRight = 2, xMid = 4, yTop = 8, yBottom = 16, yMid = 32, stretchToFit = 64, fillDestination = 128, onlyReduceInSize = 256, onlyIncreaseInSize = 512, doNotResize = (onlyIncreaseInSize | onlyReduceInSize), centred = 4 + 32 } |
Flag values that can be combined and used in the constructor. More... | |
Public Member Functions | |
RectanglePlacement ()=default | |
Creates a default RectanglePlacement object, which is equivalent to using the 'centred' flag. More... | |
RectanglePlacement (const RectanglePlacement &)=default | |
Creates a copy of another RectanglePlacement object. More... | |
RectanglePlacement (int placementFlags) noexcept | |
Creates a RectanglePlacement object using a combination of flags from the Flags enum. More... | |
template<typename ValueType > | |
Rectangle< ValueType > | appliedTo (const Rectangle< ValueType > &source, const Rectangle< ValueType > &destination) const noexcept |
Returns the rectangle that should be used to fit the given source rectangle into the destination rectangle using the current flags. More... | |
void | applyTo (double &sourceX, double &sourceY, double &sourceW, double &sourceH, double destinationX, double destinationY, double destinationW, double destinationH) const noexcept |
Adjusts the position and size of a rectangle to fit it into a space. More... | |
int | getFlags () const noexcept |
Returns the raw flags that are set for this object. More... | |
AffineTransform | getTransformToFit (const Rectangle< float > &source, const Rectangle< float > &destination) const noexcept |
Returns the transform that should be applied to these source coordinates to fit them into the destination rectangle using the current flags. More... | |
bool | operator!= (const RectanglePlacement &) const noexcept |
RectanglePlacement & | operator= (const RectanglePlacement &)=default |
Copies another RectanglePlacement object. More... | |
bool | operator== (const RectanglePlacement &) const noexcept |
bool | testFlags (int flagsToTest) const noexcept |
Tests a set of flags for this object. More... | |
Private Attributes | |
int | flags { centred } |
Defines the method used to position some kind of rectangular object within a rectangular viewport.
Although similar to Justification, this is more specific, and has some extra options.
@tags{Graphics}
Flag values that can be combined and used in the constructor.
|
inlinenoexcept |
Creates a RectanglePlacement object using a combination of flags from the Flags enum.
|
inlinedefault |
Creates a default RectanglePlacement object, which is equivalent to using the 'centred' flag.
|
default |
Creates a copy of another RectanglePlacement object.
|
inlinenoexcept |
Returns the rectangle that should be used to fit the given source rectangle into the destination rectangle using the current flags.
References juce::gl::h, juce::gl::source, juce::gl::w, juce::gl::x, and juce::gl::y.
|
noexcept |
Adjusts the position and size of a rectangle to fit it into a space.
The source rectangle coordinates will be adjusted so that they fit into the destination rectangle based on this object's flags.
|
inlinenoexcept |
Returns the raw flags that are set for this object.
References juce::gl::flags.
|
noexcept |
Returns the transform that should be applied to these source coordinates to fit them into the destination rectangle using the current flags.
|
noexcept |
|
default |
Copies another RectanglePlacement object.
|
noexcept |
Tests a set of flags for this object.
References juce::gl::flags.