1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:57:35 +00:00

LibGfx: Add start of an ICC profile writer

For now, this can write the profile header.

`icc` refuses to dump its contents since the required copyrightTag,
profileDescriptionTag, and required per-device-class tags are missing,
but it looks ok in a hex editor.
This commit is contained in:
Nico Weber 2023-02-17 13:21:26 -05:00 committed by Andrew Kaster
parent e8a2c17f8f
commit 8b8b7b232e
3 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) 2023, Nico Weber <thakis@chromium.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteBuffer.h>
namespace Gfx::ICC {
class Profile;
// Serializes a Profile object.
// Ignores the Profile's on_disk_size() and id() and recomputes them instead.
// Also ignores and the offsets and sizes in tag data.
// But if the profile has its tag data in tag order and has a computed id,
// it's a goal that encode(Profile::try_load_from_externally_owned_memory(bytes) returns `bytes`.
// Unconditionally computes a Profile ID (which is an MD5 hash of most of the contents, see Profile::compute_id()) and writes it to the output.
ErrorOr<ByteBuffer> encode(Profile const&);
}