Class description

Essentially a float array of size 9 with matrix manipulation methods on the array (all methods eventually call the underlying C implementation)

show

Default construction (scaleX, scaleY, PerSP2 1.0, others 0)

val m = Matrix()
Copy the code

Copy construction (deep copy)

val m = Matrix(oldMatrix)
Copy the code

Method statement

Set (all set-related methods reset the matrix array, so only the last call is valid)

matrix.setTranslate(xt,yt)// Shift value (xt: x shift, yt:y shift)
matrix.setScale(xs,ys)// Scale value (xs: x scale, ys:y scale)
matrix.setScale(xs,ys,cx,cy)Cx :x axis zoom center point, cy:y axis zoom center point)
matrix.setValues(values)// All values (values:float array, applicable to panned values, scaled values, etc.)
Copy the code

Post (after multiplication matrix: newM*M)

translation
matrix.postTranslate(dx,dy)
Copy the code

The zoom
matrix.postScale(sx,sy)
Copy the code

Center scale
matrix.postScale(sx,sy,px,py)//px,py is the center point before scaling
Copy the code

The actual combination is the following

matrix.postTranslate(-px,-py)
matrix.postScale(sx,sy)
matrix.postTranslate(px,py)
Copy the code

Pre (front multiplication matrix: M*newM)

translation
matrix.preTranslate(dx,dy)
Copy the code

The zoom
matrix.preScale(sx,sy)
Copy the code

Center scale
matrix.preScale(sx,sy,px,py)//px,py is the center point before scaling
Copy the code

The actual combination is the following

matrix.preTranslate(px,py)
matrix.preScale(sx,sy)
matrix.preTranslate(-px,-py)
Copy the code