strokeRect method

  1. @override
void strokeRect(
  1. num x,
  2. num y,
  3. num width,
  4. num height,
  5. PStyle style,
)
override

Stroke a rectangle (x,y , width x height).

Implementation

@override
void strokeRect(num x, num y, num width, num height, PStyle style) {
  if (width == 1 || height == 1) {
    fillRect(x, y, width, height, style);
    return;
  }

  x = transform.x(x);
  y = transform.y(y);

  x = canvasX(x);
  y = canvasY(y);
  width = canvasX(width);
  height = canvasY(height);

  if (width <= 0 || height <= 0) return;

  final size = _setStrokeStyle(style);

  if (size % 2 != 0) {
    x += 0.5;
    y += 0.5;
    --width;
    --height;
  }

  //_ctx.strokeRect(x + 0.5, y + 0.5, width - 1, height - 1);

  _ctx.strokeRect(x, y, width, height);
}