1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 19:15:06 +00:00
Commit graph

23 commits

Author SHA1 Message Date
Nico Weber
8f4d2486dd LibGfx: Expand spec comment for parse_device_attributes() in ICCProfile 2023-01-07 13:41:41 +00:00
Nico Weber
fdbe501d3e LibGfx+icc: Print fields that are fourccs registered with the ICC
Namely:
- preferred CMM type
- device manufacturer
- device model
- profile creator

These all have in common that they can take arbitrary values, so I added
a FourCC class to deal with them, instead of using an enum class.
I made distinct types for each of them, so that they aren't accidentally
mixed up.
2023-01-07 13:41:41 +00:00
Nico Weber
d223477bc6 LibGfx+icc: Print device attribute flags
These flags are always 0 in practice in all profiles I've seen so far,
but hey, probably nice to dump them anyways.

And hey, it's just 86 lines to print 4 bits.
2023-01-06 21:33:46 +01:00
Nico Weber
c00ce2fba0 LibGfx+icc: Verify ICCProfile ID at parse time instead of in icc
Always computing computing the md5 takes some time, but most
icc profiles are small. So that's probably fine.

If this ends up being a perf problem in the future, or if it ends up
rejecting tons of embedded proiles from images, we can row it back.
But let's see if we can get away with this first.
2023-01-06 20:26:14 +01:00
Nico Weber
31af741c66 LibGfx: Rename variable in parse_profile_id() to match spec better 2023-01-06 20:26:14 +01:00
Nico Weber
b0068c387b LibGfx: Verify ICC reserved header bytes are zero
I checked that they are zero for all profiles in Compact-ICC-Profiles
and for all .icc files in /Library/ColorSync and
/System/Library/ColorSync on my Mac (running macOS 12.6.2).
2023-01-06 19:17:22 +01:00
Nico Weber
090bd02a88 LibGfx: Extract all_bytes_are_zero() function in ICCProfile 2023-01-06 19:17:22 +01:00
Nico Weber
aa107ef2d6 LibGfx: Add quotes and reflow for glanceability 2023-01-06 19:17:22 +01:00
Nico Weber
478bd97b25 LibGfx: Rename ICCHeader::profile_md5 to profile_id to match spec 2023-01-06 19:17:22 +01:00
Nico Weber
68f678f566 LibGfx+icc: Print if profile id is valid 2023-01-05 10:54:35 +01:00
Nico Weber
d5c8c90ff0 LibGfx: Store profile id MD5 in ICCProfile 2023-01-05 10:54:35 +01:00
Nico Weber
27189850d8 LibGfx: Sort ICC parsing functions by spec number 2023-01-05 10:54:35 +01:00
Linus Groh
b9913f9441 LibGfx: Fix typos in ICC spec comments 2023-01-03 18:53:20 +01:00
Nico Weber
79badfd650 LibGfx+icc: Print pcs illuminant 2023-01-02 15:20:51 +01:00
Nico Weber
47f29170b3 LibGfx+icc: Add profile connection space printing
This is a bit messy: The spec says that PCSXYZ and PCSLAB are the only
valid profile connection spaces -- except for DeviceLink profles, where
all data color spaces are valid.

So this uses the existing ColorSpace enum for profile connection spaces
instead of adding a dedicated enum, to not duplicate all the color space
parsing and printing code.  That matches what the spec does, too.
This saves about 100 lines of code, at the expense of less type
safety -- but further down the line we probably want to be able to
compare data color spaces and profile connection spaces, so the type
safety would likely get in the way then. (But if not, we can change
things around once we get to that point.)
2022-12-31 23:18:35 +01:00
Nico Weber
0b46e572b5 LibGfx+icc: Print profile flags
These flags are always 0 in practice in all profiles I've seen so far,
but hey, probably nice to dump them anyways.
2022-12-31 23:17:48 +01:00
Nico Weber
b1e977e18a LibGfx: Use VERIFY_NOT_REACHED() for impossible states in ICC code
The `parse_` functions reject invalid values, so we know the default is
unreachable.
2022-12-31 12:59:22 -05:00
Nico Weber
a8ee5dd9cd LibGfx: Make ICC name converters return StringView 2022-12-31 12:59:22 -05:00
Nico Weber
743e9fc786 LibGfx: Read rendering intent from ICCProfile header 2022-12-30 17:21:57 +01:00
Nico Weber
eaf1f67bb1 LibGfx: Read data color space from ICCProfile header 2022-12-30 10:14:22 -05:00
Nico Weber
50c6d133a9 LibGfx: Remove now-unneeded casts 2022-12-28 20:13:12 +00:00
Nico Weber
782ab0a11f LibGfx: Read profile creation time from ICCProfile header 2022-12-27 15:58:39 -08:00
Nico Weber
d8867f8077 LibGfx: Start adding a class for handling ICC color profiles
For now, this checks the magic number and reads file version and
device class.
2022-12-27 07:44:37 -07:00