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

PixelPaint: Ask to preserve transparency when exporting

Previously the alpha channel was thrown away when exporting to BMP or
PNG in PixelPaint, instead let the user decide.
This commit is contained in:
Marcus Nilsson 2021-07-04 12:34:10 +02:00 committed by Andreas Kling
parent 8324ffefe7
commit 2183d01eb0
3 changed files with 15 additions and 11 deletions

View file

@ -157,7 +157,8 @@ int main(int argc, char** argv)
auto save_path = GUI::FilePicker::get_save_filepath(window, "untitled", "bmp");
if (!save_path.has_value())
return;
auto result = editor->image().export_bmp_to_file(save_path.value());
auto preserve_alpha_channel = GUI::MessageBox::show(window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
auto result = editor->image().export_bmp_to_file(save_path.value(), preserve_alpha_channel == GUI::MessageBox::ExecYes);
if (result.is_error())
GUI::MessageBox::show_error(window, String::formatted("Export to BMP failed: {}", result.error()));
},
@ -169,7 +170,8 @@ int main(int argc, char** argv)
auto save_path = GUI::FilePicker::get_save_filepath(window, "untitled", "png");
if (!save_path.has_value())
return;
auto result = editor->image().export_bmp_to_file(save_path.value());
auto preserve_alpha_channel = GUI::MessageBox::show(window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
auto result = editor->image().export_png_to_file(save_path.value(), preserve_alpha_channel == GUI::MessageBox::ExecYes);
if (result.is_error())
GUI::MessageBox::show_error(window, String::formatted("Export to PNG failed: {}", result.error()));
},