canvaskit-wasm 0.39
build 2026-04-29
PaintStyle
How a Paint interprets a shape: as a fill (interior pixels), a stroke (the outline), or both. Set via paint.setStyle(CK.PaintStyle.<value>).
const style = controls.select('style', ['Fill', 'Stroke'], 'Stroke');
const paint = new CK.Paint();
paint.setColor(CK.Color(40, 90, 180, 0.6));
paint.setStrokeWidth(8);
paint.setAntiAlias(true);
const r = CK.RRectXY(CK.LTRBRect(120, 50, 300, 200), 18, 18);
loop(() => {
paint.setStyle(CK.PaintStyle[style()]);
canvas.clear(CK.WHITE);
canvas.drawRRect(r, paint);
surface.flush();
});
All values
| Value | Notes |
|---|---|
Fill | Default. Paints the interior of the shape. |
Stroke | Outlines the shape using stroke width / cap / join / dash. |