iPlug2 - C++ Audio Plug-in Framework
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
IRECT Struct Reference

Used to manage a rectangular area, independent of draw class/platform. More...

#include <IGraphicsStructs.h>

Public Member Functions

 IRECT ()
 Construct an empty IRECT.
 
 IRECT (float l, float t, float r, float b)
 Construct a new IRECT with dimensions. More...
 
 IRECT (float x, float y, const IBitmap &bitmap)
 Construct a new IRECT at the given position and with the same size as the bitmap. More...
 
bool Empty () const
 
void Clear ()
 Set all fields of this IRECT to 0.
 
bool operator== (const IRECT &rhs) const
 
bool operator!= (const IRECT &rhs) const
 
float W () const
 
float H () const
 
float MW () const
 
float MH () const
 
float Area () const
 
IRECT Union (const IRECT &rhs) const
 Create a new IRECT that is a union of this IRECT and rhs. More...
 
IRECT Intersect (const IRECT &rhs) const
 Create a new IRECT that is the intersection of this IRECT and rhs. More...
 
bool Intersects (const IRECT &rhs) const
 Returns true if this IRECT shares any common pixels with rhs, false otherwise. More...
 
bool Contains (const IRECT &rhs) const
 Returns true if this IRECT completely contains rhs. More...
 
bool Contains (float x, float y) const
 Returns true if this IRECT completely contains the point (x,y). More...
 
bool ContainsEdge (float x, float y) const
 Returns true if the point (x,y) is either contained in this IRECT or on an edge. More...
 
void Constrain (float &x, float &y) const
 Ensure the point (x,y) is inside this IRECT. More...
 
IRECT Inset (const IRECT &rhs) const
 Offsets the input IRECT based on the parent. More...
 
bool Mergeable (const IRECT &rhs) const
 Return if this IRECT and rhs may be merged. More...
 
IRECT FracRect (EDirection layoutDir, float frac, bool fromTopOrRight=false) const
 Get a new rectangle which is a fraction of this rectangle. More...
 
IRECT FracRectHorizontal (float frac, bool rhs=false) const
 Returns a new IRECT with a width that is multiplied by frac. More...
 
IRECT FracRectVertical (float frac, bool fromTop=false) const
 Returns a new IRECT with a height that is multiplied by frac. More...
 
IRECT SubRectVertical (int numSlices, int sliceIdx) const
 Returns a new IRECT which is a horizontal "slice" of this IRECT. More...
 
IRECT SubRectHorizontal (int numSlices, int sliceIdx) const
 Returns a new IRECT which is a vertical "slice" of this IRECT. More...
 
IRECT SubRect (EDirection layoutDir, int numSlices, int sliceIdx) const
 Get a new rectangle which is a "slice" of this rectangle. More...
 
IRECT GetFromTLHC (float w, float h) const
 Get a subrect of this IRECT expanding from the top-left corner. More...
 
IRECT GetFromBLHC (float w, float h) const
 Get a subrect of this IRECT expanding from the bottom-left corner. More...
 
IRECT GetFromTRHC (float w, float h) const
 Get a subrect of this IRECT expanding from the top-right corner. More...
 
IRECT GetFromBRHC (float w, float h) const
 Get a subrect of this IRECT expanding from the bottom-right corner. More...
 
IRECT GetFromTop (float amount) const
 Get a subrect of this IRECT bounded in Y by the top edge and 'amount'. More...
 
IRECT GetFromBottom (float amount) const
 Get a subrect of this IRECT bounded in Y by 'amount' and the bottom edge. More...
 
IRECT GetFromLeft (float amount) const
 Get a subrect of this IRECT bounded in X by the left edge and 'amount'. More...
 
IRECT GetFromRight (float amount) const
 Get a subrect of this IRECT bounded in X by 'amount' and the right edge. More...
 
IRECT GetReducedFromTop (float amount) const
 Get a subrect of this IRECT reduced in height from the top edge by 'amount'. More...
 
IRECT GetReducedFromBottom (float amount) const
 Get a subrect of this IRECT reduced in height from the bottom edge by 'amount'. More...
 
IRECT GetReducedFromLeft (float amount) const
 Get a subrect of this IRECT reduced in width from the left edge by 'amount'. More...
 
IRECT GetReducedFromRight (float amount) const
 Get a subrect of this IRECT reduced in width from the right edge by 'amount'. More...
 
IRECT ReduceFromTop (float amount)
 Reduce in height from the top edge by 'amount' and return the removed region. More...
 
IRECT ReduceFromBottom (float amount)
 Reduce in height from the bottom edge by 'amount' and return the removed region. More...
 
IRECT ReduceFromLeft (float amount)
 Reduce in width from the left edge by 'amount' and return the removed region. More...
 
IRECT ReduceFromRight (float amount)
 Reduce in width from the right edge by 'amount' and return the removed region. More...
 
IRECT GetGridCell (int row, int col, int nRows, int nColumns) const
 Get a subrect (by row, column) of this IRECT which is a cell in a grid of size (nRows * nColumns) More...
 
IRECT GetGridCell (int cellIndex, int nRows, int nColumns, EDirection dir=EDirection::Horizontal, int nCells=1) const
 Get a subrect (by index) of this IRECT which is a cell (or union of nCells sequential cells on same row/column) in a grid of size (nRows * nColumns) More...
 
bool IsPixelAligned () const
 
bool IsPixelAligned (float scale) const
 Return true if, when scaled by scale, this IRECT is pixel aligned When scaling this mutliples each value of the IRECT, it does not scale from the center. More...
 
void PixelAlign ()
 Pixel aligns the rect in an inclusive manner (moves all points outwards)
 
void PixelAlign (float scale)
 Pixel-align this IRECT at the given scale factor then scale it back down When scaling this mutliples each value of the IRECT, it does not scale from the center. More...
 
IRECT GetPixelAligned () const
 Get a copy of this IRECT with PixelAlign() called. More...
 
IRECT GetPixelAligned (float scale) const
 Get a copy of this IRECT with PixelAlign(scale) called. More...
 
