1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibGfx: Add ICCProfile support for textType

This is used in v2 profiles for the required 'cprt' tag.
This commit is contained in:
Nico Weber 2023-01-21 20:50:20 -05:00 committed by Linus Groh
parent d33eef14a0
commit 3dfb012a1a
2 changed files with 70 additions and 5 deletions

View file

@ -12,6 +12,7 @@
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/Span.h>
#include <AK/String.h>
#include <AK/URL.h>
#include <LibCrypto/Hash/MD5.h>
@ -31,11 +32,11 @@ enum class FourCCType {
template<FourCCType type>
struct [[gnu::packed]] DistinctFourCC {
explicit DistinctFourCC(u32 value)
constexpr explicit DistinctFourCC(u32 value)
: value(value)
{
}
explicit operator u32() const { return value; }
constexpr operator u32() const { return value; }
char c0() const { return value >> 24; }
char c1() const { return (value >> 16) & 0xff; }
@ -256,6 +257,26 @@ public:
}
};
// ICC v4, 10.24 textType
class TextTagData : public TagData {
public:
static constexpr TagTypeSignature Type { 0x74657874 }; // 'text'
static ErrorOr<NonnullRefPtr<TextTagData>> from_bytes(ReadonlyBytes, u32 offset, u32 size);
TextTagData(u32 offset, u32 size, String text)
: TagData(offset, size, Type)
, m_text(move(text))
{
}
// Guaranteed to be 7-bit ASCII.
String const& text() const { return m_text; }
private:
String m_text;
};
namespace Detail {
struct TagTableEntry;
}