roundRect method

void roundRect(
  1. num x,
  2. num y,
  3. num w,
  4. num h, [
  5. JSAny radii,
])

The CanvasRenderingContext2D.roundRect() method of the Canvas 2D API adds a rounded rectangle to the current path.

The radii of the corners can be specified in much the same way as the CSS border-radius property.

Like other methods that modify the current path, this method does not directly render anything. To draw the rounded rectangle onto a canvas, you can use the CanvasRenderingContext2D.fill or CanvasRenderingContext2D.stroke methods.

Implementation

external void roundRect(
  num x,
  num y,
  num w,
  num h, [
  JSAny radii,
]);