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

LibGfx+icc: Read namedColor2Type

This is the type of namedColor2Tag, which is a required tag in
NamedColor profiles.

The implementation is pretty basic for now and only exposes the
numbers stored in the file directly (after endian conversion).
This commit is contained in:
Nico Weber 2023-02-07 09:49:03 -05:00 committed by Linus Groh
parent 1ce34805f8
commit cbcf8471a6
4 changed files with 176 additions and 1 deletions

View file

@ -580,6 +580,8 @@ ErrorOr<NonnullRefPtr<TagData>> Profile::read_tag(ReadonlyBytes bytes, u32 offse
return Lut8TagData::from_bytes(tag_bytes, offset_to_beginning_of_tag_data_element, size_of_tag_data_element);
case MultiLocalizedUnicodeTagData::Type:
return MultiLocalizedUnicodeTagData::from_bytes(tag_bytes, offset_to_beginning_of_tag_data_element, size_of_tag_data_element);
case NamedColor2TagData::Type:
return NamedColor2TagData::from_bytes(tag_bytes, offset_to_beginning_of_tag_data_element, size_of_tag_data_element);
case ParametricCurveTagData::Type:
return ParametricCurveTagData::from_bytes(tag_bytes, offset_to_beginning_of_tag_data_element, size_of_tag_data_element);
case S15Fixed16ArrayTagData::Type:
@ -1137,7 +1139,14 @@ ErrorOr<void> Profile::check_tag_types()
// ICC v4, 9.2.37 namedColor2Tag
// "Permitted tag types: namedColor2Type"
// FIXME
if (auto type = m_tag_table.get(namedColor2Tag); type.has_value()) {
if (type.value()->type() != NamedColor2TagData::Type)
return Error::from_string_literal("ICC::Profile: namedColor2Tag has unexpected type");
// ICC v4, 10.17 namedColor2Type
// "The device representation corresponds to the headers “data colour space” field.
// This representation should be consistent with the “number of device coordinates” field in the namedColor2Type."
// FIXME: check that
}
// ICC v4, 9.2.38 outputResponseTag
// "Permitted tag types: responseCurveSet16Type"