101 fillDestination = 128,
106 onlyReduceInSize = 256,
111 onlyIncreaseInSize = 512,
115 doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
124 inline int getFlags() const noexcept {
return flags; }
130 inline bool testFlags (
int flagsToTest)
const noexcept {
return (flags & flagsToTest) != 0; }
139 void applyTo (
double& sourceX,
146 double destinationH)
const noexcept;
151 template <
typename ValueType>
155 double x = source.getX(), y = source.getY(), w = source.getWidth(), h = source.getHeight();
156 applyTo (x, y, w, h,
static_cast<double> (destination.getX()),
static_cast<double> (destination.getY()),
157 static_cast<double> (destination.getWidth()),
static_cast<double> (destination.getHeight()));
159 static_cast<ValueType
> (w),
static_cast<ValueType
> (h));
171 int flags { centred };
Defines the method used to position some kind of rectangular object within a rectangular viewport.
int getFlags() const noexcept
Returns the raw flags that are set for this object.
bool testFlags(int flagsToTest) const noexcept
Tests a set of flags for this object.
RectanglePlacement()=default
Creates a default RectanglePlacement object, which is equivalent to using the 'centred' flag.
RectanglePlacement(const RectanglePlacement &)=default
Creates a copy of another RectanglePlacement object.
RectanglePlacement(int placementFlags) noexcept
Creates a RectanglePlacement object using a combination of flags from the Flags enum.
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 rect...
Flags
Flag values that can be combined and used in the constructor.
Manages a rectangle and allows geometric operations to be performed on it.