@Properties(inherit=Skia.class) public class sk_matrix_t extends Pointer
(X,Y) = T[M]((x,y)) X = (M[0] * x + M[1] * y + M[2]) / (M[6] * x + M[7] * y + M[8]); Y = (M[3] * x + M[4] * y + M[5]) / (M[6] * x + M[7] * y + M[8]);
Therefore, the identity matrix is
sk_matrix_t identity = {{1, 0, 0, 0, 1, 0, 0, 0, 1}};
A matrix that scales by sx and sy is:
sk_matrix_t scale = {{sx, 0, 0, 0, sy, 0, 0, 0, 1}};
A matrix that translates by tx and ty is:
sk_matrix_t translate = {{1, 0, tx, 0, 1, ty, 0, 0, 1}};
A matrix that rotates around the origin by A radians:
sk_matrix_t rotate = {{cos(A), -sin(A), 0, sin(A), cos(A), 0, 0, 0, 1}};
Two matrixes can be concatinated by:
void concat_matrices(sk_matrix_t* dst, const sk_matrix_t* matrixU, const sk_matrix_t* matrixV) { const float* u = matrixU->mat; const float* v = matrixV->mat; sk_matrix_t result = {{ u[0] * v[0] + u[1] * v[3] + u[2] * v[6], u[0] * v[1] + u[1] * v[4] + u[2] * v[7], u[0] * v[2] + u[1] * v[5] + u[2] * v[8], u[3] * v[0] + u[4] * v[3] + u[5] * v[6], u[3] * v[1] + u[4] * v[4] + u[5] * v[7], u[3] * v[2] + u[4] * v[5] + u[5] * v[8], u[6] * v[0] + u[7] * v[3] + u[8] * v[6], u[6] * v[1] + u[7] * v[4] + u[8] * v[7], u[6] * v[2] + u[7] * v[5] + u[8] * v[8] }}; dst = result; }
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter| Constructor and Description |
|---|
sk_matrix_t()
Default native constructor.
|
sk_matrix_t(long size)
Native array allocator.
|
sk_matrix_t(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
float |
persp0() |
sk_matrix_t |
persp0(float setter) |
float |
persp1() |
sk_matrix_t |
persp1(float setter) |
float |
persp2() |
sk_matrix_t |
persp2(float setter) |
sk_matrix_t |
position(long position) |
float |
scaleX() |
sk_matrix_t |
scaleX(float setter) |
float |
scaleY() |
sk_matrix_t |
scaleY(float setter) |
float |
skewX() |
sk_matrix_t |
skewX(float setter) |
float |
skewY() |
sk_matrix_t |
skewY(float setter) |
float |
transX() |
sk_matrix_t |
transX(float setter) |
float |
transY() |
sk_matrix_t |
transY(float setter) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic sk_matrix_t()
public sk_matrix_t(long size)
Pointer.position(long).public sk_matrix_t(Pointer p)
Pointer.Pointer(Pointer).public sk_matrix_t position(long position)
public float scaleX()
public sk_matrix_t scaleX(float setter)
public float skewX()
public sk_matrix_t skewX(float setter)
public float transX()
public sk_matrix_t transX(float setter)
public float skewY()
public sk_matrix_t skewY(float setter)
public float scaleY()
public sk_matrix_t scaleY(float setter)
public float transY()
public sk_matrix_t transY(float setter)
public float persp0()
public sk_matrix_t persp0(float setter)
public float persp1()
public sk_matrix_t persp1(float setter)
public float persp2()
public sk_matrix_t persp2(float setter)
Copyright © 2020. All rights reserved.