void PixelSnap ()
 Pixel aligns to nearest pixels This may make the IRECT smaller, unlike PixelAlign(). More...
 
void PixelSnap (float scale)
 Pixel align a scaled version of this IRECT. More...
 
IRECT GetPixelSnapped () const
 
IRECT GetPixelSnapped (float scale) const
 Get a copy of this IRECT with PixelSnap(scale) called. More...
 
void Pad (float padding)
 Pad this IRECT N.B. More...
 
void Pad (float padL, float padT, float padR, float padB)
 Pad this IRECT N.B. More...
 
void HPad (float padding)
 Pad this IRECT in the X-axis N.B. More...
 
void VPad (float padding)
 Pad this IRECT in the Y-axis N.B. More...
 
void MidHPad (float padding)
 Set the width of this IRECT to 2*padding without changing it's center point on the X-axis. More...
 
void MidVPad (float padding)
 Set the height of this IRECT to 2*padding without changing it's center point on the Y-axis. More...
 
IRECT GetPadded (float padding) const
 Get a copy of this IRECT with each value padded by padding N.B. More...
 
IRECT GetPadded (float padL, float padT, float padR, float padB) const
 Get a copy of this IRECT with the values padded N.B. More...
 
IRECT GetHPadded (float padding) const
 Get a copy of this IRECT padded in the X-axis N.B. More...
 
IRECT GetVPadded (float padding) const
 Get a copy of this IRECT padded in the Y-axis N.B. More...
 
IRECT GetMidHPadded (float padding) const
 Get a copy of this IRECT where its width = 2 * padding but the center point on the X-axis has not changed. More...
 
IRECT GetMidVPadded (float padding) const
 Get a copy of this IRECT where its height = 2 * padding but the center point on the Y-axis has not changed. More...
 
IRECT GetHSliced (float w, bool rhs=false) const
 Get a copy of this IRECT with a new width. More...
 
IRECT GetVSliced (float h, bool bot=false) const
 Get a copy of this IRECT with a new height. More...
 
void Clank (const IRECT &rhs)
 
void Scale (float scale)
 Multiply each field of this IRECT by scale. More...
 
void ScaleAboutCentre (float scale)
 Scale the width and height of this IRECT by scale without changing the center point. More...
 
IRECT GetScaled (float scale) const
 Get a copy of this IRECT with all values multiplied by scale. More...
 
IRECT GetScaledAboutCentre (float scale) const
 Get a copy of this IRECT where the width and height are multiplied by scale without changing the center point. More...
 
void GetRandomPoint (float &x, float &y) const
 Get a random point within this rectangle. More...
 
IRECT GetRandomSubRect () const
 
void Offset (float l, float t, float r, float b)
 Offset each field of the rectangle. More...
 
IRECT GetOffset (float l, float t, float r, float b) const
 Get a copy of this rectangle where each field is offset by a specified amount. More...
 
void Translate (float x, float y)
 Translate this rectangle. More...
 
IRECT GetTranslated (float x, float y) const
 Get a translated copy of this rectangle. More...
 
IRECT GetHShifted (float x) const
 Get a copy of this rectangle translated on the X axis. More...
 
IRECT GetVShifted (float y) const
 Get a copy of this rectangle translated on the Y axis. More...
 
IRECT GetCentredInside (const IRECT &sr) const
 Get a rectangle the size of sr but with the same center point as this rectangle. More...
 
IRECT GetCentredInside (float w, float h=0.f) const
 Get a rectangle with the same center point as this rectangle and the given size. More...
 
IRECT GetCentredInside (const IBitmap &bitmap) const
 Get a rectangle with the same center point as this rectangle and the size of the bitmap. More...
 
void VAlignTo (const IRECT &sr, EVAlign align)
 Vertically align this rect to the reference IRECT. More...
 
void HAlignTo (const IRECT &sr, EAlign align)
 Horizontally align this rect to the reference IRECT. More...
 
IRECT GetVAlignedTo (const IRECT &sr, EVAlign align) const
 Get a rectangle the same dimensions as this one, vertically aligned to the reference IRECT. More...
 
float GetLengthOfShortestSide () const
 
IRECT GetHAlignedTo (const IRECT &sr, EAlign align) const
 Get a rectangle the same dimensions as this one, horizontally aligned to the reference IRECT. More...
 
void DBGPrint ()
 Print the IRECT's detailes to the console in Debug builds.
 

Static Public Member Functions

static IRECT MakeXYWH (float l, float t, float w, float h)
 Create a new IRECT with the given position and size. More...
 
static IRECT LinearInterpolateBetween (const IRECT &start, const IRECT &dest, float progress)
 Get a rectangle that is a linear interpolation between start and dest More...
 

Public Attributes

float L
 Left side of the rectangle (X)
 
float T
 Top of the rectangle (Y)
 
float R
 Right side of the rectangle (X + W)
 
float B
 Bottom of the rectangle (Y + H)
 

Detailed Description

Used to manage a rectangular area, independent of draw class/platform.

An IRECT is always specified in 1:1 pixels, any scaling for high DPI happens in the drawing class. In IGraphics 0,0 is top left.

Definition at line 750 of file IGraphicsStructs.h.

Constructor & Destructor Documentation

IRECT::IRECT ( float  l,
float  t,
float  r,
float  b 
)
inline

Construct a new IRECT with dimensions.

Parameters
lLeft
tTop
rRight
bBottom

Definition at line 772 of file IGraphicsStructs.h.

IRECT::IRECT ( float  x,
float  y,
const IBitmap bitmap 
)
inline

Construct a new IRECT at the given position and with the same size as the bitmap.

Parameters
xTop
yLeft
bitmapBitmap for the size

Definition at line 780 of file IGraphicsStructs.h.

References IBitmap::FH(), and IBitmap::FW().

Member Function Documentation

float IRECT::Area ( ) const
inline
Returns
float the area of this IRECT

Definition at line 834 of file IGraphicsStructs.h.

References IBitmap::H(), and IBitmap::W().

