mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
PixelPaint: Start using Editing-Masks for some tools
This patch starts to integrate the usage of Editing-Masks for the following tools: Spray-Tool, Brush-Tool and Erase-Tool
This commit is contained in:
parent
0a120e239a
commit
d9d9103cbb
3 changed files with 4 additions and 3 deletions
|
@ -34,6 +34,7 @@ void EraseTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint
|
|||
int radius = size() / 2;
|
||||
Gfx::IntRect rect { point.x() - radius, point.y() - radius, size(), size() };
|
||||
GUI::Painter painter(bitmap);
|
||||
// FIXME: Currently this mode does not respect the editing mask if present.
|
||||
painter.clear_rect(rect, color);
|
||||
} else {
|
||||
for (int y = point.y() - size(); y < point.y() + size(); y++) {
|
||||
|
@ -47,7 +48,7 @@ void EraseTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint
|
|||
auto old_color = bitmap.get_pixel(x, y);
|
||||
auto falloff = get_falloff(distance);
|
||||
auto new_color = old_color.interpolate(color, falloff);
|
||||
bitmap.set_pixel(x, y, new_color);
|
||||
set_pixel_with_possible_mask(x, y, new_color, bitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue