Fix for ImageMagick 7#14
Conversation
ImageMagick 7 no longer has `IntegerPixel`. Instead it now defines `LongPixel` to have always 32 bits on all architectures. In ImageMagick 6, `LongPixel` had 32 or 64 bits, depending on the size of the native type `long`.
| #if MagickLibVersion >= 0x700 | ||
| storageType = LongPixel; | ||
| #else | ||
| storageType = IntegerPixel; | ||
| #endif |
There was a problem hiding this comment.
I think I would prefer a solution using <type_traits> instead of hardcoding library version numbers, but it might be less understandable, so I'm okay with this version as well.
There was a problem hiding this comment.
<type_traits> would require a C++11 compatible compiler. Not a very high hurdle nowadays but a new requirement.
There was a problem hiding this comment.
And it IS a version dependent change.
There was a problem hiding this comment.
I'm definitely okay with merging this as-is.
There was a problem hiding this comment.
Maybe someone check with GraphicsMagic? I see that my ImageMagic 7.1.1 has #define MagickLibVersion 0x711 while GraphicsMagick 1.3.45 has #define MagickLibVersion 0x282502. Different format.
There was a problem hiding this comment.
GraphicsMagic 1.3.45 still has IntegerPixel and defines this enum:
typedef enum
{
CharPixel, /* Unsigned 8 bit 'unsigned char' */
ShortPixel, /* Unsigned 16 bit 'unsigned short int' */
IntegerPixel, /* Unsigned 32 bit 'unsigned int' */
LongPixel, /* Unsigned 32 or 64 bit (CPU dependent) 'unsigned long' */
FloatPixel, /* Floating point 32-bit 'float' */
DoublePixel /* Floating point 64-bit 'double' */
} StorageType;
So in GraphicsMagic 1.3.45, we still need IntegerPixel for 32 bit pixels.
I need to change the MagickLibVersion test.
ImageMagick 7 no longer has
IntegerPixel. Instead it now definesLongPixelto have always 32 bits on all architectures. In ImageMagick 6,LongPixelhad 32 or 64 bits, depending on the size of the native typelong.However, GraphicsMagic still behaves like before even in the latest version 1.4.