void IRECT::Clank ( const IRECT rhs)
inline
Todo:
Parameters
rhs

Definition at line 1415 of file IGraphicsStructs.h.

References B, L, R, and T.

void IRECT::Constrain ( float &  x,
float &  y 
) const
inline

Ensure the point (x,y) is inside this IRECT.

Parameters
xpoint X, will be modified if it's outside this IRECT
ypoint Y, will be modified if it's outside this IRECT

Definition at line 901 of file IGraphicsStructs.h.

Referenced by IVKeyboardControl::Draw(), IVXYPadControl::OnMouseDrag(), IVMultiSliderControl< MAXNC >::SnapToMouse(), and IControl::SnapToMouse().

bool IRECT::Contains ( const IRECT rhs) const
inline
bool IRECT::Contains ( float  x,
float  y 
) const
inline

Returns true if this IRECT completely contains the point (x,y).

Parameters
xpoint X
ypoint Y
Returns
true the point (x,y) is inside this IRECT
false the point (x,y) is outside this IRECT

Definition at line 882 of file IGraphicsStructs.h.

bool IRECT::ContainsEdge ( float  x,
float  y 
) const
inline

Returns true if the point (x,y) is either contained in this IRECT or on an edge.

Unlike Contains(x,y) this method includes right-most and bottom-most pixels.

Parameters
xpoint X
ypoint Y
Returns
true the point (x,y) is inside this IRECT
false the point (x,y) is outside this IRECT

Definition at line 893 of file IGraphicsStructs.h.

bool IRECT::Empty ( ) const
inline
IRECT IRECT::FracRect ( EDirection  layoutDir,
float  frac,
bool  fromTopOrRight = false 
) const
inline

Get a new rectangle which is a fraction of this rectangle.

Parameters
layoutDirEDirection::Vertical or EDirection::Horizontal
fracFractional multiplier
fromTopOrRightIf true the new rectangle will expand from the top (Vertical) or right (Horizontal) otherwise it will expand from the bottom (Vertical) or left (Horizontal)
Returns
IRECT the new rectangle

Definition at line 937 of file IGraphicsStructs.h.

Referenced by IVRangeSliderControl::Draw(), IVTrackControlBase::DrawBackground(), IVSliderControl::DrawWidget(), and IVRangeSliderControl::DrawWidget().

IRECT IRECT::FracRectHorizontal ( float  frac,
bool  rhs = false 
) const
inline

Returns a new IRECT with a width that is multiplied by frac.

Parameters
fracwidth multiplier
rhsif true, the new IRECT will expand/contract from the right, otherwise it will come from the left
Returns
IRECT the new IRECT

Definition at line 949 of file IGraphicsStructs.h.

References IBitmap::W().

Referenced by IVColorSwatchControl::DrawWidget(), IRECTList::GetFracGrid(), and ICaptionControl::OnResize().

IRECT IRECT::FracRectVertical ( float  frac,
bool  fromTop = false 
) const
inline

Returns a new IRECT with a height that is multiplied by frac.

Parameters
fracheight multiplier
fromTopif true, the new IRECT will expand/contract from the top, otherwise it will come from the bottom
Returns
IRECT the new IRECT

Definition at line 963 of file IGraphicsStructs.h.

References IBitmap::H().

Referenced by IWheelControl::Draw(), IRECTList::GetFracGrid(), IVNumberBoxControl::OnAttached(), and IVNumberBoxControl::OnResize().

IRECT IRECT::GetCentredInside ( const IRECT sr) const
inline
IRECT IRECT::GetCentredInside ( float  w,
float  h = 0.f 
) const
inline

Get a rectangle with the same center point as this rectangle and the given size.

Parameters
wWidth of the new rectangle (minimum 1.0)
hHeight of the new rectangle (a value of 0 will make it the same as w, thus a square)
Returns
IRECT the new rectangle

Definition at line 1599 of file IGraphicsStructs.h.

References B, L, R, and T.

IRECT IRECT::GetCentredInside ( const IBitmap bitmap) const
inline

Get a rectangle with the same center point as this rectangle and the size of the bitmap.

Parameters
bitmapBitmap used to size the new rectangle
Returns
IRECT the new rectangle

Definition at line 1618 of file IGraphicsStructs.h.

References B, IBitmap::FH(), IBitmap::FW(), L, R, and T.

IRECT IRECT::GetFromBLHC ( float  w,
float  h 
) const
inline

Get a subrect of this IRECT expanding from the bottom-left corner.

Parameters
wWidth of the desired IRECT
hHeight of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1026 of file IGraphicsStructs.h.

IRECT IRECT::GetFromBottom ( float  amount) const
inline

Get a subrect of this IRECT bounded in Y by 'amount' and the bottom edge.

Parameters
amountSize in Y of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1048 of file IGraphicsStructs.h.

Referenced by TestFontControl::Draw(), IWheelControl::Draw(), IVectorBase::MakeRects(), and TestDirBrowseControl::OnResize().

IRECT IRECT::GetFromBRHC ( float  w,
float  h 
) const
inline

Get a subrect of this IRECT expanding from the bottom-right corner.

Parameters
wWidth of the desired IRECT
hHeight of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1038 of file IGraphicsStructs.h.

Referenced by ICornerResizerControl::OnRescale().

IRECT IRECT::GetFromLeft ( float  amount) const
inline

Get a subrect of this IRECT bounded in X by the left edge and 'amount'.

Parameters
amountSize in X of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1053 of file IGraphicsStructs.h.

Referenced by IVRadioButtonControl::DrawWidget().

IRECT IRECT::GetFromRight ( float  amount) const
inline

Get a subrect of this IRECT bounded in X by 'amount' and the right edge.

Parameters
amountSize in X of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1058 of file IGraphicsStructs.h.

Referenced by IVRadioButtonControl::DrawWidget(), and TestDirBrowseControl::OnResize().

IRECT IRECT::GetFromTLHC ( float  w,
float  h 
) const
inline

Get a subrect of this IRECT expanding from the top-left corner.

