LibGfx: Move AnimationWriter to its own file

No behavior change.
This commit is contained in:
Nico Weber 2024-05-11 19:53:38 -04:00 committed by Tim Flynn
parent 58cbecbe0c
commit 6c79efcae4
8 changed files with 46 additions and 11 deletions

View file

@ -63,6 +63,7 @@ shared_library("LibGfx") {
"ICC/TagTypes.cpp",
"ICC/Tags.cpp",
"ICC/WellKnownProfiles.cpp",
"ImageFormats/AnimationWriter.cpp",
"ImageFormats/BMPLoader.cpp",
"ImageFormats/BMPWriter.cpp",
"ImageFormats/BooleanDecoder.cpp",

View file

@ -9,6 +9,7 @@
#include <LibGfx/ICC/BinaryWriter.h>
#include <LibGfx/ICC/Profile.h>
#include <LibGfx/ICC/WellKnownProfiles.h>
#include <LibGfx/ImageFormats/AnimationWriter.h>
#include <LibGfx/ImageFormats/BMPLoader.h>
#include <LibGfx/ImageFormats/BMPWriter.h>
#include <LibGfx/ImageFormats/JPEGLoader.h>

View file

@ -36,6 +36,7 @@ set(SOURCES
ICC/Tags.cpp
ICC/TagTypes.cpp
ICC/WellKnownProfiles.cpp
ImageFormats/AnimationWriter.cpp
ImageFormats/BMPLoader.cpp
ImageFormats/BMPWriter.cpp
ImageFormats/BooleanDecoder.cpp

View file

@ -0,0 +1,13 @@
/*
* Copyright (c) 2024, Nico Weber <thakis@chromium.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/ImageFormats/AnimationWriter.h>
namespace Gfx {
AnimationWriter::~AnimationWriter() = default;
}

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2024, Nico Weber <thakis@chromium.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Point.h>
namespace Gfx {
class AnimationWriter {
public:
virtual ~AnimationWriter();
// Flushes the frame to disk.
// IntRect { at, at + bitmap.size() } must fit in the dimensions
// passed to `start_writing_animation()`.
// FIXME: Consider passing in disposal method and blend mode.
virtual ErrorOr<void> add_frame(Bitmap&, int duration_ms, IntPoint at = {}) = 0;
};
}

View file

@ -11,6 +11,7 @@
#include <AK/Debug.h>
#include <LibCompress/DeflateTables.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/ImageFormats/AnimationWriter.h>
#include <LibGfx/ImageFormats/WebPShared.h>
#include <LibGfx/ImageFormats/WebPWriter.h>
#include <LibRIFF/RIFF.h>

View file

@ -13,21 +13,12 @@
namespace Gfx {
class AnimationWriter;
struct WebPEncoderOptions {
Optional<ReadonlyBytes> icc_data;
};
class AnimationWriter {
public:
virtual ~AnimationWriter() = default;
// Flushes the frame to disk.
// IntRect { at, at + bitmap.size() } must fit in the dimensions
// passed to `start_writing_animation()`.
// FIXME: Consider passing in disposal method and blend mode.
virtual ErrorOr<void> add_frame(Bitmap&, int duration_ms, IntPoint at = {}) = 0;
};
class WebPWriter {
public:
using Options = WebPEncoderOptions;

View file

@ -7,6 +7,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibGfx/ImageFormats/AnimationWriter.h>
#include <LibGfx/ImageFormats/ImageDecoder.h>
#include <LibGfx/ImageFormats/WebPWriter.h>