SkMatrix matrix = SkMatrix::MakeIdentity(); if(matrix.isIdentity()) { std::cout << "Matrix is an identity matrix"; }
SkMatrix matrix; matrix.setScale(2, 2); // Scale by 2 in x and y direction if(matrix.isIdentity()) { std::cout << "Matrix is an identity matrix"; } else { std::cout << "Matrix is not an identity matrix"; }In this example, a matrix is created using the SkMatrix constructor and then scaled by 2 in both the x and y directions using the setScale() method. Then, the isIdentity() method is called which will return false as the matrix is no longer an identity matrix. Package library: Skia Graphics Library.