Parameters
wWidth of the desired IRECT
hWeight of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1020 of file IGraphicsStructs.h.

IRECT IRECT::GetFromTop ( float  amount) const
inline

Get a subrect of this IRECT bounded in Y by the top edge and 'amount'.

Parameters
amountSize in Y of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1043 of file IGraphicsStructs.h.

Referenced by TestFontControl::Draw(), and IVectorBase::MakeRects().

IRECT IRECT::GetFromTRHC ( float  w,
float  h 
) const
inline

Get a subrect of this IRECT expanding from the top-right corner.

Parameters
wWidth of the desired IRECT
hHeight of the desired IRECT
Returns
IRECT The resulting subrect

Definition at line 1032 of file IGraphicsStructs.h.

IRECT IRECT::GetGridCell ( int  row,
int  col,
int  nRows,
int  nColumns 
) const
inline

Get a subrect (by row, column) of this IRECT which is a cell in a grid of size (nRows * nColumns)

Parameters
rowRow index of the desired subrect
colColumn index of the desired subrect
nRowsNumber of rows in the cell grid
nColumnsNumber of columns in the cell grid
Returns
IRECT The resulting subrect

Definition at line 1106 of file IGraphicsStructs.h.

References SubRectHorizontal().

Referenced by TestBlendControl::Draw(), IVLEDMeterControl< MAXNC >::Draw(), and IVColorSwatchControl::OnResize().

IRECT IRECT::GetGridCell ( int  cellIndex,
int  nRows,
int  nColumns,
EDirection  dir = EDirection::Horizontal,
int  nCells = 1 
) const
inline

Get a subrect (by index) of this IRECT which is a cell (or union of nCells sequential cells on same row/column) in a grid of size (nRows * nColumns)

Parameters
cellIndexIndex of the desired cell in the cell grid
nRowsNumber of rows in the cell grid
nColumnsNumber of columns in the cell grid
dirDesired direction of indexing, by row (EDirection::Horizontal) or by column (EDirection::Vertical)
nCellsNumber of desired sequential cells to join (on same row/column)
Returns
IRECT The resulting subrect

Definition at line 1121 of file IGraphicsStructs.h.

References SubRectHorizontal(), SubRectVertical(), and Union().

IRECT IRECT::GetHAlignedTo ( const IRECT sr,
EAlign  align 
) const
inline

Get a rectangle the same dimensions as this one, horizontally aligned to the reference IRECT.

Parameters
srthe IRECT to use as reference
alignthe horizontal alignment
Returns
the new rectangle

Definition at line 1681 of file IGraphicsStructs.h.

References HAlignTo().

IRECT IRECT::GetHPadded ( float  padding) const
inline

Get a copy of this IRECT padded in the X-axis N.B.

Using a positive padding value will expand the IRECT, a negative value will contract it

Parameters
paddingLeft and right padding
Returns
IRECT the new rectangle

Definition at line 1359 of file IGraphicsStructs.h.

Referenced by IVSliderControl::Draw(), and IPopupMenuControl::DrawCellBackground().

IRECT IRECT::GetHShifted ( float  x) const
inline

Get a copy of this rectangle translated on the X axis.

Parameters
xOffset
Returns
IRECT the new rectangle

Definition at line 1568 of file IGraphicsStructs.h.

IRECT IRECT::GetHSliced ( float  w,
bool  rhs = false 
) const
inline

Get a copy of this IRECT with a new width.

Parameters
wWidth of the new rectangle
rhsIf true the new rectangle will expand from the right side, otherwise it will expand from the left
Returns
IRECT the new rectangle

Definition at line 1393 of file IGraphicsStructs.h.

float IRECT::GetLengthOfShortestSide ( ) const
inline
Returns
float Either the width or the height of the rectangle, whichever is less

Definition at line 1669 of file IGraphicsStructs.h.

References IBitmap::H(), and IBitmap::W().

IRECT IRECT::GetMidHPadded ( float  padding) const
inline

Get a copy of this IRECT where its width = 2 * padding but the center point on the X-axis has not changed.

Parameters
paddingLeft and right padding (1/2 the new width)
Returns
IRECT the new rectangle

Definition at line 1376 of file IGraphicsStructs.h.

Referenced by IVRangeSliderControl::Draw(), IVSliderControl::OnResize(), and IBSliderControl::OnResize().

IRECT IRECT::GetMidVPadded ( float  padding) const
inline

Get a copy of this IRECT where its height = 2 * padding but the center point on the Y-axis has not changed.

Parameters
paddingTop and bottom padding (1/2 the new height)
Returns
IRECT the new rectangle

Definition at line 1384 of file IGraphicsStructs.h.

Referenced by IVRangeSliderControl::Draw(), IWheelControl::Draw(), IVectorBase::MakeRects(), IVSliderControl::OnResize(), and IBSliderControl::OnResize().

IRECT IRECT::GetOffset ( float  l,
float  t,
float  r,
float  b 
) const
inline

Get a copy of this rectangle where each field is offset by a specified amount.

Parameters
lLeft offset
tTop offset
rRight offset
bBottom offset
Returns
IRECT the new rectangle

Definition at line 1540 of file IGraphicsStructs.h.

IRECT IRECT::GetPadded ( float  padding) const
inline
IRECT IRECT::GetPadded ( float  padL,
float  padT,
float  padR,
float  padB 
) const
inline

Get a copy of this IRECT with the values padded N.B.

Using a positive padding value will expand the IRECT, a negative value will contract it

Parameters
padLLeft-padding
padTTop-padding
padRRight-padding
padBBottom-padding
Returns
IRECT the new rectangle

Definition at line 1350 of file IGraphicsStructs.h.

IRECT IRECT::GetPixelAligned ( ) const
inline

Get a copy of this IRECT with PixelAlign() called.

Returns
IRECT the new rectangle

Definition at line 1218 of file IGraphicsStructs.h.

References PixelAlign().

Referenced by IGraphics::BeginFrame(), and IGraphics::StartLayer().

IRECT IRECT::GetPixelAligned ( float  scale) const
inline

