canvaskit-wasm 0.39 build 2026-04-29

IRect

IRect is the integer-pixel variant of Rect: an Int32Array of [left, top, right, bottom]. Used by APIs that operate on whole pixels, mostly readPixels / writePixels and Canvas.getDeviceClipBounds.

Build with CK.LTRBiRect(l, t, r, b) or CK.XYWHiRect(x, y, w, h).

const region = CK.LTRBiRect(60, 50, 360, 200); const paint = new CK.Paint(); paint.setColor(CK.Color(40, 90, 180, 0.5)); paint.setAntiAlias(true); canvas.clear(CK.WHITE); // drawRect accepts both Rect and IRect — though for vector drawing you'd // normally use Rect. IRect mostly shines on the readback path. canvas.drawRect(region, paint); surface.flush(); paint.delete();

The right / bottom edges are exclusive (the rect covers [left, right) × [top, bottom)).

See also