1 module dmagick.c.option; 2 3 import core.stdc.stdio; 4 5 import dmagick.c.exception; 6 import dmagick.c.image; 7 import dmagick.c.magickType; 8 import dmagick.c.magickVersion; 9 10 alias ptrdiff_t ssize_t; 11 12 extern(C) 13 { 14 mixin( 15 { 16 static if ( MagickLibVersion >= 0x670 ) 17 { 18 string options = "enum CommandOption"; 19 } 20 else 21 { 22 string options = "enum MagickOption"; 23 } 24 25 options ~= " 26 { 27 MagickUndefinedOptions = -1, 28 MagickAlignOptions = 0, 29 MagickAlphaOptions, 30 MagickBooleanOptions,"; 31 32 static if ( MagickLibVersion >= 0x682 ) 33 { 34 options ~= "MagickCacheOptions,"; 35 } 36 37 options ~= " 38 MagickChannelOptions, 39 MagickClassOptions, 40 MagickClipPathOptions, 41 MagickCoderOptions, 42 MagickColorOptions, 43 MagickColorspaceOptions, 44 MagickCommandOptions, 45 MagickComposeOptions, 46 MagickCompressOptions, 47 MagickConfigureOptions, 48 MagickDataTypeOptions, 49 MagickDebugOptions, 50 MagickDecorateOptions, 51 MagickDelegateOptions,"; 52 53 static if ( MagickLibVersion >= 0x661 ) 54 { 55 options ~= "MagickDirectionOptions,"; 56 } 57 58 options ~= " 59 MagickDisposeOptions, 60 MagickDistortOptions, 61 MagickDitherOptions, 62 MagickEndianOptions, 63 MagickEvaluateOptions, 64 MagickFillRuleOptions, 65 MagickFilterOptions, 66 MagickFontOptions, 67 MagickFontsOptions, 68 MagickFormatOptions, 69 MagickFunctionOptions, 70 MagickGravityOptions,"; 71 72 static if ( MagickLibVersion < 0x670 ) 73 { 74 options ~= "MagickImageListOptions,"; 75 } 76 77 options ~= " 78 MagickIntentOptions, 79 MagickInterlaceOptions, 80 MagickInterpolateOptions, 81 MagickKernelOptions, 82 MagickLayerOptions, 83 MagickLineCapOptions, 84 MagickLineJoinOptions, 85 MagickListOptions, 86 MagickLocaleOptions, 87 MagickLogEventOptions, 88 MagickLogOptions, 89 MagickMagicOptions, 90 MagickMethodOptions, 91 MagickMetricOptions, 92 MagickMimeOptions, 93 MagickModeOptions, 94 MagickModuleOptions, 95 MagickMorphologyOptions, 96 MagickNoiseOptions, 97 MagickOrientationOptions,"; 98 99 static if ( MagickLibVersion >= 0x684 ) 100 { 101 options ~= "MagickPixelIntensityOptions,"; 102 } 103 104 options ~= " 105 MagickPolicyOptions, 106 MagickPolicyDomainOptions, 107 MagickPolicyRightsOptions, 108 MagickPreviewOptions, 109 MagickPrimitiveOptions, 110 MagickQuantumFormatOptions, 111 MagickResolutionOptions, 112 MagickResourceOptions, 113 MagickSparseColorOptions,"; 114 115 static if ( MagickLibVersion >= 0x669 ) 116 { 117 options ~= "MagickStatisticOptions,"; 118 } 119 120 options ~= " 121 MagickStorageOptions, 122 MagickStretchOptions, 123 MagickStyleOptions, 124 MagickThresholdOptions, 125 MagickTypeOptions, 126 MagickValidateOptions, 127 MagickVirtualPixelOptions"; 128 129 static if ( MagickLibVersion >= 0x688 ) 130 { 131 options ~= "MagickComplexOptions, 132 MagickIntensityOptions,"; 133 } 134 135 options ~= "}"; 136 137 return options; 138 }()); 139 140 static if ( MagickLibVersion >= 0x686 ) 141 { 142 enum ValidateType 143 { 144 UndefinedValidate, 145 NoValidate = 0x00000, 146 ColorspaceValidate = 0x00001, 147 CompareValidate = 0x00002, 148 CompositeValidate = 0x00004, 149 ConvertValidate = 0x00008, 150 FormatsDiskValidate = 0x00010, 151 FormatsMapValidate = 0x00020, 152 FormatsMemoryValidate = 0x00040, 153 IdentifyValidate = 0x00080, 154 ImportExportValidate = 0x00100, 155 MontageValidate = 0x00200, 156 StreamValidate = 0x00400, 157 AllValidate = 0x7fffffff 158 } 159 } 160 else 161 { 162 enum ValidateType 163 { 164 UndefinedValidate, 165 NoValidate = 0x00000, 166 CompareValidate = 0x00001, 167 CompositeValidate = 0x00002, 168 ConvertValidate = 0x00004, 169 FormatsInMemoryValidate = 0x00008, 170 FormatsOnDiskValidate = 0x00010, 171 IdentifyValidate = 0x00020, 172 ImportExportValidate = 0x00040, 173 MontageValidate = 0x00080, 174 StreamValidate = 0x00100, 175 AllValidate = 0x7fffffff 176 } 177 } 178 179 enum CommandOptionFlags 180 { 181 UndefinedOptionFlag = 0x0000, 182 FireOptionFlag = 0x0001, /* Option sequence firing point */ 183 ImageInfoOptionFlag = 0x0002, /* Sets ImageInfo, no image needed */ 184 DrawInfoOptionFlag = 0x0004, /* Sets DrawInfo, no image needed */ 185 QuantizeInfoOptionFlag = 0x0008, /* Sets QuantizeInfo, no image needed */ 186 GlobalOptionFlag = 0x0010, /* Sets Global Option, no image needed */ 187 SimpleOperatorOptionFlag = 0x0100, /* Simple Image processing operator */ 188 ListOperatorOptionFlag = 0x0200, /* Multi-Image List processing operator */ 189 SpecialOperatorOptionFlag = 0x0400, /* Specially handled Operator Option */ 190 GenesisOptionFlag = 0x0400, /* Genesis Command Wrapper Option */ 191 NonConvertOptionFlag = 0x4000, /* Option not used by Convert */ 192 DeprecateOptionFlag = 0x8000 /* Deprecate option, give warning */ 193 } 194 195 struct OptionInfo 196 { 197 const(char)* 198 mnemonic; 199 200 ssize_t 201 type; 202 203 static if ( MagickLibVersion >= 0x670 ) 204 { 205 ssize_t 206 flags; 207 } 208 209 MagickBooleanType 210 stealth; 211 } 212 213 static if ( MagickLibVersion >= 0x670 ) 214 { 215 char** GetCommandOptions(const CommandOption); 216 217 const(char)* CommandOptionToMnemonic(const CommandOption, const ssize_t); 218 219 MagickBooleanType IsCommandOption(const(char)*); 220 MagickBooleanType ListCommandOptions(FILE*, const CommandOption, ExceptionInfo*); 221 222 ssize_t GetCommandOptionFlags(const CommandOption, const MagickBooleanType, const(char)*); 223 ssize_t ParseCommandOption(const CommandOption, const MagickBooleanType, const(char)*); 224 } 225 else 226 { 227 char** GetMagickOptions(const MagickOption); 228 229 const(char)* MagickOptionToMnemonic(const MagickOption, const ssize_t); 230 231 MagickBooleanType IsMagickOption(const(char)*); 232 MagickBooleanType ListMagickOptions(FILE*, const MagickOption, ExceptionInfo*); 233 234 ssize_t ParseMagickOption(const MagickOption, const MagickBooleanType,const(char)*); 235 } 236 237 static if ( MagickLibVersion >= 0x690 ) 238 { 239 MagickBooleanType IsOptionMember(const(char)*, const(char)*); 240 } 241 242 char* GetNextImageOption(const(ImageInfo)*); 243 char* RemoveImageOption(ImageInfo*, const(char)*); 244 245 const(char)* GetImageOption(const(ImageInfo)*, const(char)*); 246 247 MagickBooleanType CloneImageOptions(ImageInfo*, const(ImageInfo)*); 248 MagickBooleanType DefineImageOption(ImageInfo*, const(char)*); 249 MagickBooleanType DeleteImageOption(ImageInfo*, const(char)*); 250 MagickBooleanType SetImageOption(ImageInfo*, const(char)*, const(char)*); 251 252 ssize_t ParseChannelOption(const(char)*); 253 254 void DestroyImageOptions(ImageInfo*); 255 void ResetImageOptions(const(ImageInfo)*); 256 void ResetImageOptionIterator(const(ImageInfo)*); 257 }