DISTRHO Plugin Framework
Public Member Functions | List of all members
Rectangle< T > Class Template Reference

#include <Geometry.hpp>

Public Member Functions

 Rectangle () noexcept
 
 Rectangle (const T &x, const T &y, const T &width, const T &height) noexcept
 
 Rectangle (const T &x, const T &y, const Size< T > &size) noexcept
 
 Rectangle (const Point< T > &pos, const T &width, const T &height) noexcept
 
 Rectangle (const Point< T > &pos, const Size< T > &size) noexcept
 
 Rectangle (const Rectangle< T > &rect) noexcept
 
const T & getX () const noexcept
 
const T & getY () const noexcept
 
const T & getWidth () const noexcept
 
const T & getHeight () const noexcept
 
const Point< T > & getPos () const noexcept
 
const Size< T > & getSize () const noexcept
 
void setX (const T &x) noexcept
 
void setY (const T &y) noexcept
 
void setPos (const T &x, const T &y) noexcept
 
void setPos (const Point< T > &pos) noexcept
 
void moveBy (const T &x, const T &y) noexcept
 
void moveBy (const Point< T > &pos) noexcept
 
void setWidth (const T &width) noexcept
 
void setHeight (const T &height) noexcept
 
void setSize (const T &width, const T &height) noexcept
 
void setSize (const Size< T > &size) noexcept
 
void growBy (double multiplier) noexcept
 
void shrinkBy (double divider) noexcept
 
void setRectangle (const Point< T > &pos, const Size< T > &size) noexcept
 
void setRectangle (const Rectangle< T > &rect) noexcept
 
bool contains (const T &x, const T &y) const noexcept
 
bool contains (const Point< T > &pos) const noexcept
 
bool containsAfterScaling (const Point< T > &pos, double scaling) const noexcept
 
template<typename T2 >
bool contains (const Point< T2 > &pos) const noexcept
 
bool containsX (const T &x) const noexcept
 
bool containsY (const T &y) const noexcept
 
bool isNull () const noexcept
 
bool isNotNull () const noexcept
 
bool isValid () const noexcept
 
bool isInvalid () const noexcept
 
void draw (const GraphicsContext &context)
 
void drawOutline (const GraphicsContext &context, T lineWidth=1)
 
Rectangle< T > & operator= (const Rectangle< T > &rect) noexcept
 
Rectangle< T > & operator*= (double m) noexcept
 
Rectangle< T > & operator/= (double d) noexcept
 
bool operator== (const Rectangle< T > &size) const noexcept
 
bool operator!= (const Rectangle< T > &size) const noexcept
 
void draw ()
 
void drawOutline ()
 

Detailed Description

template<typename T>
class Rectangle< T >

DGL Rectangle class.

This class describes a rectangle, defined by a starting point and a size.

Constructor & Destructor Documentation

◆ Rectangle() [1/6]

template<typename T >
Rectangle< T >::Rectangle ( )
noexcept

Constructor for a null rectangle.

◆ Rectangle() [2/6]

template<typename T >
Rectangle< T >::Rectangle ( const T &  x,
const T &  y,
const T &  width,
const T &  height 
)
noexcept

Constructor using custom X, Y, width and height values.

◆ Rectangle() [3/6]

template<typename T >
Rectangle< T >::Rectangle ( const T &  x,
const T &  y,
const Size< T > &  size 
)
noexcept

Constructor using custom X, Y and size values.

◆ Rectangle() [4/6]

template<typename T >
Rectangle< T >::Rectangle ( const Point< T > &  pos,
const T &  width,
const T &  height 
)
noexcept

Constructor using custom pos, width and height values.

◆ Rectangle() [5/6]

template<typename T >
Rectangle< T >::Rectangle ( const Point< T > &  pos,
const Size< T > &  size 
)
noexcept

Constructor using custom position and size.

◆ Rectangle() [6/6]

template<typename T >
Rectangle< T >::Rectangle ( const Rectangle< T > &  rect)
noexcept

Constructor using another Rectangle class values.

Member Function Documentation

◆ getX()

template<typename T >
const T& Rectangle< T >::getX ( ) const
noexcept

Get X value.

◆ getY()

template<typename T >
const T& Rectangle< T >::getY ( ) const
noexcept

Get Y value.

◆ getWidth()

template<typename T >
const T& Rectangle< T >::getWidth ( ) const
noexcept

Get width.

◆ getHeight()

template<typename T >
const T& Rectangle< T >::getHeight ( ) const
noexcept

Get height.

◆ getPos()

template<typename T >
const Point<T>& Rectangle< T >::getPos ( ) const
noexcept

Get position.

◆ getSize()

template<typename T >
const Size<T>& Rectangle< T >::getSize ( ) const
noexcept

Get size.

◆ setX()

