| Flutter Impeller |

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
impeller::TRect< T > Struct Template Reference

`#include <rect.h>`

## Public Types
using | Type = T

## Public Member Functions
constexpr | TRect ()
constexpr | TRect (TSize< Type > size)
constexpr | TRect (TPoint< Type > origin, TSize< Type > size)
constexpr | TRect (const Type components[4])
constexpr | TRect (Type x, Type y, Type width, Type height)
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 (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 | IsZero () const
constexpr bool | IsEmpty () const
constexpr bool | IsMaximum () const
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 std::array< T, 4 > | GetLTRB () const
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 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 > | 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)
template<class U >
constexpr static TRect | MakeSize (const TSize< U > &size)
template<typename PointIter >
constexpr static std::optional< TRect > | MakePointBounds (const PointIter first, const PointIter last)
constexpr static TRect | MakeMaximum ()

## Public Attributes
TPoint< Type > | origin
TSize< Type > | size

## Detailed Description

### template<class T>
struct impeller::TRect< T >

Definition at line 20 of file rect.h.

## Member Typedef Documentation

## ◆ Type

template<class T >

using impeller::TRect< T >::Type = T

Definition at line 21 of file rect.h.

## Constructor & Destructor Documentation

## ◆ TRect() [1/6]

template<class T >

constexpr impeller::TRect< T >::TRect | ( |  | ) |
| inline constexpr

Definition at line 26 of file rect.h.

26 : origin({0, 0}), size({0, 0}) {}

Referenced by impeller::TRect< Scalar >::Expand(), impeller::TRect< Scalar >::MakeLTRB(), 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().

## ◆ TRect() [2/6]

template<class T >

constexpr impeller::TRect< T >::TRect | ( | TSize< Type > | size | ) |
| inline constexpr

Definition at line 28 of file rect.h.

28 : origin({0.0, 0.0}), size(size) {}

## ◆ TRect() [3/6]

template<class T >

constexpr impeller::TRect< T >::TRect | ( | TPoint< Type > | origin,
|  | TSize< Type > | size
| ) |  |
| inline constexpr

Definition at line 30 of file rect.h.

31 : origin(origin), size(size) {}

## ◆ TRect() [4/6]

template<class T >

constexpr impeller::TRect< T >::TRect | ( | const Type | components[4] | ) |
| inline constexpr

Definition at line 33 of file rect.h.

34 : origin(components[0], components[1]),
35 size(components[2], components[3]) {}

## ◆ TRect() [5/6]

template<class T >

constexpr impeller::TRect< T >::TRect | ( | Type | x,
|  | Type | y,
|  | Type | width,
|  | Type | height
| ) |  |
| inline constexpr

Definition at line 37 of file rect.h.

38 : origin(x, y), size(width, height) {}

## ◆ TRect() [6/6]

template<class T >
template<class U >

constexpr impeller::TRect< T >::TRect | ( | const TRect< U > & | other | ) |
| inline explicit constexpr

Definition at line 83 of file rect.h.

84 : origin(static_cast<TPoint<Type>>(other.origin)),
85 size(static_cast<TSize<Type>>(other.size)) {}

## Member Function Documentation

## ◆ Contains() [1/2]

template<class T >

constexpr bool impeller::TRect< T >::Contains | ( | const TPoint< Type > & | p | ) | const
| inline constexpr

Definition at line 122 of file rect.h.

122 {
123 return p.x >= GetLeft() && p.x < GetRight() && p.y >= GetTop() &&
124 p.y < GetBottom();
125 }

Referenced by impeller::RectGeometry::CoversArea(), impeller::FillPathGeometry::CoversArea(), and impeller::testing::TEST().

## ◆ Contains() [2/2]

template<class T >

constexpr bool impeller::TRect< T >::Contains | ( | const TRect< T > & | o | ) | const
| inline constexpr

Definition at line 127 of file rect.h.

127 {
128 return Union(o).size == size;
129 }

## ◆ Cutout()

template<class T >

constexpr std::optional<TRect<T> > impeller::TRect< T >::Cutout | ( | const TRect< T > & | o | ) | const
| inline constexpr

Returns the new boundary rectangle that would result from the rectangle being cutout by a second rectangle.

