JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
juce::RectanglePlacement Class Reference

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 , xRight , xMid , yTop ,
  yBottom , yMid , stretchToFit , fillDestination ,
  onlyReduceInSize , onlyIncreaseInSize , doNotResize , centred
}
 Flag values that can be combined and used in the constructor. More...
 

Public Member Functions

 RectanglePlacement (int placementFlags) noexcept
 Creates a RectanglePlacement object using a combination of flags from the Flags enum.
 
 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.
 
RectanglePlacementoperator= (const RectanglePlacement &)=default
 Copies another RectanglePlacement object.
 
bool operator== (const RectanglePlacement &) const noexcept
 
bool operator!= (const RectanglePlacement &) const noexcept
 
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.
 
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.
 
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.
 
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.
 

Detailed Description

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}

Definition at line 39 of file juce_RectanglePlacement.h.

Member Enumeration Documentation

◆ Flags

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).

Definition at line 60 of file juce_RectanglePlacement.h.

Constructor & Destructor Documentation

◆ RectanglePlacement()

juce::RectanglePlacement::RectanglePlacement ( int  placementFlags)
noexcept

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

Definition at line 44 of file juce_RectanglePlacement.h.

Member Function Documentation

◆ appliedTo()

template<typename ValueType >
Rectangle< ValueType > juce::RectanglePlacement::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.

Definition at line 152 of file juce_RectanglePlacement.h.

◆ applyTo()

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

Definition at line 39 of file juce_RectanglePlacement.cpp.

◆ getFlags()

int juce::RectanglePlacement::getFlags ( ) const
noexcept

Returns the raw flags that are set for this object.

Definition at line 124 of file juce_RectanglePlacement.h.

◆ getTransformToFit()

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

Definition at line 82 of file juce_RectanglePlacement.cpp.

◆ operator!=()

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

Definition at line 34 of file juce_RectanglePlacement.cpp.

◆ operator==()

bool juce::RectanglePlacement::operator== ( const RectanglePlacement other) const
noexcept

Definition at line 29 of file juce_RectanglePlacement.cpp.

◆ testFlags()

bool juce::RectanglePlacement::testFlags ( int  flagsToTest) const
noexcept

Tests a set of flags for this object.

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

Definition at line 130 of file juce_RectanglePlacement.h.


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