How to convert a Python Cairo matrix into Android Canvas Matrix?
<p>Matrix in cairo graphics module in python is described as </p>

<pre><code>cairo.Matrix(xx = 1.0, yx = 0.0, xy = 0.0, yy = 1.0, x0 = 0.0, y0 = 0.0)
</code></pre>

<p>In Andorid's Canvas, Matrix is defined as,</p>

<blockquote>
  <p>The Matrix class holds a 3x3 matrix for transforming coordinates.</p>
</blockquote>

<p>If those 6 affine transformation values (xx ,yx, xy, yy, x0, y0) are given, how those can be fit into 9 valued an Android's Matrix?</p>

<p>6 valued PyCairo Matrix can be mapped into 9 valued Android Matrix as followed,</p>

<pre><code>android.graphics.Matrix() matrix = new android.graphics.Matrix();
matrix.setValues(new float[] {xx, xy, x0, yx, yy, y0, 0F, 0F, 1F});
</code></pre>

<p>In terms of Matrix mathematics, the mapping is actually looked like this,</p>

<pre><code>| xx xy x0 |
| yx yy y0 |
| 0   0  1 |
</code></pre>

android python matrix transformation cairo