Definition at line 240 of file rect.h.

240 {
241 const auto& [a_left, a_top, a_right, a_bottom] = GetLTRB(); // Source rect.
242 const auto& [b_left, b_top, b_right, b_bottom] = o.GetLTRB(); // Cutout.
243 if (b_left <= a_left && b_right >= a_right) {
244 if (b_top <= a_top && b_bottom >= a_bottom) {
245 // Full cutout.
246 return std::nullopt;
247 }
248 if (b_top <= a_top && b_bottom > a_top) {
249 // Cuts off the top.
250 return TRect::MakeLTRB(a_left, b_bottom, a_right, a_bottom);
251 }
252 if (b_bottom >= a_bottom && b_top < a_bottom) {
253 // Cuts out the bottom.
254 return TRect::MakeLTRB(a_left, a_top, a_right, b_top);
255 }
256 }
257 if (b_top <= a_top && b_bottom >= a_bottom) {
258 if (b_left <= a_left && b_right > a_left) {
259 // Cuts out the left.
260 return TRect::MakeLTRB(b_right, a_top, a_right, a_bottom);
261 }
262 if (b_right >= a_right && b_left < a_right) {
263 // Cuts out the right.
264 return TRect::MakeLTRB(a_left, a_top, b_left, a_bottom);
265 }
266 }
267
268 return *this;
269 }

Referenced by impeller::testing::TEST().

## ◆ Expand() [1/2]

template<class T >

constexpr TRect<T> impeller::TRect< T >::Expand | ( | T | amount | ) | const
| inline constexpr

Returns a rectangle with expanded edges in all directions. Negative expansion results in shrinking.

Definition at line 288 of file rect.h.

288 {
289 return TRect(origin.x - amount, //
290 origin.y - amount, //
291 size.width + amount * 2, //
292 size.height + amount * 2);
293 }

## ◆ Expand() [2/2]

template<class T >

constexpr TRect<T> impeller::TRect< T >::Expand | ( | T | left,
|  | T | top,
|  | T | right,
|  | T | bottom
| ) |  | const
| inline constexpr

Returns a rectangle with expanded edges. Negative expansion results in shrinking.

Definition at line 279 of file rect.h.

279 {
280 return TRect(origin.x - left, //
281 origin.y - top, //
282 size.width + left + right, //
283 size.height + top + bottom);
284 }

Referenced by impeller::Canvas::ClipRRect().

## ◆ GetBottom()

template<class T >

constexpr auto impeller::TRect< T >::GetBottom | ( |  | ) | const
| inline constexpr

Definition at line 158 of file rect.h.

158 {
159 if (IsMaximum()) {
160 return std::numeric_limits<Type>::infinity();
161 }
162 return std::max(origin.y, origin.y + size.height);
163 }

