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

LibGfx: Read data color space from ICCProfile header

This commit is contained in:
Nico Weber 2022-12-30 07:54:58 -05:00 committed by Tim Flynn
parent 7bb4cd74b8
commit eaf1f67bb1
2 changed files with 126 additions and 1 deletions

View file

@ -45,17 +45,49 @@ enum class DeviceClass : u32 {
};
char const* device_class_name(DeviceClass);
// ICC v4, 7.2.6 Data colour space field, Table 19 — Data colour space signatures
enum class ColorSpace : u32 {
nCIEXYZ = 0x58595A20, // 'XYZ '
CIELAB = 0x4C616220, // 'Lab '
CIELUV = 0x4C757620, // 'Luv '
YCbCr = 0x59436272, // 'YCbr'
CIEYxy = 0x59787920, // 'Yxy '
RGB = 0x52474220, // 'RGB '
Gray = 0x47524159, // 'GRAY'
HSV = 0x48535620, // 'HSV '
HLS = 0x484C5320, // 'HLS '
CMYK = 0x434D594B, // 'CMYK'
CMY = 0x434D5920, // 'CMY '
TwoColor = 0x32434C52, // '2CLR'
ThreeColor = 0x33434C52, // '3CLR'
FourColor = 0x34434C52, // '4CLR'
FiveColor = 0x35434C52, // '5CLR'
SixColor = 0x36434C52, // '6CLR'
SevenColor = 0x37434C52, // '7CLR'
EightColor = 0x38434C52, // '8CLR'
NineColor = 0x39434C52, // '9CLR'
TenColor = 0x41434C52, // 'ACLR'
ElevenColor = 0x42434C52, // 'BCLR'
TwelveColor = 0x43434C52, // 'CCLR'
ThirteenColor = 0x44434C52, // 'DCLR'
FourteenColor = 0x45434C52, // 'ECLR'
FifteenColor = 0x46434C52, // 'FCLR'
};
char const* color_space_name(ColorSpace);
class Profile : public RefCounted<Profile> {
public:
static ErrorOr<NonnullRefPtr<Profile>> try_load_from_externally_owned_memory(ReadonlyBytes bytes);
Version version() const { return m_version; }
DeviceClass device_class() const { return m_device_class; }
ColorSpace data_color_space() const { return m_data_color_space; }
time_t creation_timestamp() const { return m_creation_timestamp; }
private:
Version m_version;
DeviceClass m_device_class;
ColorSpace m_data_color_space;
time_t m_creation_timestamp;
};