SkMatrix matrix; matrix.preTranslate(10, 10); matrix.preRotate(45); SkRect rect = SkRect::MakeLTRB(0, 0, 100, 100); matrix.mapRect(&rect);
SkMatrix matrix; matrix.preTranslate(20, 30); matrix.preScale(2, 1); SkPoint center = SkPoint::Make(50, 50); matrix.mapPoints(¢er, 1);In these examples, preTranslate() is used to apply a translation to the matrix before other transformations like preRotate() or preScale() are applied. The resulting transformation is then applied to a rectangle or a point using the mapRect() or mapPoints() method. SkMatrix is part of the Skia graphics library, which is an open-source 2D graphics library used in a variety of applications, including Google Chrome, Firefox, and Android.