FastUIDraw
Public Member Functions | Public Attributes | List of all members
fastuidraw::RoundedRect Class Reference

#include <rounded_rect.hpp>

Inheritance diagram for fastuidraw::RoundedRect:
Inheritance graph
[legend]

Public Member Functions

 RoundedRect (void)
 
RoundedRectcorner_radii (vec2 v)
 
RoundedRectcorner_radius (enum corner_t c, vec2 v)
 
bool is_flat (void) const
 
RoundedRectmake_flat (void)
 
RoundedRectsanitize (void)
 
- Public Member Functions inherited from fastuidraw::RectT< float >
 RectT (void)
 
 RectT (const RectT< S > &rect)
 
RectTheight (float h)
 
float height (void) const
 
RectTmax_point (const vecN< float, 2 > &p)
 
RectTmax_point (float x, float y)
 
float & max_x (void)
 
float max_x (void) const
 
float & max_y (void)
 
float max_y (void) const
 
RectTmin_point (const vecN< float, 2 > &p)
 
RectTmin_point (float x, float y)
 
float & min_x (void)
 
float min_x (void) const
 
float & min_y (void)
 
float min_y (void) const
 
vecN< float, 2 > point (enum corner_t c) const
 
RectTsanitize_size (void)
 
RectTsize (const vecN< float, 2 > &sz)
 
RectTsize (float width, float height)
 
vecN< float, 2 > size (void) const
 
RectTtranslate (const vecN< float, 2 > &tr)
 
RectTtranslate (float x, float y)
 
RectTwidth (float w)
 
float width (void) const
 

Public Attributes

vecN< vec2, 4 > m_corner_radii
 
- Public Attributes inherited from fastuidraw::RectT< float >
vecN< float, 2 > m_max_point
 
vecN< float, 2 > m_min_point
 

Additional Inherited Members

- Public Types inherited from fastuidraw::RectEnums
enum  { maxx_mask = 1, maxy_mask = 2 }
 
enum  corner_t { minx_miny_corner = 0, minx_maxy_corner = maxy_mask, maxx_miny_corner = maxx_mask, maxx_maxy_corner = maxx_mask | maxy_mask }
 

Detailed Description

Class to specify the geometry of a rounded rectangle; the geometry of the base class Rect defines the -bounding- rectangle of the RoundedRect

Definition at line 35 of file rounded_rect.hpp.

Constructor & Destructor Documentation

◆ RoundedRect()

fastuidraw::RoundedRect::RoundedRect ( void  )
inline

Defautl ctor, intializing all fields as zero,

Definition at line 41 of file rounded_rect.hpp.

Member Function Documentation

◆ corner_radii()

RoundedRect& fastuidraw::RoundedRect::corner_radii ( vec2  v)
inline

Provided as a conveniance, sets each element of m_corner_radii to the named value.

Parameters
vvalue to which to set the corner radii

Definition at line 66 of file rounded_rect.hpp.

◆ corner_radius()

RoundedRect& fastuidraw::RoundedRect::corner_radius ( enum corner_t  c,
vec2  v 
)
inline

Provided as a conveniance, equivalent to

Parameters
cwhich radii corner to set
vvalue to which to set the corner radii

Definition at line 54 of file rounded_rect.hpp.

◆ is_flat()

bool fastuidraw::RoundedRect::is_flat ( void  ) const
inline

Returns true if each corner radii is 0.

Definition at line 86 of file rounded_rect.hpp.

◆ make_flat()

RoundedRect& fastuidraw::RoundedRect::make_flat ( void  )
inline

Set all corner radii values to 0.

Definition at line 77 of file rounded_rect.hpp.

◆ sanitize()

RoundedRect& fastuidraw::RoundedRect::sanitize ( void  )
inline

Sanitize the RoundedRect as follows:

  • each of the corner radii is non-negative
  • each of the corner radii is no more than half the dimension
  • both the width and height are non-negative

Definition at line 101 of file rounded_rect.hpp.

Member Data Documentation

◆ m_corner_radii

vecN<vec2, 4> fastuidraw::RoundedRect::m_corner_radii

Specifies the radii at each of the corners, enumerated by corner_t

Definition at line 126 of file rounded_rect.hpp.


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