#include <rstransform.h>
Public Member Functions | |
constexpr | RSTransform () |
constexpr | RSTransform (Scalar scaled_cos, Scalar scaled_sin, Scalar translate_x, Scalar translate_y) |
bool | IsAxisAligned () const |
Matrix | GetMatrix () const |
void | GetQuad (Scalar width, Scalar height, Quad &quad) const |
Quad | GetQuad (Scalar width, Scalar height) const |
Quad | GetQuad (Size size) const |
std::optional< Rect > | GetBounds (Scalar width, Scalar height) const |
std::optional< Rect > | GetBounds (Size size) const |
Static Public Member Functions | |
static RSTransform | Make (Point origin, Scalar scale, Radians radians) |
Public Attributes | |
Scalar | scaled_cos |
Scalar | scaled_sin |
Scalar | translate_x |
Scalar | translate_y |
A utility struct that stores a simple transform composed of a translation, a rotation, and a uniform scale.
This transform is used by drawAtlas to transform the sprites. This structure mirrors the Flutter RSTransform class.
Definition at line 20 of file rstransform.h.
|
inlineconstexpr |
Definition at line 21 of file rstransform.h.
|
inlineconstexpr |
Definition at line 27 of file rstransform.h.
Returns the bounds of the 4 corner points of the transformed quad for a sub-image of the indicated size.
Definition at line 49 of file rstransform.cc.
References GetQuad(), and impeller::TRect< Scalar >::MakePointBounds().
Referenced by impeller::DlAtlasGeometry::ComputeBoundingBox().
Definition at line 53 of file rstransform.cc.
References GetQuad(), and impeller::TRect< Scalar >::MakePointBounds().
Matrix impeller::RSTransform::GetMatrix | ( | ) | const |
Definition at line 15 of file rstransform.cc.
References impeller::Matrix::MakeRow(), scaled_cos, scaled_sin, translate_x, and translate_y.
Returns the 4 corner points of the transformed quad for a sub-image of the indicated size in the same order as Rect::GetPoints.
The order is UpperLeft, UpperRight, LowerLeft, LowerRight
Definition at line 24 of file rstransform.cc.
References scaled_cos, scaled_sin, translate_x, and translate_y.
Referenced by impeller::DlAtlasGeometry::CreateBlendVertexBuffer(), impeller::DlAtlasGeometry::CreateSimpleVertexBuffer(), GetBounds(), and GetQuad().
Definition at line 43 of file rstransform.cc.
References GetQuad(), impeller::TSize< T >::height, and impeller::TSize< T >::width.
bool impeller::RSTransform::IsAxisAligned | ( | ) | const |
Returns true iff the resulting transformed quad will be aligned with the axes, even if rotated by a quadrant rotation.
Definition at line 11 of file rstransform.cc.
References scaled_cos, and scaled_sin.
|
inlinestatic |
Constructs an RSTransform from the indicated origin, uniform scale, and radians rotation.
Definition at line 38 of file rstransform.h.
References impeller::Matrix::CosSin(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::testing::TEST().
Scalar impeller::RSTransform::scaled_cos |
Definition at line 43 of file rstransform.h.
Referenced by GetMatrix(), GetQuad(), IsAxisAligned(), and std::operator<<().
Scalar impeller::RSTransform::scaled_sin |
Definition at line 44 of file rstransform.h.
Referenced by GetMatrix(), GetQuad(), IsAxisAligned(), and std::operator<<().
Scalar impeller::RSTransform::translate_x |
Definition at line 45 of file rstransform.h.
Referenced by GetMatrix(), GetQuad(), and std::operator<<().
Scalar impeller::RSTransform::translate_y |
Definition at line 46 of file rstransform.h.
Referenced by GetMatrix(), GetQuad(), and std::operator<<().