template<typename T >
void Rectangle< T >::setX ( const T &  x)
noexcept

Set X value as x.

◆ setY()

template<typename T >
void Rectangle< T >::setY ( const T &  y)
noexcept

Set Y value as y.

◆ setPos() [1/2]

template<typename T >
void Rectangle< T >::setPos ( const T &  x,
const T &  y 
)
noexcept

Set X and Y values as x and y respectively.

◆ setPos() [2/2]

template<typename T >
void Rectangle< T >::setPos ( const Point< T > &  pos)
noexcept

Set X and Y values according to pos.

◆ moveBy() [1/2]

template<typename T >
void Rectangle< T >::moveBy ( const T &  x,
const T &  y 
)
noexcept

Move this rectangle by x and y values.

◆ moveBy() [2/2]

template<typename T >
void Rectangle< T >::moveBy ( const Point< T > &  pos)
noexcept

Move this rectangle by pos.

◆ setWidth()

template<typename T >
void Rectangle< T >::setWidth ( const T &  width)
noexcept

Set width.

◆ setHeight()

template<typename T >
void Rectangle< T >::setHeight ( const T &  height)
noexcept

Set height.

◆ setSize() [1/2]

template<typename T >
void Rectangle< T >::setSize ( const T &  width,
const T &  height 
)
noexcept

Set size using width and height.

◆ setSize() [2/2]

template<typename T >
void Rectangle< T >::setSize ( const Size< T > &  size)
noexcept

Set size.

◆ growBy()

template<typename T >
void Rectangle< T >::growBy ( double  multiplier)
noexcept

Grow size by multiplier.

◆ shrinkBy()

template<typename T >
void Rectangle< T >::shrinkBy ( double  divider)
noexcept

Shrink size by divider.

◆ setRectangle() [1/2]

template<typename T >
void Rectangle< T >::setRectangle ( const Point< T > &  pos,
const Size< T > &  size 
)
noexcept

Set rectangle using pos and size.

◆ setRectangle() [2/2]

template<typename T >
void Rectangle< T >::setRectangle ( const Rectangle< T > &  rect)
noexcept

Set rectangle.

◆ contains() [1/3]

template<typename T >
bool Rectangle< T >::contains ( const T &  x,
const T &  y 
) const
noexcept

Check if this rectangle contains the point defined by X and Y.

◆ contains() [2/3]

template<typename T >
bool Rectangle< T >::contains ( const Point< T > &  pos) const
noexcept

Check if this rectangle contains the point pos.

◆ containsAfterScaling()

template<typename T >
bool Rectangle< T >::containsAfterScaling ( const Point< T > &  pos,
double  scaling 
) const
noexcept

Check if this rectangle contains the point pos affected by a custom scale.

◆ contains() [3/3]

template<typename T >
template<typename T2 >
bool Rectangle< T >::contains ( const Point< T2 > &  pos) const
noexcept

Check if this rectangle contains the point pos of another type.

◆ containsX()

template<typename T >
bool Rectangle< T >::containsX ( const T &  x) const
noexcept

Check if this rectangle contains X.

◆ containsY()

template<typename T >
bool Rectangle< T >::containsY ( const T &  y) const
noexcept

Check if this rectangle contains Y.

◆ isNull()

template<typename T >
bool Rectangle< T >::isNull ( ) const
noexcept

Return true if size is null (0x0). An null size is also invalid.

◆ isNotNull()

template<typename T >
bool Rectangle< T >::isNotNull ( ) const
noexcept

Return true if size is not null (0x0). A non-null size is still invalid if its width or height are negative.

◆ isValid()

template<typename T >
bool Rectangle< T >::isValid ( ) const
noexcept

Return true if size is valid (width and height are higher than zero).

◆ isInvalid()

template<typename T >
bool Rectangle< T >::isInvalid ( ) const
noexcept

Return true if size is invalid (width or height are lower or equal to zero). An invalid size might not be null under some circumstances.

◆ draw() [1/2]

template<typename T >
void Rectangle< T >::draw ( const GraphicsContext context)

Draw this rectangle using the provided graphics context.

◆ drawOutline() [1/2]

template<typename T >
void Rectangle< T >::drawOutline ( const GraphicsContext context,
lineWidth = 1 
)

Draw lines (outline of this rectangle) using the provided graphics context, optionally specifying line width.

◆ draw() [2/2]

template<typename T >
void Rectangle< T >::draw ( )

Draw this rectangle using the current OpenGL state.
DEPRECATED Please use draw(const GraphicsContext&) instead.

◆ drawOutline() [2/2]

template<typename T >
void Rectangle< T >::drawOutline ( )

Draw lines (outline of this rectangle) using the current OpenGL state.
DEPRECATED Please use drawOutline(const GraphicsContext&,T) instead.


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