mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
PixelPaint: Add grayscale filter
Add a new Color category to the Filter menu. Add the Grayscale filter under Filter->Color to turn the selected layer to grey colors. Created GrayscaleFilter.h. Modify Filter.h to allow filters without parameters.
This commit is contained in:
parent
fdc9ff2ee7
commit
dd912bd351
4 changed files with 60 additions and 1 deletions
|
@ -660,6 +660,18 @@ int main(int argc, char** argv)
|
|||
}
|
||||
}));
|
||||
|
||||
auto& color_filters_menu = filter_menu.add_submenu("&Color");
|
||||
color_filters_menu.add_action(GUI::Action::create("Grayscale", [&](auto&) {
|
||||
auto* editor = current_image_editor();
|
||||
if (!editor)
|
||||
return;
|
||||
if (auto* layer = editor->active_layer()) {
|
||||
Gfx::GrayscaleFilter filter;
|
||||
filter.apply(layer->bitmap(), layer->rect(), layer->bitmap(), layer->rect());
|
||||
editor->did_complete_action();
|
||||
}
|
||||
}));
|
||||
|
||||
auto& help_menu = window->add_menu("&Help");
|
||||
help_menu.add_action(GUI::CommonActions::make_about_action("Pixel Paint", app_icon, window));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue