Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvRoundRect Class Reference

Geometric class. More...

#include <ilviews/base/geometry/IlvRoundRect.h>

Inheritance diagram for IlvRoundRect:
IlvRect

Public Member Functions

 IlvRoundRect (const IlvRect &rect, const RoundedRectRads &radiuses)
 Constructor 4. More...
 
 IlvRoundRect (const IlvRect &rect, IlvDim radius)
 Constructor 2. More...
 
 IlvRoundRect (const IlvRoundRect &roundRect)
 Copy constructor.
 
 IlvRoundRect (IlvPos x, IlvPos y, IlvDim w, IlvDim h, const RoundedRectRads &radiuses)
 Constructor 3. More...
 
 IlvRoundRect (IlvPos x=0, IlvPos y=0, IlvDim w=0, IlvDim h=0, IlvDim radius=0)
 Constructor 1. More...
 
const IlvRoundRectCornerbottomLeftCorner () const
 Retrieves the bottom-left corner. More...
 
const IlvRoundRectCornerbottomRightCorner () const
 Retrieves the bottom-right corner. More...
 
void expand (IlvPos delta)
 Uniformly expands the rectangle. More...
 
void expand (IlvPos dx, IlvPos dy)
 Expands the rectangle. More...
 
RoundedRectRads getRadiuses () const
 returns the radiuses in RoundedRectRads format. { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} }
 
void grow (IlvPos dw, IlvPos dh)
 Resizes the rectangle. More...
 
void grow (IlvPos dw, IlvPos dh, IlvPos dRadw, IlvPos dRadh)
 Resizes the rectangle. More...
 
virtual IlvBoolean isEvenlyRounded () const
 Indicates that all corner radiuses are equal. More...
 
virtual IlvBoolean isRounded () const
 Indicates that the rectangle is rounded. More...
 
void moveResize (IlvPos x, IlvPos y, IlvDim w, IlvDim h)
 Moves and resizes the rectangles. Corner radiuses are not modified, except if corner radiuses are too large for the new size. In this case they are reduced. More...
 
void resize (IlvDim w, IlvDim h)
 Resizes the rectangle. Corner radiuses are not modified, except if corner radiuses are too large for the new size. In this case they are reduced. More...
 
void scale (IlFloat sw, IlFloat sh)
 Resizes the rectangle. More...
 
void set (IlvPos x, IlvPos y, IlvDim w, IlvDim h)
 Moves and resizes the rectangles. If corner radiuses are too large for the new size, they are reduced. More...
 
void set (IlvPos x, IlvPos y, IlvDim w, IlvDim h, const RoundedRectRads &radiuses)
 Moves and resizes the rectangles. More...
 
void set (IlvPos x, IlvPos y, IlvDim w, IlvDim h, IlvDim radius)
 Moves and resizes the rectangles. More...
 
void setH (IlvDim newW)
 Sets the height. If corner radiuses are too large for the new size, they are reduced. More...
 
void setRadiuses (const RoundedRectRads &radiuses)
 Sets the width and height of the corners. If radius dimensions are too large for rectangle's width and height, the radiuses are proportionally scaled down. More...
 
void setRadiuses (IlvDim radius)
 Sets the width and height of the corners. The value will be set to both width and height of all corners, so that all the radiuses will have the same value. More...
 
void setW (IlvDim newW)
 Sets the width. If corner radiuses are too large for the new size, they are reduced. More...
 
const IlvRoundRectCornertopLeftCorner () const
 Retrieves the top-left corner. More...
 
const IlvRoundRectCornertopRightCorner () const
 Retrieves the top-right corner. More...
 
- Public Member Functions inherited from IlvRect
 IlvRect (IlvPos x=0, IlvPos y=0, IlvDim w=0, IlvDim h=0)
 Constructor. More...
 
IlvRectadd (const IlvPoint &point)
 Adds a point. More...
 
IlvRectadd (const IlvRect &rect)
 Adds a rectangle. More...
 
IlvPos bottom () const
 Retrieves the location of the bottom border. More...
 
IlvPoint center () const
 Retrieves to location of the center. More...
 
IlvPos centerx () const
 Retrieves the x coordinate of the center. More...
 
IlvPos centery () const
 Retrieves the y coordinate of the center. More...
 
