1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:37:47 +00:00

LibGfx: Support getting a bitmap for a region of painter

This will be needed so we can apply filter effects to the backdrop
of an element in LibWeb.

This now also allows getting a crop of a bitmap in a different format
than the source bitmap. This is for if the painter's bitmap does not
have an alpha channel, but you want to ensure the cropped bitmap does.
This commit is contained in:
MacDue 2022-09-15 08:31:29 +01:00 committed by Sam Atkins
parent 978a70ddcc
commit 60356c8dde
4 changed files with 13 additions and 3 deletions

View file

@ -62,6 +62,7 @@ public:
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); }
Optional<Color> get_pixel(IntPoint const&);
ErrorOr<NonnullRefPtr<Bitmap>> get_region_bitmap(IntRect const&, BitmapFormat format, Optional<IntRect&> actual_region = {});
void draw_line(IntPoint const&, IntPoint const&, Color, int thickness = 1, LineStyle style = LineStyle::Solid, Color alternate_color = Color::Transparent);
void draw_triangle_wave(IntPoint const&, IntPoint const&, Color color, int amplitude, int thickness = 1);
void draw_quadratic_bezier_curve(IntPoint const& control_point, IntPoint const&, IntPoint const&, Color, int thickness = 1, LineStyle style = LineStyle::Solid);