Get a copy of this IRECT with PixelAlign(scale) called.

Parameters
scaleScaling factor for the alignment
Returns
IRECT the new rectangle

Definition at line 1228 of file IGraphicsStructs.h.

References PixelAlign().

IRECT IRECT::GetPixelSnapped ( ) const
inline
Returns
IRECT A copy of this IRECT with PixelSnap() called

Definition at line 1256 of file IGraphicsStructs.h.

References PixelSnap().

Referenced by IGraphics::GetPixelSnapped().

IRECT IRECT::GetPixelSnapped ( float  scale) const
inline

Get a copy of this IRECT with PixelSnap(scale) called.

Parameters
Scalingfactor for the alignment
Returns
IRECT the new rectangle

Definition at line 1266 of file IGraphicsStructs.h.

References PixelSnap().

void IRECT::GetRandomPoint ( float &  x,
float &  y 
) const
inline

Get a random point within this rectangle.

Parameters
xOUT output X value of point
yOUT output Y value of point

Definition at line 1501 of file IGraphicsStructs.h.

References IBitmap::H(), and IBitmap::W().

Referenced by GetRandomSubRect().

IRECT IRECT::GetRandomSubRect ( ) const
inline
Returns
IRECT A random rectangle inside this IRECT

Definition at line 1511 of file IGraphicsStructs.h.

References GetRandomPoint().

Referenced by TestAnimationControl::OnMouseDown().

IRECT IRECT::GetReducedFromBottom ( float  amount) const
inline

Get a subrect of this IRECT reduced in height from the bottom edge by 'amount'.

Parameters
amountSize in Y to reduce by
Returns
IRECT The resulting subrect

Definition at line 1068 of file IGraphicsStructs.h.

Referenced by IVectorBase::MakeRects().

IRECT IRECT::GetReducedFromLeft ( float  amount) const
inline

Get a subrect of this IRECT reduced in width from the left edge by 'amount'.

Parameters
amountSize in X to reduce by
Returns
IRECT The resulting subrect

Definition at line 1073 of file IGraphicsStructs.h.

IRECT IRECT::GetReducedFromRight ( float  amount) const
inline

Get a subrect of this IRECT reduced in width from the right edge by 'amount'.

Parameters
amountSize in X to reduce by
Returns
IRECT The resulting subrect

Definition at line 1078 of file IGraphicsStructs.h.

IRECT IRECT::GetReducedFromTop ( float  amount) const
inline

Get a subrect of this IRECT reduced in height from the top edge by 'amount'.

Parameters
amountSize in Y to reduce by
Returns
IRECT The resulting subrect

Definition at line 1063 of file IGraphicsStructs.h.

Referenced by IVectorBase::MakeRects().

IRECT IRECT::GetScaled ( float  scale) const
inline

Get a copy of this IRECT with all values multiplied by scale.

Parameters
scaleThe amount to multiply each value by
Returns
IRECT the resulting rectangle

Definition at line 1466 of file IGraphicsStructs.h.

References Scale().

IRECT IRECT::GetScaledAboutCentre ( float  scale) const
inline

Get a copy of this IRECT where the width and height are multiplied by scale without changing the center point.

Parameters
scaleScaling factor
Returns
IRECT the resulting rectangle

Definition at line 1476 of file IGraphicsStructs.h.

References ScaleAboutCentre().

Referenced by ILEDControl::Draw(), and IVectorBase::MakeRects().

IRECT IRECT::GetTranslated ( float  x,
float  y 
) const
inline

Get a translated copy of this rectangle.

Parameters
xOffset in the X axis
yOffset in the Y axis
Returns
IRECT the new rectangle

Definition at line 1560 of file IGraphicsStructs.h.

Referenced by IVLabelControl::Draw(), IWheelControl::Draw(), PlaceHolder::Draw(), IGraphicsSkia::DrawFastDropShadow(), IVectorBase::DrawPressableEllipse(), IVectorBase::DrawPressableRectangle(), IVectorBase::DrawPressableTriangle(), and IRECTList::GetFracGrid().

IRECT IRECT::GetVAlignedTo ( const IRECT sr,
EVAlign  align 
) const
inline

Get a rectangle the same dimensions as this one, vertically aligned to the reference IRECT.

Parameters
srthe source IRECT to use as reference
alignthe vertical alignment
Returns
the new rectangle

Definition at line 1661 of file IGraphicsStructs.h.

References VAlignTo().

IRECT IRECT::GetVPadded ( float  padding) const
inline

Get a copy of this IRECT padded in the Y-axis N.B.

Using a positive padding value will expand the IRECT, a negative value will contract it

Parameters
paddingTop and bottom padding
Returns
IRECT the new rectangle

Definition at line 1368 of file IGraphicsStructs.h.

Referenced by ITextEntryControl::Draw(), IVSliderControl::Draw(), IVPlotControl::Draw(), and IVGroupControl::OnResize().

IRECT IRECT::GetVShifted ( float  y) const
inline

Get a copy of this rectangle translated on the Y axis.

Parameters
yOffset
Returns
IRECT the new rectangle

Definition at line 1576 of file IGraphicsStructs.h.

IRECT IRECT::GetVSliced ( float  h,
bool  bot = false 
) const
inline

Get a copy of this IRECT with a new height.

Parameters
hHeight of the new rectangle
botIf true the new rectangle will expand from the bottom, otherwise it will expand from the top
Returns
IRECT the new rectangle

Definition at line 1405 of file IGraphicsStructs.h.

float IRECT::H ( ) const
inline
Returns
float the height of this IRECT

Definition at line 825 of file IGraphicsStructs.h.

