|
@@ -19,6 +19,7 @@
|
|
#include <LibGfx/BMPWriter.h>
|
|
#include <LibGfx/BMPWriter.h>
|
|
#include <LibGfx/Bitmap.h>
|
|
#include <LibGfx/Bitmap.h>
|
|
#include <LibGfx/PNGWriter.h>
|
|
#include <LibGfx/PNGWriter.h>
|
|
|
|
+#include <LibGfx/QOIWriter.h>
|
|
#include <LibImageDecoderClient/Client.h>
|
|
#include <LibImageDecoderClient/Client.h>
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
|
|
|
|
@@ -212,6 +213,17 @@ ErrorOr<void> Image::export_png_to_file(Core::File& file, bool preserve_alpha_ch
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ErrorOr<void> Image::export_qoi_to_file(Core::File& file) const
|
|
|
|
+{
|
|
|
|
+ auto bitmap = TRY(try_compose_bitmap(Gfx::BitmapFormat::BGRA8888));
|
|
|
|
+
|
|
|
|
+ auto encoded_data = Gfx::QOIWriter::encode(bitmap);
|
|
|
|
+ if (!file.write(encoded_data.data(), encoded_data.size()))
|
|
|
|
+ return Error::from_errno(file.error());
|
|
|
|
+
|
|
|
|
+ return {};
|
|
|
|
+}
|
|
|
|
+
|
|
void Image::add_layer(NonnullRefPtr<Layer> layer)
|
|
void Image::add_layer(NonnullRefPtr<Layer> layer)
|
|
{
|
|
{
|
|
for (auto& existing_layer : m_layers) {
|
|
for (auto& existing_layer : m_layers) {
|