// SPDX-License-Identifier: LGPL-3.0-or-later #pragma once #include "tool_base.h" class sweep_line_tool : public tool_base { public: sweep_line_tool(canvas_buffer &canvas); // Draw example triangle void draw(); // Compatibility for main application (only handles draw methods with one or two points) void draw(int _x, int _y); // Draw triangle provided by three given points void draw(int x0, int y0, int x1, int y1, int x2, int y2); void set_text(std::stringstream &stream); private: // Draw every pixel on the specified y coordinate, // in the interval given by the boundaries b1 and b2. // The boundaries do not need to be sorted. void draw_interval(int b1, int b2, int y); };