Referenced by IGraphics::BeginFrame(), IPopupMenuControl::CreatePopupMenu(), IGraphicsCanvas::DoDrawText(), TestDrawContextControl::Draw(), TestLayerControl::Draw(), TestShadowGradientControl::Draw(), TestGradientControl::Draw(), TestMultiPathControl::Draw(), IColorPickerControl::Draw(), ISkLottieControl::Draw(), IFPSDisplayControl::Draw(), IVLEDMeterControl< MAXNC >::Draw(), IVKeyboardControl::Draw(), IVPlotControl::Draw(), ISVGKnobControl::Draw(), IWheelControl::Draw(), IURLControl::Draw(), IVTrackControlBase::DrawBackground(), IGraphicsCanvas::DrawBitmap(), IGraphicsNanoVG::DrawBitmap(), IGraphics::DrawBitmapedText(), IPopupMenuControl::DrawCalloutArrow(), IGraphics::DrawData(), IGraphicsNanoVG::DrawDottedRect(), IPopupMenuControl::DrawDownArrow(), IGraphicsNanoVG::DrawFastDropShadow(), IGraphics::DrawFittedBitmap(), IGraphics::DrawFittedLayer(), IVectorBase::DrawPressableTriangle(), IPopupMenuControl::DrawSubMenuArrow(), IPopupMenuControl::DrawSubMenuCalloutArrow(), IGraphics::DrawSVG(), IPopupMenuControl::DrawUpArrow(), IVScopeControl< MAXNC, MAXBUF >::DrawWidget(), IVDisplayControl::DrawWidget(), IVKnobControl::DrawWidget(), IVXYPadControl::DrawWidget(), GetCentredInside(), IRECTList::GetFracGrid(), IVKnobControl::GetKnobDragBounds(), IVectorBase::GetRoundedCornerRadius(), IFlexBox::Init(), IGraphicsNanoVG::LoadAPIFont(), IVectorBase::MakeRects(), IWebViewControl::OnAttached(), ITextEntryControl::OnKeyDown(), ICornerResizerControl::OnMouseDblClick(), IShaderControl::OnMouseDown(), IVMultiSliderControl< MAXNC >::OnMouseDown(), IShaderControl::OnMouseDrag(), IGraphicsLiveEdit::OnMouseDrag(), IVXYPadControl::OnMouseDrag(), IShaderControl::OnMouseUp(), IWebViewControl::OnRescale(), TestSizeControl::OnResize(), IWebViewControl::OnResize(), IShaderControl::OnResize(), IVGroupControl::OnResize(), ISVGSliderControl::OnResize(), PlaceHolder::OnResize(), IGraphics::PathEllipse(), IGraphics::PathRoundRect(), ITextControl::SetBoundsBasedOnStr(), IControl::SetPosition(), IBubbleControl::SetStrokeColor(), IVMultiSliderControl< MAXNC >::SnapToMouse(), IControl::SnapToMouse(), IGraphics::StartLayer(), IMatrix::Transform(), and VAlignTo().

void IRECT::HAlignTo ( const IRECT sr,
EAlign  align 
)
inline

Horizontally align this rect to the reference IRECT.

Parameters
srthe IRECT to use as reference
alignthe horizontal alignment

Definition at line 1646 of file IGraphicsStructs.h.

References L, R, IBitmap::W(), and W().

Referenced by GetHAlignedTo().

void IRECT::HPad ( float  padding)
inline

Pad this IRECT in the X-axis N.B.

Using a positive padding value will expand the IRECT, a negative value will contract it

Parameters
paddingLeft and right padding

Definition at line 1301 of file IGraphicsStructs.h.

Referenced by IPopupMenuControl::CreatePopupMenu(), IVGroupControl::OnResize(), and IBubbleControl::SetStrokeColor().

IRECT IRECT::Inset ( const IRECT rhs) const
inline

Offsets the input IRECT based on the parent.

Parameters
rhsIRECT to offset

Definition at line 912 of file IGraphicsStructs.h.

References B, L, R, and T.

Referenced by TestFlexBoxControl::OnResize().

IRECT IRECT::Intersect ( const IRECT rhs) const
inline

Create a new IRECT that is the intersection of this IRECT and rhs.

The resulting IRECT will have the maximum L and T values and minimum R and B values of the inputs.

Parameters
rhsanother IRECT
Returns
IRECT the new IRECT

Definition at line 851 of file IGraphicsStructs.h.

References B, L, R, and T.

Referenced by IGraphics::BeginFrame(), IRECTList::GetFracGrid(), IRECTList::Optimize(), and IGraphics::PathClipRegion().

bool IRECT::Intersects ( const IRECT rhs) const
inline

Returns true if this IRECT shares any common pixels with rhs, false otherwise.

Parameters
rhsanother IRECT
Returns
true this IRECT shares any common space with rhs
false this IRECT and rhs are completely separate

Definition at line 863 of file IGraphicsStructs.h.

References B, Empty(), L, R, and T.

bool IRECT::IsPixelAligned ( ) const
inline
Returns
true If all the values of this IRECT are within 1/1000th of being an integer

Definition at line 1176 of file IGraphicsStructs.h.

Referenced by IsPixelAligned().

bool IRECT::IsPixelAligned ( float  scale) const
inline

Return true if, when scaled by scale, this IRECT is pixel aligned When scaling this mutliples each value of the IRECT, it does not scale from the center.

Parameters
scaleScale value for the test
Returns
true The scaled IRECT is pixel-aligned

Definition at line 1189 of file IGraphicsStructs.h.

References IsPixelAligned(), and Scale().

static IRECT IRECT::LinearInterpolateBetween ( const IRECT start,
const IRECT dest,
float  progress 
)
inlinestatic

Get a rectangle that is a linear interpolation between start and dest

Parameters
startStarting rectangle
destEnding rectangle
progressInterpolation point
Returns
IRECT the new rectangle

Definition at line 1488 of file IGraphicsStructs.h.

References B, L, R, and T.

Referenced by IVToggleControl::DrawValue().

static IRECT IRECT::MakeXYWH ( float  l,
float  t,
float  w,
float  h 
)
inlinestatic

Create a new IRECT with the given position and size.

Parameters
lLeft/X of new IRECT
tTop/Y of new IRECT
wWidth of new IRECT
hHeight of new IRECT
Returns
the new IRECT

Definition at line 794 of file IGraphicsStructs.h.

Referenced by IBSwitchControl::OnMouseDown().

