SkRect rect = SkRect::MakeLTRB(10, 20, 30, 40); SkMatrix mat = // define the new coordinate system SkRect newRect; mat.mapRect(&newRect, rect);
SkRect rect = SkRect::MakeLTRB(10, 20, 30, 40); SkMatrix mat; mat.setScale(2, 2); // scale by a factor of 2 SkRect newRect; mat.mapRect(&newRect, rect);In this example, we define a new SkMatrix object mat using the setScale method, which takes two arguments representing the x and y scaling factors. We then apply the scaling transformation to the rectangle by calling mapRect with the pointer to the rectangle to be transformed, and the SkMatrix object representing the transformation. Package Library: Skia Library.