openshot-audio  0.1.7
Public Types | Public Member Functions | List of all members
RectanglePlacement Class Reference

#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
}
 

Public Member Functions

 RectanglePlacement (int placementFlags) noexcept
 
 RectanglePlacement () noexcept
 
 RectanglePlacement (const RectanglePlacement &) noexcept
 
RectanglePlacementoperator= (const RectanglePlacement &) noexcept
 
bool operator== (const RectanglePlacement &) const noexcept
 
bool operator!= (const RectanglePlacement &) const noexcept
 
int getFlags () const noexcept
 
bool testFlags (int flagsToTest) const noexcept
 
void applyTo (double &sourceX, double &sourceY, double &sourceW, double &sourceH, double destinationX, double destinationY, double destinationW, double destinationH) const noexcept
 
template<typename ValueType >
Rectangle< ValueType > appliedTo (const Rectangle< ValueType > &source, const Rectangle< ValueType > &destination) const noexcept
 
AffineTransform getTransformToFit (const Rectangle< float > &source, const Rectangle< float > &destination) const noexcept
 

Detailed Description

Defines the method used to postion some kind of rectangular object within a rectangular viewport.

Although similar to Justification, this is more specific, and has some extra options.

Member Enumeration Documentation

Flag values that can be combined and used in the constructor.

Enumerator
xLeft 

Indicates that the source rectangle's left edge should be aligned with the left edge of the target rectangle.

xRight 

Indicates that the source rectangle's right edge should be aligned with the right edge of the target rectangle.

xMid 

Indicates that the source should be placed in the centre between the left and right sides of the available space.

yTop 

Indicates that the source's top edge should be aligned with the top edge of the destination rectangle.

yBottom 

Indicates that the source's bottom edge should be aligned with the bottom edge of the destination rectangle.

yMid 

Indicates that the source should be placed in the centre between the top and bottom sides of the available space.

stretchToFit 

If this flag is set, then the source rectangle will be resized to completely fill the destination rectangle, and all other flags are ignored.

fillDestination 

If this flag is set, then the source rectangle will be resized so that it is the minimum size to completely fill the destination rectangle, without changing its aspect ratio. This means that some of the source rectangle may fall outside the destination.

If this flag is not set, the source will be given the maximum size at which none of it falls outside the destination rectangle.

onlyReduceInSize 

Indicates that the source rectangle can be reduced in size if required, but should never be made larger than its original size.

onlyIncreaseInSize 

Indicates that the source rectangle can be enlarged if required, but should never be made smaller than its original size.

doNotResize 

Indicates that the source rectangle's size should be left unchanged.

centred 

A shorthand value that is equivalent to (xMid | yMid).

Constructor & Destructor Documentation

RectanglePlacement::RectanglePlacement ( int  placementFlags)
inlinenoexcept

Creates a RectanglePlacement object using a combination of flags from the Flags enum.

RectanglePlacement::RectanglePlacement ( )
inlinenoexcept

Creates a default RectanglePlacement object, which is equivalent to using the 'centred' flag.

RectanglePlacement::RectanglePlacement ( const RectanglePlacement other)
noexcept

Creates a copy of another RectanglePlacement object.

Member Function Documentation

template<typename ValueType >
Rectangle<ValueType> RectanglePlacement::appliedTo ( const Rectangle< ValueType > &  source,
const Rectangle< ValueType > &  destination 
) const
inlinenoexcept

Returns the rectangle that should be used to fit the given source rectangle into the destination rectangle using the current flags.

void RectanglePlacement::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.

The source rectangle coordinates will be adjusted so that they fit into the destination rectangle based on this object's flags.

int RectanglePlacement::getFlags ( ) const
inlinenoexcept

Returns the raw flags that are set for this object.

AffineTransform RectanglePlacement::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.

bool RectanglePlacement::operator!= ( const RectanglePlacement other) const
noexcept
RectanglePlacement & RectanglePlacement::operator= ( const RectanglePlacement other)
noexcept

Copies another RectanglePlacement object.

bool RectanglePlacement::operator== ( const RectanglePlacement other) const
noexcept
bool RectanglePlacement::testFlags ( int  flagsToTest) const
inlinenoexcept

Tests a set of flags for this object.

Returns
true if any of the flags passed in are set on this object.

The documentation for this class was generated from the following files: