PixelPaint: Add more icons

This adds menu item icons for Add Mask, Flatten Image, Fit Image To
View, and Generic 5x5 Convolution.

This modifies the menu item icon for Swap Colors to make the action more
obvious and improve accessibility.
This commit is contained in:
electrikmilk 2022-08-23 19:26:06 -04:00 committed by Andreas Kling
parent 07a7d3e136
commit 1a9d4ffecf
Notes: sideshowbarker 2024-07-17 07:49:17 +09:00
8 changed files with 12 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 153 B

View file

@ -22,6 +22,7 @@ ErrorOr<IconBag> IconBag::try_create()
icon_bag.default_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/default-colors.png"sv));
icon_bag.load_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/load-color-palette.png"sv));
icon_bag.save_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/save-color-palette.png"sv));
icon_bag.fit_image_to_view = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/fit-image-to-view.png"sv));
icon_bag.add_guide = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-guide.png"sv));
icon_bag.clear_guides = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/clear-guides.png"sv));
icon_bag.edit_flip_vertical = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv));
@ -36,11 +37,14 @@ ErrorOr<IconBag> IconBag::try_create()
icon_bag.active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-up.png"sv));
icon_bag.active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-down.png"sv));
icon_bag.delete_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv));
icon_bag.flatten_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/flatten-image.png"sv));
icon_bag.merge_visible = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-visible.png"sv));
icon_bag.merge_active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-up.png"sv));
icon_bag.merge_active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-down.png"sv));
icon_bag.filter = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png"sv));
icon_bag.generic_5x5_convolution = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/generic-5x5-convolution.png"sv));
icon_bag.levels = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/levels.png"sv));
icon_bag.add_mask = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-mask.png"sv));
return icon_bag;
}

View file

@ -23,6 +23,7 @@ struct IconBag final {
RefPtr<Gfx::Bitmap> default_colors { nullptr };
RefPtr<Gfx::Bitmap> load_color_palette { nullptr };
RefPtr<Gfx::Bitmap> save_color_palette { nullptr };
RefPtr<Gfx::Bitmap> fit_image_to_view { nullptr };
RefPtr<Gfx::Bitmap> add_guide { nullptr };
RefPtr<Gfx::Bitmap> clear_guides { nullptr };
RefPtr<Gfx::Bitmap> edit_flip_vertical { nullptr };
@ -37,10 +38,13 @@ struct IconBag final {
RefPtr<Gfx::Bitmap> active_layer_up { nullptr };
RefPtr<Gfx::Bitmap> active_layer_down { nullptr };
RefPtr<Gfx::Bitmap> delete_layer { nullptr };
RefPtr<Gfx::Bitmap> flatten_image { nullptr };
RefPtr<Gfx::Bitmap> merge_visible { nullptr };
RefPtr<Gfx::Bitmap> merge_active_layer_up { nullptr };
RefPtr<Gfx::Bitmap> merge_active_layer_down { nullptr };
RefPtr<Gfx::Bitmap> filter { nullptr };
RefPtr<Gfx::Bitmap> generic_5x5_convolution { nullptr };
RefPtr<Gfx::Bitmap> levels { nullptr };
RefPtr<Gfx::Bitmap> add_mask { nullptr };
};
}

View file

@ -450,7 +450,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
m_view_menu->add_action(*m_zoom_out_action);
m_view_menu->add_action(*m_reset_zoom_action);
m_view_menu->add_action(GUI::Action::create(
"Fit Image To &View", [&](auto&) {
"Fit Image To &View", g_icon_bag.fit_image_to_view, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
editor->fit_image_to_view();
@ -594,7 +594,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
m_layer_menu->add_separator();
m_layer_menu->add_action(GUI::Action::create(
"Add M&ask", { Mod_Ctrl | Mod_Shift, Key_M }, nullptr, [&](auto&) {
"Add M&ask", { Mod_Ctrl | Mod_Shift, Key_M }, g_icon_bag.add_mask, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
auto active_layer = editor->active_layer();
@ -691,7 +691,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
};
m_layer_menu->add_separator();
m_layer_menu->add_action(GUI::Action::create(
"Fl&atten Image", { Mod_Ctrl, Key_F }, [&](auto&) {
"Fl&atten Image", { Mod_Ctrl, Key_F }, g_icon_bag.flatten_image, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
editor->image().flatten_all_layers();
@ -784,7 +784,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
}));
m_filter_menu->add_separator();
m_filter_menu->add_action(GUI::Action::create("Generic 5x5 &Convolution", [&](auto&) {
m_filter_menu->add_action(GUI::Action::create("Generic 5x5 &Convolution", g_icon_bag.generic_5x5_convolution, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
if (auto* layer = editor->active_layer()) {