Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::canvas::Rect2D Struct Reference

Axis-aligned rectangle in canvas coordinates. More...

#include <rectangle_list.hpp>

Public Member Functions

float right () const
float bottom () const
bool empty () const
bool contains (float px, float py) const
bool intersects (const Rect2D &other) const
Rect2D intersection (const Rect2D &other) const
Rect2D enclosing_union (const Rect2D &other) const
bool operator== (const Rect2D &o) const

Public Attributes

float x = 0
float y = 0
float width = 0
float height = 0

Detailed Description

Axis-aligned rectangle in canvas coordinates.

NAMED Rect2D, NOT Rect, ON PURPOSE — do not "simplify" this back. Apple's MacTypes.h declares a GLOBAL struct Rect (and a global Point) for Carbon compatibility. Any translation unit that says using namespace pulp::canvas; AND transitively includes an Apple header then hits an unfixable ambiguity inside Apple's own headers:

MacTypes.h:556:16: error: reference to 'Rect' is ambiguous
  note: candidate found by name lookup is 'pulp::canvas::Rect'

65 TUs in this repo use that using-directive. The name stayed survivable only while this header was rarely included; once Path (and therefore canvas.hpp) needed a rect type, it became visible nearly repo-wide and the collision became unavoidable. Point2D in affine_transform.hpp is named for exactly the same reason.

Member Function Documentation

◆ bottom()

float pulp::canvas::Rect2D::bottom ( ) const
inline

◆ contains()

bool pulp::canvas::Rect2D::contains ( float px,
float py ) const
inline

◆ empty()

bool pulp::canvas::Rect2D::empty ( ) const
inline

◆ enclosing_union()

Rect2D pulp::canvas::Rect2D::enclosing_union ( const Rect2D & other) const
inline

◆ intersection()

Rect2D pulp::canvas::Rect2D::intersection ( const Rect2D & other) const
inline

◆ intersects()

bool pulp::canvas::Rect2D::intersects ( const Rect2D & other) const
inline

◆ operator==()

bool pulp::canvas::Rect2D::operator== ( const Rect2D & o) const
inline

◆ right()

float pulp::canvas::Rect2D::right ( ) const
inline

Member Data Documentation

◆ height

float pulp::canvas::Rect2D::height = 0

◆ width

float pulp::canvas::Rect2D::width = 0

◆ x

float pulp::canvas::Rect2D::x = 0

◆ y

float pulp::canvas::Rect2D::y = 0

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