1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

PixelPaint: Add background color options to "new image" dialog

This now allows you to select a background color for your new image,
and optionally allows saving that default. You can pick between
Transparent, White, Black, or a custom color (similar to other
editors).
This commit is contained in:
MacDue 2022-12-13 23:54:29 +00:00 committed by Linus Groh
parent 69de709625
commit e8dbb1a8b2
3 changed files with 69 additions and 1 deletions

View file

@ -159,7 +159,9 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto image = PixelPaint::Image::try_create_with_size(dialog->image_size()).release_value_but_fixme_should_propagate_errors();
auto bg_layer = PixelPaint::Layer::try_create_with_size(*image, image->size(), "Background").release_value_but_fixme_should_propagate_errors();
image->add_layer(*bg_layer);
bg_layer->content_bitmap().fill(Color::White);
auto background_color = dialog->background_color();
if (background_color != Gfx::Color::Transparent)
bg_layer->content_bitmap().fill(background_color);
auto& editor = create_new_editor(*image);
auto image_title = dialog->image_name().trim_whitespace();