Win an Ipad
  Developer   Documents   Matrix

Matrix

This article explains how rotation of graphic object can be changed in Moscrif.

Matrix


Matrix class holds a 3D matrix for transforming coordinates. It is used for x and y transformation, rotation, scaling and skewing graphic objects.

 

Example of how to rotate bitmap graphic to 45 degree:

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

 MaskFilter   Matrix   Bitmap graphics 
Write a Comment (0)
Subject
Please complete this mandatory field.
HTML Tags Not Allowed!
Comment
Please complete this mandatory field.