IlBoolean contains (const IlvPoint &p) const
 Checks if a point is located in this rectangle. More...
 
IlBoolean contains (const IlvRect &rect) const
 Checks if a rectangle is located in this rectangle. More...
 
void expand (IlvPos delta)
 Uniformly expands the rectangle. More...
 
void expand (IlvPos dx, IlvPos dy)
 Expands the rectangle. More...
 
IlBoolean extends (const IlvRect &rect) const
 Checks if a given rectangle is a direct extension of this rectangle. More...
 
IlvDim getH () const
 Retrieves the height. More...
 
IlvDim getW () const
 Retrieves the width. More...
 
IlvPos getX () const
 Retrieves the x coordinate of the origin. More...
 
IlvPos getY () const
 Retrieves the y coordinate of the origin. More...
 
void grow (IlvPos dw, IlvPos dh)
 Resizes the rectangle. More...
 
IlBoolean inside (const IlvRect &rect) const
 Checks if a rectangle is located in this rectangle. More...
 
IlvRectintersection (const IlvRect &other)
 Computes an intersection. More...
 
IlBoolean intersects (const IlvRect &rect) const
 Checks if a rectangle intersects with this rectangle. More...
 
IlvPos left () const
 Retrieves the location of the left border. More...
 
IlvPoint lowerLeft () const
 Retrieves to location of the lower-left corner. More...
 
IlvPoint lowerRight () const
 Retrieves to location of the lower-right corner. More...
 
void move (const IlvPoint &orig)
 Moves the rectangle. More...
 
void move (IlvPos x, IlvPos y)
 Moves the rectangle. More...
 
void moveResize (IlvPos x, IlvPos y, IlvDim w, IlvDim h)
 Moves and resizes the rectangles. More...
 
IlvRectoperator= (const IlvRect &r)=default
 Assignment operator. More...
 
int operator== (const IlvRect &r) const
 Equality operator. More...
 
void resize (IlvDim w, IlvDim h)
 Resizes the rectangle. More...
 
IlvPos right () const
 Retrieves the location of the right border. More...
 
void scale (IlFloat sw, IlFloat sh)
 Resizes the rectangle. More...
 
void set (IlvPos x, IlvPos y, IlvDim w, IlvDim h)
 Moves and resizes the rectangles. More...
 
void setH (IlvDim newH)
 Sets the height. More...
 
void setW (IlvDim newW)
 Sets the width. More...
 
void setX (IlvPos newX)
 Sets the x coordinate of the origin. More...
 
void setY (IlvPos newY)
 Sets the y coordinate of the origin. More...
 
void size (IlvDim &w, IlvDim &h) const
 Retrieves the dimensions. More...
 
IlvPos top () const
 Retrieves the location of the top border. More...
 
void translate (const IlvPoint &dp)
 Translates the rectangle. More...
 
void translate (IlvPos dx, IlvPos dy)
 Translates the rectangle. More...
 
const IlvPointupperLeft () const
 Retrieves to location of the upper-left corner. More...
 
IlvPoint upperRight () const
 Retrieves to location of the upper-right corner. More...
 

Detailed Description

Geometric class.

Library: xviews or winviews or mviews (mutually exclusive)

IlvRoundRect is a rectangle IlvRect with rounded corners. Each corner is a IlvRoundRectCorner. Corner radiuses can't be greater than rectangle's dimension. For instance the addition (top left corner width + top right corner width) can't be greater than rectangle width. Therefore:

Constructor & Destructor Documentation

◆ IlvRoundRect() [1/4]

IlvRoundRect::IlvRoundRect ( IlvPos  x = 0,
IlvPos  y = 0,
IlvDim  w = 0,
IlvDim  h = 0,
IlvDim  radius = 0 
)

Constructor 1.

This constructor initializes a new rounded rectangle with defined dimensions and a single radius. The radius value will be set to both width and height of all corners, so that all the radiuses will have the same value.

Parameters
xThe x coordinate of the top-left corner of this rectangle.
yThe y coordinate of the top-left corner of this rectangle.
wThe width of this rectangle.
hThe height of this rectangle.
radiusDimension of all the corner.

◆ IlvRoundRect() [2/4]

