PageRenderTime 32ms CodeModel.GetById 11ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/dmagick/c/option.d

http://github.com/MikeWey/DMagick
D | 273 lines | 233 code | 40 blank | 0 comment | 14 complexity | 1fa45a044fb3f24537d9a297f0214eff MD5 | raw file
  1module dmagick.c.option;
  2
  3import core.stdc.stdio;
  4
  5import dmagick.c.exception;
  6import dmagick.c.image;
  7import dmagick.c.magickType;
  8import dmagick.c.magickVersion;
  9
 10alias ptrdiff_t ssize_t;
 11
 12extern(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			static if ( MagickLibVersion >= 0x692 )
136			{
137				options ~= "MagickGradientOptions,
138				            MagickWeightOptions,";
139			}
140
141			static if ( MagickLibVersion >= 0x693 )
142			{
143				options ~= "MagickComplianceOptions,";
144			}
145
146			static if ( MagickLibVersion >= 0x699 )
147			{
148				options ~= "MagickAutoThresholdOptions";
149			}
150
151			options ~= "}";
152
153		return options;
154	}());
155
156	static if ( MagickLibVersion >= 0x686 )
157	{
158		enum ValidateType
159		{
160			UndefinedValidate,
161			NoValidate = 0x00000,
162			ColorspaceValidate = 0x00001,
163			CompareValidate = 0x00002,
164			CompositeValidate = 0x00004,
165			ConvertValidate = 0x00008,
166			FormatsDiskValidate = 0x00010,
167			FormatsMapValidate = 0x00020,
168			FormatsMemoryValidate = 0x00040,
169			IdentifyValidate = 0x00080,
170			ImportExportValidate = 0x00100,
171			MontageValidate = 0x00200,
172			StreamValidate = 0x00400,
173			AllValidate = 0x7fffffff
174		}
175	}
176	else
177	{
178		enum ValidateType
179		{
180			UndefinedValidate,
181			NoValidate = 0x00000,
182			CompareValidate = 0x00001,
183			CompositeValidate = 0x00002,
184			ConvertValidate = 0x00004,
185			FormatsInMemoryValidate = 0x00008,
186			FormatsOnDiskValidate = 0x00010,
187			IdentifyValidate = 0x00020,
188			ImportExportValidate = 0x00040,
189			MontageValidate = 0x00080,
190			StreamValidate = 0x00100,
191			AllValidate = 0x7fffffff
192		}
193	}
194
195	enum CommandOptionFlags
196	{
197		UndefinedOptionFlag       = 0x0000,
198		FireOptionFlag            = 0x0001,  /* Option sequence firing point */
199		ImageInfoOptionFlag       = 0x0002,  /* Sets ImageInfo, no image needed */
200		DrawInfoOptionFlag        = 0x0004,  /* Sets DrawInfo, no image needed */
201		QuantizeInfoOptionFlag    = 0x0008,  /* Sets QuantizeInfo, no image needed */
202		GlobalOptionFlag          = 0x0010,  /* Sets Global Option, no image needed */
203		SimpleOperatorOptionFlag  = 0x0100,  /* Simple Image processing operator */
204		ListOperatorOptionFlag    = 0x0200,  /* Multi-Image List processing operator */
205		SpecialOperatorOptionFlag = 0x0400,  /* Specially handled Operator Option */
206		GenesisOptionFlag         = 0x0400,  /* Genesis Command Wrapper Option  */
207		NonConvertOptionFlag      = 0x4000,  /* Option not used by Convert */
208		DeprecateOptionFlag       = 0x8000   /* Deprecate option, give warning */
209	}
210
211	struct OptionInfo
212	{
213		const(char)*
214			mnemonic;
215
216		ssize_t
217			type;
218
219		static if ( MagickLibVersion >= 0x670 )
220		{
221			ssize_t
222				flags;
223		}
224
225		MagickBooleanType
226			stealth;
227	}
228
229	static if ( MagickLibVersion >= 0x670 )
230	{
231		char** GetCommandOptions(const CommandOption);
232
233		const(char)* CommandOptionToMnemonic(const CommandOption, const ssize_t);
234
235		MagickBooleanType IsCommandOption(const(char)*);
236		MagickBooleanType ListCommandOptions(FILE*, const CommandOption, ExceptionInfo*);
237
238		ssize_t GetCommandOptionFlags(const CommandOption, const MagickBooleanType, const(char)*);
239		ssize_t ParseCommandOption(const CommandOption, const MagickBooleanType, const(char)*);
240	}
241	else
242	{
243		char** GetMagickOptions(const MagickOption);
244
245		const(char)* MagickOptionToMnemonic(const MagickOption, const ssize_t);
246
247		MagickBooleanType IsMagickOption(const(char)*);
248		MagickBooleanType ListMagickOptions(FILE*, const MagickOption, ExceptionInfo*);
249
250		ssize_t ParseMagickOption(const MagickOption, const MagickBooleanType,const(char)*);
251	}
252
253	static if ( MagickLibVersion >= 0x690 )
254	{
255		MagickBooleanType IsOptionMember(const(char)*, const(char)*);
256	}
257
258	char*  GetNextImageOption(const(ImageInfo)*);
259	char*  RemoveImageOption(ImageInfo*, const(char)*);
260
261	const(char)* GetImageOption(const(ImageInfo)*, const(char)*);
262
263	MagickBooleanType CloneImageOptions(ImageInfo*, const(ImageInfo)*);
264	MagickBooleanType DefineImageOption(ImageInfo*, const(char)*);
265	MagickBooleanType DeleteImageOption(ImageInfo*, const(char)*);
266	MagickBooleanType SetImageOption(ImageInfo*, const(char)*, const(char)*);
267
268	ssize_t ParseChannelOption(const(char)*);
269
270	void DestroyImageOptions(ImageInfo*);
271	void ResetImageOptions(const(ImageInfo)*);
272	void ResetImageOptionIterator(const(ImageInfo)*);
273}