mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-10 11:36:22 +00:00
LibGfx: Move AnimationWriter to its own file
No behavior change.
This commit is contained in:
parent
58cbecbe0c
commit
6c79efcae4
Notes:
sideshowbarker
2024-07-16 22:34:39 +09:00
Author: https://github.com/nico
Commit: 6c79efcae4
Pull-request: https://github.com/SerenityOS/serenity/pull/24288
8 changed files with 46 additions and 11 deletions
|
@ -63,6 +63,7 @@ shared_library("LibGfx") {
|
||||||
"ICC/TagTypes.cpp",
|
"ICC/TagTypes.cpp",
|
||||||
"ICC/Tags.cpp",
|
"ICC/Tags.cpp",
|
||||||
"ICC/WellKnownProfiles.cpp",
|
"ICC/WellKnownProfiles.cpp",
|
||||||
|
"ImageFormats/AnimationWriter.cpp",
|
||||||
"ImageFormats/BMPLoader.cpp",
|
"ImageFormats/BMPLoader.cpp",
|
||||||
"ImageFormats/BMPWriter.cpp",
|
"ImageFormats/BMPWriter.cpp",
|
||||||
"ImageFormats/BooleanDecoder.cpp",
|
"ImageFormats/BooleanDecoder.cpp",
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <LibGfx/ICC/BinaryWriter.h>
|
#include <LibGfx/ICC/BinaryWriter.h>
|
||||||
#include <LibGfx/ICC/Profile.h>
|
#include <LibGfx/ICC/Profile.h>
|
||||||
#include <LibGfx/ICC/WellKnownProfiles.h>
|
#include <LibGfx/ICC/WellKnownProfiles.h>
|
||||||
|
#include <LibGfx/ImageFormats/AnimationWriter.h>
|
||||||
#include <LibGfx/ImageFormats/BMPLoader.h>
|
#include <LibGfx/ImageFormats/BMPLoader.h>
|
||||||
#include <LibGfx/ImageFormats/BMPWriter.h>
|
#include <LibGfx/ImageFormats/BMPWriter.h>
|
||||||
#include <LibGfx/ImageFormats/JPEGLoader.h>
|
#include <LibGfx/ImageFormats/JPEGLoader.h>
|
||||||
|
|
|
@ -36,6 +36,7 @@ set(SOURCES
|
||||||
ICC/Tags.cpp
|
ICC/Tags.cpp
|
||||||
ICC/TagTypes.cpp
|
ICC/TagTypes.cpp
|
||||||
ICC/WellKnownProfiles.cpp
|
ICC/WellKnownProfiles.cpp
|
||||||
|
ImageFormats/AnimationWriter.cpp
|
||||||
ImageFormats/BMPLoader.cpp
|
ImageFormats/BMPLoader.cpp
|
||||||
ImageFormats/BMPWriter.cpp
|
ImageFormats/BMPWriter.cpp
|
||||||
ImageFormats/BooleanDecoder.cpp
|
ImageFormats/BooleanDecoder.cpp
|
||||||
|
|
13
Userland/Libraries/LibGfx/ImageFormats/AnimationWriter.cpp
Normal file
13
Userland/Libraries/LibGfx/ImageFormats/AnimationWriter.cpp
Normal 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;
|
||||||
|
|
||||||
|
}
|
26
Userland/Libraries/LibGfx/ImageFormats/AnimationWriter.h
Normal file
26
Userland/Libraries/LibGfx/ImageFormats/AnimationWriter.h
Normal 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -11,6 +11,7 @@
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <LibCompress/DeflateTables.h>
|
#include <LibCompress/DeflateTables.h>
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
|
#include <LibGfx/ImageFormats/AnimationWriter.h>
|
||||||
#include <LibGfx/ImageFormats/WebPShared.h>
|
#include <LibGfx/ImageFormats/WebPShared.h>
|
||||||
#include <LibGfx/ImageFormats/WebPWriter.h>
|
#include <LibGfx/ImageFormats/WebPWriter.h>
|
||||||
#include <LibRIFF/RIFF.h>
|
#include <LibRIFF/RIFF.h>
|
||||||
|
|
|
@ -13,21 +13,12 @@
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
||||||
|
class AnimationWriter;
|
||||||
|
|
||||||
struct WebPEncoderOptions {
|
struct WebPEncoderOptions {
|
||||||
Optional<ReadonlyBytes> icc_data;
|
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 {
|
class WebPWriter {
|
||||||
public:
|
public:
|
||||||
using Options = WebPEncoderOptions;
|
using Options = WebPEncoderOptions;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibCore/MappedFile.h>
|
#include <LibCore/MappedFile.h>
|
||||||
|
#include <LibGfx/ImageFormats/AnimationWriter.h>
|
||||||
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
||||||
#include <LibGfx/ImageFormats/WebPWriter.h>
|
#include <LibGfx/ImageFormats/WebPWriter.h>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue