8 #ifndef SkMatrix_DEFINED
9 #define SkMatrix_DEFINED
15 #include "include/private/base/SkMacros.h"
16 #include "include/private/base/SkTo.h"
26 #define SK_SUPPORT_LEGACY_MATRIX_RECTTORECT
52 SK_BEGIN_REQUIRE_DENSE
62 constexpr
SkMatrix() :
SkMatrix(1,0,0, 0,1,0, 0,0,1, kIdentity_Mask | kRectStaysRect_Mask) {}
158 return MakeRectToRect(src, dst, mode);
182 m.
setAll(scaleX, skewX, transX, skewY, scaleY, transY, pers0, pers1, pers2);
192 kTranslate_Mask = 0x01,
195 kPerspective_Mask = 0x08,
207 if (fTypeMask & kUnknown_Mask) {
208 fTypeMask = this->computeTypeMask();
223 return this->getType() == 0;
236 return !(this->getType() & ~(kScale_Mask | kTranslate_Mask));
247 bool isTranslate()
const {
return !(this->getType() & ~(kTranslate_Mask)); }
271 if (fTypeMask & kUnknown_Mask) {
272 fTypeMask = this->computeTypeMask();
274 return (fTypeMask & kRectStaysRect_Mask) != 0;
312 return SkToBool(this->getPerspectiveTypeMaskOnly() &
352 static constexpr
int kMScaleX = 0;
353 static constexpr
int kMSkewX = 1;
354 static constexpr
int kMTransX = 2;
355 static constexpr
int kMSkewY = 3;
356 static constexpr
int kMScaleY = 4;
357 static constexpr
int kMTransY = 5;
358 static constexpr
int kMPersp0 = 6;
359 static constexpr
int kMPersp1 = 7;
360 static constexpr
int kMPersp2 = 8;
365 static constexpr
int kAScaleX = 0;
366 static constexpr
int kASkewY = 1;
367 static constexpr
int kASkewX = 2;
368 static constexpr
int kAScaleY = 3;
369 static constexpr
int kATransX = 4;
370 static constexpr
int kATransY = 5;
380 SkASSERT((
unsigned)index < 9);
392 SkASSERT((
unsigned)index < 9);
404 SkASSERT(r >= 0 && r <= 2);
405 SkASSERT(c >= 0 && c <= 2);
406 return fMat[r*3 + c];
476 SkASSERT((
unsigned)index < 9);
477 this->setTypeMask(kUnknown_Mask);
489 SkASSERT((
unsigned)index < 9);
491 this->setTypeMask(kUnknown_Mask);
564 fMat[kMScaleX] = scaleX;
565 fMat[kMSkewX] = skewX;
566 fMat[kMTransX] = transX;
567 fMat[kMSkewY] = skewY;
568 fMat[kMScaleY] = scaleY;
569 fMat[kMTransY] = transY;
570 fMat[kMPersp0] = persp0;
571 fMat[kMPersp1] = persp1;
572 fMat[kMPersp2] = persp2;
573 this->setTypeMask(kUnknown_Mask);
584 memcpy(buffer, fMat, 9 *
sizeof(
SkScalar));
1138 #ifndef SK_SUPPORT_LEGACY_MATRIX_RECTTORECT
1176 #ifndef SK_SUPPORT_LEGACY_MATRIX_RECTTORECT
1207 if (this->isIdentity()) {
1213 return this->invertNonIdentity(inverse);
1271 this->doNormalizePerspective();
1303 void mapPoints(SkPoint dst[],
const SkPoint src[],
int count)
const;
1329 this->mapPoints(pts, pts, count);
1375 this->mapXY(pt.x(), pt.y(), &result);
1417 this->mapXY(x,y, &result);
1437 SkScalar x = this->getTranslateX(),
1438 y = this->getTranslateY();
1439 if (this->hasPerspective()) {
1441 if (w) { w = 1 / w; }
1477 void mapVectors(SkVector dst[],
const SkVector src[],
int count)
const;
1503 this->mapVectors(vecs, vecs, count);
1524 SkVector vec = { dx, dy };
1525 this->mapVectors(result, &vec, 1);
1546 SkVector vec = { dx, dy };
1547 this->mapVectors(&vec, &vec, 1);
1576 return this->mapRect(rect, *rect, pc);
1587 (void)this->mapRect(&dst, src, pc);
1622 this->mapPoints(dst, 4);
1781 return Concat(a, b);
1788 this->setTypeMask(kUnknown_Mask);
1803 fMat[kMScaleX] = sx;
1805 fMat[kMTransX] = tx;
1808 fMat[kMScaleY] = sy;
1809 fMat[kMTransY] = ty;
1816 if (sx != 1 || sy != 1) {
1817 mask |= kScale_Mask;
1819 if (tx != 0.0f || ty != 0.0f) {
1820 mask |= kTranslate_Mask;
1822 if (sx != 0 && sy != 0) {
1823 mask |= kRectStaysRect_Mask;
1825 this->setTypeMask(mask);
1842 static constexpr
int kRectStaysRect_Mask = 0x10;
1847 static constexpr
int kOnlyPerspectiveValid_Mask = 0x40;
1849 static constexpr
int kUnknown_Mask = 0x80;
1851 static constexpr
int kORableMasks = kTranslate_Mask |
1856 static constexpr
int kAllMasks = kTranslate_Mask |
1860 kRectStaysRect_Mask;
1863 mutable int32_t fTypeMask;
1871 , fTypeMask(typeMask) {}
1873 static void ComputeInv(
SkScalar dst[9],
const SkScalar src[9],
double invDet,
bool isPersp);
1875 uint8_t computeTypeMask()
const;
1876 uint8_t computePerspectiveTypeMask()
const;
1878 void setTypeMask(
int mask) {
1880 SkASSERT(kUnknown_Mask == mask || (mask & kAllMasks) == mask ||
1881 ((kUnknown_Mask | kOnlyPerspectiveValid_Mask) & mask)
1882 == (kUnknown_Mask | kOnlyPerspectiveValid_Mask));
1886 void orTypeMask(
int mask) {
1887 SkASSERT((mask & kORableMasks) == mask);
1891 void clearTypeMask(
int mask) {
1893 SkASSERT((mask & kAllMasks) == mask);
1897 TypeMask getPerspectiveTypeMaskOnly()
const {
1898 if ((fTypeMask & kUnknown_Mask) &&
1899 !(fTypeMask & kOnlyPerspectiveValid_Mask)) {
1900 fTypeMask = this->computePerspectiveTypeMask();
1902 return (TypeMask)(fTypeMask & 0xF);
1908 bool isTriviallyIdentity()
const {
1909 if (fTypeMask & kUnknown_Mask) {
1912 return ((fTypeMask & 0xF) == 0);
1915 inline void updateTranslateMask() {
1916 if ((fMat[kMTransX] != 0) | (fMat[kMTransY] != 0)) {
1917 fTypeMask |= kTranslate_Mask;
1919 fTypeMask &= ~kTranslate_Mask;
1926 static MapXYProc GetMapXYProc(TypeMask mask) {
1927 SkASSERT((mask & ~kAllMasks) == 0);
1928 return gMapXYProcs[mask & kAllMasks];
1931 MapXYProc getMapXYProc()
const {
1932 return GetMapXYProc(this->getType());
1935 typedef void (*MapPtsProc)(
const SkMatrix& mat, SkPoint dst[],
1936 const SkPoint src[],
int count);
1938 static MapPtsProc GetMapPtsProc(TypeMask mask) {
1939 SkASSERT((mask & ~kAllMasks) == 0);
1940 return gMapPtsProcs[mask & kAllMasks];
1943 MapPtsProc getMapPtsProc()
const {
1944 return GetMapPtsProc(this->getType());
1947 [[nodiscard]]
bool invertNonIdentity(
SkMatrix* inverse)
const;
1949 static bool Poly2Proc(
const SkPoint[],
SkMatrix*);
1950 static bool Poly3Proc(
const SkPoint[],
SkMatrix*);
1951 static bool Poly4Proc(
const SkPoint[],
SkMatrix*);
1961 static const MapXYProc gMapXYProcs[];
1963 static void Identity_pts(
const SkMatrix&, SkPoint[],
const SkPoint[],
int);
1964 static void Trans_pts(
const SkMatrix&, SkPoint dst[],
const SkPoint[],
int);
1965 static void Scale_pts(
const SkMatrix&, SkPoint dst[],
const SkPoint[],
int);
1966 static void ScaleTrans_pts(
const SkMatrix&, SkPoint dst[],
const SkPoint[],
1968 static void Persp_pts(
const SkMatrix&, SkPoint dst[],
const SkPoint[],
int);
1970 static void Affine_vpts(
const SkMatrix&, SkPoint dst[],
const SkPoint[],
int);
1972 static const MapPtsProc gMapPtsProcs[];
1975 size_t writeToMemory(
void* buffer)
const;
1984 size_t readFromMemory(
const void* buffer,
size_t length);
1987 bool postIDiv(
int divx,
int divy);
1988 void doNormalizePerspective();
1990 friend class SkPerspIter;
1991 friend class SkMatrixPriv;
1992 friend class SerializationTest;
1994 SK_END_REQUIRE_DENSE
SkApplyPerspectiveClip
When we transform points through a matrix containing perspective (the bottom row is something other t...
Definition: SkMatrix.h:34
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
static bool SkScalarsAreFinite(SkScalar a, SkScalar b)
Definition: SkScalar.h:70
#define SK_ScalarNearlyZero
Definition: SkScalar.h:111
#define SkRadiansToDegrees(radians)
Definition: SkScalar.h:90
float SkScalar
Definition: SkScalar.h:14
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
static const SkMatrix & InvalidMatrix()
Returns reference to a const SkMatrix with invalid values.
SkMatrix & set(int index, SkScalar value)
Sets SkMatrix value.
Definition: SkMatrix.h:488
SkScalar mapRadius(SkScalar radius) const
Returns geometric mean radius of ellipse formed by constructing circle of size radius,...
SkMatrix & postSkew(SkScalar kx, SkScalar ky)
Sets SkMatrix to SkMatrix constructed from skewing by (kx, ky) about pivot point (0,...
SkMatrix & setSkewY(SkScalar v)
Sets vertical skew factor.
Definition: SkMatrix.h:511
SkMatrix & postRotate(SkScalar degrees)
Sets SkMatrix to SkMatrix constructed from rotating by degrees about pivot point (0,...
static const SkMatrix & I()
Returns reference to const identity SkMatrix.
SkScalar getPerspY() const
Returns factor scaling input y-axis relative to input x-axis.
Definition: SkMatrix.h:463
SkMatrix & setRSXform(const SkRSXform &rsxForm)
Sets SkMatrix to rotate, scale, and translate using a compressed matrix form.
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
Returns SkMatrix set to scale and translate src to dst.
Definition: SkMatrix.h:156
SkMatrix & setScale(SkScalar sx, SkScalar sy)
Sets SkMatrix to scale by sx and sy about at pivot point at (0, 0).
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
Sets all values from parameters.
Definition: SkMatrix.h:561
bool getMinMaxScales(SkScalar scaleFactors[2]) const
Sets scaleFactors[0] to the minimum scaling factor, and scaleFactors[1] to the maximum scaling factor...
void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint src[], int count) const
Returns homogeneous points, starting with 2D src points (with implied w = 1).
static SkMatrix RotateDeg(SkScalar deg)
Sets SkMatrix to rotate by |deg| about a pivot point at (0, 0).
Definition: SkMatrix.h:103
SkScalar getSkewY() const
Returns scale factor multiplied by x-axis input, contributing to y-axis output.
Definition: SkMatrix.h:429
void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const
Maps src SkPoint3 array of length count to dst SkPoint3 array, which must of length count or greater.
SkMatrix & setPerspY(SkScalar v)
Sets input y-axis perspective factor, which causes mapXY() to vary input y-axis values inversely prop...
Definition: SkMatrix.h:543
static SkMatrix RotateRad(SkScalar rad)
Definition: SkMatrix.h:113
void mapVectors(SkVector dst[], const SkVector src[], int count) const
Maps src vector array of length count to vector SkPoint array of equal or greater length.
static SkMatrix Translate(SkIVector t)
Definition: SkMatrix.h:96
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Sets SkMatrix to translate by (dx, dy).
Definition: SkMatrix.h:90
SkMatrix & setSkewX(SkScalar v)
Sets horizontal skew factor.
Definition: SkMatrix.h:517
void mapVectors(SkVector vecs[], int count) const
Maps vecs vector array of length count in place, multiplying each vector by SkMatrix,...
Definition: SkMatrix.h:1502
SkMatrix & preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from scaling by (sx, sy) about pivot poi...
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
Sets SkMatrix to rotate by degrees about a pivot point at (px, py).
SkScalar getTranslateY() const
Returns translation contributing to y-axis output.
Definition: SkMatrix.h:451
ScaleToFit
Definition: SkMatrix.h:135
@ kStart_ScaleToFit
scales and aligns to left and top
Definition: SkMatrix.h:137
@ kEnd_ScaleToFit
scales and aligns to right and bottom
Definition: SkMatrix.h:139
@ kCenter_ScaleToFit
scales and aligns to center
Definition: SkMatrix.h:138
@ kFill_ScaleToFit
scales in x and y to fill destination SkRect
Definition: SkMatrix.h:136
static void SetAffineIdentity(SkScalar affine[6])
Fills affine with identity values in column major order.
constexpr SkMatrix()
Creates an identity SkMatrix:
Definition: SkMatrix.h:62
SkScalar rc(int r, int c) const
Returns one matrix value from a particular row/column.
Definition: SkMatrix.h:403
void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty)
Initializes SkMatrix with scale and translate elements.
Definition: SkMatrix.h:1802
bool preservesRightAngles(SkScalar tol=SK_ScalarNearlyZero) const
Returns true if SkMatrix contains only translation, rotation, reflection, and scale.
void dump() const
Writes text representation of SkMatrix to standard output.
bool asAffine(SkScalar affine[6]) const
Fills affine in column major order.
SkMatrix & postScale(SkScalar sx, SkScalar sy)
Sets SkMatrix to SkMatrix constructed from scaling by (sx, sy) about pivot point (0,...
SkPoint mapPoint(SkPoint pt) const
Returns SkPoint pt multiplied by SkMatrix.
Definition: SkMatrix.h:1373
SkMatrix & reset()
Sets SkMatrix to identity; which has no effect on mapped SkPoint.
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
Maps src SkPoint array of length count to dst SkPoint array of equal or greater length.
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Sets SkMatrix to SkMatrix constructed from scaling by (sx, sy) about pivot point (px,...
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
Sets SkMatrix to:
Definition: SkMatrix.h:178
void mapPoints(SkPoint pts[], int count) const
Maps pts SkPoint array of length count in place.
Definition: SkMatrix.h:1328
SkMatrix & preRotate(SkScalar degrees)
Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from rotating by degrees about pivot poi...
SkMatrix & preSkew(SkScalar kx, SkScalar ky)
Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from skewing by (kx, ky) about pivot poi...
SkMatrix & setIdentity()
Sets SkMatrix to identity; which has no effect on mapped SkPoint.
Definition: SkMatrix.h:625
SkMatrix & setTranslate(const SkVector &v)
Sets SkMatrix to translate by (v.fX, v.fY).
Definition: SkMatrix.h:638
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Sets SkMatrix to scale by sx and sy, about a pivot point at (px, py).
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
Returns SkMatrix a multiplied by SkMatrix b.
Definition: SkMatrix.h:1774
SkMatrix & preSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from skewing by (kx, ky) about pivot poi...
friend SK_API bool operator!=(const SkMatrix &a, const SkMatrix &b)
Compares a and b; returns true if a and b are not numerically equal.
Definition: SkMatrix.h:1666
SkMatrix & setRotate(SkScalar degrees)
Sets SkMatrix to rotate by degrees about a pivot point at (0, 0).
SkScalar getSkewX() const
Returns scale factor multiplied by y-axis input, contributing to x-axis output.
Definition: SkMatrix.h:437
bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count)
Sets SkMatrix to map src to dst.
friend SK_API bool operator==(const SkMatrix &a, const SkMatrix &b)
Compares a and b; returns true if a and b are numerically equal.
SkMatrix & setTranslateY(SkScalar v)
Sets vertical translation.
Definition: SkMatrix.h:529
bool invert(SkMatrix *inverse) const
Sets inverse to reciprocal matrix, returning true if SkMatrix can be inverted.
Definition: SkMatrix.h:1205
SkMatrix & preScale(SkScalar sx, SkScalar sy)
Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from scaling by (sx, sy) about pivot poi...
bool isTranslate() const
Returns true if SkMatrix is identity, or translates.
Definition: SkMatrix.h:247
void mapXY(SkScalar x, SkScalar y, SkPoint *result) const
Maps SkPoint (x, y) to result.
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
Sets SkMatrix to SkMatrix constructed from translation (dx, dy) multiplied by SkMatrix.
bool rectStaysRect() const
Returns true SkMatrix maps SkRect to another SkRect.
Definition: SkMatrix.h:270
SkScalar & operator[](int index)
Returns writable SkMatrix value.
Definition: SkMatrix.h:475
bool mapRect(SkRect *rect, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Sets rect to bounds of rect corners mapped by SkMatrix.
Definition: SkMatrix.h:1575
static SkMatrix RotateDeg(SkScalar deg, SkPoint pt)
Definition: SkMatrix.h:108
SkScalar getScaleX() const
Returns scale factor multiplied by x-axis input, contributing to x-axis output.
Definition: SkMatrix.h:414
SkScalar getMinScale() const
Returns the minimum scaling factor of SkMatrix by decomposing the scaling and skewing elements.
SkMatrix & postSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
Sets SkMatrix to SkMatrix constructed from skewing by (kx, ky) about pivot point (px,...
SkMatrix & setPerspX(SkScalar v)
Sets input x-axis perspective factor, which causes mapXY() to vary input x-axis values inversely prop...
Definition: SkMatrix.h:536
SkMatrix & setScaleX(SkScalar v)
Sets horizontal scale factor.
Definition: SkMatrix.h:499
bool decomposeScale(SkSize *scale, SkMatrix *remaining=nullptr) const
Decomposes SkMatrix into scale components and whatever remains.
SkMatrix & preConcat(const SkMatrix &other)
Sets SkMatrix to SkMatrix multiplied by SkMatrix other.
void get9(SkScalar buffer[9]) const
Copies nine scalar values contained by SkMatrix into buffer, in member value ascending order: kMScale...
Definition: SkMatrix.h:583
SkRect mapRect(const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Returns bounds of src corners mapped by SkMatrix.
Definition: SkMatrix.h:1584
void mapRectScaleTranslate(SkRect *dst, const SkRect &src) const
Sets dst to bounds of src corners mapped by SkMatrix.
SkScalar getScaleY() const
Returns scale factor multiplied by y-axis input, contributing to y-axis output.
Definition: SkMatrix.h:421
SkPoint mapOrigin() const
Returns (0, 0) multiplied by SkMatrix.
Definition: SkMatrix.h:1436
static SkMatrix MakeRectToRect(const SkRect &src, const SkRect &dst, ScaleToFit stf)
Returns SkMatrix set to scale and translate src SkRect to dst SkRect.
Definition: SkMatrix.h:1171
bool isScaleTranslate() const
Returns true if SkMatrix at most scales and translates.
Definition: SkMatrix.h:235
SkScalar operator[](int index) const
Returns one matrix value.
Definition: SkMatrix.h:379
void normalizePerspective()
A matrix is categorized as 'perspective' if the bottom row is not [0, 0, 1].
Definition: SkMatrix.h:1269
SkMatrix & setScaleY(SkScalar v)
Sets vertical scale factor.
Definition: SkMatrix.h:505
SkMatrix & preRotate(SkScalar degrees, SkScalar px, SkScalar py)
Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from rotating by degrees about pivot poi...
SkScalar getMaxScale() const
Returns the maximum scaling factor of SkMatrix by decomposing the scaling and skewing elements.
SkMatrix & set9(const SkScalar buffer[9])
Sets SkMatrix to nine scalar values in buffer, in member value ascending order: kMScaleX,...
SkVector mapVector(SkScalar dx, SkScalar dy) const
Returns vector (dx, dy) multiplied by SkMatrix, treating SkMatrix translation as zero.
Definition: SkMatrix.h:1545
SkMatrix & preTranslate(SkScalar dx, SkScalar dy)
Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from translation (dx,...
bool hasPerspective() const
Returns true if the matrix contains perspective elements.
Definition: SkMatrix.h:311
SkPoint mapXY(SkScalar x, SkScalar y) const
Returns SkPoint (x, y) multiplied by SkMatrix.
Definition: SkMatrix.h:1415
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
Sets SkMatrix to translate by (dx, dy).
SkMatrix & setAffine(const SkScalar affine[6])
Sets SkMatrix to affine values, passed in column major order.
bool isFinite() const
Returns true if all elements of the matrix are finite.
Definition: SkMatrix.h:1833
friend SkMatrix operator*(const SkMatrix &a, const SkMatrix &b)
Definition: SkMatrix.h:1780
SkScalar get(int index) const
Returns one matrix value.
Definition: SkMatrix.h:391
bool setRectToRect(const SkRect &src, const SkRect &dst, ScaleToFit stf)
Sets SkMatrix to scale and translate src SkRect to dst SkRect.
SkMatrix & setSkew(SkScalar kx, SkScalar ky)
Sets SkMatrix to skew by kx and ky, about a pivot point at (0, 0).
bool preservesAxisAlignment() const
Returns true SkMatrix maps SkRect to another SkRect.
Definition: SkMatrix.h:298
SkScalar getPerspX() const
Returns factor scaling input x-axis relative to input y-axis.
Definition: SkMatrix.h:457
bool isSimilarity(SkScalar tol=SK_ScalarNearlyZero) const
Returns true if SkMatrix contains only translation, rotation, reflection, and uniform scale.
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Sets SkMatrix to scale by (sx, sy).
Definition: SkMatrix.h:74
SkMatrix & postConcat(const SkMatrix &other)
Sets SkMatrix to SkMatrix other multiplied by SkMatrix.
static SkMatrix Skew(SkScalar kx, SkScalar ky)
Sets SkMatrix to skew by (kx, ky) about pivot point (0, 0).
Definition: SkMatrix.h:123
SkMatrix & postRotate(SkScalar degrees, SkScalar px, SkScalar py)
Sets SkMatrix to SkMatrix constructed from rotating by degrees about pivot point (px,...
SkMatrix & setSinCos(SkScalar sinValue, SkScalar cosValue)
Sets SkMatrix to rotate by sinValue and cosValue, about a pivot point at (0, 0).
SkMatrix & setTranslateX(SkScalar v)
Sets horizontal translation.
Definition: SkMatrix.h:523
SkMatrix & setSinCos(SkScalar sinValue, SkScalar cosValue, SkScalar px, SkScalar py)
Sets SkMatrix to rotate by sinValue and cosValue, about a pivot point at (px, py).
SkMatrix & setConcat(const SkMatrix &a, const SkMatrix &b)
Sets SkMatrix to SkMatrix a multiplied by SkMatrix b.
SkMatrix & setSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
Sets SkMatrix to skew by kx and ky, about a pivot point at (px, py).
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Sets dst to bounds of src corners mapped by SkMatrix.
static SkMatrix Translate(SkVector t)
Definition: SkMatrix.h:95
SkScalar getTranslateX() const
Returns translation contributing to x-axis output.
Definition: SkMatrix.h:444
TypeMask
Definition: SkMatrix.h:190
void mapVector(SkScalar dx, SkScalar dy, SkVector *result) const
Maps vector (dx, dy) to result.
Definition: SkMatrix.h:1523
TypeMask getType() const
Returns a bit field describing the transformations the matrix may perform.
Definition: SkMatrix.h:206
bool isIdentity() const
Returns true if SkMatrix is identity.
Definition: SkMatrix.h:222
void dirtyMatrixTypeCache()
Sets internal cache to unknown state.
Definition: SkMatrix.h:1787
void mapRectToQuad(SkPoint dst[4], const SkRect &rect) const
Maps four corners of rect to dst.
Definition: SkMatrix.h:1619
Definition: SkPoint3.h:14
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
void toQuad(SkPoint quad[4]) const
Returns four points in quad that enclose SkRect ordered as: top-left, top-right, bottom-right,...