1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:15:07 +00:00
Commit graph

18 commits

Author SHA1 Message Date
Lucas CHOLLET
5b62d877f2 LibGfx/TIFF: Parse more common tags
These tags are either part of the baseline specification or included by
default by GIMP when exporting TIFF files. Note that we don't add
support for them in the decoder yet. This commit only allows us to parse
the metadata and display it gracefully.
2023-12-18 07:14:11 +01:00
Lucas CHOLLET
64d7e386d2 LibGfx/TIFF: Parse the PhotometricInterpretation tag 2023-12-10 09:45:30 +01:00
Lucas CHOLLET
965da551e3 LibGfx/TIFF: Print the corresponding enum value's name when possible
As an example, for the tag 262 if the value is 5, "LZW" will be
displayed instead of the numeric value.
2023-12-07 11:10:55 +01:00
Lucas CHOLLET
2691651abf LibGfx/TIFF: Generated the code to output debug prints
When the `TIFF_DEBUG` flag is set, the TIFF decoder logs every tag and
their values. This is already useful but require the developer to have
the spec handy in order to decrypt each value to its signification. None
of this information is available at runtime, but this is known by the
Python generator. So by generating these debug logs, we drastically
increase their value.

As a bonus point, most of these functions should be useful when we will
display image's metadata in Serenity.
2023-12-07 11:10:55 +01:00
Lucas CHOLLET
b82f5d7f3e LibGfx/TIFF: Add a C++ formatter for TIFF::Value 2023-12-07 11:10:55 +01:00
Lucas CHOLLET
6e282538cc LibGfx/TIFF: Generate a C++ helper function to print enums
For a given enum value, this function will return its corresponding name
as a `StringView`.
2023-12-07 11:10:55 +01:00
Lucas CHOLLET
f00e9540d5 LibGfx/TIFF: Add an intrinsic way to get the exportable name of Enums
The `TIFFType` enum is exported with a different name to C++. This
change of behavior was handled by manually setting the parameter of a
function. However, we will soon need the exported name in more places,
so let's make it a property of the Enum itself.
2023-12-07 11:10:55 +01:00
Lucas CHOLLET
1d345109c4 LibGfx/TIFF: Move Formatter<Rational>'s definition to TIFFMetadata.h
This will soon be used in TIFFTagHandler.cpp, so the definition needs to
be shared.
2023-12-07 11:10:55 +01:00
Lucas CHOLLET
923d9e834f LibGfx/TIFF: Add support for the SamplesPerPixel tag 2023-12-07 08:17:46 +00:00
Lucas CHOLLET
d9b69c644e LibGfx/TIFF: Allow any number of values for the tag BitsPerSample
Only some specific number of values should be allowed, but let's accept
everything for now and add these checks when the generator will be more
mature.
2023-12-07 08:17:46 +00:00
Lucas CHOLLET
a382ea7c1f LibGfx/TIFF: Consider ASCII and UTF-8 as containers
The generator will now create APIs that return a single `String`
instead of a `Vector<String>`.
2023-12-03 20:27:00 +01:00
Lucas CHOLLET
4994609af0 LibGfx/TIFF: Add support for the ICCProfile tag 2023-12-02 10:36:02 +01:00
Lucas CHOLLET
5622e7d77c LibGfx/TIFF: Support tag names with capitalized acronym
We now turn 'ICCProfile' into 'icc_profile' instead of 'i_c_c_profile'.
2023-12-02 10:36:02 +01:00
Lucas CHOLLET
62f28d9968 LibGfx/TIFF: Teach the generator how to handle tags of type Undefined
This tag type is a bit different as even if it fits in the general
definition given in the TIFF specification. That is the value will be of
one specified type multiplied by a known count. Having a
`Vector<Variant<u8, ...>>` will be very painful to use. So let's deviate
a bit from the normal way and use a `ByteBuffer` directly instead this
complicated type.
2023-12-02 10:36:02 +01:00
Lucas CHOLLET
4280f4d2c7 LibGfx/TIFF: Automatically export all enums associated with tags 2023-12-01 12:45:03 +01:00
Lucas CHOLLET
9090290d11 LibGfx/TIFF: Rename BitPerSample => BitsPerSample
This is the proper name used in the spec.
2023-11-28 10:53:06 +01:00
Nico Weber
b2302ed23f LibGfx: Unbreak building with Python 3.9
Unbreaks building with macOS 13 system python, and is less code too.
No behavior change.
2023-11-27 21:58:16 -05:00
Lucas CHOLLET
9836a9ad0e LibGfx/TIFF: Introduce a code generator
This will allow us to generate code that handle and provide easy access
to metadata stored in TIFF's tags. The generator is a Python script, and
it output both TIFFMetadata.h and TIFFTagHandler.cpp files.

The generator will definitely need some update to support all TIFF and
EXIF tags, but that will still be easier than writing everything
ourselves.

Some small modifications are needed in TIFFLoader.cpp to make it
compatible with the new `Metadata` class.
2023-11-27 09:07:16 -07:00