mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:27:35 +00:00
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.
This commit is contained in:
parent
88d5fd4b73
commit
0b46e572b5
3 changed files with 47 additions and 0 deletions
|
@ -84,6 +84,34 @@ enum class RenderingIntent {
|
|||
};
|
||||
StringView rendering_intent_name(RenderingIntent);
|
||||
|
||||
// ICC v4, 7.2.11 Profile flags field
|
||||
class Flags {
|
||||
public:
|
||||
Flags();
|
||||
|
||||
// "The profile flags field contains flags."
|
||||
Flags(u32);
|
||||
|
||||
u32 bits() const { return m_bits; }
|
||||
|
||||
// "These can indicate various hints for the CMM such as distributed processing and caching options."
|
||||
// "The least-significant 16 bits are reserved for the ICC."
|
||||
u16 color_management_module_bits() const { return bits() >> 16; }
|
||||
u16 icc_bits() const { return bits() & 0xff; }
|
||||
|
||||
// "Bit position 0: Embedded profile (0 if not embedded, 1 if embedded in file)"
|
||||
bool is_embedded_in_file() const { return (icc_bits() & 1) != 0; }
|
||||
|
||||
// "Bit position 1: Profile cannot be used independently of the embedded colour data (set to 1 if true, 0 if false)"
|
||||
// Double negation isn't unconfusing, so this function uses the inverted, positive sense.
|
||||
bool can_be_used_independently_of_embedded_color_data() const { return (icc_bits() & 2) == 0; }
|
||||
|
||||
static constexpr u32 KnownBitsMask = 3;
|
||||
|
||||
private:
|
||||
u32 m_bits = 0;
|
||||
};
|
||||
|
||||
class Profile : public RefCounted<Profile> {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Profile>> try_load_from_externally_owned_memory(ReadonlyBytes bytes);
|
||||
|
@ -92,6 +120,7 @@ public:
|
|||
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; }
|
||||
Flags flags() const { return m_flags; }
|
||||
RenderingIntent rendering_intent() const { return m_rendering_intent; }
|
||||
|
||||
private:
|
||||
|
@ -99,6 +128,7 @@ private:
|
|||
DeviceClass m_device_class;
|
||||
ColorSpace m_data_color_space;
|
||||
time_t m_creation_timestamp;
|
||||
Flags m_flags;
|
||||
RenderingIntent m_rendering_intent;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue