LibGUI: Add drawing triangle from coordinate list
This commit is contained in:
parent
dafea57fe2
commit
b3d1fa4c54
Notes:
sideshowbarker
2024-07-17 10:04:24 +09:00
Author: https://github.com/frhun Commit: https://github.com/SerenityOS/serenity/commit/b3d1fa4c54 Pull-request: https://github.com/SerenityOS/serenity/pull/14282 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/MacDue
2 changed files with 7 additions and 0 deletions
Userland/Libraries/LibGfx
|
@ -671,6 +671,12 @@ void Painter::draw_bitmap(IntPoint const& p, GlyphBitmap const& bitmap, Color co
|
|||
}
|
||||
}
|
||||
|
||||
void Painter::draw_triangle(IntPoint const& offset, Span<IntPoint const> control_points, Color color)
|
||||
{
|
||||
VERIFY(control_points.size() == 3);
|
||||
draw_triangle(control_points[0] + offset, control_points[1] + offset, control_points[2] + offset, color);
|
||||
}
|
||||
|
||||
void Painter::draw_triangle(IntPoint const& a, IntPoint const& b, IntPoint const& c, Color color)
|
||||
{
|
||||
IntPoint p0(to_physical(a));
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
void draw_scaled_bitmap(IntRect const& dst_rect, Gfx::Bitmap const&, IntRect const& src_rect, float opacity = 1.0f, ScalingMode = ScalingMode::NearestNeighbor);
|
||||
void draw_scaled_bitmap(IntRect const& dst_rect, Gfx::Bitmap const&, FloatRect const& src_rect, float opacity = 1.0f, ScalingMode = ScalingMode::NearestNeighbor);
|
||||
void draw_triangle(IntPoint const&, IntPoint const&, IntPoint const&, Color);
|
||||
void draw_triangle(IntPoint const& offset, Span<IntPoint const>, Color);
|
||||
void draw_ellipse_intersecting(IntRect const&, Color, int thickness = 1);
|
||||
void set_pixel(IntPoint const&, Color, bool blend = false);
|
||||
void set_pixel(int x, int y, Color color, bool blend = false) { set_pixel({ x, y }, color, blend); }
|
||||
|
|
Loading…
Add table
Reference in a new issue