Referenced by impeller::Canvas::Canvas(), impeller::Canvas::ClipRRect(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLeftBottom(), impeller::TRect< Scalar >::GetLTRB(), and impeller::TRect< Scalar >::GetRightBottom().

## ◆ GetLeft()

template<class T >

constexpr auto impeller::TRect< T >::GetLeft | ( |  | ) | const
| inline constexpr

Definition at line 137 of file rect.h.

137 {
138 if (IsMaximum()) {
139 return -std::numeric_limits<Type>::infinity();
140 }
141 return std::min(origin.x, origin.x + size.width);
142 }

Referenced by impeller::Canvas::Canvas(), impeller::Canvas::ClipRRect(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::DrawGlyph(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLeftBottom(), impeller::TRect< Scalar >::GetLeftTop(), and impeller::TRect< Scalar >::GetLTRB().

## ◆ GetLeftBottom()

template<class T >

constexpr TPoint<T> impeller::TRect< T >::GetLeftBottom | ( |  | ) | const
| inline constexpr

Definition at line 169 of file rect.h.

169 { return {GetLeft(), GetBottom()}; }

## ◆ GetLeftTop()

template<class T >

constexpr TPoint<T> impeller::TRect< T >::GetLeftTop | ( |  | ) | const
| inline constexpr

Definition at line 165 of file rect.h.

165 { return {GetLeft(), GetTop()}; }

## ◆ GetLTRB()

template<class T >

constexpr std::array<T, 4> impeller::TRect< T >::GetLTRB | ( |  | ) | const
| inline constexpr

Definition at line 175 of file rect.h.

175 {
176 return {GetLeft(), GetTop(), GetRight(), GetBottom()};
177 }

Referenced by impeller::TRect< Scalar >::Cutout(), impeller::TRect< Scalar >::GetPoints(), impeller::TRect< Scalar >::GetPositive(), impeller::TRect< Scalar >::Intersection(), and impeller::TRect< Scalar >::Union().

## ◆ GetPoints()

template<class T >

constexpr std::array<TPoint<T>, 4> impeller::TRect< T >::GetPoints | ( |  | ) | const
| inline constexpr

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 187 of file rect.h.

187 {
188 auto [left, top, right, bottom] = GetLTRB();
189 return {TPoint(left, top), TPoint(right, top), TPoint(left, bottom),
190 TPoint(right, bottom)};
191 }

Referenced by impeller::ComputeUVGeometryForRect(), impeller::TRect< Scalar >::GetTransformedPoints(), impeller::ClipContents::Render(), and impeller::testing::TEST().

## ◆ GetPositive()

template<class T >

constexpr TRect impeller::TRect< T >::GetPositive | ( |  | ) | const
| inline constexpr

Get a version of this rectangle that has a non-negative size.

Definition at line 180 of file rect.h.

180 {
181 auto ltrb = GetLTRB();
182 return MakeLTRB(ltrb[0], ltrb[1], ltrb[2], ltrb[3]);
183 }

Referenced by impeller::testing::TEST().

## ◆ GetRight()

template<class T >

constexpr auto impeller::TRect< T >::GetRight | ( |  | ) | const
| inline constexpr

Definition at line 151 of file rect.h.

151 {
152 if (IsMaximum()) {
153 return std::numeric_limits<Type>::infinity();
154 }
155 return std::max(origin.x, origin.x + size.width);
156 }

Referenced by impeller::Canvas::Canvas(), impeller::Canvas::ClipRRect(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLTRB(), impeller::TRect< Scalar >::GetRightBottom(), and impeller::TRect< Scalar >::GetRightTop().

## ◆ GetRightBottom()

template<class T >

constexpr TPoint<T> impeller::TRect< T >::GetRightBottom | ( |  | ) | const
| inline constexpr

Definition at line 171 of file rect.h.

171 {
172 return {GetRight(), GetBottom()};
173 }

## ◆ GetRightTop()

template<class T >

constexpr TPoint<T> impeller::TRect< T >::GetRightTop | ( |  | ) | const
| inline constexpr

Definition at line 167 of file rect.h.

167 { return {GetRight(), GetTop()}; }

## ◆ GetTop()

template<class T >

constexpr auto impeller::TRect< T >::GetTop | ( |  | ) | const
| inline constexpr

Definition at line 144 of file rect.h.

144 {
145 if (IsMaximum()) {
146 return -std::numeric_limits<Type>::infinity();
147 }
148 return std::min(origin.y, origin.y + size.height);
149 }

Referenced by impeller::Canvas::Canvas(), impeller::Canvas::ClipRRect(), impeller::TRect< Scalar >::Contains(), impeller::DlDispatcher::drawDisplayList(), impeller::DrawGlyph(), impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::GetLeftTop(), impeller::TRect< Scalar >::GetLTRB(), and impeller::TRect< Scalar >::GetRightTop().

## ◆ GetTransformedPoints()

template<class T >

constexpr std::array<TPoint<T>, 4> impeller::TRect< T >::GetTransformedPoints | ( | const Matrix & | transform | ) | const
| inline constexpr

Definition at line 193 of file rect.h.

194 {
195 auto points = GetPoints();
196 for (size_t i = 0; i < points.size(); i++) {
197 points[i] = transform * points[i];
198 }
199 return points;
200 }

Referenced by impeller::Snapshot::GetCoverageUVs(), impeller::AtlasContents::Render(), impeller::AtlasTextureContents::Render(), impeller::AtlasColorContents::Render(), impeller::testing::TEST(), and impeller::TRect< Scalar >::TransformBounds().

## ◆ Intersection()

template<class T >

constexpr std::optional<TRect<T> > impeller::TRect< T >::Intersection | ( | const TRect< T > & | o | ) | const
| inline constexpr

Definition at line 219 of file rect.h.

219 {
220 auto this_ltrb = GetLTRB();
221 auto other_ltrb = o.GetLTRB();
222 auto intersection =
223 TRect::MakeLTRB(std::max(this_ltrb[0], other_ltrb[0]), //
224 std::max(this_ltrb[1], other_ltrb[1]), //
225 std::min(this_ltrb[2], other_ltrb[2]), //
226 std::min(this_ltrb[3], other_ltrb[3]) //
227 );
228 if (intersection.size.IsEmpty()) {
229 return std::nullopt;
230 }
231 return intersection;
232 }

Referenced by impeller::AdvancedBlend(), impeller::TRect< Scalar >::IntersectsWithRect(), impeller::PipelineBlend(), and impeller::testing::TEST().

## ◆ IntersectsWithRect()

template<class T >

constexpr bool impeller::TRect< T >::IntersectsWithRect | ( | const TRect< T > & | o | ) | const
| inline constexpr

Definition at line 234 of file rect.h.

234 {
235 return Intersection(o).has_value();
236 }

Referenced by impeller::testing::TEST().

## ◆ IsEmpty()

template<class T >

constexpr bool impeller::TRect< T >::IsEmpty | ( |  | ) | const
| inline constexpr

Definition at line 133 of file rect.h.

133 { return size.IsEmpty(); }

Referenced by impeller::NinePatchConverter::DrawNinePatch(), and impeller::TextureContents::Render().

## ◆ IsMaximum()

template<class T >

constexpr bool impeller::TRect< T >::IsMaximum | ( |  | ) | const
| inline constexpr

Definition at line 135 of file rect.h.

135 { return *this == MakeMaximum(); }

Referenced by impeller::TRect< Scalar >::GetBottom(), impeller::TRect< Scalar >::GetLeft(), impeller::TRect< Scalar >::GetRight(), and impeller::TRect< Scalar >::GetTop().

## ◆ IsZero()

template<class T >

constexpr bool impeller::TRect< T >::IsZero | ( |  | ) | const
| inline constexpr

Definition at line 131 of file rect.h.

131 { return size.IsZero(); }

## ◆ MakeLTRB()

template<class T >

constexpr static TRect impeller::TRect< T >::MakeLTRB | ( | Type | left,
|  | Type | top,
|  | Type | right,
|  | Type | bottom
| ) |  |
| inline static constexpr

Definition at line 40 of file rect.h.

43 {
44 return TRect(left, top, right - left, bottom - top);
45 }

Referenced by impeller::TRect< Scalar >::Cutout(), impeller::TRect< Scalar >::GetPositive(), impeller::TRect< Scalar >::Intersection(), impeller::TRect< Scalar >::MakeMaximum(), impeller::TRect< Scalar >::MakePointBounds(), and impeller::TRect< Scalar >::Union().

## ◆ MakeMaximum()

template<class T >

constexpr static TRect impeller::TRect< T >::MakeMaximum | ( |  | ) |
| inline static constexpr

Definition at line 75 of file rect.h.

75 {
76 return TRect::MakeLTRB(-std::numeric_limits<Type>::infinity(),
77 -std::numeric_limits<Type>::infinity(),
78 std::numeric_limits<Type>::infinity(),
79 std::numeric_limits<Type>::infinity());
80 }

Referenced by impeller::TRect< Scalar >::IsMaximum().

## ◆ MakePointBounds()

template<class T >
template<typename PointIter >

constexpr static std::optional<TRect> impeller::TRect< T >::MakePointBounds | ( | const PointIter | first,
|  | const PointIter | last
| ) |  |
| inline static constexpr

Definition at line 57 of file rect.h.

58 {
59 if (first == last) {
60 return std::nullopt;
61 }
62 auto left = first->x;
63 auto top = first->y;
64 auto right = first->x;
65 auto bottom = first->y;
66 for (auto it = first + 1; it < last; ++it) {
67 left = std::min(left, it->x);
68 top = std::min(top, it->y);
69 right = std::max(right, it->x);
70 bottom = std::max(bottom, it->y);
71 }
72 return TRect::MakeLTRB(left, top, right, bottom);
73 }

Referenced by impeller::TRect< Scalar >::TransformBounds().

## ◆ MakeSize()

template<class T >
template<class U >

constexpr static TRect impeller::TRect< T >::MakeSize | ( | const TSize< U > & | size | ) |
| inline static constexpr

Definition at line 52 of file rect.h.

52 {
53 return TRect(0.0, 0.0, size.width, size.height);
54 }

## ◆ MakeXYWH()

template<class T >

constexpr static TRect impeller::TRect< T >::MakeXYWH | ( | Type | x,
|  | Type | y,
|  | Type | width,
|  | Type | height
| ) |  |
| inline static constexpr

Definition at line 47 of file rect.h.

47 {
48 return TRect(x, y, width, height);
49 }

## ◆ operator*() [1/2]

template<class T >

constexpr TRect impeller::TRect< T >::operator* | ( | const TRect< T > & | r | ) | const
| inline constexpr

Definition at line 99 of file rect.h.

99 {
100 return TRect({origin.x * r.origin.x, origin.y * r.origin.y},
101 {size.width * r.size.width, size.height * r.size.height});
102 }

## ◆ operator*() [2/2]

template<class T >

constexpr TRect impeller::TRect< T >::operator* | ( | Type | scale | ) | const
| inline constexpr

Definition at line 97 of file rect.h.

97 { return Scale(scale); }

## ◆ operator+()

template<class T >

constexpr TRect impeller::TRect< T >::operator+ | ( | const TRect< T > & | r | ) | const
| inline constexpr

Definition at line 87 of file rect.h.

87 {
88 return TRect({origin.x + r.origin.x, origin.y + r.origin.y},
89 {size.width + r.size.width, size.height + r.size.height});
90 }

## ◆ operator-()

template<class T >

constexpr TRect impeller::TRect< T >::operator- | ( | const TRect< T > & | r | ) | const
| inline constexpr

Definition at line 92 of file rect.h.

92 {
93 return TRect({origin.x - r.origin.x, origin.y - r.origin.y},
94 {size.width - r.size.width, size.height - r.size.height});
95 }

## ◆ operator==()

template<class T >

constexpr bool impeller::TRect< T >::operator== | ( | const TRect< T > & | r | ) | const
| inline constexpr

Definition at line 104 of file rect.h.

104 {
105 return origin == r.origin && size == r.size;
106 }

## ◆ Project()

template<class T >

constexpr TRect<T> impeller::TRect< T >::Project | ( | TRect< T > | source | ) | const
| inline constexpr

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 299 of file rect.h.

299 {
300 return source.Shift(-origin).Scale(
301 TSize<T>(1.0 / static_cast<Scalar>(size.width),
302 1.0 / static_cast<Scalar>(size.height)));
303 }

Referenced by impeller::TextureContents::Render().

## ◆ Scale() [1/3]

template<class T >

constexpr TRect impeller::TRect< T >::Scale | ( | TPoint< T > | scale | ) | const
| inline constexpr

Definition at line 113 of file rect.h.

113 {
114 return TRect({origin.x * scale.x, origin.y * scale.y},
115 {size.width * scale.x, size.height * scale.y});
116 }

## ◆ Scale() [2/3]

template<class T >

constexpr TRect impeller::TRect< T >::Scale | ( | TSize< T > | scale | ) | const
| inline constexpr

Definition at line 118 of file rect.h.

118 {
119 return Scale(TPoint<T>(scale));
120 }

## ◆ Scale() [3/3]

template<class T >

constexpr TRect impeller::TRect< T >::Scale | ( | Type | scale | ) | const
| inline constexpr

Definition at line 108 of file rect.h.

108 {
109 return TRect({origin.x * scale, origin.y * scale},
110 {size.width * scale, size.height * scale});
111 }

Referenced by impeller::MakeTextFrameFromTextBlobSkia(), impeller::TRect< Scalar >::operator*(), and impeller::TRect< Scalar >::Scale().

## ◆ Shift()

template<class T >

constexpr TRect<T> impeller::TRect< T >::Shift | ( | TPoint< T > | offset | ) | const
| inline constexpr

Returns a new rectangle translated by the given offset.

Definition at line 272 of file rect.h.

272 {
273 return TRect(origin.x + offset.x, origin.y + offset.y, size.width,
274 size.height);
275 }

Referenced by impeller::TRect< Scalar >::Project().

## ◆ TransformBounds()

template<class T >

constexpr TRect impeller::TRect< T >::TransformBounds | ( | const Matrix & | transform | ) | const
| inline constexpr

Creates a new bounding box that contains this transformed rectangle.

Definition at line 204 of file rect.h.

204 {
205 auto points = GetTransformedPoints(transform);
206 return TRect::MakePointBounds(points.begin(), points.end()).value();
207 }

Referenced by impeller::RectGeometry::CoversArea(), impeller::FillPathGeometry::CoversArea(), impeller::TextureFilterInput::GetCoverage(), impeller::Snapshot::GetCoverage(), impeller::SolidRRectBlurContents::GetCoverage(), impeller::VerticesGeometry::GetCoverage(), impeller::TextureContents::GetCoverage(), impeller::AtlasContents::GetCoverage(), impeller::AtlasTextureContents::GetCoverage(), impeller::AtlasColorContents::GetCoverage(), impeller::MatrixFilterContents::GetFilterCoverage(), and impeller::testing::TEST_P().

## ◆ Union()

template<class T >

constexpr TRect impeller::TRect< T >::Union | ( | const TRect< T > & | o | ) | const
| inline constexpr

Definition at line 209 of file rect.h.

209 {
210 auto this_ltrb = GetLTRB();
211 auto other_ltrb = o.GetLTRB();
212 return TRect::MakeLTRB(std::min(this_ltrb[0], other_ltrb[0]), //
213 std::min(this_ltrb[1], other_ltrb[1]), //
214 std::max(this_ltrb[2], other_ltrb[2]), //
215 std::max(this_ltrb[3], other_ltrb[3]) //
216 );
217 }

Referenced by impeller::TRect< Scalar >::Contains(), and impeller::testing::TEST().

## Member Data Documentation

## ◆ origin

template<class T >

TPoint<Type> impeller::TRect< T >::origin

Definition at line 23 of file rect.h.

Referenced by impeller::PathBuilder::AddArc(), impeller::PathBuilder::AddOval(), impeller::PathBuilder::AddRect(), impeller::PathBuilder::AddRoundedRect(), impeller::AdvancedBlend(), impeller::ComputeUVGeometryForRect(), impeller::DrawGlyph(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandMTL::Encode(), impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandMTL::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::TRect< Scalar >::Expand(), impeller::TRect< Scalar >::GetBottom(), impeller::BorderMaskBlurFilterContents::GetFilterCoverage(), impeller::DirectionalMorphologyFilterContents::GetFilterCoverage(), impeller::DirectionalGaussianBlurFilterContents::GetFilterCoverage(), impeller::TRect< Scalar >::GetLeft(), impeller::VerticesGeometry::GetPositionUVBuffer(), impeller::TRect< Scalar >::GetRight(), impeller::TRect< Scalar >::GetTop(), impeller::AtlasBlenderKey::Hash::operator()(), impeller::TRect< Scalar >::operator*(), impeller::TRect< Scalar >::operator+(), impeller::TRect< Scalar >::operator-(), std::operator<<(), impeller::TRect< Scalar >::operator==(), impeller::PipelineBlend(), impeller::TRect< Scalar >::Project(), RectNear(), impeller::TextContents::Render(), impeller::TRect< Scalar >::Scale(), impeller::PassBindingsCache::SetScissor(), impeller::PassBindingsCache::SetViewport(), impeller::TRect< Scalar >::Shift(), and impeller::testing::TEST().

## ◆ size

template<class T >

TSize<Type> impeller::TRect< T >::size

Definition at line 24 of file rect.h.

Referenced by impeller::PathBuilder::AddArc(), impeller::PathBuilder::AddOval(), impeller::PathBuilder::AddRect(), impeller::PathBuilder::AddRoundedRect(), impeller::AdvancedBlend(), impeller::CanAppendToExistingAtlas(), impeller::Canvas::ClipRRect(), impeller::ComputeUVGeometryForRect(), impeller::TRect< Scalar >::Contains(), impeller::DrawGlyph(), impeller::Canvas::DrawImageRect(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToTextureCommandMTL::Encode(), impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandMTL::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::TRect< Scalar >::Expand(), impeller::TRect< Scalar >::GetBottom(), impeller::BorderMaskBlurFilterContents::GetFilterCoverage(), impeller::DirectionalMorphologyFilterContents::GetFilterCoverage(), impeller::DirectionalGaussianBlurFilterContents::GetFilterCoverage(), impeller::TRect< Scalar >::GetLeft(), impeller::VerticesGeometry::GetPositionUVBuffer(), impeller::TRect< Scalar >::GetRight(), impeller::TRect< Scalar >::GetTop(), impeller::TRect< Scalar >::IsEmpty(), impeller::TRect< Scalar >::IsZero(), impeller::TRect< Scalar >::MakeSize(), impeller::AtlasBlenderKey::Hash::operator()(), impeller::TRect< Scalar >::operator*(), impeller::TRect< Scalar >::operator+(), impeller::TRect< Scalar >::operator-(), std::operator<<(), impeller::TRect< Scalar >::operator==(), impeller::PipelineBlend(), impeller::TRect< Scalar >::Project(), RectNear(), impeller::TextContents::Render(), impeller::TextureContents::Render(), impeller::TRect< Scalar >::Scale(), impeller::PassBindingsCache::SetScissor(), impeller::PassBindingsCache::SetViewport(), impeller::TRect< Scalar >::Shift(), and impeller::testing::TEST().

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

- impeller/geometry/rect.h

impeller::TRect::GetLTRB
constexpr std::array< T, 4 > GetLTRB() const
Definition: rect.h:175
impeller::TRect::size
TSize< Type > size
Definition: rect.h:24
impeller::TPoint::y
Type y
Definition: point.h:24
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::TRect::IsMaximum
constexpr bool IsMaximum() const
Definition: rect.h:135
impeller::TRect::TRect
constexpr TRect()
Definition: rect.h:26
impeller::TRect::GetPoints
constexpr std::array< TPoint< T >, 4 > GetPoints() const
Get the points that represent the 4 corners of this rectangle. The order is: Top left,...
Definition: rect.h:187
impeller::TRect::Intersection
constexpr std::optional< TRect< T > > Intersection(const TRect &o) const
Definition: rect.h:219
impeller::TRect::GetLeft
constexpr auto GetLeft() const
Definition: rect.h:137
impeller::TRect::GetTransformedPoints
constexpr std::array< TPoint< T >, 4 > GetTransformedPoints(const Matrix &transform) const
Definition: rect.h:193
impeller::TRect::Scale
constexpr TRect Scale(Type scale) const
Definition: rect.h:108
impeller::TRect::origin
TPoint< Type > origin
Definition: rect.h:23
impeller::TRect::MakePointBounds
constexpr static std::optional< TRect > MakePointBounds(const PointIter first, const PointIter last)
Definition: rect.h:57
impeller::TSize::IsZero
constexpr bool IsZero() const
Definition: size.h:103
impeller::TSize::width
Type width
Definition: size.h:21
impeller::TPoint::x
Type x
Definition: point.h:23
impeller::TRect::GetRight
constexpr auto GetRight() const
Definition: rect.h:151
impeller::TRect::MakeMaximum
constexpr static TRect MakeMaximum()
Definition: rect.h:75
impeller::TRect::Union
constexpr TRect Union(const TRect &o) const
Definition: rect.h:209
impeller::TRect::GetBottom
constexpr auto GetBottom() const
Definition: rect.h:158
impeller::TSize::height
Type height
Definition: size.h:22
impeller::TRect::MakeLTRB
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:40
impeller::TSize::IsEmpty
constexpr bool IsEmpty() const
Definition: size.h:105
impeller::TRect::GetTop
constexpr auto GetTop() const
Definition: rect.h:144