1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

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.
This commit is contained in:
Nico Weber 2023-01-06 15:57:45 -05:00 committed by Sam Atkins
parent 516d800b01
commit fdbe501d3e
3 changed files with 121 additions and 0 deletions

View file

@ -31,6 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto icc_file = TRY(Core::MappedFile::map(icc_path));
auto profile = TRY(Gfx::ICC::Profile::try_load_from_externally_owned_memory(icc_file->bytes()));
out_optional("preferred CMM type", profile->preferred_cmm_type());
outln("version: {}", profile->version());
outln("device class: {}", Gfx::ICC::device_class_name(profile->device_class()));
outln("data color space: {}", Gfx::ICC::data_color_space_name(profile->data_color_space()));
@ -46,6 +47,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (auto color_management_module_bits = flags.color_management_module_bits())
outln(" CMM bits: 0x{:04x}", color_management_module_bits);
out_optional("device manufacturer", profile->device_manufacturer());
out_optional("device model", profile->device_model());
auto device_attributes = profile->device_attributes();
outln("device attributes: 0x{:016x}", device_attributes.bits());
outln(" media is {}, {}, {}, {}",
@ -59,6 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
outln("rendering intent: {}", Gfx::ICC::rendering_intent_name(profile->rendering_intent()));
outln("pcs illuminant: {}", profile->pcs_illuminant());
out_optional("creator", profile->creator());
out_optional("id", profile->id());
return 0;