Developer   API   Graphics   Matrix

  •  Config(0)
  •  Properties(6)
  •  Methods(15)
  •  Events(0)

Matrix(native)

The Matrix class holds a 3x3 matrix for transforming coordinates.

Example

var bitmap = Bitmap.fromFile("dat://moscrif.jpg"); var matrix = new Matrix(); //move bitmap to the midle of screen matrix.setTranslate(System.width / 2 - bitmap.width / 2, System.height / 2 - bitmap.height / 2); //rotate bitmap to 45° matrix.preRotate(45); //draw rotated bitmap canvas.drawBitmapMatrix(bitmap, matrix);

Properties

  • scaleX : Float
    X scale
  • scaleY : Float
    Y scale
  • skewX : Float
    X skew
  • skewY : Float
    Y skew
  • translateX : Float
    X translate
  • translateY : Float
    Y translate

Methods

  • postRotate(degrees, px, py) : Boolean
    Postconcats the matrix with the specified rotation. M' = R(degrees, px, py) * M
  • postScale(sx, sy, px, py) : Boolean
    Postconcats the matrix with the specified scale. M' = S(sx, sy, px, py) * M
  • postSkew(kx, ky, px, py) : Boolean
    Postconcats the matrix with the specified skew. M' = K(kx, ky, px, py) * M
  • postTranslate(dx,dy) : Boolean
    Postconcats the matrix with the specified translation. M' = T(dx, dy) * M
  • preRotate(degrees, px, py) : Boolean
    Preconcats the matrix with the specified rotation. M' = M * R(degrees, px, py).
  • preScale(sx, sy, px, py) : Boolean
    Preconcats the matrix with the specified scale. M' = M * S(sx, sy, px, py)
  • preSkew(kx, ky, px, py) : Boolean
    Preconcats the matrix with the specified skew. M' = M * K(kx, ky, px, py)
  • preTranslate(dx, dy) : Boolean
    Preconcats the matrix with the specified translation. M' = M * T(dx, dy)
  • reset()
    Reset matrix to the matrix identity
  • setRectToRect(srcleft, srctop, srcright, srcbottom, dstleft, dsttop, dstright, dstbottom, scaleToFit) : Boolean
    Set the matrix to the scale and translate values that map the source rectangle to the destination rectangle, returning true if the the result can be represented.
  • setRotate(degrees, px, py)
    Set the matrix to rotate by the specified number of degrees around a pivot point at (px, py). The pivot point is the coordinate that should remain unchanged by the specified transformation.
  • setScale(sx, sy [,px, py])
    Set the matrix to scale by sx and sy, with a pivot point at (px, py). The pivot point is the coordinate that should remain unchanged by the specified transformation.
  • setSkew(kx, ky, px, py)
    Set the matrix to skew by sx and sy, with a pivot point at (px, py). The pivot point is the coordinate that should remain unchanged by the specified transformation.
  • setTranslate(dx, dy)
    Set the matrix to translate by (dx, dy).
  • this() : Matrix
    Object constructor creates new 3x3 matrix
API Navigation
Skip Navigation Links.
Expand <span>User Interface</span> User Interface
Expand <span>Core & System</span> Core & System
Collapse <span>Graphics</span> Graphics
Canvas
Paint
Bitmap
Typeface
Path
Matrix
Shader
ColorFilter
MaskFilter
Expand <span>Files and Databases</span> Files and Databases
Expand <span>Crypto</span> Crypto
Expand <span>Native User Interface</span> Native User Interface
Expand <span>Net</span> Net
Expand <span>Media</span> Media
Expand <span>Sensor</span> Sensor
Expand <span>Game Development</span> Game Development