Add support for modern Gimp images/XCF files

We now support up to and including version 11 of the XCF format, earlier
it only supported version 1 (from 1997, according to the XCF spec).

Biggest difference seems to be that they changed to 64bit for offsets
from version 11 and upwards, otherwise it's mostly just newer enum
values and theoretically major stuff that we don't really need to care
about to get a thumbnail (e. g. linear vs. perceptual RGB).

We still don't support all features, but now it handles that more
gracefully and should at least create thumbnails that are usable. It
should also be easier to update in the future if/when there comes new
versions.

Also added a test file created with the latest version of Gimp
(2.10.18).

Reviewed By: aacid

Differential Revision: https://phabricator.kde.org/D25937
This commit is contained in:
Martin T. H. Sandsmark 2019-11-11 23:25:28 +01:00
parent f089e860e0
commit c60e77c048
5 changed files with 638 additions and 195 deletions

View File

@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.5)
project(KImageFormats)
set (CMAKE_CXX_STANDARD 14)
include(FeatureSummary)
find_package(ECM 5.69.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

View File

@ -56,16 +56,6 @@ typedef enum {
INDEXED
} GimpImageBaseType;
//! Type of individual layers in an XCF file.
typedef enum {
RGB_GIMAGE,
RGBA_GIMAGE,
GRAY_GIMAGE,
GRAYA_GIMAGE,
INDEXED_GIMAGE,
INDEXEDA_GIMAGE
} GimpImageType;
// From GIMP "libgimp/gimpenums.h" v2.4
@ -96,49 +86,6 @@ typedef enum {
GRAIN_MERGE_MODE
} LayerModeEffects;
// From GIMP "xcf.c" v1.2
//! Properties which can be stored in an XCF file.
typedef enum {
PROP_END = 0,
PROP_COLORMAP = 1,
PROP_ACTIVE_LAYER = 2,
PROP_ACTIVE_CHANNEL = 3,
PROP_SELECTION = 4,
PROP_FLOATING_SELECTION = 5,
PROP_OPACITY = 6,
PROP_MODE = 7,
PROP_VISIBLE = 8,
PROP_LINKED = 9,
PROP_PRESERVE_TRANSPARENCY = 10,
PROP_APPLY_MASK = 11,
PROP_EDIT_MASK = 12,
PROP_SHOW_MASK = 13,
PROP_SHOW_MASKED = 14,
PROP_OFFSETS = 15,
PROP_COLOR = 16,
PROP_COMPRESSION = 17,
PROP_GUIDES = 18,
PROP_RESOLUTION = 19,
PROP_TATTOO = 20,
PROP_PARASITES = 21,
PROP_UNIT = 22,
PROP_PATHS = 23,
PROP_USER_UNIT = 24,
MAX_SUPPORTED_PROPTYPE // should always be at the end so its value is last + 1
} PropType;
// From GIMP "xcf.c" v1.2
//! Compression type used in layer tiles.
typedef enum {
COMPRESS_NONE = 0,
COMPRESS_RLE = 1,
COMPRESS_ZLIB = 2,
COMPRESS_FRACTAL = 3 /* Unused. */
} CompressionType;
// From GIMP "paint_funcs.c" v1.2

File diff suppressed because it is too large Load Diff