Commit 95c403cb authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add a 'strokeRectangle' helper function

parent 328fdff5
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -117,5 +117,24 @@ void strokeLine(
  strokePath(layer, clip, p, style);
}

void strokeRectangle(
    Layer* layer,
    double x,
    double y,
    double w,
    double h,
    const StrokeStyle& style) {
  Path p;
  p.moveTo(x, y);
  p.lineTo(x + w, y);
  p.lineTo(x + w, y + h);
  p.lineTo(x, y + h);
  p.lineTo(x, y);

  Rectangle clip(0, 0, layer->width, layer->height);
  strokePath(layer, clip, p, style);
}


} // namespace plotfx
+8 −0
Original line number Diff line number Diff line
@@ -106,5 +106,13 @@ void strokeLine(
    double y2,
    const StrokeStyle& style);

void strokeRectangle(
    Layer* layer,
    double x,
    double y,
    double w,
    double h,
    const StrokeStyle& style);

} // namespace plotfx