IlvRoundRect::IlvRoundRect ( const IlvRect rect,
IlvDim  radius 
)

Constructor 2.

This constructor initializes a new rounded rectangle with defined dimensions and a single radius. The radius value will be set to both width and height of all corners, so that all the radiuses will have the same value.

Parameters
rectRectangle's position and dimensions.
radiusDimension of all the corners.

◆ IlvRoundRect() [3/4]

IlvRoundRect::IlvRoundRect ( IlvPos  x,
IlvPos  y,
IlvDim  w,
IlvDim  h,
const RoundedRectRads &  radiuses 
)

Constructor 3.

This constructor initializes a new rounded rectangle with defined dimensions.

Parameters
xThe x coordinate of the top-left corner of this rectangle.
yThe y coordinate of the top-left corner of this rectangle.
wThe width of this rectangle.
hThe height of this rectangle.
radiusesWidth and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} }

◆ IlvRoundRect() [4/4]

IlvRoundRect::IlvRoundRect ( const IlvRect rect,
const RoundedRectRads &  radiuses 
)

Constructor 4.

This constructor initializes a new rounded rectangle with defined dimensions and a single radius. The radius value will be set to both width and height of all corners, so that all the radiuses will have the same value.

Parameters
rectRectangle's position and dimensions.
radiusesWidth and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} }

Member Function Documentation

◆ bottomLeftCorner()

const IlvRoundRectCorner& IlvRoundRect::bottomLeftCorner ( ) const

Retrieves the bottom-left corner.

Returns
bottom-left corner.

◆ bottomRightCorner()

const IlvRoundRectCorner& IlvRoundRect::bottomRightCorner ( ) const

Retrieves the bottom-right corner.

Returns
top-right corner.

◆ expand() [1/2]

void IlvRoundRect::expand ( IlvPos  delta)

Uniformly expands the rectangle.

This member function is equivalent to:

translate(-delta, -delta);
grow(2*delta, 2*delta);

If delta is negative, and 2*|delta| is bigger than of one of the rectangle's current dimensions, this dimension (width or height) is set to 0.

Corner radiuses are not modified, except if corner radiuses are too large for the new size. In this case they are reduced.

Parameters
deltaThe growth to be applied to the rectangle, in all directions.

◆ expand() [2/2]

void IlvRoundRect::expand ( IlvPos  dx,
IlvPos  dy 
)

Expands the rectangle.

This member function is equivalent to:

translate(-dx, -dy);
grow(2*dx, 2*dy);

If dx is negative, and |dx| is bigger than the current width, the new width is set to 0. If dy is negative, and |dy| is bigger than the current height, the new height is set to 0.

Corner radiuses are not modified, except if corner radiuses are too large for the new size. In this case they are reduced.

Parameters
dxThe horizontal growth to be applied to the rectangle.
dyThe vertical growth to be applied to the rectangle.

◆ grow() [1/2]

void IlvRoundRect::grow ( IlvPos  dw,
IlvPos  dh 
)

Resizes the rectangle.

Changes the dimensions of this object by means of a variation of the current width and height. The new width is the sum of the old width and dw. Sets the new width of the rectangle to 0 if -dw is larger than the current width. The new height is the sum of the old height and dh.Sets the new height of the rectangle to 0 if -dh is larger than the current height.

Corner radiuses are not modified, except if corner radiuses are too large for the new size. In this case they are reduced.

Parameters
dwWidth growing
dhHeight growing

◆ grow() [2/2]

void IlvRoundRect::grow ( IlvPos  dw,
IlvPos  dh,
IlvPos  dRadw,
IlvPos  dRadh 
)

Resizes the rectangle.

Changes the dimensions of this object by means of a variation of the current width and height. The new width is the sum of the old width and dw. Sets the new width of the rectangle to 0 if -dw is larger than the current width. The new height is the sum of the old height and dh.Sets the new height of the rectangle to 0 if -dh is larger than the current height.

Parameters
dwRectangle width growing
dhRectangle height growing
dRadwWidth growing of all the radiuses
dRadhHeight growing of all the radiuses

◆ isEvenlyRounded()

virtual IlvBoolean IlvRoundRect::isEvenlyRounded ( ) const
virtual

Indicates that all corner radiuses are equal.

Returns
True if all corner radiuses are equal.

◆ isRounded()

virtual IlvBoolean IlvRoundRect::isRounded ( ) const
virtual

Indicates that the rectangle is rounded.

Returns
False if all corner's width and height are equal to zero.

◆ moveResize()

void IlvRoundRect::moveResize ( IlvPos  x,
IlvPos  y,
IlvDim  w,
IlvDim  h 
)

Moves and resizes the rectangles. Corner radiuses are not modified, except if corner radiuses are too large for the new size. In this case they are reduced.

Parameters
xThe new x coordinate of the top-left corner of this rectangle.
yThe new y coordinate of the top-left corner of this rectangle.
wThe new width of this rectangle.
hThe new height of this rectangle.

◆ resize()

void IlvRoundRect::resize ( IlvDim  w,
IlvDim  h 
)

Resizes the rectangle. Corner radiuses are not modified, except if corner radiuses are too large for the new size. In this case they are reduced.

Parameters
wThe new width of this rectangle.
hThe new height of this rectangle.

◆ scale()

void IlvRoundRect::scale ( IlFloat  sw,
IlFloat  sh 
)

Resizes the rectangle.

Changes the dimensions of this object by means of two scaling factors applied to both the width and the height of this rectangle. Corners are also scaled. sw and sh must be positive values.

◆ set() [1/3]

void IlvRoundRect::set ( IlvPos  x,
IlvPos  y,
IlvDim  w,
IlvDim  h 
)

Moves and resizes the rectangles. If corner radiuses are too large for the new size, they are reduced.

Parameters
xThe new x coordinate of the top-left corner of this rectangle.
yThe new y coordinate of the top-left corner of this rectangle.
wThe new width of this rectangle.
hThe new height of this rectangle.

◆ set() [2/3]

void IlvRoundRect::set ( IlvPos  x,
IlvPos  y,
IlvDim  w,
IlvDim  h,
const RoundedRectRads &  radiuses 
)

Moves and resizes the rectangles.

Parameters
xThe new x coordinate of the top-left corner of this rectangle.
yThe new y coordinate of the top-left corner of this rectangle.
wThe new width of this rectangle.
hThe new height of this rectangle.
radiusesWidth and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} }

◆ set() [3/3]

void IlvRoundRect::set ( IlvPos  x,
IlvPos  y,
IlvDim  w,
IlvDim  h,
IlvDim  radius 
)

Moves and resizes the rectangles.

Parameters
xThe new x coordinate of the top-left corner of this rectangle.
yThe new y coordinate of the top-left corner of this rectangle.
wThe new width of this rectangle.
hThe new height of this rectangle.
radiusDimension of all the corners.

◆ setH()

void IlvRoundRect::setH ( IlvDim  newW)

Sets the height. If corner radiuses are too large for the new size, they are reduced.

Parameters
newHThe new height of this rectangle.

◆ setRadiuses() [1/2]

void IlvRoundRect::setRadiuses ( const RoundedRectRads &  radiuses)

Sets the width and height of the corners. If radius dimensions are too large for rectangle's width and height, the radiuses are proportionally scaled down.

Parameters
radiusesWidth and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} }

◆ setRadiuses() [2/2]

void IlvRoundRect::setRadiuses ( IlvDim  radius)

Sets the width and height of the corners. The value will be set to both width and height of all corners, so that all the radiuses will have the same value.

Parameters
radiusDimension of all the corner.

◆ setW()

void IlvRoundRect::setW ( IlvDim  newW)

Sets the width. If corner radiuses are too large for the new size, they are reduced.

Parameters
newWThe new width of this rectangle.

◆ topLeftCorner()

const IlvRoundRectCorner& IlvRoundRect::topLeftCorner ( ) const

Retrieves the top-left corner.

Returns
top-left corner.

◆ topRightCorner()

const IlvRoundRectCorner& IlvRoundRect::topRightCorner ( ) const

Retrieves the top-right corner.

Returns
top-right corner.
IlvRect::translate
void translate(const IlvPoint &dp)
Translates the rectangle.
Definition: IlvBaseGeometry.h:1023
IlvRoundRect::grow
void grow(IlvPos dw, IlvPos dh)
Resizes the rectangle.