1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
#ifndef PHP_IMAGEMAGICK_VERSION_DEFS_H
# define PHP_IMAGEMAGICK_VERSION_DEFS_H
// Q) Why are the defines done in this file?
//
// A) Checking whether an ImageMagick function is available _and_ usable is
// annoyingly difficult. It's pretty common for new functions to be introduced
// in patch releases, (e.g. 6.5.4-8) rather than in minor releases (6.5.5-0).
//
// Additionally, the api for new functions often changes quite rapidly in the
// first few versions it is available in, which means we can't just check for
// the presence of the symbol
//
// Because of those two things, the sanest thing to do is to support features
// based on the minimum minor version from which they are continually
// available and stable.
//
// Any mistake in which version is required for a feature can be fixed in a
// single place, rather than having to have duplicated info elsewhere.
#if MagickLibVersion >= 0x700
#if MagickLibVersion >= 0x702
#define IM_HAVE_IMAGICK_SETIMAGEINTERPOLATEMETHOD 1
#endif
#elif MagickLibVersion >= 0x631
#define IM_HAVE_IMAGICK_SETIMAGEINTERPOLATEMETHOD 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_SETIMAGEPIXELCOLOR 1
#endif
// Although there is some 'cannyEdgeImage' code in ImageMagick 6,
// there is no 'MagickCannyEdgeImage' exported function in the API.
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_CANNYEDGEIMAGE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_SETSEED 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_WAVELETDENOISEIMAGE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_MEANSHIFTIMAGE 1
#endif
#if MagickLibVersion >= 0x710
#define IM_HAVE_IMAGICK_KMEANSIMAGE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_RANGETHRESHOLDIMAGE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_AUTOTHRESHOLDIMAGE 1
#endif
#if MagickLibVersion >= 0x710
#define IM_HAVE_IMAGICK_BILATERALBLURIMAGE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_CLAHEIMAGE 1
#endif
#if MagickLibVersion >= 0x702
#define IM_HAVE_IMAGICK_CHANNELFXIMAGE 1
#endif
#if MagickLibVersion >= 0x710
#define IM_HAVE_IMAGICK_COLORTHRESHOLDIMAGE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_COMPLEXIMAGES 1
#endif
#if MagickLibVersion >= 0x702
#define IM_HAVE_IMAGICK_INTERPOLATIVERESIZEIMAGE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_LEVELIMAGECOLORS 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_LEVELIZEIMAGE 1
#endif
#if MagickLibVersion >= 0x702
#define IM_HAVE_IMAGICK_ORDEREDDITHERIMAGE 1
#endif
#if MagickLibVersion >= 0x70B
#define IM_HAVE_IMAGICK_WHITEBALANCEIMAGE 1
#endif
#if MagickLibVersion >= 0x702
#define IM_HAVE_IMAGICK_ADD_NOISE_WITH_ATTENUATE 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_DELETE_OPTION 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_BACKGROUND_COLOR 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_IMAGE_ARTIFACTS 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_IMAGE_DISTORTIONS 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_IMAGE_KURTOSIS 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_IMAGE_MEAN 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_IMAGE_RANGE 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_INTERPOLATE_METHOD 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_OPTIONS 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_ORIENTATION 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_RESOLUTION 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_GET_TYPE 1
#endif
#if MagickLibVersion >= 0x709
#define IM_HAVE_IMAGICK_POLYNOMIAL_IMAGE 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_SET_DEPTH 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_SET_EXTRACT 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_SET_INTERPOLATE_METHOD 1
#endif
#if MagickLibVersion >= 0x701
#define IM_HAVE_IMAGICK_SET_ORIENTATION 1
#endif
#if MagickLibVersion >= 0x70A
// Technically, this may be available earlier, but the behaviour around
// default mask changed.
#define IM_HAVE_IMAGICK_GETSETIMAGEMASK 1
// ImageMagick forget to export the header until about 7.0.11-14...
WandExport MagickBooleanType MagickSetImageMask(
MagickWand *wand, const PixelMask type, const MagickWand *clip_mask
);
#endif
// The above is sub-optimal as it's hard to read. It'd be better to do
// something like the below:
//#define MAGICK_LIB_RANGE(NAME, IM6_VERSION, IM7_VERSION) slash
//#if MagickLibVersion >= 0x700 slash
// #if MagickLibVersion >= IM7_VERSION slash
// #define IM_HAVE_##NAME 1 slash
// #endif slash
//#elif MagickLibVersion >= 0x600 slash
// #if MagickLibVersion >= IM6_VERSION slash
// #define IM_HAVE_##NAME 1 slash
// #endif slash
//#endif
// MAGICK_LIB_RANGE(IMAGICK_SETIMAGEINTERPOLATEMETHOD, 0x631, 0x702)
// But this type of macro expansion is not possible.
//
// https://stackoverflow.com/questions/48431325/is-it-possible-to-define-macro-inside-macro
// "The resulting completely macro-replaced preprocessing token sequence is not
// processed as a preprocessing directive even if it resembles one,..."
//
// An alternative would be to use code generation to build the define file as
// part of the build process. However that would involve looking at m4 config files.
#if MagickLibVersion >= 0x700
// declare symbols only defined in C source and not in header
WandExport MagickBooleanType MagickSetImageMask(
MagickWand *wand, const PixelMask type, const MagickWand *clip_mask
);
#endif
#if MagickLibVersion >= 0x710
// declare symbols only defined in C source and not in header
WandExport MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
const double radius,const double sigma,const double intensity_sigma,
const double spatial_sigma);
#endif
#endif /* PHP_IMAGEMAGICK_VERSION_DEFS_H */
|