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

LibGfx+icc: Read chromaticityTag

This isn't terribly useful. But some profiles, for example the ones at
https://vpifg.com/help/icc-profiles/, do contain this tag and it seems
nice to be able to dump it, just for completeness.

I haven't seen any files that contain a phosphor or colorant type
different from "Unknown", even for the Rec2020 profile on that page.
(It has x,y coordinates that match the values required for Rec2020,
but it doesn't set the phosphor or colorant type to that.)
This commit is contained in:
Nico Weber 2023-02-09 12:26:43 -05:00 committed by Linus Groh
parent c61cfdd5ed
commit b232281d15
4 changed files with 116 additions and 2 deletions

View file

@ -572,6 +572,8 @@ ErrorOr<NonnullRefPtr<TagData>> Profile::read_tag(ReadonlyBytes bytes, u32 offse
auto type = tag_type(tag_bytes);
switch (type) {
case ChromaticityTagData::Type:
return ChromaticityTagData::from_bytes(tag_bytes, offset_to_beginning_of_tag_data_element, size_of_tag_data_element);
case CicpTagData::Type:
return CicpTagData::from_bytes(tag_bytes, offset_to_beginning_of_tag_data_element, size_of_tag_data_element);
case CurveTagData::Type:
@ -988,7 +990,8 @@ ErrorOr<void> Profile::check_tag_types()
// ICC v4, 9.2.16 chromaticityTag
// "Permitted tag types: chromaticityType"
// FIXME
if (!has_type(chromaticityTag, { ChromaticityTagData::Type }, {}))
return Error::from_string_literal("ICC::Profile: ChromaticityTagData has unexpected type");
// ICC v4, 9.2.17 cicpTag
// "Permitted tag types: cicpType"