bool IRECT::Mergeable ( const IRECT rhs) const
inline

Return if this IRECT and rhs may be merged.

The two rects cover exactly the area returned by Union()

Parameters
rhsanother IRECT
Returns
true this IRECT wholly contains rhs or rhs wholly contains this IRECT
false any part of these IRECTs does not overlap

Definition at line 922 of file IGraphicsStructs.h.

References B, Empty(), L, R, and T.

float IRECT::MH ( ) const
inline
void IRECT::MidHPad ( float  padding)
inline

Set the width of this IRECT to 2*padding without changing it's center point on the X-axis.

Parameters
paddingLeft and right padding (1/2 the new width)

Definition at line 1318 of file IGraphicsStructs.h.

void IRECT::MidVPad ( float  padding)
inline

Set the height of this IRECT to 2*padding without changing it's center point on the Y-axis.

Parameters
paddingTop and bottom padding (1/2 the new height)

Definition at line 1327 of file IGraphicsStructs.h.

float IRECT::MW ( ) const
inline
void IRECT::Offset ( float  l,
float  t,
float  r,
float  b 
)
inline

Offset each field of the rectangle.

Parameters
lLeft offset
tTop offset
rRight offset
bBottom offset

Definition at line 1526 of file IGraphicsStructs.h.

Referenced by IVectorBase::GetAdjustedHandleBounds(), and IVGroupControl::OnResize().

void IRECT::Pad ( float  padding)
inline

Pad this IRECT N.B.

Using a positive padding value will expand the IRECT, a negative value will contract it

Parameters
paddingPadding amount

Definition at line 1276 of file IGraphicsStructs.h.

Referenced by IPopupMenuControl::CreatePopupMenu(), GFXLabelControl::Draw(), IVectorBase::GetAdjustedHandleBounds(), IVNumberBoxControl::OnAttached(), IVNumberBoxControl::OnResize(), and IBubbleControl::SetStrokeColor().

void IRECT::Pad ( float  padL,
float  padT,
float  padR,
float  padB 
)
inline

Pad this IRECT N.B.

Using a positive padding value will expand the IRECT, a negative value will contract it

Parameters
padLLeft-padding
padTTop-padding
padRRight-padding
padBBottom-padding

Definition at line 1290 of file IGraphicsStructs.h.

void IRECT::PixelAlign ( float  scale)
inline

Pixel-align this IRECT at the given scale factor then scale it back down When scaling this mutliples each value of the IRECT, it does not scale from the center.

Parameters
scaleScale value for the alignment

Definition at line 1208 of file IGraphicsStructs.h.

void IRECT::PixelSnap ( )
inline

Pixel aligns to nearest pixels This may make the IRECT smaller, unlike PixelAlign().

Definition at line 1237 of file IGraphicsStructs.h.

Referenced by GetPixelSnapped().

void IRECT::PixelSnap ( float  scale)
inline

Pixel align a scaled version of this IRECT.

Parameters
scaleScaling factor for the alignment

Definition at line 1247 of file IGraphicsStructs.h.

IRECT IRECT::ReduceFromBottom ( float  amount)
inline

Reduce in height from the bottom edge by 'amount' and return the removed region.

Parameters
amountSize in Y to reduce by
Returns
IRECT The removed subrect

Definition at line 1088 of file IGraphicsStructs.h.

Referenced by IVectorBase::DrawPressableEllipse(), and IVectorBase::DrawPressableRectangle().

IRECT IRECT::ReduceFromLeft ( float  amount)
inline

Reduce in width from the left edge by 'amount' and return the removed region.

Parameters
amountSize in X to reduce by
Returns
IRECT The removed subrect

Definition at line 1093 of file IGraphicsStructs.h.

Referenced by IVBakedPresetManagerControl::OnAttached(), IVNumberBoxControl::OnAttached(), IVDiskPresetManagerControl::OnAttached(), and IVNumberBoxControl::OnResize().

IRECT IRECT::ReduceFromRight ( float  amount)
inline

Reduce in width from the right edge by 'amount' and return the removed region.

Parameters
amountSize in X to reduce by
Returns
IRECT The removed subrect

Definition at line 1098 of file IGraphicsStructs.h.

Referenced by IVectorBase::DrawPressableEllipse(), IVectorBase::DrawPressableRectangle(), and IVDiskPresetManagerControl::OnAttached().

IRECT IRECT::ReduceFromTop ( float  amount)
inline

Reduce in height from the top edge by 'amount' and return the removed region.

Parameters
amountSize in Y to reduce by
Returns
IRECT The removed subrect

Definition at line 1083 of file IGraphicsStructs.h.

void IRECT::Scale ( float  scale)
inline

Multiply each field of this IRECT by scale.

Parameters
scaleThe amount to multiply each field by

Definition at line 1441 of file IGraphicsStructs.h.

Referenced by IGraphicsCanvas::DrawBitmap(), GetScaled(), and IsPixelAligned().

void IRECT::ScaleAboutCentre ( float  scale)
inline

Scale the width and height of this IRECT by scale without changing the center point.

Parameters
scaleThe scaling factor

Definition at line 1451 of file IGraphicsStructs.h.

References IBitmap::H(), and IBitmap::W().

Referenced by GetScaledAboutCentre().

IRECT IRECT::SubRect ( EDirection  layoutDir,
int  numSlices,
int  sliceIdx 
) const
inline

Get a new rectangle which is a "slice" of this rectangle.

Parameters
layoutDirEDirection::Vertical or EDirection::Horizontal
numSlicesNumber of equal-sized parts to divide this IRECT into
sliceIdxWhich "slice" to return
Returns
IRECT the new rectangle

Definition at line 1008 of file IGraphicsStructs.h.

Referenced by IVTrackControlBase::DrawTrackHandle(), IVToggleControl::DrawValue(), and IVTabSwitchControl::OnResize().

IRECT IRECT::SubRectHorizontal ( int  numSlices,
int  sliceIdx 
) const
inline

Returns a new IRECT which is a vertical "slice" of this IRECT.

