1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

Mandelbrot: Export images in a fixed resolution

This makes the exported image independent from the current window size
and just always exports it at 1920x1080.
This commit is contained in:
Gunnar Beutner 2021-05-18 14:41:21 +02:00 committed by Andreas Kling
parent f2f728d39a
commit 92879383fb

View file

@ -221,7 +221,9 @@ void Mandelbrot::resize_event(GUI::ResizeEvent& event)
void Mandelbrot::export_image(String const& export_path)
{
m_set.resize(Gfx::IntSize { 1920, 1080 });
auto png = Gfx::PNGWriter::encode(m_set.bitmap());
m_set.resize(size());
auto file = fopen(export_path.characters(), "wb");
if (!file) {
GUI::MessageBox::show(window(), String::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot", GUI::MessageBox::Type::Error);