Base Module  VST 3.6.6
SDK for developing VST Plug-in
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Data Fields
Rect Class Reference

Rectangle Class. More...

#include <frect.h>

Public Member Functions

 Rect ()
 create empty rectangle with coordinates set to zero More...
 
 Rect (UCoord left, UCoord top, UCoord right, UCoord bottom)
 create rectangle with four individual coordinates More...
 
 Rect (UCoord w, UCoord h)
 create rectangle with zero left/top coordinates and right/bottom coordinates according to the given width and height More...
 
 Rect (const Point &topLeft, const Point &bottomRight)
 create rectangle defined by a top/left Point and a bottom/right Point More...
 
 Rect (const Point &topLeft, UCoord width, UCoord height)
 create rectangle defined by a top/left Point and the given width and height More...
 
 Rect (const ViewRect &vr)
 create rectangle defined by a ViewRect More...
 
UCoord getWidth () const
 return width of rectangle (right coordinate - left coordinate) More...
 
UCoord getHeight () const
 return height of rectangle (bottom coordinate - top coordinate) More...
 
RectsetWidth (const UCoord w)
 set width by setting the right coordinate with respect to the left More...
 
RectsetHeight (const UCoord h)
 set height by setting the bottom coordinate with respect to the top More...
 
void setEmpty ()
 resets coordinates to all zero - now isEmpty returns true More...
 
Point getTopLeft () const
 get top/left as Point More...
 
PointgetTopLeft (Point &) const
 get top/left as Point More...
 
Point getBottomRight () const
 get bottom/right as Point More...
 
PointgetBottomRight (Point &) const
 get bottom/right as Point More...
 
Point getTopRight () const
 get top/right as Point More...
 
PointgetTopRight (Point &) const
 get top/right as Point More...
 
Point getBottomLeft () const
 get bottom/left as Point More...
 
PointgetBottomLeft (Point &) const
 get bottom/left as Point More...
 
PointtoPoint (Direction dir, Point &p) const
 convert rectangle to a point More...
 
Point toPoint (Direction dir) const
 convert rectangle to a point More...
 
RectsetTopLeft (const UCoord left, const UCoord top)
 set top/left from coordinates More...
 
RectsetBottomRight (const UCoord right, const UCoord bottom)
 set bottom/right from coordinates More...
 
RectsetSize (const UCoord w, const UCoord h)
 set size by setting bottom/right with respect to left/top More...
 
Rectoperator() (UCoord left, UCoord top, UCoord right, UCoord bottom)
 set left/top/right/bottom from four individual coordinates More...
 
Rectoperator() (const Point &topLeft, const Point &bottomRight)
 set left/top/right/bottom from top/left Point and bottom/right Point More...
 
void set (UCoord left, UCoord top, UCoord right, UCoord bottom)
 return height of rectangle (bottom coordinate - top coordinate) More...
 
RectmoveTo (const Point &where)
 move rectangle to a new top/left point while maintaining width and height More...
 
Rectoffset (UCoord x, UCoord y=0)
 offset rectangle by x/y coordinates maintaining width and height More...
 
Rectoffset (const Point &where)
 offset rectangle by a x/y Point maintaining width and height More...
 
Rectinset (UCoord delta)
 inset top/left and bottom/right by equal amounts to change rectangle size More...
 
Rectinset (UCoord deltaH, UCoord deltaV)
 inset left/right by an equal amount similarly, inset top/bottom by an equal amount, to change rectangle size More...
 
Rectinset (UCoord deltaL, UCoord deltaT, UCoord deltaR, UCoord deltaB)
 inset left/top/right/bottom each by a separate amount to change the rectangle size More...
 
Rectoriginize ()
 move rectangle so the left/top coordinate are zero while maintaining the width and height More...
 
Rectnormalize ()
 flips left/right and top/bottom values if value pairs are such that right<left or bottom<top coordinates More...
 
Rectcenter (const Rect &rect)
 centers this with respect to rect More...
 
RectcenterH (const Rect &rect)
 centers this with respect to rect More...
 
RectcenterV (const Rect &rect)
 centers this with respect to rect More...
 
bool bound (const Rect &rect)
 set this to the intersection of this and rect; returns false if intersection is empty More...
 
bool slideInside (const Rect &rect)
 fit this inside the larger rect. if not possible return false. More...
 
bool join (const Rect &rect)
 set this to the union of this and rect More...
 
bool joinEvenIfEmpty (const Rect &rect)
 set this to the union of this and rect and do not skip if both rect areas are 'empty' More...
 
bool subtract (const Rect &rect)
 trim this by the rect given More...
 
bool isEmpty () const
 
bool rectInside (const Rect &rect) const
 checks if rect is enclosed by this More...
 
bool rectIntersect (const Rect &rect) const
 checks if rect touches this More...
 
bool rectIntersect (const Rect &rect, Rect &result) const
 checks if rect touches this: if true intersection is in result More...
 
Point getCenter () const
 get point in the middle of the rect (might not be precise for even sized rects) More...
 
Point getLeftCenter () const
 
Point getRightCenter () const
 
Point getTopCenter () const
 
Point getBottomCenter () const
 
bool overlapHorizontal (const Rect &rect) const
 checks if the horizontal coord ranges overlap More...
 
bool overlapVertical (const Rect &rect) const
 checks if the vertical coord ranges overlap More...
 
UCoord getOverlapHorizontal (const Rect &rect) const
 get horizontal overlapping area, returns 0 if not overlapping More...
 
UCoord getOverlapVertical (const Rect &rect) const
 get vertical overlapping area, returns 0 if not overlapping More...
 
bool pointInside (const Point &where) const
 checks if point is inside this rect More...
 
Pointconstrain (Point &p) const
 constrains the point such that is lies within this rect More...
 
bool lineInside (const Point &p1, const Point &p2) const
 is line inside rect ? More...
 
bool lineIntersect (const Point &p1, const Point &p2) const
 is line intersecting rect? More...
 
bool boundLine (Point &p1, Point &p2) const
 bound line to rect, returns false if line does not intersect rect More...
 
Rectoperator+= (const Point &p)
 performs a 'offset' operation on this More...
 
Rectoperator+= (const Rect &rect)
 performs a 'join' operation on this More...
 
ViewRect & toViewRect (ViewRect &vr) const
 sets the ViewRect coordinates to the current coordinates of this More...
 
void fromViewRect (const ViewRect &vr)
 sets the current coordinates of this to the ViewRect coordinates More...
 
Rectoperator= (const ViewRect &vr)
 performs a 'fromViewRect' operation More...
 
 operator ViewRect () const
 conversion operator to ViewRect More...
 

Data Fields

UCoord left
 
UCoord top
 
UCoord right
 
UCoord bottom
 

Detailed Description

Rectangle Class.

See also
Point, UCoord

Constructor & Destructor Documentation

Rect ( )
inline

create empty rectangle with coordinates set to zero

Create empty rectangle with coordinates set to zero.

Rect ( UCoord  left,
UCoord  top,
UCoord  right,
UCoord  bottom 
)
inline

create rectangle with four individual coordinates

Create rectangle with four individual coordinates.

Rect ( UCoord  w,
UCoord  h 
)
inline

create rectangle with zero left/top coordinates and right/bottom coordinates according to the given width and height

Create rectangle with zero left/top coordinates and right/bottom coordinates according to the given width and height.

Rect ( const Point topLeft,
const Point bottomRight 
)
inline

create rectangle defined by a top/left Point and a bottom/right Point

Create rectangle defined by a top/left Point and a bottom/right Point.

Rect ( const Point topLeft,
UCoord  width,
UCoord  height 
)
inline

create rectangle defined by a top/left Point and the given width and height

Create rectangle defined by a top/left Point and the given width and height.

Rect ( const ViewRect &  vr)

create rectangle defined by a ViewRect

Member Function Documentation

UCoord getWidth ( ) const
inline

return width of rectangle (right coordinate - left coordinate)

Return width of rectangle (right coordinate - left coordinate)

UCoord getHeight ( ) const
inline

return height of rectangle (bottom coordinate - top coordinate)

Return height of rectangle (bottom coordinate - top coordinate)

Rect & setWidth ( const UCoord  w)
inline

set width by setting the right coordinate with respect to the left

Set width by setting the right coordinate with respect to the left.

Rect & setHeight ( const UCoord  h)
inline

set height by setting the bottom coordinate with respect to the top

Set height by setting the bottom coordinate with respect to the top.

void setEmpty ( )
inline

resets coordinates to all zero - now isEmpty returns true

Resets coordinates to all zero - now isEmpty returns true.

Point getTopLeft ( ) const
inline

get top/left as Point

Get top/left as Point.

Point & getTopLeft ( Point p) const
inline

get top/left as Point

Get top/left as Point.

Point getBottomRight ( ) const
inline

get bottom/right as Point

Get bottom/right as Point.

Point & getBottomRight ( Point p) const
inline

get bottom/right as Point

Get bottom/right as Point.

Point getTopRight ( ) const
inline

get top/right as Point

Get top/right as Point.

Point & getTopRight ( Point p) const
inline

get top/right as Point

Get top/right as Point.

Point getBottomLeft ( ) const
inline

get bottom/left as Point

Get bottom/left as Point.

Point & getBottomLeft ( Point p) const
inline

get bottom/left as Point

Get bottom/left as Point.

Point & toPoint ( Direction  dir,
Point p 
) const

convert rectangle to a point

Point toPoint ( Direction  dir) const
inline

convert rectangle to a point

Rect & setTopLeft ( const UCoord  left,
const UCoord  top 
)
inline

set top/left from coordinates

Set top/left from coordinates.

Rect & setBottomRight ( const UCoord  right,
const UCoord  bottom 
)
inline

set bottom/right from coordinates

Set bottom/right from coordinates.

Rect & setSize ( const UCoord  w,
const UCoord  h 
)
inline

set size by setting bottom/right with respect to left/top

Set size by setting bottom/right with respect to left/top.

Rect & operator() ( UCoord  left,
UCoord  top,
UCoord  right,
UCoord  bottom 
)
inline

set left/top/right/bottom from four individual coordinates

Set left/top/right/bottom from four individual coordinates.

Rect & operator() ( const Point topLeft,
const Point bottomRight 
)
inline

set left/top/right/bottom from top/left Point and bottom/right Point

Set left/top/right/bottom from top/left Point and bottom/right Point.

void set ( UCoord  left,
UCoord  top,
UCoord  right,
UCoord  bottom 
)
inline

return height of rectangle (bottom coordinate - top coordinate)

Return height of rectangle (bottom coordinate - top coordinate)

Rect & moveTo ( const Point where)

move rectangle to a new top/left point while maintaining width and height

Rect & offset ( UCoord  x,
UCoord  y = 0 
)
inline

offset rectangle by x/y coordinates maintaining width and height

Rect & offset ( const Point where)
inline

offset rectangle by a x/y Point maintaining width and height

Rect & inset ( UCoord  delta)

inset top/left and bottom/right by equal amounts to change rectangle size

Rect & inset ( UCoord  deltaH,
UCoord  deltaV 
)

inset left/right by an equal amount similarly, inset top/bottom by an equal amount, to change rectangle size

Rect & inset ( UCoord  deltaL,
UCoord  deltaT,
UCoord  deltaR,
UCoord  deltaB 
)

inset left/top/right/bottom each by a separate amount to change the rectangle size

Rect & originize ( )
inline

move rectangle so the left/top coordinate are zero while maintaining the width and height

Rect & normalize ( )
inline

flips left/right and top/bottom values if value pairs are such that right<left or bottom<top coordinates

Rect & center ( const Rect rect)

centers this with respect to rect

Rect & centerH ( const Rect rect)

centers this with respect to rect

Rect & centerV ( const Rect rect)

centers this with respect to rect

bool bound ( const Rect rect)
inline

set this to the intersection of this and rect; returns false if intersection is empty

Set this to the intersection of this and rect; returns false if intersection is empty.

bool slideInside ( const Rect rect)

fit this inside the larger rect. if not possible return false.

bool join ( const Rect rect)

set this to the union of this and rect

bool joinEvenIfEmpty ( const Rect rect)

set this to the union of this and rect and do not skip if both rect areas are 'empty'

bool subtract ( const Rect rect)

trim this by the rect given

bool isEmpty ( ) const
bool rectInside ( const Rect rect) const

checks if rect is enclosed by this

bool rectIntersect ( const Rect rect) const

checks if rect touches this

bool rectIntersect ( const Rect rect,
Rect result 
) const

checks if rect touches this: if true intersection is in result

Point getCenter ( ) const
inline

get point in the middle of the rect (might not be precise for even sized rects)

Point getLeftCenter ( ) const
inline
Point getRightCenter ( ) const
inline
Point getTopCenter ( ) const
inline
Point getBottomCenter ( ) const
inline
bool overlapHorizontal ( const Rect rect) const

checks if the horizontal coord ranges overlap

bool overlapVertical ( const Rect rect) const

checks if the vertical coord ranges overlap

UCoord getOverlapHorizontal ( const Rect rect) const

get horizontal overlapping area, returns 0 if not overlapping

UCoord getOverlapVertical ( const Rect rect) const

get vertical overlapping area, returns 0 if not overlapping

bool pointInside ( const Point where) const

checks if point is inside this rect

Point & constrain ( Point p) const

constrains the point such that is lies within this rect

bool lineInside ( const Point p1,
const Point p2 
) const

is line inside rect ?

bool lineIntersect ( const Point p1,
const Point p2 
) const

is line intersecting rect?

bool boundLine ( Point p1,
Point p2 
) const

bound line to rect, returns false if line does not intersect rect

Rect & operator+= ( const Point p)
inline

performs a 'offset' operation on this

Performs a 'offset' operation on this.

Rect & operator+= ( const Rect rect)
inline

performs a 'join' operation on this

Performs a 'join' operation on this.

ViewRect & toViewRect ( ViewRect &  vr) const

sets the ViewRect coordinates to the current coordinates of this

void fromViewRect ( const ViewRect &  vr)

sets the current coordinates of this to the ViewRect coordinates

Rect & operator= ( const ViewRect &  vr)

performs a 'fromViewRect' operation

operator ViewRect ( ) const

conversion operator to ViewRect

Field Documentation

UCoord left
UCoord top
UCoord right
UCoord bottom
Empty

Copyright ©2016 Steinberg Media Technologies GmbH. All Rights Reserved.