SkMatrix matrix; matrix.setScale(2.0f, 2.0f); // Scale by 2 in x and y SkPoint points[2] = { SkPoint::Make(10, 10), SkPoint::Make(20, 20) }; matrix.mapVectors(points, 2); // Apply the scaling transformation to the array of points // points now contains { SkPoint::Make(20, 20), SkPoint::Make(40, 40) }
SkMatrix matrix; matrix.setRotate(45); // Rotate by 45 degrees SkPoint points[2] = { SkPoint::Make(10, 10), SkPoint::Make(20, 20) }; matrix.mapVectors(points, 2); // Apply the rotation transformation to the array of points // points now contains { SkPoint::Make(0, 14), SkPoint::Make(0, 28) }
SkMatrix matrix; matrix.setTranslate(10, 10); // Translate by (10, 10) SkPoint points[2] = { SkPoint::Make(10, 10), SkPoint::Make(20, 20) }; matrix.mapVectors(points, 2); // Apply the translation transformation to the array of points // points now contains { SkPoint::Make(20, 20), SkPoint::Make(30, 30) }Package/library: SkMatrix is part of the Skia Graphics Library.