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

LibGfx+icc: Read signatureType

This isn't used by any mandatory tags, and it's not terribly useful.
But jpegs exported by Lightroom Classic write the 'tech' tag, and
it seems nice to be able to dump its contents.

signatureType stores a single u32 which for different tags with this
type means different things.

In each case, the value is one from a short table of valid values,
suggesting this should be a per-tag enum class instead of a
per-tag DistinctFourCC, per the comment at the top of DistincFourCC.h.
On the other hand, 3 of the 4 tables have an explicit "It is possible
that the ICC will define other signature values in the future" note,
which suggests the FourCC might actually be the way to go.

For now, just punt on that and manually dump the u32 in fourcc style
in icc.cpp and don't add any to_string() methods that return a readable
string based on the contents of these tables.
This commit is contained in:
Nico Weber 2023-02-07 15:15:55 -05:00 committed by Linus Groh
parent cbcf8471a6
commit 8bd64f001c
4 changed files with 53 additions and 4 deletions

View file

@ -229,6 +229,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
i++;
}
outln(" ]");
} else if (tag_data->type() == Gfx::ICC::SignatureTagData::Type) {
auto& signature = static_cast<Gfx::ICC::SignatureTagData&>(*tag_data);
// FIXME: For colorimetricIntentImageStateTag, interpret signature according to ICC v4 Table 26
// FIXME: For perceptualRenderingIntentGamutTag, interpret signature according to ICC v4 Table 27
// FIXME: For saturationRenderingIntentGamutTag, interpret signature according to ICC v4 Table 28
// FIXME: For technologyTag, interpret signature according to ICC v4 Table 29
outln(" signature: '{:c}{:c}{:c}{:c}' / 0x{:08x}",
signature.signature() >> 24, (signature.signature() >> 16) & 0xff, (signature.signature() >> 8) & 0xff, signature.signature() & 0xff,
signature.signature());
} else if (tag_data->type() == Gfx::ICC::TextDescriptionTagData::Type) {
auto& text_description = static_cast<Gfx::ICC::TextDescriptionTagData&>(*tag_data);
outln(" ascii: \"{}\"", text_description.ascii_description());