// Create a SkIRect with (left=10, top=20, right=30, bottom=40) SkIRect rect = SkIRect::MakeLTRB(10, 20, 30, 40); // Get the width and height of the rectangle int width = rect.width(); int height = rect.height(); // Translate the rectangle by (dx=5, dy=10) rect.offset(5, 10);
// Create a SkIRect with (left=0, top=0, right=100, bottom=100) SkIRect rect(0, 0, 100, 100); // Check if the rectangle contains a point (x=50, y=75) bool contains = rect.contains(50, 75); // Intersect the rectangle with another rectangle (left=25, top=50, right=75, bottom=100) SkIRect intersectRect = rect.intersect(SkIRect::MakeLTRB(25, 50, 75, 100));This example creates an SkIRect with integer coordinates (0, 0) for the top-left corner and integer coordinates (100, 100) for the bottom-right corner using the constructor. It checks if the rectangle contains a point (50, 75) using the `contains` method. Finally, it intersects the rectangle with another rectangle using the `intersect` method and stores the result in `intersectRect`. Package library: Skia Graphics Library