SkCanvas canvas; SkMatrix matrix; matrix.setScale(2.0f, 2.0f); canvas.concat(matrix); // scales drawing by a factor of 2
SkCanvas canvas; SkMatrix matrix; matrix.setRotate(45.0f); canvas.concat(matrix); // rotates drawing by 45 degreesIn this example, we create a SkCanvas object and a SkMatrix object called matrix. We then set the rotation of the matrix to 45 degrees using the setRotate() method. Finally, we concatenate the matrix with the canvas using SkCanvas::concat(), which rotates the drawing by 45 degrees. These examples use the Skia graphics library, which is typically included in Android applications but can also be used in desktop applications.