iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
IRECTList Class Reference

Used to manage a list of rectangular areas and optimize them for drawing to the screen. More...

#include <IGraphicsStructs.h>

Public Member Functions

 IRECTList (const IRECTList &)=delete
 
IRECTListoperator= (const IRECTList &)=delete
 
int Size () const
 
void Add (const IRECT &rect)
 Add a rectangle to the list. More...
 
void Set (int idx, const IRECT &rect)
 Set a specific rectangle in the list (will crash if idx is invalid) More...
 
const IRECTGet (int idx) const
 Get an IRECT from the list (will crash if idx is invalid) More...
 
void Clear ()
 Clear the list. More...
 
IRECT Bounds ()
 Get a union of all rectangles in the list. More...
 
void PixelAlign ()
 Align the rectangles to pixel boundaries. More...
 
void PixelAlign (float scale)
 Pixel-align the IRECTs at the given scale factor then scale them back down. More...
 
int Find (float x, float y) const
 Find the first index of the rect that contains point x, y, if it exists. More...
 
void Optimize ()
 Remove rects that are contained by other rects and intersections and merge any rects that can be merged. More...
 

Static Public Member Functions

static bool GetFracGrid (const IRECT &input, IRECTList &rects, const std::initializer_list< float > &rowFractions, const std::initializer_list< float > &colFractions, EDirection layoutDir=EDirection::Horizontal)
 Fill an IRECTList with divisons of an input IRECT. More...
 

Detailed Description

Used to manage a list of rectangular areas and optimize them for drawing to the screen.

Definition at line 1729 of file IGraphicsStructs.h.

Constructor & Destructor Documentation

◆ IRECTList()

IRECTList::IRECTList ( )
inline

Definition at line 1732 of file IGraphicsStructs.h.

Member Function Documentation

◆ Add()

void IRECTList::Add ( const IRECT rect)
inline

Add a rectangle to the list.

Parameters
rectThe IRECT to add

Definition at line 1743 of file IGraphicsStructs.h.

Referenced by IGraphics::AttachGestureRecognizerToRegion(), GetFracGrid(), and IGraphics::IsDirty().

◆ Bounds()

IRECT IRECTList::Bounds ( )
inline

Get a union of all rectangles in the list.

Returns
IRECT Union of all rectangles in the list

Definition at line 1772 of file IGraphicsStructs.h.

References Get(), and IRECT::Union().

Referenced by IGraphics::Draw(), and GetFracGrid().

◆ Clear()

void IRECTList::Clear ( )
inline

Clear the list.

Definition at line 1765 of file IGraphicsStructs.h.

Referenced by IGraphics::ClearGestureRegions().

◆ Find()

int IRECTList::Find ( float  x,
float  y 
) const
inline

Find the first index of the rect that contains point x, y, if it exists.

Parameters
xHorizontal position to check
yVertical position to check
Returns
integer index of rect that contains point x,y or -1 if not found

Definition at line 1807 of file IGraphicsStructs.h.

References IRECT::Contains(), Get(), and Size().

Referenced by IGraphics::OnGestureRecognized(), and IGraphics::RespondsToGesture().

◆ Get()

const IRECT & IRECTList::Get ( int  idx) const
inline

Get an IRECT from the list (will crash if idx is invalid)

Parameters
idxThe index to get
Returns
const IRECT& The IRECT at idx

Definition at line 1759 of file IGraphicsStructs.h.

Referenced by Bounds(), IGraphics::Draw(), Find(), Optimize(), and PixelAlign().

◆ GetFracGrid()

static bool IRECTList::GetFracGrid ( const IRECT input,
IRECTList rects,
const std::initializer_list< float > &  rowFractions,
const std::initializer_list< float > &  colFractions,
EDirection  layoutDir = EDirection::Horizontal 
)
inlinestatic

Fill an IRECTList with divisons of an input IRECT.

Parameters
inputThe input rectangle
rectsThe output IRECTList
rowFractionsInitializer list of fractions for the grid rows (should sum to 1.0)
colFractionsInitializer list of fractions for the grid columns (should sum to 1.0)
layoutDirBy default the cell idx increases horizontally (by row). If set to EDirection::Vertical, cell idx increases vertically (by column).
Returns
true if the row and column fractions summed to 1.0, and grid creation was successful

Definition at line 1825 of file IGraphicsStructs.h.

References Add(), Bounds(), IRECT::FracRectHorizontal(), IRECT::FracRectVertical(), IRECT::GetTranslated(), IRECT::H(), IRECT::Intersect(), and IRECT::W().

◆ Optimize()

void IRECTList::Optimize ( )
inline

Remove rects that are contained by other rects and intersections and merge any rects that can be merged.

Definition at line 1887 of file IGraphicsStructs.h.

References IRECT::Contains(), Get(), IRECT::Intersect(), IRECT::Intersects(), IRECT::Mergeable(), Set(), and Size().

Referenced by IGraphics::Draw().

◆ PixelAlign() [1/2]

void IRECTList::PixelAlign ( )
inline

Align the rectangles to pixel boundaries.

Definition at line 1781 of file IGraphicsStructs.h.

References Get(), IRECT::PixelAlign(), Set(), and Size().

Referenced by IGraphics::Draw().

◆ PixelAlign() [2/2]

void IRECTList::PixelAlign ( float  scale)
inline

Pixel-align the IRECTs at the given scale factor then scale them back down.

Parameters
scaleScale value for the alignment

Definition at line 1793 of file IGraphicsStructs.h.

References Get(), IRECT::PixelAlign(), Set(), and Size().

◆ Set()

void IRECTList::Set ( int  idx,
const IRECT rect 
)
inline

Set a specific rectangle in the list (will crash if idx is invalid)

Parameters
idxThe index to set
rectThe new IRECT

Definition at line 1751 of file IGraphicsStructs.h.

Referenced by Optimize(), and PixelAlign().

◆ Size()

int IRECTList::Size ( ) const
inline
Returns
int The number of rectangles in the list

Definition at line 1739 of file IGraphicsStructs.h.

Referenced by IGraphics::AttachGestureRecognizerToRegion(), IGraphics::Draw(), Find(), Optimize(), PixelAlign(), and IGraphics::RespondsToGesture().


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