Geometric class. More...
#include <ilviews/base/geometry/IlvRoundRect.h>
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 IlvRoundRectCorner & | bottomLeftCorner () const |
Retrieves the bottom-left corner. More... | |
const IlvRoundRectCorner & | bottomRightCorner () 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 IlvRoundRectCorner & | topLeftCorner () const |
Retrieves the top-left corner. More... | |
const IlvRoundRectCorner & | topRightCorner () 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... | |
IlvRect & | add (const IlvPoint &point) |
Adds a point. More... | |
IlvRect & | add (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... | |
IlvRect & | intersection (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... | |
IlvRect & | operator= (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 IlvPoint & | upperLeft () const |
Retrieves to location of the upper-left corner. More... | |
IlvPoint | upperRight () const |
Retrieves to location of the upper-right corner. More... | |
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:
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.
x | The x coordinate of the top-left corner of this rectangle. |
y | The y coordinate of the top-left corner of this rectangle. |
w | The width of this rectangle. |
h | The height of this rectangle. |
radius | Dimension of all the corner. |
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.
rect | Rectangle's position and dimensions. |
radius | Dimension of all the corners. |
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.
x | The x coordinate of the top-left corner of this rectangle. |
y | The y coordinate of the top-left corner of this rectangle. |
w | The width of this rectangle. |
h | The height of this rectangle. |
radiuses | Width and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} } |
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.
rect | Rectangle's position and dimensions. |
radiuses | Width and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} } |
const IlvRoundRectCorner& IlvRoundRect::bottomLeftCorner | ( | ) | const |
Retrieves the bottom-left corner.
const IlvRoundRectCorner& IlvRoundRect::bottomRightCorner | ( | ) | const |
Retrieves the bottom-right corner.
void IlvRoundRect::expand | ( | IlvPos | delta | ) |
Uniformly expands the rectangle.
This member function is equivalent to:
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.
delta | The growth to be applied to the rectangle, in all directions. |
Expands the rectangle.
This member function is equivalent to:
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.
dx | The horizontal growth to be applied to the rectangle. |
dy | The vertical growth to be applied to the rectangle. |
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.
dw | Width growing |
dh | Height growing |
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.
dw | Rectangle width growing |
dh | Rectangle height growing |
dRadw | Width growing of all the radiuses |
dRadh | Height growing of all the radiuses |
|
virtual |
Indicates that all corner radiuses are equal.
|
virtual |
Indicates that the rectangle is rounded.
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.
x | The new x coordinate of the top-left corner of this rectangle. |
y | The new y coordinate of the top-left corner of this rectangle. |
w | The new width of this rectangle. |
h | The new height of this rectangle. |
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.
w | The new width of this rectangle. |
h | The new height of this rectangle. |
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.
Moves and resizes the rectangles. If corner radiuses are too large for the new size, they are reduced.
x | The new x coordinate of the top-left corner of this rectangle. |
y | The new y coordinate of the top-left corner of this rectangle. |
w | The new width of this rectangle. |
h | The new height of this rectangle. |
Moves and resizes the rectangles.
x | The new x coordinate of the top-left corner of this rectangle. |
y | The new y coordinate of the top-left corner of this rectangle. |
w | The new width of this rectangle. |
h | The new height of this rectangle. |
radiuses | Width and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} } |
Moves and resizes the rectangles.
x | The new x coordinate of the top-left corner of this rectangle. |
y | The new y coordinate of the top-left corner of this rectangle. |
w | The new width of this rectangle. |
h | The new height of this rectangle. |
radius | Dimension of all the corners. |
void IlvRoundRect::setH | ( | IlvDim | newW | ) |
Sets the height. If corner radiuses are too large for the new size, they are reduced.
newH | The new height of this rectangle. |
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.
radiuses | Width and height of each corner. This param must have the next structure: { {topLeftWidth, topLeftHeight}, {topRightWidth, topRightHeight}, {bottomRightWidth, bottomRightHeight}, {bottomLeftWidth, bottomLeftHeight} } |
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.
radius | Dimension of all the corner. |
void IlvRoundRect::setW | ( | IlvDim | newW | ) |
Sets the width. If corner radiuses are too large for the new size, they are reduced.
newW | The new width of this rectangle. |
const IlvRoundRectCorner& IlvRoundRect::topLeftCorner | ( | ) | const |
Retrieves the top-left corner.
const IlvRoundRectCorner& IlvRoundRect::topRightCorner | ( | ) | const |
Retrieves the top-right corner.