First divide the current width into numSlices equal parts, then return the n'th "slice" where "n" is sliceIdx. The returned IRECT will have the same height as this IRECT.

Parameters
numSlicesnumber of equal-sized parts to divide this IRECT into
sliceIdxwhich "slice" to select
Returns
IRECT the new IRECT

Definition at line 995 of file IGraphicsStructs.h.

References IBitmap::W().

Referenced by GetGridCell().

IRECT IRECT::SubRectVertical ( int  numSlices,
int  sliceIdx 
) const
inline

Returns a new IRECT which is a horizontal "slice" of this IRECT.

First divide the current height into numSlices equal parts, then return the n'th "slice" where "n" is sliceIdx. The returned IRECT will have the same width as this IRECT.

Parameters
numSlicesnumber of equal-sized parts to divide this IRECT into
sliceIdxwhich "slice" to select
Returns
IRECT the new IRECT

Definition at line 980 of file IGraphicsStructs.h.

References IBitmap::H().

Referenced by GetGridCell().

void IRECT::Translate ( float  x,
float  y 
)
inline

Translate this rectangle.

Parameters
xOffset in the X axis
yOffset in the Y axis

Definition at line 1548 of file IGraphicsStructs.h.

Referenced by IGraphics::DoMeasureTextRotation(), IBSliderControl::Draw(), IVGroupControl::OnResize(), and IBubbleControl::SetStrokeColor().

IRECT IRECT::Union ( const IRECT rhs) const
inline

Create a new IRECT that is a union of this IRECT and rhs.

The resulting IRECT will have the minimim L and T values and maximum R and B values of the inputs.

Parameters
rhsanother IRECT
Returns
IRECT the new IRECT

Definition at line 840 of file IGraphicsStructs.h.

References B, Empty(), L, R, and T.

Referenced by IRECTList::Bounds(), IPopupMenuControl::CalculateMenuPanels(), IGraphics::CalculateTextRotation(), IPopupMenuControl::CreatePopupMenu(), GetGridCell(), IVGroupControl::OnResize(), and IBubbleControl::SetStrokeColor().

void IRECT::VAlignTo ( const IRECT sr,
EVAlign  align 
)
inline

Vertically align this rect to the reference IRECT.

Parameters
srthe source IRECT to use as reference
alignthe vertical alignment

Definition at line 1632 of file IGraphicsStructs.h.

References B, IBitmap::H(), H(), and T.

Referenced by GetVAlignedTo().

void IRECT::VPad ( float  padding)
inline

Pad this IRECT in the Y-axis N.B.

Using a positive padding value will expand the IRECT, a negative value will contract it

Parameters
paddingTop and bottom padding

Definition at line 1310 of file IGraphicsStructs.h.

float IRECT::W ( ) const
inline
Returns
float the width of this IRECT

Definition at line 822 of file IGraphicsStructs.h.

Referenced by IGraphics::BeginFrame(), IPopupMenuControl::CalculateMenuPanels(), IPopupMenuControl::CreatePopupMenu(), IGraphicsCanvas::DoDrawText(), IGraphicsCanvas::DoMeasureText(), IGraphicsSkia::DoMeasureText(), IGraphicsNanoVG::DoMeasureText(), TestMaskControl::Draw(), TestDrawContextControl::Draw(), TestLayerControl::Draw(), TestPolyControl::Draw(), TestShadowGradientControl::Draw(), TestMultiPathControl::Draw(), TestArcControl::Draw(), TestFontControl::Draw(), IColorPickerControl::Draw(), ILEDControl::Draw(), ISkLottieControl::Draw(), IFPSDisplayControl::Draw(), IVLEDMeterControl< MAXNC >::Draw(), IVKeyboardControl::Draw(), IVPlotControl::Draw(), ISVGKnobControl::Draw(), IWheelControl::Draw(), IURLControl::Draw(), ICaptionControl::Draw(), IVTrackControlBase::DrawBackground(), IGraphicsCanvas::DrawBitmap(), IGraphicsNanoVG::DrawBitmap(), IGraphics::DrawBitmapedText(), IGraphics::DrawData(), IGraphicsNanoVG::DrawDottedRect(), IGraphicsNanoVG::DrawFastDropShadow(), IGraphics::DrawFittedBitmap(), IGraphics::DrawFittedLayer(), IVectorBase::DrawPressableTriangle(), IGraphics::DrawSVG(), IVScopeControl< MAXNC, MAXBUF >::DrawWidget(), IVDisplayControl::DrawWidget(), IVRadioButtonControl::DrawWidget(), IVKnobControl::DrawWidget(), IVXYPadControl::DrawWidget(), GetCentredInside(), IRECTList::GetFracGrid(), IVKnobControl::GetKnobDragBounds(), IVectorBase::GetRoundedCornerRadius(), HAlignTo(), IFlexBox::Init(), IGraphicsNanoVG::LoadAPIFont(), IVectorBase::MakeRects(), IWebViewControl::OnAttached(), IVNumberBoxControl::OnAttached(), ICornerResizerControl::OnMouseDblClick(), IShaderControl::OnMouseDown(), IShaderControl::OnMouseDrag(), IGraphicsLiveEdit::OnMouseDrag(), IVXYPadControl::OnMouseDrag(), IShaderControl::OnMouseUp(), IWebViewControl::OnRescale(), TestDirBrowseControl::OnResize(), TestSizeControl::OnResize(), TestGradientControl::OnResize(), IVNumberBoxControl::OnResize(), IWebViewControl::OnResize(), IShaderControl::OnResize(), IVKeyboardControl::OnResize(), ISVGSliderControl::OnResize(), PlaceHolder::OnResize(), IGraphics::PathEllipse(), IGraphics::PathRoundRect(), ITextControl::SetBoundsBasedOnStr(), IControl::SetPosition(), IBubbleControl::SetStrokeColor(), IVMultiSliderControl< MAXNC >::SnapToMouse(), IControl::SnapToMouse(), IGraphics::StartLayer(), and IMatrix::Transform().


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