Commit graph

24 commits

Author SHA1 Message Date
Nico Weber
9756842734 LibGfx+icc: Add ICCProfile support for s15Fixed16ArrayType and print it
This is the type of the chromaticAdaptationTag, which is a required tag
in v4 profiles for all non-DeviceLink profiles.
2023-01-23 18:09:23 +00:00
Nico Weber
6cfb057430 LibGfx+icc: Add ICCProfile support for XYZType and print it 2023-01-23 12:08:25 +00:00
Nico Weber
e7eccf4ac8 LibGfx+icc: Add ICCProfile support for textDescriptionType and print it
This is used in v2 profiles for the required 'desc' tag. In v2
profiles, it's also used by the 'dmnd', 'dmdd', 'scrd', 'vued' tags.

In v4 profiles, these all use 'mluc' instead (except for 'scrd', which
is no longer part of the spec in v4).
2023-01-23 10:09:01 +00:00
Nico Weber
19ce63babf icc: Print MultiLocalizedUnicodeTagData contents 2023-01-22 15:25:58 +00:00
Nico Weber
3bc70d7aa5 icc: Print TextTagData contents 2023-01-22 15:25:58 +00:00
Nico Weber
b56a145a67 LibGfx+icc: Make device manufacturer and device model clickable 2023-01-21 22:16:38 -05:00
Nico Weber
a0522aec90 icc: Remove needless use of DateTime::to_deprecated_string()
Turns out DateTime has a Formatter that prints the same thing that
to_deprecated_string() returns.

No behavior change.
2023-01-21 01:50:24 +00:00
Nico Weber
e47e5f5ce0 icc: Tweak output to look nicer
Align header on the `:`, and make bitmask output more structured.
2023-01-21 01:50:24 +00:00
Nico Weber
f28b052590 LibGfx: Add scaffolding for reading ICC tag table
The idea is that we'll have one type for each tag type.
For now, this treats all tag types as unknown, but it puts most
of the infrastructure for reading tags in place.
2023-01-20 21:44:36 +00:00
Nico Weber
7ae97c9fc4 LibGfx+icc: Look at profile_size field
This trims the input bytes to the profile size stored in the file.
Alternatively, we could reject files where the stored size doesn't
match the handed in size. But ICC profiles can be embedded in other
files, and those could conceivably pad the ICC profile data some.
2023-01-08 23:41:14 +01:00
Nico Weber
aee7c44064 LibGfx+icc: Print primary platform
There's a small, old-timey list of platforms in the spec, but as far
as I can tell nobody is using additional platforms on Linux or Android
or what. So let's try going with an enum class instead of the FourCC
machinery for now.
2023-01-08 09:56:07 +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
516d800b01 icc: Extract out_optional() function 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
68f678f566 LibGfx+icc: Print if profile id is valid 2023-01-05 10:54:35 +01:00
Nico Weber
5d4ffd5580 icc: Print profile id 2023-01-05 10:54:35 +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
ca4ebf5d1b icc: Print rendering intent 2022-12-30 17:21:57 +01:00
Nico Weber
b7a627ab06 icc: Print data color space 2022-12-30 10:14:22 -05:00
Nico Weber
a38b3e112b icc: Print profile creation time 2022-12-27 15:58:39 -08:00
Nico Weber
7f52f45e9d LibGfx: Start adding a utility for handling ICC color profiles
For now, this dumps file version and device class.

https://github.com/saucecontrol/compact-icc-profiles has good
test inputs.
2022-12-27 07:44:37 -07:00