Commit b7a9a880 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add fillRectangle helper method

parent 5e203ca7
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -130,6 +130,23 @@ void strokeRectangle(
  strokePath(layer, clip, p, style);
}

void fillRectangle(
    Layer* layer,
    const Point& origin,
    double width,
    double height,
    const FillStyle& style) {
  Path p;
  p.moveTo(origin.x, origin.y);
  p.lineTo(origin.x + width, origin.y);
  p.lineTo(origin.x + width, origin.y + height);
  p.lineTo(origin.x, origin.y + height);
  p.lineTo(origin.x, origin.y);

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


} // namespace plotfx
+7 −0
Original line number Diff line number Diff line
@@ -110,5 +110,12 @@ void strokeRectangle(
    double height,
    const StrokeStyle& style);

void fillRectangle(
    Layer* layer,
    const Point& origin,
    double width,
    double height,
    const FillStyle& style);

} // namespace plotfx