Louvre v2.18.1-1
C++ library for Wayland compositors
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
LRRect Class Reference

A rectangle with rounded corners. More...

#include <LRRect.h>

+ Inheritance diagram for LRRect:

Public Member Functions

 LRRect (const LRect &rect={ 0 }, Int32 radTL=0, Int32 radTR=0, Int32 radBR=0, Int32 radBL=0) noexcept
 Constructs a rounded rectangle.
 
bool isValid () const noexcept
 Checks if the rectangle is valid.
 
constexpr bool operator== (const LRRect &other) const
 Compares two rounded rectangles for equality.
 
constexpr bool operator!= (const LRRect &other) const
 Compares two rounded rectangles for inequality.
 
- Public Member Functions inherited from LRectTemplate< Int32 >
constexpr LRectTemplate () noexcept
 Initializes the vector with (0,0,0,0).
 
constexpr LRectTemplate (Int32 x, Int32 y, Int32 width, Int32 height) noexcept
 Initializes the vector with (x,y,width,height).
 
constexpr LRectTemplate (const LPointTemplate< NA > &topLeft, const LPointTemplate< NB > &bottomRight) noexcept
 Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()).
 
constexpr LRectTemplate (Int32 topLeft, const LPointTemplate< N > &bottomRight) noexcept
 Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()).
 
constexpr LRectTemplate (const LPointTemplate< N > &topLeft, Int32 bottomRight) noexcept
 Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()).
 
constexpr LRectTemplate (Int32 all) noexcept
 Initializes the vector with (all,all,all,all).
 
constexpr LRectTemplate (const LPointTemplate< N > &p) noexcept
 Initializes the vector with (p.x(),p.y(),p.x(),p.y()).
 
constexpr LRectTemplate (const LRectTemplate< N > &r) noexcept
 Copy constructor.
 
constexpr Int32 x () const noexcept
 First vector component.
 
constexpr Int32 y () const noexcept
 Second vector component.
 
constexpr Int32 w () const noexcept
 Third vector component.
 
constexpr Int32 h () const noexcept
 Fourth vector component.
 
constexpr Int32 width () const noexcept
 Third vector component.
 
constexpr Int32 height () const noexcept
 Fourth vector component.
 
constexpr Int32 area () const noexcept
 The multiplication of the third and fourth component (width*height)
 
constexpr bool containsPoint (const LPointTemplate< N > &point, bool inclusive=true) const noexcept
 
constexpr bool intersects (const LRectTemplate< N > &rect, bool inclusive=true) const noexcept
 
constexpr const LPointTemplate< Int32 > & topLeft () const noexcept
 2D vector given by the (x,y) components of the rectangle
 
constexpr const LPointTemplate< Int32 > & bottomRight () const noexcept
 2D vector given by the (w,h) components of the rectangle
 
constexpr const LPointTemplate< Int32 > & TL () const noexcept
 2D vector given by the (x,y) components of the rectangle
 
constexpr const LPointTemplate< Int32 > & BR () const noexcept
 2D vector given by the (w,h) components of the rectangle
 
constexpr const LPointTemplate< Int32 > & pos () const noexcept
 2D vector given by the (x,y) components of the rectangle
 
constexpr const LPointTemplate< Int32 > & size () const noexcept
 2D vector given by the (w,h) components of the rectangle
 
constexpr void setX (Int32 x) noexcept
 Asigns the first component.
 
constexpr void setY (Int32 y) noexcept
 Asigns the second component.
 
constexpr void setW (Int32 width) noexcept
 Asigns the third component.
 
constexpr void setH (Int32 height) noexcept
 Asigns the fourth component.
 
constexpr void setWidth (Int32 width) noexcept
 Asigns the third component.
 
constexpr void setHeight (Int32 height) noexcept
 Asigns the fourth component.
 
constexpr void setTL (const LPointTemplate< Int32 > &p) noexcept
 Asigns the (x,y) components.
 
constexpr void setBR (const LPointTemplate< Int32 > &p) noexcept
 Asigns the (w,h) components.
 
constexpr void setTopLeft (const LPointTemplate< Int32 > &p) noexcept
 Asigns the (x,y) components.
 
constexpr void setBottomRight (const LPointTemplate< Int32 > &p) noexcept
 Asigns the (w,h) components.
 
constexpr void setPos (const LPointTemplate< Int32 > &p) noexcept
 Asigns the (x,y) components.
 
constexpr void setSize (const LPointTemplate< Int32 > &p) noexcept
 Asigns the (w,h) components.
 
constexpr bool clip (const LRectTemplate< N > &rect) noexcept
 Returns true if the resulting rectangle has an area of 0.
 

Public Attributes

Int32 fRadTL
 Radius of the top-left corner.
 
Int32 fRadTR
 Radius of the top-right corner.
 
Int32 fRadBR
 Radius of the bottom-right corner.
 
Int32 fRadBL
 Radius of the bottom-left corner.
 

Detailed Description

A rectangle with rounded corners.

This class extends LRect by adding support for rounded corners.

Constructor & Destructor Documentation

◆ LRRect()

LRRect ( const LRect rect = { 0 },
Int32  radTL = 0,
Int32  radTR = 0,
Int32  radBR = 0,
Int32  radBL = 0 
)
inlinenoexcept

Constructs a rounded rectangle.

Parameters
rectThe base rectangle.
radTLRadius of the top-left corner.
radTRRadius of the top-right corner.
radBRRadius of the bottom-right corner.
radBLRadius of the bottom-left corner.

Member Function Documentation

◆ isValid()

bool isValid ( ) const
inlinenoexcept

Checks if the rectangle is valid.

A rectangle is valid if its width and height are non-negative, each corner radius is non-negative, and the sum of adjacent corner radii does not exceed the respective width or height.

Returns
true if the rectangle is valid, false otherwise.

◆ operator==()

constexpr bool operator== ( const LRRect other) const
inlineconstexpr

Compares two rounded rectangles for equality.

Parameters
otherThe rectangle to compare with.
Returns
true if all properties match, false otherwise.

◆ operator!=()

constexpr bool operator!= ( const LRRect other) const
inlineconstexpr

Compares two rounded rectangles for inequality.

Parameters
otherThe rectangle to compare with.
Returns
true if any property differs, false otherwise.

Member Data Documentation

◆ fRadTL

Int32 fRadTL

Radius of the top-left corner.

◆ fRadTR

Int32 fRadTR

Radius of the top-right corner.

◆ fRadBR

Int32 fRadBR

Radius of the bottom-right corner.

◆ fRadBL

Int32 fRadBL

Radius of the bottom-left corner.