canvaskit-wasm 0.39 build 2026-04-29

RRect

RRect is a Float32Array of 12 floats: [left, top, right, bottom, rx0, ry0, rx1, ry1, rx2, ry2, rx3, ry3]. The four (rxN, ryN) pairs are the corner radii in order top-left, top-right, bottom-right, bottom-left. Each corner can have independent x and y radii, which gives elliptical rounding.

Like Rect, it's a plain typed array — no allocation, no delete().

const uniform = CK.RRectXY(CK.LTRBRect(60, 40, 200, 210), 24, 24); // Build a per-corner RRect by hand. const perCorner = new Float32Array([ 220, 40, 360, 210, // l, t, r, b 0, 0, // top-left (sharp) 40, 40, // top-right (round) 0, 0, // bottom-right (sharp) 60, 16, // bottom-left (elliptical) ]); const paint = new CK.Paint(); paint.setColor(CK.Color(40, 90, 180, 0.4)); paint.setAntiAlias(true); canvas.clear(CK.WHITE); canvas.drawRRect(uniform, paint); canvas.drawRRect(perCorner, paint); surface.flush(); paint.delete();

Helpers

  • CK.RRectXY(rect, rx, ry) — uniform radii on all four corners.
  • Manual: build a Float32Array(12) with explicit per-corner values when you want each corner different.

See also