#include <rect.h>
Public Types | |
| using | Type = T |
Public Member Functions | |
| constexpr | TRect () |
| template<class U > | |
| constexpr | TRect (const TRect< U > &other) |
| constexpr TRect | operator+ (const TRect &r) const |
| constexpr TRect | operator- (const TRect &r) const |
| constexpr TRect | operator* (Type scale) const |
| constexpr TRect | operator* (const TRect &r) const |
| constexpr bool | operator== (const TRect &r) const |
| constexpr TRect | Scale (Type scale) const |
| constexpr TRect | Scale (Type scale_x, Type scale_y) const |
| constexpr TRect | Scale (TPoint< T > scale) const |
| constexpr TRect | Scale (TSize< T > scale) const |
| constexpr bool | Contains (const TPoint< Type > &p) const |
| constexpr bool | Contains (const TRect &o) const |
| constexpr bool | IsEmpty () const |
| Returns true if either of the width or height are 0, negative, or NaN. More... | |
| constexpr bool | IsSquare () const |
| Returns true if width and height are equal and neither is NaN. More... | |
| constexpr bool | IsMaximum () const |
| constexpr TPoint< Type > | GetOrigin () const |
| Returns the upper left corner of the rectangle as specified when it was constructed. More... | |
| constexpr TSize< Type > | GetSize () const |
| Returns the size of the rectangle as specified when it was constructed and which may be negative in either width or height. More... | |
| constexpr Type | GetX () const |
| Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|. More... | |
| constexpr Type | GetY () const |
| Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|. More... | |
| constexpr Type | GetWidth () const |
| Returns the width of the rectangle, equivalent to |GetSize().width|. More... | |
| constexpr Type | GetHeight () const |
| Returns the height of the rectangle, equivalent to |GetSize().height|. More... | |
| constexpr auto | GetLeft () const |
| constexpr auto | GetTop () const |
| constexpr auto | GetRight () const |
| constexpr auto | GetBottom () const |
| constexpr TPoint< T > | GetLeftTop () const |
| constexpr TPoint< T > | GetRightTop () const |
| constexpr TPoint< T > | GetLeftBottom () const |
| constexpr TPoint< T > | GetRightBottom () const |
| constexpr T | Area () const |
| Get the area of the rectangle, equivalent to |GetSize().Area()|. More... | |
| constexpr Point | GetCenter () const |
| Get the center point as a |Point|. More... | |
| constexpr std::array< T, 4 > | GetLTRB () const |
| constexpr std::array< T, 4 > | GetXYWH () const |
| Get the x, y coordinates of the origin and the width and height of the rectangle in an array. More... | |
| constexpr TRect | GetPositive () const |
| Get a version of this rectangle that has a non-negative size. More... | |
| constexpr std::array< TPoint< T >, 4 > | GetPoints () const |
| Get the points that represent the 4 corners of this rectangle. The order is: Top left, top right, bottom left, bottom right. More... | |
| constexpr std::array< TPoint< T >, 4 > | GetTransformedPoints (const Matrix &transform) const |
| constexpr TRect | TransformBounds (const Matrix &transform) const |
| Creates a new bounding box that contains this transformed rectangle. More... | |
| constexpr Matrix | GetNormalizingTransform () const |
| Constructs a Matrix that will map all points in the coordinate space of the rectangle into a new normalized coordinate space where the upper left corner of the rectangle maps to (0, 0) and the lower right corner of the rectangle maps to (1, 1). More... | |
| constexpr TRect | Union (const TRect &o) const |
| constexpr std::optional< TRect< T > > | Intersection (const TRect &o) const |
| constexpr bool | IntersectsWithRect (const TRect &o) const |
| constexpr std::optional< TRect< T > > | Cutout (const TRect &o) const |
| Returns the new boundary rectangle that would result from the rectangle being cutout by a second rectangle. More... | |
| constexpr TRect< T > | Shift (TPoint< T > offset) const |
| Returns a new rectangle translated by the given offset. More... | |
| constexpr TRect< T > | Expand (T left, T top, T right, T bottom) const |
| Returns a rectangle with expanded edges. Negative expansion results in shrinking. More... | |
| constexpr TRect< T > | Expand (T amount) const |
| Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
| constexpr TRect< T > | Expand (T horizontal_amount, T vertical_amount) const |
| Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
| constexpr TRect< T > | Expand (TPoint< T > amount) const |
| Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
| constexpr TRect< T > | Expand (TSize< T > amount) const |
| Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking. More... | |
| constexpr TRect< T > | Project (TRect< T > source) const |
| Returns a new rectangle that represents the projection of the source rectangle onto this rectangle. In other words, the source rectangle is redefined in terms of the corrdinate space of this rectangle. More... | |
Static Public Member Functions | |
| constexpr static TRect | MakeLTRB (Type left, Type top, Type right, Type bottom) |
| constexpr static TRect | MakeXYWH (Type x, Type y, Type width, Type height) |
| constexpr static TRect | MakeOriginSize (const TPoint< Type > &origin, const TSize< Type > &size) |
| template<class U > | |
| constexpr static TRect | MakeSize (const TSize< U > &size) |
| template<typename U > | |
| constexpr static std::optional< TRect > | MakePointBounds (const U &value) |
| template<typename PointIter > | |
| constexpr static std::optional< TRect > | MakePointBounds (const PointIter first, const PointIter last) |
| constexpr static TRect | MakeMaximum () |
| constexpr static TRect | RoundOut (const TRect &r) |
| constexpr static std::optional< TRect > | Union (const TRect &a, const std::optional< TRect > b) |
| constexpr static std::optional< TRect > | Union (const std::optional< TRect > a, const TRect &b) |
| constexpr static std::optional< TRect > | Union (const std::optional< TRect > a, const std::optional< TRect > b) |
| constexpr static std::optional< TRect > | Intersection (const TRect &a, const std::optional< TRect > b) |
| constexpr static std::optional< TRect > | Intersection (const std::optional< TRect > a, const TRect &b) |
| constexpr static std::optional< TRect > | Intersection (const std::optional< TRect > a, const std::optional< TRect > b) |
| using impeller::TRect< T >::Type = T |
|
inlineconstexpr |
Definition at line 25 of file rect.h.
Referenced by impeller::TRect< Scalar >::Expand(), impeller::TRect< Scalar >::MakeLTRB(), impeller::TRect< Scalar >::MakeOriginSize(), impeller::TRect< Scalar >::MakeSize(), impeller::TRect< Scalar >::MakeXYWH(), impeller::TRect< Scalar >::operator*(), impeller::TRect< Scalar >::operator+(), impeller::TRect< Scalar >::operator-(), impeller::TRect< Scalar >::Scale(), and impeller::TRect< Scalar >::Shift().
|
inlineexplicitconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 127 of file rect.h.
Referenced by impeller::RectGeometry::CoversArea(), impeller::RoundRectGeometry::CoversArea(), impeller::FillPathGeometry::CoversArea(), and impeller::testing::TEST().
|
inlineconstexpr |
|
inlineconstexpr |
Returns the new boundary rectangle that would result from the rectangle being cutout by a second rectangle.
Definition at line 334 of file rect.h.
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
|
inlineconstexpr |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking.
|
inlineconstexpr |
Returns a rectangle with expanded edges. Negative expansion results in shrinking.
Definition at line 373 of file rect.h.
Referenced by impeller::Canvas::ClipRRect(), impeller::RoundRectGeometry::CoversArea(), impeller::BorderMaskBlurFilterContents::GetFilterCoverage(), impeller::DirectionalGaussianBlurFilterContents::GetFilterCoverage(), impeller::BorderMaskBlurFilterContents::GetFilterSourceCoverage(), impeller::DirectionalMorphologyFilterContents::GetFilterSourceCoverage(), impeller::GaussianBlurFilterContents::GetFilterSourceCoverage(), impeller::DirectionalGaussianBlurFilterContents::GetFilterSourceCoverage(), and impeller::testing::TEST_P().
|
inlineconstexpr |
|
inlineconstexpr |
Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking.
|
inlineconstexpr |
Definition at line 198 of file rect.h.
Referenced by impeller::Canvas::Canvas(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLeftBottom(), impeller::TRect< Scalar >::GetLTRB(), impeller::TRect< Scalar >::GetRightBottom(), and impeller::TRect< Scalar >::RoundOut().
|
inlineconstexpr |
Get the center point as a |Point|.
Definition at line 225 of file rect.h.
Referenced by impeller::PathBuilder::AddArc(), impeller::PathBuilder::AddOval(), impeller::Canvas::DrawOval(), and impeller::Tessellator::FilledEllipse().
|
inlineconstexpr |
Returns the height of the rectangle, equivalent to |GetSize().height|.
Definition at line 175 of file rect.h.
Referenced by impeller::Canvas::ClipRRect(), impeller::RoundRectGeometry::CoversArea(), impeller::DrawGlyph(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandMTL::Encode(), impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandMTL::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::Tessellator::FilledRoundRect(), impeller::AtlasBlenderKey::Hash::operator()(), RectNear(), impeller::PassBindingsCache::SetScissor(), impeller::PassBindingsCache::SetViewport(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 177 of file rect.h.
Referenced by impeller::Canvas::Canvas(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::DrawGlyph(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLeftBottom(), impeller::TRect< Scalar >::GetLeftTop(), impeller::TRect< Scalar >::GetLTRB(), and impeller::TRect< Scalar >::RoundOut().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 205 of file rect.h.
Referenced by impeller::Tessellator::FilledRoundRect().
|
inlineconstexpr |
Definition at line 229 of file rect.h.
Referenced by impeller::TRect< Scalar >::Cutout(), impeller::TRect< Scalar >::GetPoints(), impeller::TRect< Scalar >::GetPositive(), impeller::TRect< Scalar >::Intersection(), and impeller::TRect< Scalar >::Union().
|
inlineconstexpr |
Constructs a Matrix that will map all points in the coordinate space of the rectangle into a new normalized coordinate space where the upper left corner of the rectangle maps to (0, 0) and the lower right corner of the rectangle maps to (1, 1).
Empty and non-finite rectangles will return a zero-scaling transform that maps all points to (0, 0).
Definition at line 280 of file rect.h.
Referenced by impeller::ComputeUVGeometryForRect(), and impeller::VerticesGeometry::GetPositionUVBuffer().
|
inlineconstexpr |
Returns the upper left corner of the rectangle as specified when it was constructed.
Note that unlike the |GetLeft|, |GetTop|, and |GetLeftTop| methods which will return values as if the rectangle had been "unswapped" by calling |GetPositive| on it, this method returns the raw origin values.
Definition at line 154 of file rect.h.
Referenced by impeller::PathBuilder::AddArc(), impeller::PathBuilder::AddOval(), impeller::PathBuilder::AddRect(), impeller::PathBuilder::AddRoundedRect(), impeller::AdvancedBlend(), impeller::DirectionalMorphologyFilterContents::GetFilterCoverage(), std::operator<<(), impeller::PipelineBlend(), and impeller::testing::TEST().
|
inlineconstexpr |
Get the points that represent the 4 corners of this rectangle. The order is: Top left, top right, bottom left, bottom right.
Definition at line 247 of file rect.h.
Referenced by impeller::ComputeUVGeometryForRect(), impeller::TRect< Scalar >::GetTransformedPoints(), impeller::ClipContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Get a version of this rectangle that has a non-negative size.
Definition at line 240 of file rect.h.
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 191 of file rect.h.
Referenced by impeller::Canvas::Canvas(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLTRB(), impeller::TRect< Scalar >::GetRightBottom(), impeller::TRect< Scalar >::GetRightTop(), and impeller::TRect< Scalar >::RoundOut().
|
inlineconstexpr |
Definition at line 217 of file rect.h.
Referenced by impeller::Tessellator::FilledRoundRect().
|
inlineconstexpr |
|
inlineconstexpr |
Returns the size of the rectangle as specified when it was constructed and which may be negative in either width or height.
Definition at line 159 of file rect.h.
Referenced by impeller::PathBuilder::AddRect(), impeller::PathBuilder::AddRoundedRect(), impeller::AdvancedBlend(), impeller::CanAppendToExistingAtlas(), impeller::Canvas::DrawOval(), impeller::Tessellator::FilledEllipse(), impeller::DirectionalMorphologyFilterContents::GetFilterCoverage(), std::operator<<(), impeller::PipelineBlend(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Definition at line 184 of file rect.h.
Referenced by impeller::Canvas::Canvas(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::DrawGlyph(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLeftTop(), impeller::TRect< Scalar >::GetLTRB(), impeller::TRect< Scalar >::GetRightTop(), and impeller::TRect< Scalar >::RoundOut().
|
inlineconstexpr |
Definition at line 253 of file rect.h.
Referenced by impeller::GaussianBlurFilterContents::CalculateUVs(), impeller::Snapshot::GetCoverageUVs(), impeller::AtlasContents::Render(), impeller::AtlasTextureContents::Render(), impeller::AtlasColorContents::Render(), impeller::testing::TEST(), and impeller::TRect< Scalar >::TransformBounds().
|
inlineconstexpr |
Returns the width of the rectangle, equivalent to |GetSize().width|.
Definition at line 171 of file rect.h.
Referenced by impeller::Canvas::ClipRRect(), impeller::RoundRectGeometry::CoversArea(), impeller::DrawGlyph(), impeller::Canvas::DrawOval(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandMTL::Encode(), impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandMTL::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::Tessellator::FilledEllipse(), impeller::Tessellator::FilledRoundRect(), impeller::AtlasBlenderKey::Hash::operator()(), RectNear(), impeller::PassBindingsCache::SetScissor(), impeller::PassBindingsCache::SetViewport(), and impeller::testing::TEST().
|
inlineconstexpr |
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
Definition at line 163 of file rect.h.
Referenced by impeller::DrawGlyph(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandMTL::Encode(), impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandMTL::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::AtlasBlenderKey::Hash::operator()(), RectNear(), impeller::PassBindingsCache::SetScissor(), impeller::PassBindingsCache::SetViewport(), and impeller::testing::TEST().
|
inlineconstexpr |
Get the x, y coordinates of the origin and the width and height of the rectangle in an array.
Definition at line 235 of file rect.h.
Referenced by impeller::TextContents::Render(), and impeller::testing::TEST().
|
inlineconstexpr |
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
Definition at line 167 of file rect.h.
Referenced by impeller::DrawGlyph(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandMTL::Encode(), impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandMTL::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::AtlasBlenderKey::Hash::operator()(), RectNear(), impeller::PassBindingsCache::SetScissor(), impeller::PassBindingsCache::SetViewport(), and impeller::testing::TEST().
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlineconstexpr |
Definition at line 312 of file rect.h.
Referenced by impeller::AdvancedBlend(), impeller::TRect< Scalar >::Intersection(), impeller::TRect< Scalar >::IntersectsWithRect(), impeller::PipelineBlend(), and impeller::testing::TEST().
|
inlineconstexpr |
Definition at line 328 of file rect.h.
Referenced by impeller::testing::TEST().
|
inlineconstexpr |
Returns true if either of the width or height are 0, negative, or NaN.
Definition at line 138 of file rect.h.
Referenced by impeller::Canvas::DrawImageRect(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetNormalizingTransform(), and impeller::TextureContents::Render().
|
inlineconstexpr |
Definition at line 143 of file rect.h.
Referenced by impeller::TRect< Scalar >::GetBottom(), impeller::TRect< Scalar >::GetLeft(), impeller::TRect< Scalar >::GetRight(), and impeller::TRect< Scalar >::GetTop().
|
inlineconstexpr |
Returns true if width and height are equal and neither is NaN.
Definition at line 141 of file rect.h.
Referenced by impeller::Canvas::DrawOval(), and impeller::Tessellator::FilledEllipse().
|
inlinestaticconstexpr |
Definition at line 27 of file rect.h.
Referenced by impeller::TRect< Scalar >::Cutout(), impeller::TRect< Scalar >::GetPositive(), impeller::TRect< Scalar >::Intersection(), impeller::TRect< Scalar >::MakeMaximum(), impeller::TRect< Scalar >::MakePointBounds(), impeller::TRect< Scalar >::RoundOut(), and impeller::TRect< Scalar >::Union().
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
Definition at line 49 of file rect.h.
Referenced by impeller::TRect< Scalar >::MakePointBounds(), and impeller::TRect< Scalar >::TransformBounds().
|
inlinestaticconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Returns a new rectangle that represents the projection of the source rectangle onto this rectangle. In other words, the source rectangle is redefined in terms of the corrdinate space of this rectangle.
Definition at line 424 of file rect.h.
Referenced by impeller::TextureContents::Render().
|
inlinestaticconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 108 of file rect.h.
Referenced by ImGui_ImplImpeller_RenderDrawData(), impeller::MakeTextFrameFromTextBlobSkia(), impeller::TRect< Scalar >::operator*(), impeller::TRect< Scalar >::Scale(), and impeller::testing::TEST().
|
inlineconstexpr |
|
inlineconstexpr |
Returns a new rectangle translated by the given offset.
Definition at line 366 of file rect.h.
Referenced by impeller::TRect< Scalar >::Project(), and impeller::testing::TEST_P().
|
inlineconstexpr |
Creates a new bounding box that contains this transformed rectangle.
Definition at line 264 of file rect.h.
Referenced by impeller::RectGeometry::CoversArea(), impeller::RoundRectGeometry::CoversArea(), impeller::FillPathGeometry::CoversArea(), impeller::TextureFilterInput::GetCoverage(), impeller::Snapshot::GetCoverage(), impeller::VerticesGeometry::GetCoverage(), impeller::TextureContents::GetCoverage(), impeller::AtlasContents::GetCoverage(), impeller::AtlasTextureContents::GetCoverage(), impeller::AtlasColorContents::GetCoverage(), impeller::MatrixFilterContents::GetFilterCoverage(), impeller::LocalMatrixFilterContents::GetFilterSourceCoverage(), and impeller::testing::TEST_P().
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlineconstexpr |
Definition at line 302 of file rect.h.
Referenced by impeller::testing::TEST(), and impeller::TRect< Scalar >::Union().