1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:57:35 +00:00

LibGfx: Implement filling paths

There are some imperfections with intersecting edges (because the main
algorithm used is scanline, and that is not geared towards drawing
complex shapes), however, it behaves mostly fine for normal use :^)
This commit is contained in:
AnotherTest 2020-05-06 11:55:12 +04:30 committed by Andreas Kling
parent 4d20cf57db
commit f54b41f748
5 changed files with 274 additions and 8 deletions

View file

@ -71,8 +71,17 @@ public:
void draw_emoji(const Point&, const Gfx::Bitmap&, const Font&);
void draw_glyph_or_emoji(const Point&, u32 codepoint, const Font&, Color);
static void for_each_line_segment_on_bezier_curve(const FloatPoint& control_point, const FloatPoint& p1, const FloatPoint& p2, Function<void(const FloatPoint&, const FloatPoint&)>&);
static void for_each_line_segment_on_bezier_curve(const FloatPoint& control_point, const FloatPoint& p1, const FloatPoint& p2, Function<void(const FloatPoint&, const FloatPoint&)>&&);
void stroke_path(const Path&, Color, int thickness);
enum class WindingRule {
Nonzero,
EvenOdd,
};
void fill_path(Path&, Color, WindingRule rule = WindingRule::Nonzero);
const Font& font() const { return *state().font; }
void set_font(const Font& font) { state().font = &font; }