Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
graphics::RectType< DataType > Struct Template Referencefinal

Rectangle that is defined by the top left corner and the size. More...

#include <Rect.h>

Public Member Functions

bool IsValid () const noexcept
 Return true if the rectangle is not empty. More...
 
bool Contains (PointType< DataType > pt) const noexcept
 Return true if the rectangle contains the point specified. More...
 

Public Attributes

PointType< DataType > origin
 Origin of the rectangle. More...
 
SizeType< DataType > size
 Size of the rectangle. More...
 

Detailed Description

template<typename DataType>
struct graphics::RectType< DataType >

Rectangle that is defined by the top left corner and the size.

Definition at line 22 of file Rect.h.

Member Function Documentation

◆ Contains()

template<typename DataType >
bool graphics::RectType< DataType >::Contains ( PointType< DataType >  pt) const
inlinenoexcept

Return true if the rectangle contains the point specified.

Definition at line 36 of file Rect.h.

37 {
38 return pt.x >= origin.x && pt.y >= origin.y &&
39 (pt.x < (origin.x + size.width)) &&
40 (pt.y < (origin.y + size.height));
41 }
PointType< DataType > origin
Origin of the rectangle.
Definition: Rect.h:25
SizeType< DataType > size
Size of the rectangle.
Definition: Rect.h:27

References graphics::RectType< DataType >::origin, and graphics::RectType< DataType >::size.

◆ IsValid()

template<typename DataType >
bool graphics::RectType< DataType >::IsValid ( ) const
inlinenoexcept

Return true if the rectangle is not empty.

Definition at line 30 of file Rect.h.

31 {
32 return size.width > 0 && size.height > 0;
33 }

References graphics::RectType< DataType >::size.

Member Data Documentation

◆ origin

template<typename DataType >
PointType<DataType> graphics::RectType< DataType >::origin

Origin of the rectangle.

Definition at line 25 of file Rect.h.

Referenced by graphics::RectType< DataType >::Contains(), and graphics::rect_cast().

◆ size

template<typename DataType >
SizeType<DataType> graphics::RectType< DataType >::size

Size of the rectangle.

Definition at line 27 of file Rect.h.

Referenced by graphics::RectType< DataType >::Contains(), graphics::RectType< DataType >::IsValid(), and graphics::rect_cast().


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