/src/graphicsmagick/magick/enum_strings.c
Line | Count | Source |
1 | | /* |
2 | | % Copyright (C) 2008-2025 GraphicsMagick Group |
3 | | % |
4 | | % This program is covered by multiple licenses, which are described in |
5 | | % Copyright.txt. You should have received a copy of Copyright.txt with this |
6 | | % package; otherwise see http://www.graphicsmagick.org/www/Copyright.html. |
7 | | % |
8 | | % Interfaces to convert to and from the string form of enumeration values. |
9 | | % |
10 | | % Written by Bob Friesenhahn, June 2008. |
11 | | % |
12 | | */ |
13 | | |
14 | | #include "magick/studio.h" |
15 | | #include "magick/enum_strings.h" |
16 | | #include "magick/utility.h" |
17 | | |
18 | | /* |
19 | | BlobMode |
20 | | */ |
21 | | MagickExport const char *BlobModeToString(BlobMode blob_mode) |
22 | 0 | { |
23 | 0 | const char |
24 | 0 | *mode_string="?"; |
25 | |
|
26 | 0 | switch (blob_mode) |
27 | 0 | { |
28 | 0 | case UndefinedBlobMode: |
29 | 0 | mode_string="Undefined"; |
30 | 0 | break; |
31 | 0 | case ReadBlobMode: |
32 | 0 | mode_string="Read"; |
33 | 0 | break; |
34 | 0 | case ReadBinaryBlobMode: |
35 | 0 | mode_string="ReadBinary"; |
36 | 0 | break; |
37 | 0 | case WriteBlobMode: |
38 | 0 | mode_string="Write"; |
39 | 0 | break; |
40 | 0 | case WriteBinaryBlobMode: |
41 | 0 | mode_string="WriteBinary"; |
42 | 0 | break; |
43 | 0 | } |
44 | 0 | return mode_string; |
45 | 0 | } |
46 | | |
47 | | /* |
48 | | ChannelType |
49 | | */ |
50 | | MagickExport const char *ChannelTypeToString(const ChannelType channel) |
51 | 0 | { |
52 | 0 | const char |
53 | 0 | *channel_type="?"; |
54 | |
|
55 | 0 | switch (channel) |
56 | 0 | { |
57 | 0 | case UndefinedChannel: |
58 | 0 | channel_type="undefined"; |
59 | 0 | break; |
60 | 0 | case RedChannel: |
61 | 0 | channel_type="red"; |
62 | 0 | break; |
63 | 0 | case CyanChannel: |
64 | 0 | channel_type="cyan"; |
65 | 0 | break; |
66 | 0 | case GreenChannel: |
67 | 0 | channel_type="green"; |
68 | 0 | break; |
69 | 0 | case MagentaChannel: |
70 | 0 | channel_type="magenta"; |
71 | 0 | break; |
72 | 0 | case BlueChannel: |
73 | 0 | channel_type="blue"; |
74 | 0 | break; |
75 | 0 | case YellowChannel: |
76 | 0 | channel_type="yellow"; |
77 | 0 | break; |
78 | 0 | case OpacityChannel: |
79 | 0 | channel_type="opacity"; |
80 | 0 | break; |
81 | 0 | case BlackChannel: |
82 | 0 | channel_type="black"; |
83 | 0 | break; |
84 | 0 | case MatteChannel: |
85 | 0 | channel_type="matte"; |
86 | 0 | break; |
87 | 0 | case AllChannels: |
88 | 0 | channel_type="all"; |
89 | 0 | break; |
90 | 0 | case GrayChannel: |
91 | 0 | channel_type="gray"; |
92 | 0 | break; |
93 | 0 | } |
94 | | |
95 | 0 | return channel_type; |
96 | 0 | } |
97 | | MagickExport ChannelType StringToChannelType(const char *option) |
98 | 0 | { |
99 | 0 | ChannelType |
100 | 0 | channel; |
101 | |
|
102 | 0 | channel=UndefinedChannel; |
103 | 0 | if (LocaleCompare("Red",option) == 0) |
104 | 0 | channel=RedChannel; |
105 | 0 | else if (LocaleCompare("Cyan",option) == 0) |
106 | 0 | channel=CyanChannel; |
107 | 0 | else if (LocaleCompare("Green",option) == 0) |
108 | 0 | channel=GreenChannel; |
109 | 0 | else if (LocaleCompare("Magenta",option) == 0) |
110 | 0 | channel=MagentaChannel; |
111 | 0 | else if (LocaleCompare("Blue",option) == 0) |
112 | 0 | channel=BlueChannel; |
113 | 0 | else if (LocaleCompare("Yellow",option) == 0) |
114 | 0 | channel=YellowChannel; |
115 | 0 | else if (LocaleCompare("Opacity",option) == 0) |
116 | 0 | channel=OpacityChannel; |
117 | 0 | else if (LocaleCompare("Alpha",option) == 0) /* ImageMagick compatibility */ |
118 | 0 | channel=OpacityChannel; |
119 | 0 | else if (LocaleCompare("Black",option) == 0) |
120 | 0 | channel=BlackChannel; |
121 | 0 | else if (LocaleCompare("Matte",option) == 0) |
122 | 0 | channel=MatteChannel; |
123 | 0 | else if (LocaleCompare("All",option) == 0) |
124 | 0 | channel=AllChannels; |
125 | 0 | else if ((LocaleCompare("Gray",option) == 0) || |
126 | 0 | (LocaleCompare("Intensity",option) == 0)) |
127 | 0 | channel=GrayChannel; |
128 | |
|
129 | 0 | return channel; |
130 | 0 | } |
131 | | |
132 | | /* |
133 | | ClassType |
134 | | */ |
135 | | MagickExport const char* ClassTypeToString(const ClassType class_type) |
136 | 766k | { |
137 | 766k | const char |
138 | 766k | *log_class_type="?"; |
139 | | |
140 | 766k | switch (class_type) |
141 | 766k | { |
142 | 107 | case UndefinedClass: |
143 | 107 | log_class_type="Undefined"; |
144 | 107 | break; |
145 | 620k | case DirectClass: |
146 | 620k | log_class_type="DirectClass"; |
147 | 620k | break; |
148 | 146k | case PseudoClass: |
149 | 146k | log_class_type="PseudoClass"; |
150 | 146k | break; |
151 | 766k | } |
152 | 766k | return log_class_type; |
153 | 766k | } |
154 | | |
155 | | /* |
156 | | ColorspaceType |
157 | | */ |
158 | | MagickExport const char *ColorspaceTypeToString(const ColorspaceType colorspace) |
159 | 752k | { |
160 | 752k | const char |
161 | 752k | *colorspace_type = "?"; |
162 | | |
163 | 752k | switch (colorspace) |
164 | 752k | { |
165 | 60 | case UndefinedColorspace: |
166 | 60 | colorspace_type="Undefined"; |
167 | 60 | break; |
168 | 791 | case CineonLogRGBColorspace: |
169 | 791 | colorspace_type="CineonLogRGB"; |
170 | 791 | break; |
171 | 685k | case RGBColorspace: |
172 | 685k | colorspace_type="RGB"; |
173 | 685k | break; |
174 | 2.99k | case GRAYColorspace: |
175 | 2.99k | colorspace_type="Gray"; |
176 | 2.99k | break; |
177 | 424 | case Rec601LumaColorspace: |
178 | 424 | colorspace_type="Rec601Luma"; |
179 | 424 | break; |
180 | 249 | case Rec709LumaColorspace: |
181 | 249 | colorspace_type="Rec709Luma"; |
182 | 249 | break; |
183 | 0 | case TransparentColorspace: |
184 | 0 | colorspace_type="Transparent"; |
185 | 0 | break; |
186 | 0 | case OHTAColorspace: |
187 | 0 | colorspace_type="OHTA"; |
188 | 0 | break; |
189 | 0 | case XYZColorspace: |
190 | 0 | colorspace_type="XYZ"; |
191 | 0 | break; |
192 | 386 | case Rec601YCbCrColorspace: |
193 | 386 | colorspace_type="Rec601YCbCr"; |
194 | 386 | break; |
195 | 899 | case Rec709YCbCrColorspace: |
196 | 899 | colorspace_type="Rec709YCbCr"; |
197 | 899 | break; |
198 | 2.94k | case YCCColorspace: |
199 | 2.94k | colorspace_type="PhotoCD YCC"; |
200 | 2.94k | break; |
201 | 3.11k | case YIQColorspace: |
202 | 3.11k | colorspace_type="YIQ"; |
203 | 3.11k | break; |
204 | 0 | case YPbPrColorspace: |
205 | 0 | colorspace_type="YPbPr"; |
206 | 0 | break; |
207 | 12 | case YUVColorspace: |
208 | 12 | colorspace_type="YUV"; |
209 | 12 | break; |
210 | 47.5k | case CMYKColorspace: |
211 | 47.5k | colorspace_type="CMYK"; |
212 | 47.5k | break; |
213 | 2.22k | case sRGBColorspace: |
214 | 2.22k | colorspace_type="PhotoCD sRGB"; |
215 | 2.22k | break; |
216 | 500 | case HSLColorspace: |
217 | 500 | colorspace_type="HSL"; |
218 | 500 | break; |
219 | 321 | case HWBColorspace: |
220 | 321 | colorspace_type="HWB"; |
221 | 321 | break; |
222 | 4.02k | case LABColorspace: |
223 | 4.02k | colorspace_type="LAB"; |
224 | 4.02k | break; |
225 | 752k | } |
226 | 752k | return colorspace_type; |
227 | 752k | } |
228 | | MagickExport ColorspaceType StringToColorspaceType(const char *option) |
229 | 5.67k | { |
230 | 5.67k | ColorspaceType |
231 | 5.67k | colorspace; |
232 | | |
233 | 5.67k | colorspace=UndefinedColorspace; |
234 | | |
235 | 5.67k | if (LocaleCompare("cineonlog",option) == 0) |
236 | 0 | colorspace=CineonLogRGBColorspace; |
237 | 5.67k | else if (LocaleCompare("cmyk",option) == 0) |
238 | 0 | colorspace=CMYKColorspace; |
239 | 5.67k | else if (LocaleCompare("gray",option) == 0) |
240 | 696 | colorspace=GRAYColorspace; |
241 | 4.97k | else if (LocaleCompare("hsl",option) == 0) |
242 | 465 | colorspace=HSLColorspace; |
243 | 4.51k | else if (LocaleCompare("hwb",option) == 0) |
244 | 294 | colorspace=HWBColorspace; |
245 | 4.21k | else if (LocaleCompare("ohta",option) == 0) |
246 | 0 | colorspace=OHTAColorspace; |
247 | 4.21k | else if (LocaleCompare("rec601luma",option) == 0) |
248 | 0 | colorspace=Rec601LumaColorspace; |
249 | 4.21k | else if (LocaleCompare("rec709luma",option) == 0) |
250 | 0 | colorspace=Rec709LumaColorspace; |
251 | 4.21k | else if (LocaleCompare("rgb",option) == 0) |
252 | 1.28k | colorspace=RGBColorspace; |
253 | 2.93k | else if (LocaleCompare("srgb",option) == 0) |
254 | 0 | colorspace=sRGBColorspace; |
255 | 2.93k | else if (LocaleCompare("transparent",option) == 0) |
256 | 0 | colorspace=TransparentColorspace; |
257 | 2.93k | else if (LocaleCompare("xyz",option) == 0) |
258 | 0 | colorspace=XYZColorspace; |
259 | 2.93k | else if (LocaleCompare("ycbcr",option) == 0) |
260 | 0 | colorspace=YCbCrColorspace; |
261 | 2.93k | else if (LocaleCompare("rec601ycbcr",option) == 0) |
262 | 0 | colorspace=Rec601YCbCrColorspace; |
263 | 2.93k | else if (LocaleCompare("rec709ycbcr",option) == 0) |
264 | 0 | colorspace=Rec709YCbCrColorspace; |
265 | 2.93k | else if (LocaleCompare("ycc",option) == 0) |
266 | 267 | colorspace=YCCColorspace; |
267 | 2.66k | else if (LocaleCompare("yiq",option) == 0) |
268 | 1.10k | colorspace=YIQColorspace; |
269 | 1.56k | else if (LocaleCompare("ypbpr",option) == 0) |
270 | 0 | colorspace=YPbPrColorspace; |
271 | 1.56k | else if (LocaleCompare("yuv",option) == 0) |
272 | 195 | colorspace=YUVColorspace; |
273 | | |
274 | 5.67k | return colorspace; |
275 | 5.67k | } |
276 | | |
277 | | /* |
278 | | CompositeOperator |
279 | | */ |
280 | | MagickExport const char *CompositeOperatorToString(const CompositeOperator composite_op) |
281 | 49.9k | { |
282 | 49.9k | const char |
283 | 49.9k | *composite_op_text = "?"; |
284 | | |
285 | 49.9k | switch (composite_op) |
286 | 49.9k | { |
287 | 0 | case UndefinedCompositeOp: |
288 | 0 | composite_op_text = "Undefined"; |
289 | 0 | break; |
290 | 8.75k | case OverCompositeOp: |
291 | 8.75k | composite_op_text = "Over"; |
292 | 8.75k | break; |
293 | 0 | case InCompositeOp: |
294 | 0 | composite_op_text = "In"; |
295 | 0 | break; |
296 | 0 | case OutCompositeOp: |
297 | 0 | composite_op_text = "Out"; |
298 | 0 | break; |
299 | 0 | case AtopCompositeOp: |
300 | 0 | composite_op_text = "Atop"; |
301 | 0 | break; |
302 | 0 | case XorCompositeOp: |
303 | 0 | composite_op_text = "Xor"; |
304 | 0 | break; |
305 | 0 | case PlusCompositeOp: |
306 | 0 | composite_op_text = "Plus"; |
307 | 0 | break; |
308 | 0 | case MinusCompositeOp: |
309 | 0 | composite_op_text = "Minus"; |
310 | 0 | break; |
311 | 0 | case AddCompositeOp: |
312 | 0 | composite_op_text = "Add"; |
313 | 0 | break; |
314 | 0 | case SubtractCompositeOp: |
315 | 0 | composite_op_text = "Subtract"; |
316 | 0 | break; |
317 | 0 | case DifferenceCompositeOp: |
318 | 0 | composite_op_text = "Difference"; |
319 | 0 | break; |
320 | 0 | case MultiplyCompositeOp: |
321 | 0 | composite_op_text = "Multiply"; |
322 | 0 | break; |
323 | 0 | case BumpmapCompositeOp: |
324 | 0 | composite_op_text = "Bumpmap"; |
325 | 0 | break; |
326 | 41.1k | case CopyCompositeOp: |
327 | 41.1k | composite_op_text = "Copy"; |
328 | 41.1k | break; |
329 | 0 | case CopyRedCompositeOp: |
330 | 0 | composite_op_text = "CopyRed"; |
331 | 0 | break; |
332 | 0 | case CopyGreenCompositeOp: |
333 | 0 | composite_op_text = "CopyGreen"; |
334 | 0 | break; |
335 | 0 | case CopyBlueCompositeOp: |
336 | 0 | composite_op_text = "CopyBlue"; |
337 | 0 | break; |
338 | 0 | case CopyOpacityCompositeOp: |
339 | 0 | composite_op_text = "CopyOpacity"; |
340 | 0 | break; |
341 | 0 | case ClearCompositeOp: |
342 | 0 | composite_op_text = "Clear"; |
343 | 0 | break; |
344 | 0 | case DissolveCompositeOp: |
345 | 0 | composite_op_text = "Dissolve"; |
346 | 0 | break; |
347 | 0 | case DisplaceCompositeOp: |
348 | 0 | composite_op_text = "Displace"; |
349 | 0 | break; |
350 | 0 | case ModulateCompositeOp: |
351 | 0 | composite_op_text = "Modulate"; |
352 | 0 | break; |
353 | 0 | case ThresholdCompositeOp: |
354 | 0 | composite_op_text = "Threshold"; |
355 | 0 | break; |
356 | 0 | case NoCompositeOp: |
357 | 0 | composite_op_text = "No"; |
358 | 0 | break; |
359 | 0 | case DarkenCompositeOp: |
360 | 0 | composite_op_text = "Darken"; |
361 | 0 | break; |
362 | 0 | case LightenCompositeOp: |
363 | 0 | composite_op_text = "Lighten"; |
364 | 0 | break; |
365 | 0 | case HueCompositeOp: |
366 | 0 | composite_op_text = "Hue"; |
367 | 0 | break; |
368 | 0 | case SaturateCompositeOp: |
369 | 0 | composite_op_text = "Saturate"; |
370 | 0 | break; |
371 | 0 | case ColorizeCompositeOp: |
372 | 0 | composite_op_text = "Colorize"; |
373 | 0 | break; |
374 | 0 | case LuminizeCompositeOp: |
375 | 0 | composite_op_text = "Luminize"; |
376 | 0 | break; |
377 | 0 | case ScreenCompositeOp: |
378 | 0 | composite_op_text = "Screen"; |
379 | 0 | break; |
380 | 0 | case OverlayCompositeOp: |
381 | 0 | composite_op_text = "Overlay"; |
382 | 0 | break; |
383 | 0 | case CopyCyanCompositeOp: |
384 | 0 | composite_op_text = "CopyCyan"; |
385 | 0 | break; |
386 | 0 | case CopyMagentaCompositeOp: |
387 | 0 | composite_op_text = "CopyMagenta"; |
388 | 0 | break; |
389 | 0 | case CopyYellowCompositeOp: |
390 | 0 | composite_op_text = "CopyYellow"; |
391 | 0 | break; |
392 | 0 | case CopyBlackCompositeOp: |
393 | 0 | composite_op_text = "CopyBlack"; |
394 | 0 | break; |
395 | 0 | case DivideCompositeOp: |
396 | 0 | composite_op_text = "Divide"; |
397 | 0 | break; |
398 | 0 | case HardLightCompositeOp: |
399 | 0 | composite_op_text = "HardLight"; |
400 | 0 | break; |
401 | 0 | case ExclusionCompositeOp: |
402 | 0 | composite_op_text = "Exclusion"; |
403 | 0 | break; |
404 | 0 | case ColorDodgeCompositeOp: |
405 | 0 | composite_op_text = "ColorDodge"; |
406 | 0 | break; |
407 | 0 | case ColorBurnCompositeOp: |
408 | 0 | composite_op_text = "ColorBurn"; |
409 | 0 | break; |
410 | 0 | case SoftLightCompositeOp: |
411 | 0 | composite_op_text = "SoftLight"; |
412 | 0 | break; |
413 | 0 | case LinearBurnCompositeOp: |
414 | 0 | composite_op_text = "LinearBurn"; |
415 | 0 | break; |
416 | 0 | case LinearDodgeCompositeOp: |
417 | 0 | composite_op_text = "LinearDodge"; |
418 | 0 | break; |
419 | 0 | case LinearLightCompositeOp: |
420 | 0 | composite_op_text = "LinearLight"; |
421 | 0 | break; |
422 | 0 | case VividLightCompositeOp: |
423 | 0 | composite_op_text = "VividLight"; |
424 | 0 | break; |
425 | 0 | case PinLightCompositeOp: |
426 | 0 | composite_op_text = "PinLight"; |
427 | 0 | break; |
428 | 0 | case HardMixCompositeOp: |
429 | 0 | composite_op_text = "HardMix"; |
430 | 0 | break; |
431 | 49.9k | } |
432 | | |
433 | 49.9k | return composite_op_text; |
434 | 49.9k | } |
435 | | MagickExport CompositeOperator StringToCompositeOperator(const char *option) |
436 | 15.1k | { |
437 | 15.1k | static const struct |
438 | 15.1k | { |
439 | 15.1k | const CompositeOperator op; |
440 | 15.1k | const char str[12]; |
441 | 15.1k | } composite_operators[] = |
442 | 15.1k | { |
443 | 15.1k | { UndefinedCompositeOp, "Undefined" }, |
444 | 15.1k | { OverCompositeOp, "Over" }, |
445 | 15.1k | { OverCompositeOp, "SrcOver" }, |
446 | 15.1k | { InCompositeOp , "In" }, |
447 | 15.1k | { InCompositeOp , "SrcIn" }, |
448 | 15.1k | { OutCompositeOp, "Out" }, |
449 | 15.1k | { OutCompositeOp, "SrcOut" }, |
450 | 15.1k | { AtopCompositeOp, "Atop" }, |
451 | 15.1k | { AtopCompositeOp, "SrcAtop" }, |
452 | 15.1k | { XorCompositeOp, "Xor" }, |
453 | 15.1k | { PlusCompositeOp, "Plus" }, |
454 | 15.1k | { MinusCompositeOp, "Minus" }, |
455 | 15.1k | { AddCompositeOp, "Add" }, |
456 | 15.1k | { SubtractCompositeOp, "Subtract" }, |
457 | 15.1k | { DifferenceCompositeOp, "Difference" }, |
458 | 15.1k | { MultiplyCompositeOp, "Multiply" }, |
459 | 15.1k | { BumpmapCompositeOp, "Bumpmap" }, |
460 | 15.1k | { CopyCompositeOp, "Copy" }, |
461 | 15.1k | { CopyRedCompositeOp, "CopyRed" }, |
462 | 15.1k | { CopyGreenCompositeOp, "CopyGreen" }, |
463 | 15.1k | { CopyBlueCompositeOp, "CopyBlue" }, |
464 | 15.1k | { CopyOpacityCompositeOp, "CopyOpacity" }, |
465 | 15.1k | { CopyOpacityCompositeOp, "CopyAlpha" }, /* ImageMagick compatibility */ |
466 | 15.1k | { ClearCompositeOp, "Clear" }, |
467 | 15.1k | { DissolveCompositeOp, "Dissolve" }, |
468 | 15.1k | { DisplaceCompositeOp, "Displace" }, |
469 | 15.1k | { ModulateCompositeOp, "Modulate" }, |
470 | 15.1k | { ThresholdCompositeOp, "Threshold" }, |
471 | 15.1k | { NoCompositeOp, "No" }, |
472 | 15.1k | { DarkenCompositeOp, "Darken" }, |
473 | 15.1k | { LightenCompositeOp, "Lighten" }, |
474 | 15.1k | { HueCompositeOp, "Hue" }, |
475 | 15.1k | { SaturateCompositeOp, "Saturate" }, |
476 | 15.1k | { ColorizeCompositeOp, "Colorize" }, |
477 | 15.1k | { LuminizeCompositeOp, "Luminize" }, |
478 | 15.1k | { ScreenCompositeOp, "Screen" }, |
479 | 15.1k | { OverlayCompositeOp, "Overlay" }, |
480 | 15.1k | { CopyCyanCompositeOp, "CopyCyan" }, |
481 | 15.1k | { CopyMagentaCompositeOp, "CopyMagenta" }, |
482 | 15.1k | { CopyYellowCompositeOp, "CopyYellow" }, |
483 | 15.1k | { CopyBlackCompositeOp, "CopyBlack" }, |
484 | 15.1k | { DivideCompositeOp, "Divide" }, |
485 | 15.1k | { HardLightCompositeOp, "HardLight" }, |
486 | 15.1k | { ExclusionCompositeOp, "Exclusion" }, |
487 | 15.1k | { ColorDodgeCompositeOp, "ColorDodge" }, |
488 | 15.1k | { ColorBurnCompositeOp, "ColorBurn" }, |
489 | 15.1k | { SoftLightCompositeOp, "SoftLight" }, |
490 | 15.1k | { LinearBurnCompositeOp, "LinearBurn" }, |
491 | 15.1k | { LinearDodgeCompositeOp, "LinearDodge" }, |
492 | 15.1k | { LinearLightCompositeOp, "LinearLight" }, |
493 | 15.1k | { VividLightCompositeOp, "VividLight" }, |
494 | 15.1k | { PinLightCompositeOp, "PinLight" }, |
495 | 15.1k | { HardMixCompositeOp, "HardMix" } |
496 | | /* Apparently missing IM operators */ |
497 | | /* ChangeMask */ |
498 | | /* DivideDst */ |
499 | | /* Dst */ |
500 | | /* DstAtop */ |
501 | | /* DstIn */ |
502 | | /* DstOut */ |
503 | | /* DstOver */ |
504 | | /* MinusDst */ |
505 | | /* PegtopLight */ |
506 | | /* Src */ |
507 | 15.1k | }; |
508 | | |
509 | 15.1k | CompositeOperator |
510 | 15.1k | composite_op = UndefinedCompositeOp; |
511 | | |
512 | 15.1k | unsigned int |
513 | 15.1k | index, |
514 | 15.1k | mindex; |
515 | | |
516 | 15.1k | char |
517 | 15.1k | c; |
518 | | |
519 | 15.1k | char |
520 | 15.1k | match_string[MaxTextExtent]; |
521 | | |
522 | | /* |
523 | | Handle dash or underscore separated values like the major brand by |
524 | | stripping them out. |
525 | | */ |
526 | 93.1k | for (index = 0, mindex =0; option[index] != 0; index++) |
527 | 78.0k | { |
528 | 78.0k | c=option[index]; |
529 | 78.0k | if ((c != '_') && (c != '-')) |
530 | 77.6k | if (mindex < sizeof(match_string)-2) |
531 | 77.4k | match_string[mindex++]=c; |
532 | 78.0k | } |
533 | 15.1k | match_string[mindex]='\0'; |
534 | | |
535 | | /* |
536 | | Find a match |
537 | | */ |
538 | 15.1k | for (index = 0; |
539 | 274k | index < sizeof(composite_operators)/sizeof(composite_operators[0]); |
540 | 259k | index++) |
541 | 274k | { |
542 | 274k | if (LocaleCompare(composite_operators[index].str, match_string) == 0) |
543 | 15.1k | { |
544 | 15.1k | composite_op = composite_operators[index].op; |
545 | 15.1k | break; |
546 | 15.1k | } |
547 | 274k | } |
548 | | |
549 | 15.1k | return composite_op; |
550 | 15.1k | } |
551 | | |
552 | | /* |
553 | | CompressionType |
554 | | */ |
555 | | MagickExport const char* CompressionTypeToString(const CompressionType compression_type) |
556 | 88.9k | { |
557 | 88.9k | const char |
558 | 88.9k | *compression_string="?"; |
559 | | |
560 | 88.9k | switch (compression_type) |
561 | 88.9k | { |
562 | 62 | case UndefinedCompression: |
563 | 62 | compression_string="Undefined"; |
564 | 62 | break; |
565 | 84.6k | case NoCompression: |
566 | 84.6k | compression_string="No"; |
567 | 84.6k | break; |
568 | 1.62k | case BZipCompression: |
569 | 1.62k | compression_string="BZip"; |
570 | 1.62k | break; |
571 | 12 | case FaxCompression: |
572 | 12 | compression_string="Fax"; |
573 | 12 | break; |
574 | 0 | case Group4Compression: |
575 | 0 | compression_string="Group4"; |
576 | 0 | break; |
577 | 0 | case JPEGCompression: |
578 | 0 | compression_string="JPEG"; |
579 | 0 | break; |
580 | 0 | case LosslessJPEGCompression: |
581 | 0 | compression_string="Lossless JPEG"; |
582 | 0 | break; |
583 | 0 | case LZWCompression: |
584 | 0 | compression_string="LZW"; |
585 | 0 | break; |
586 | 340 | case RLECompression: |
587 | 340 | compression_string="RLE"; |
588 | 340 | break; |
589 | 2.24k | case ZipCompression: |
590 | 2.24k | compression_string="Zip"; |
591 | 2.24k | break; |
592 | 0 | case LZMACompression: |
593 | 0 | compression_string="LZMA"; |
594 | 0 | break; |
595 | 0 | case JPEG2000Compression: |
596 | 0 | compression_string="JPEG2000"; |
597 | 0 | break; |
598 | 0 | case JBIG1Compression: |
599 | 0 | compression_string="JBIG1"; |
600 | 0 | break; |
601 | 0 | case JBIG2Compression: |
602 | 0 | compression_string="JBIG2"; |
603 | 0 | break; |
604 | 0 | case ZSTDCompression: |
605 | 0 | compression_string="ZSTD"; |
606 | 0 | break; |
607 | 0 | case WebPCompression: |
608 | 0 | compression_string="WebP"; |
609 | 0 | break; |
610 | 88.9k | } |
611 | 88.9k | return compression_string; |
612 | 88.9k | } |
613 | | MagickExport CompressionType StringToCompressionType(const char *option) |
614 | 0 | { |
615 | 0 | CompressionType |
616 | 0 | compression_type = UndefinedCompression; |
617 | |
|
618 | 0 | if (LocaleCompare("None",option) == 0) |
619 | 0 | compression_type=NoCompression; |
620 | 0 | else if (LocaleCompare("BZip",option) == 0) |
621 | 0 | compression_type=BZipCompression; |
622 | 0 | else if (LocaleCompare("BZip2",option) == 0) |
623 | 0 | compression_type=BZipCompression; |
624 | 0 | else if (LocaleCompare("BZ2",option) == 0) |
625 | 0 | compression_type=BZipCompression; |
626 | 0 | else if (LocaleCompare("Fax",option) == 0) |
627 | 0 | compression_type=FaxCompression; |
628 | 0 | else if (LocaleCompare("Group3",option) == 0) |
629 | 0 | compression_type=Group3Compression; |
630 | 0 | else if (LocaleCompare("Group4",option) == 0) |
631 | 0 | compression_type=Group4Compression; |
632 | 0 | else if (LocaleCompare("JPEG",option) == 0) |
633 | 0 | compression_type=JPEGCompression; |
634 | 0 | else if (LocaleCompare("LosslessJPEG",option) == 0) |
635 | 0 | compression_type=LosslessJPEGCompression; |
636 | 0 | else if (LocaleCompare("Lossless",option) == 0) /* Bad choice! */ |
637 | 0 | compression_type=LosslessJPEGCompression; |
638 | 0 | else if (LocaleCompare("LZW",option) == 0) |
639 | 0 | compression_type=LZWCompression; |
640 | 0 | else if (LocaleCompare("RLE",option) == 0) |
641 | 0 | compression_type=RLECompression; |
642 | 0 | else if (LocaleCompare("Zip",option) == 0) |
643 | 0 | compression_type=ZipCompression; |
644 | 0 | else if (LocaleCompare("GZip",option) == 0) |
645 | 0 | compression_type=ZipCompression; |
646 | 0 | else if ((LocaleCompare("LZMA",option) == 0) || |
647 | 0 | (LocaleCompare("LZMA2",option) == 0)) |
648 | 0 | compression_type=LZMACompression; |
649 | 0 | else if (LocaleCompare("JPEG2000",option) == 0) |
650 | 0 | compression_type=JPEG2000Compression; |
651 | 0 | else if ((LocaleCompare("JBIG",option) == 0) || |
652 | 0 | (LocaleCompare("JBIG1",option) == 0)) |
653 | 0 | compression_type=JBIG1Compression; |
654 | 0 | else if (LocaleCompare("JBIG2",option) == 0) |
655 | 0 | compression_type=JBIG2Compression; |
656 | 0 | else if ((LocaleCompare("ZSTD",option) == 0) || |
657 | 0 | (LocaleCompare("Zstandard",option) == 0)) |
658 | 0 | compression_type=ZSTDCompression; |
659 | 0 | else if (LocaleCompare("WebP",option) == 0) |
660 | 0 | compression_type=WebPCompression; |
661 | |
|
662 | 0 | return compression_type; |
663 | 0 | } |
664 | | |
665 | | /* |
666 | | DisposeType |
667 | | */ |
668 | | MagickExport DisposeType StringToDisposeType(const char *option) |
669 | 0 | { |
670 | 0 | DisposeType dispose_type = UndefinedDispose; |
671 | |
|
672 | 0 | if (LocaleCompare("None",option) == 0) |
673 | 0 | dispose_type = NoneDispose; |
674 | 0 | else if (LocaleCompare("Background",option) == 0) |
675 | 0 | dispose_type = BackgroundDispose; |
676 | 0 | else if (LocaleCompare("Previous",option) == 0) |
677 | 0 | dispose_type = PreviousDispose; |
678 | |
|
679 | 0 | return dispose_type; |
680 | 0 | } |
681 | | MagickExport const char *DisposeTypeToString(const DisposeType dispose_type) |
682 | 35.3k | { |
683 | 35.3k | const char |
684 | 35.3k | *dispose_string="?"; |
685 | | |
686 | 35.3k | switch (dispose_type) |
687 | 35.3k | { |
688 | 32.9k | case UndefinedDispose: |
689 | 32.9k | dispose_string = "Undefined"; |
690 | 32.9k | break; |
691 | 6 | case NoneDispose: |
692 | 6 | dispose_string = "None"; |
693 | 6 | break; |
694 | 4 | case BackgroundDispose: |
695 | 4 | dispose_string = "Background"; |
696 | 4 | break; |
697 | 0 | case PreviousDispose: |
698 | 0 | dispose_string = "Previous"; |
699 | 0 | break; |
700 | 35.3k | } |
701 | | |
702 | 35.3k | return dispose_string; |
703 | 35.3k | } |
704 | | |
705 | | /* |
706 | | ConfirmAccessMode |
707 | | */ |
708 | | MagickExport const char *ConfirmAccessModeToString(const ConfirmAccessMode access_mode) |
709 | 0 | { |
710 | 0 | const char |
711 | 0 | *mode_string="?"; |
712 | |
|
713 | 0 | switch(access_mode) |
714 | 0 | { |
715 | 0 | case UndefinedConfirmAccessMode: |
716 | 0 | mode_string="Undefined"; |
717 | 0 | break; |
718 | 0 | case FileExecuteConfirmAccessMode: |
719 | 0 | mode_string="Execute"; |
720 | 0 | break; |
721 | 0 | case FileReadConfirmAccessMode: |
722 | 0 | mode_string="Read"; |
723 | 0 | break; |
724 | 0 | case FileWriteConfirmAccessMode: |
725 | 0 | mode_string="Write"; |
726 | 0 | break; |
727 | 0 | case URLGetFTPConfirmAccessMode: |
728 | 0 | mode_string="FTP Get"; |
729 | 0 | break; |
730 | 0 | case URLGetFileConfirmAccessMode: |
731 | 0 | mode_string="FILE Get"; |
732 | 0 | break; |
733 | 0 | case URLGetHTTPConfirmAccessMode: |
734 | 0 | mode_string="HTTP Get"; |
735 | 0 | break; |
736 | 0 | } |
737 | | |
738 | 0 | return mode_string; |
739 | 0 | } |
740 | | |
741 | | /* |
742 | | EndianType |
743 | | */ |
744 | | MagickExport const char *EndianTypeToString(const EndianType endian_type) |
745 | 0 | { |
746 | 0 | const char |
747 | 0 | *endian_string="?"; |
748 | |
|
749 | 0 | switch (endian_type) |
750 | 0 | { |
751 | 0 | case UndefinedEndian: |
752 | 0 | endian_string="Undefined"; |
753 | 0 | break; |
754 | 0 | case LSBEndian: |
755 | 0 | endian_string="LSB"; |
756 | 0 | break; |
757 | 0 | case MSBEndian: |
758 | 0 | endian_string="MSB"; |
759 | 0 | break; |
760 | 0 | case NativeEndian: |
761 | 0 | endian_string="Native"; |
762 | 0 | break; |
763 | 0 | } |
764 | | |
765 | 0 | return endian_string; |
766 | 0 | } |
767 | | MagickExport EndianType StringToEndianType(const char *option) |
768 | 0 | { |
769 | 0 | EndianType |
770 | 0 | endian_type = UndefinedEndian; |
771 | |
|
772 | 0 | if (LocaleCompare("LSB",option) == 0) |
773 | 0 | endian_type=LSBEndian; |
774 | 0 | else if (LocaleCompare("MSB",option) == 0) |
775 | 0 | endian_type=MSBEndian; |
776 | 0 | else if (LocaleCompare("NATIVE",option) == 0) |
777 | 0 | { |
778 | | #if defined(WORDS_BIGENDIAN) |
779 | | endian_type=MSBEndian; |
780 | | #else |
781 | 0 | endian_type=LSBEndian; |
782 | 0 | #endif |
783 | 0 | } |
784 | |
|
785 | 0 | return endian_type; |
786 | 0 | } |
787 | | |
788 | | /* |
789 | | FilterTypes |
790 | | */ |
791 | | MagickExport FilterTypes StringToFilterTypes(const char *option) |
792 | 0 | { |
793 | 0 | FilterTypes |
794 | 0 | filter = UndefinedFilter; |
795 | |
|
796 | 0 | if (LocaleCompare("Point",option) == 0) |
797 | 0 | filter=PointFilter; |
798 | 0 | else if (LocaleCompare("Box",option) == 0) |
799 | 0 | filter=BoxFilter; |
800 | 0 | else if (LocaleCompare("Triangle",option) == 0) |
801 | 0 | filter=TriangleFilter; |
802 | 0 | else if (LocaleCompare("Hermite",option) == 0) |
803 | 0 | filter=HermiteFilter; |
804 | 0 | else if (LocaleCompare("Hanning",option) == 0) |
805 | 0 | filter=HanningFilter; |
806 | 0 | else if (LocaleCompare("Hamming",option) == 0) |
807 | 0 | filter=HammingFilter; |
808 | 0 | else if (LocaleCompare("Blackman",option) == 0) |
809 | 0 | filter=BlackmanFilter; |
810 | 0 | else if (LocaleCompare("Gaussian",option) == 0) |
811 | 0 | filter=GaussianFilter; |
812 | 0 | else if (LocaleCompare("Quadratic",option) == 0) |
813 | 0 | filter=QuadraticFilter; |
814 | 0 | else if (LocaleCompare("Cubic",option) == 0) |
815 | 0 | filter=CubicFilter; |
816 | 0 | else if (LocaleCompare("Catrom",option) == 0) |
817 | 0 | filter=CatromFilter; |
818 | 0 | else if (LocaleCompare("Mitchell",option) == 0) |
819 | 0 | filter=MitchellFilter; |
820 | 0 | else if (LocaleCompare("Lanczos",option) == 0) |
821 | 0 | filter=LanczosFilter; |
822 | 0 | else if (LocaleCompare("Bessel",option) == 0) |
823 | 0 | filter=BesselFilter; |
824 | 0 | else if (LocaleCompare("Sinc",option) == 0) |
825 | 0 | filter=SincFilter; |
826 | |
|
827 | 0 | return filter; |
828 | 0 | } |
829 | | |
830 | | /* |
831 | | GravityType |
832 | | */ |
833 | | MagickExport const char *GravityTypeToString(const GravityType gravity_type) |
834 | 0 | { |
835 | 0 | const char |
836 | 0 | *gravity="?"; |
837 | |
|
838 | 0 | switch(gravity_type) |
839 | 0 | { |
840 | 0 | case ForgetGravity: |
841 | 0 | gravity="Forget"; |
842 | 0 | break; |
843 | 0 | case NorthWestGravity: |
844 | 0 | gravity="NorthWest"; |
845 | 0 | break; |
846 | 0 | case NorthGravity: |
847 | 0 | gravity="North"; |
848 | 0 | break; |
849 | 0 | case NorthEastGravity: |
850 | 0 | gravity="NorthEast"; |
851 | 0 | break; |
852 | 0 | case WestGravity: |
853 | 0 | gravity="West"; |
854 | 0 | break; |
855 | 0 | case CenterGravity: |
856 | 0 | gravity="Center"; |
857 | 0 | break; |
858 | 0 | case EastGravity: |
859 | 0 | gravity="East"; |
860 | 0 | break; |
861 | 0 | case SouthWestGravity: |
862 | 0 | gravity="SouthWest"; |
863 | 0 | break; |
864 | 0 | case SouthGravity: |
865 | 0 | gravity="South"; |
866 | 0 | break; |
867 | 0 | case SouthEastGravity: |
868 | 0 | gravity="SouthEast"; |
869 | 0 | break; |
870 | 0 | case StaticGravity: |
871 | 0 | gravity="Static"; |
872 | 0 | break; |
873 | 0 | } |
874 | | |
875 | 0 | return gravity; |
876 | 0 | } |
877 | | MagickExport GravityType StringToGravityType(const char *option) |
878 | 2.17k | { |
879 | 2.17k | GravityType |
880 | 2.17k | gravity_type=ForgetGravity; |
881 | | |
882 | 2.17k | if (LocaleCompare("Forget",option) == 0) |
883 | 0 | gravity_type=ForgetGravity; |
884 | 2.17k | else if (LocaleCompare("NorthWest",option) == 0) |
885 | 690 | gravity_type=NorthWestGravity; |
886 | 1.48k | else if (LocaleCompare("North",option) == 0) |
887 | 345 | gravity_type=NorthGravity; |
888 | 1.13k | else if (LocaleCompare("NorthEast",option) == 0) |
889 | 338 | gravity_type=NorthEastGravity; |
890 | 801 | else if (LocaleCompare("West",option) == 0) |
891 | 332 | gravity_type=WestGravity; |
892 | 469 | else if (LocaleCompare("Center",option) == 0) |
893 | 359 | gravity_type=CenterGravity; |
894 | 110 | else if (LocaleCompare("East",option) == 0) |
895 | 11 | gravity_type=EastGravity; |
896 | 99 | else if (LocaleCompare("SouthWest",option) == 0) |
897 | 1 | gravity_type=SouthWestGravity; |
898 | 98 | else if (LocaleCompare("South",option) == 0) |
899 | 74 | gravity_type=SouthGravity; |
900 | 24 | else if (LocaleCompare("SouthEast",option) == 0) |
901 | 1 | gravity_type=SouthEastGravity; |
902 | 23 | else if (LocaleCompare("Static",option) == 0) |
903 | 0 | gravity_type=StaticGravity; |
904 | | |
905 | 2.17k | return gravity_type; |
906 | 2.17k | } |
907 | | |
908 | | /* |
909 | | HighlightStyle |
910 | | */ |
911 | | MagickExport const char * |
912 | | HighlightStyleToString(const HighlightStyle difference_style) |
913 | 0 | { |
914 | 0 | const char |
915 | 0 | *style="?"; |
916 | |
|
917 | 0 | switch(difference_style) |
918 | 0 | { |
919 | 0 | case UndefinedHighlightStyle: |
920 | 0 | style="Undefined"; |
921 | 0 | break; |
922 | 0 | case AssignHighlightStyle: |
923 | 0 | style="Assign"; |
924 | 0 | break; |
925 | 0 | case ThresholdHighlightStyle: |
926 | 0 | style="Threshold"; |
927 | 0 | break; |
928 | 0 | case TintHighlightStyle: |
929 | 0 | style="Tint"; |
930 | 0 | break; |
931 | 0 | case XorHighlightStyle: |
932 | 0 | style="XOR"; |
933 | 0 | } |
934 | | |
935 | 0 | return style; |
936 | 0 | } |
937 | | MagickExport HighlightStyle |
938 | | StringToHighlightStyle(const char *option) |
939 | 0 | { |
940 | 0 | HighlightStyle |
941 | 0 | style=UndefinedHighlightStyle; |
942 | |
|
943 | 0 | if (LocaleCompare("Assign",option) == 0) |
944 | 0 | style=AssignHighlightStyle; |
945 | 0 | else if (LocaleCompare("Threshold",option) == 0) |
946 | 0 | style=ThresholdHighlightStyle; |
947 | 0 | else if (LocaleCompare("Tint",option) == 0) |
948 | 0 | style=TintHighlightStyle; |
949 | 0 | else if (LocaleCompare("XOR",option) == 0) |
950 | 0 | style=XorHighlightStyle; |
951 | |
|
952 | 0 | return style; |
953 | 0 | } |
954 | | |
955 | | /* |
956 | | ImageType |
957 | | */ |
958 | | MagickExport const char *ImageTypeToString(const ImageType image_type) |
959 | 0 | { |
960 | 0 | const char |
961 | 0 | *p = "?"; |
962 | |
|
963 | 0 | switch (image_type) |
964 | 0 | { |
965 | 0 | case UndefinedType: |
966 | 0 | p="Undefined"; |
967 | 0 | break; |
968 | 0 | case BilevelType: |
969 | 0 | p="Bilevel"; |
970 | 0 | break; |
971 | 0 | case GrayscaleType: |
972 | 0 | p="Grayscale"; |
973 | 0 | break; |
974 | 0 | case GrayscaleMatteType: |
975 | 0 | p="GrayscaleMatte"; |
976 | 0 | break; |
977 | 0 | case PaletteType: |
978 | 0 | p="Palette"; |
979 | 0 | break; |
980 | 0 | case PaletteMatteType: |
981 | 0 | p="PaletteMatte"; |
982 | 0 | break; |
983 | 0 | case TrueColorType: |
984 | 0 | p="TrueColor"; |
985 | 0 | break; |
986 | 0 | case TrueColorMatteType: |
987 | 0 | p="TrueColorMatte"; |
988 | 0 | break; |
989 | 0 | case ColorSeparationType: |
990 | 0 | p="ColorSeparation"; |
991 | 0 | break; |
992 | 0 | case ColorSeparationMatteType: |
993 | 0 | p="ColorSeparationMatte"; |
994 | 0 | break; |
995 | 0 | case OptimizeType: |
996 | 0 | p="Optimize"; |
997 | 0 | break; |
998 | 0 | } |
999 | | |
1000 | 0 | return p; |
1001 | 0 | } |
1002 | | MagickExport ImageType StringToImageType(const char *option) |
1003 | 0 | { |
1004 | 0 | ImageType |
1005 | 0 | image_type = UndefinedType; |
1006 | |
|
1007 | 0 | if (LocaleCompare("Bilevel",option) == 0) |
1008 | 0 | image_type=BilevelType; |
1009 | 0 | else if (LocaleCompare("Grayscale",option) == 0) |
1010 | 0 | image_type=GrayscaleType; |
1011 | 0 | else if (LocaleCompare("GrayscaleMatte",option) == 0) |
1012 | 0 | image_type=GrayscaleMatteType; |
1013 | 0 | else if (LocaleCompare("Palette",option) == 0) |
1014 | 0 | image_type=PaletteType; |
1015 | 0 | else if (LocaleCompare("PaletteMatte",option) == 0) |
1016 | 0 | image_type=PaletteMatteType; |
1017 | 0 | else if (LocaleCompare("TrueColor",option) == 0) |
1018 | 0 | image_type=TrueColorType; |
1019 | 0 | else if (LocaleCompare("TrueColorMatte",option) == 0) |
1020 | 0 | image_type=TrueColorMatteType; |
1021 | 0 | else if (LocaleCompare("ColorSeparation",option) == 0) |
1022 | 0 | image_type=ColorSeparationType; |
1023 | 0 | else if (LocaleCompare("ColorSeparationMatte",option) == 0) |
1024 | 0 | image_type=ColorSeparationMatteType; |
1025 | 0 | else if (LocaleCompare("Optimize",option) == 0) |
1026 | 0 | image_type=OptimizeType; |
1027 | |
|
1028 | 0 | return image_type; |
1029 | 0 | } |
1030 | | |
1031 | | /* |
1032 | | InterlaceType |
1033 | | */ |
1034 | | MagickExport const char *InterlaceTypeToString(const InterlaceType interlace_type) |
1035 | 35.3k | { |
1036 | 35.3k | const char |
1037 | 35.3k | *interlace_string = "?"; |
1038 | | |
1039 | 35.3k | switch (interlace_type) |
1040 | 35.3k | { |
1041 | 0 | case UndefinedInterlace: |
1042 | 0 | interlace_string = "Undefined"; |
1043 | 0 | break; |
1044 | 23.0k | case NoInterlace: |
1045 | 23.0k | interlace_string = "No"; |
1046 | 23.0k | break; |
1047 | 12.3k | case LineInterlace: |
1048 | 12.3k | interlace_string = "Line"; |
1049 | 12.3k | break; |
1050 | 0 | case PlaneInterlace: |
1051 | 0 | interlace_string = "Plane"; |
1052 | 0 | break; |
1053 | 0 | case PartitionInterlace: |
1054 | 0 | interlace_string = "Partition"; |
1055 | 0 | break; |
1056 | 35.3k | } |
1057 | | |
1058 | 35.3k | return interlace_string; |
1059 | 35.3k | } |
1060 | | MagickExport InterlaceType StringToInterlaceType(const char *option) |
1061 | 0 | { |
1062 | 0 | InterlaceType |
1063 | 0 | interlace_type = UndefinedInterlace; |
1064 | |
|
1065 | 0 | if (LocaleCompare("None",option) == 0) |
1066 | 0 | interlace_type=NoInterlace; |
1067 | 0 | else if (LocaleCompare("Line",option) == 0) |
1068 | 0 | interlace_type=LineInterlace; |
1069 | 0 | else if (LocaleCompare("Plane",option) == 0) |
1070 | 0 | interlace_type=PlaneInterlace; |
1071 | 0 | else if (LocaleCompare("Partition",option) == 0) |
1072 | 0 | interlace_type=PartitionInterlace; |
1073 | |
|
1074 | 0 | return interlace_type; |
1075 | 0 | } |
1076 | | |
1077 | | /* |
1078 | | MapMode |
1079 | | */ |
1080 | | MagickExport const char *MapModeToString(MapMode map_mode) |
1081 | 0 | { |
1082 | 0 | const char |
1083 | 0 | *mode_string="?"; |
1084 | |
|
1085 | 0 | switch (map_mode) |
1086 | 0 | { |
1087 | 0 | case ReadMode: |
1088 | 0 | mode_string="Read"; |
1089 | 0 | break; |
1090 | 0 | case WriteMode: |
1091 | 0 | mode_string="Write"; |
1092 | 0 | break; |
1093 | 0 | case IOMode: |
1094 | 0 | mode_string="IO"; |
1095 | 0 | break; |
1096 | 0 | } |
1097 | 0 | return mode_string; |
1098 | 0 | } |
1099 | | |
1100 | | /* |
1101 | | MetricType |
1102 | | */ |
1103 | | MagickExport const char *MetricTypeToString(MetricType metric) |
1104 | 0 | { |
1105 | 0 | const char |
1106 | 0 | *metric_string="Undefined"; |
1107 | |
|
1108 | 0 | switch (metric) |
1109 | 0 | { |
1110 | 0 | case UndefinedMetric: |
1111 | 0 | metric_string="Undefined"; |
1112 | 0 | break; |
1113 | 0 | case MeanAbsoluteErrorMetric: |
1114 | 0 | metric_string="MeanAbsoluteError"; |
1115 | 0 | break; |
1116 | 0 | case MeanSquaredErrorMetric: |
1117 | 0 | metric_string="MeanSquaredError"; |
1118 | 0 | break; |
1119 | 0 | case PeakAbsoluteErrorMetric: |
1120 | 0 | metric_string="PeakAbsoluteError"; |
1121 | 0 | break; |
1122 | 0 | case PeakSignalToNoiseRatioMetric: |
1123 | 0 | metric_string="PeakSignalToNoiseRatio"; |
1124 | 0 | break; |
1125 | 0 | case RootMeanSquaredErrorMetric: |
1126 | 0 | metric_string="RootMeanSquaredError"; |
1127 | 0 | break; |
1128 | 0 | } |
1129 | | |
1130 | 0 | return metric_string; |
1131 | 0 | } |
1132 | | MagickExport MetricType StringToMetricType(const char *option) |
1133 | 0 | { |
1134 | 0 | MetricType |
1135 | 0 | metric_type=UndefinedMetric; |
1136 | |
|
1137 | 0 | if ((LocaleCompare("MAE",option) == 0) || |
1138 | 0 | (LocaleCompare("MeanAbsoluteError",option) == 0)) |
1139 | 0 | metric_type=MeanAbsoluteErrorMetric; |
1140 | 0 | else if ((LocaleCompare("MSE",option) == 0) || |
1141 | 0 | (LocaleCompare("MeanSquaredError",option) == 0)) |
1142 | 0 | metric_type=MeanSquaredErrorMetric; |
1143 | 0 | else if ((LocaleCompare("PAE",option) == 0) || |
1144 | 0 | (LocaleCompare("PeakAbsoluteError",option) == 0)) |
1145 | 0 | metric_type=PeakAbsoluteErrorMetric; |
1146 | 0 | else if ((LocaleCompare("PSNR",option) == 0) || |
1147 | 0 | (LocaleCompare("PeakSignalToNoiseRatio",option) == 0)) |
1148 | 0 | metric_type=PeakSignalToNoiseRatioMetric; |
1149 | 0 | else if ((LocaleCompare("RMSE",option) == 0) || |
1150 | 0 | (LocaleCompare("RootMeanSquaredError",option) == 0)) |
1151 | 0 | metric_type=RootMeanSquaredErrorMetric; |
1152 | |
|
1153 | 0 | return metric_type; |
1154 | 0 | } |
1155 | | |
1156 | | /* |
1157 | | NoiseType |
1158 | | */ |
1159 | | MagickExport const char *NoiseTypeToString(NoiseType noise_type) |
1160 | 0 | { |
1161 | 0 | const char |
1162 | 0 | *noise_string="Undefined"; |
1163 | |
|
1164 | 0 | switch (noise_type) |
1165 | 0 | { |
1166 | 0 | case UniformNoise: |
1167 | 0 | noise_string="Uniform"; |
1168 | 0 | break; |
1169 | 0 | case GaussianNoise: |
1170 | 0 | noise_string="Gaussian"; |
1171 | 0 | break; |
1172 | 0 | case MultiplicativeGaussianNoise: |
1173 | 0 | noise_string="Multiplicative"; |
1174 | 0 | break; |
1175 | 0 | case ImpulseNoise: |
1176 | 0 | noise_string="Impulse"; |
1177 | 0 | break; |
1178 | 0 | case LaplacianNoise: |
1179 | 0 | noise_string="Laplacian"; |
1180 | 0 | break; |
1181 | 0 | case PoissonNoise: |
1182 | 0 | noise_string="Poisson"; |
1183 | 0 | break; |
1184 | 0 | case RandomNoise: |
1185 | 0 | noise_string="Random"; |
1186 | 0 | break; |
1187 | 0 | case UndefinedNoise: |
1188 | 0 | noise_string="Undefined"; |
1189 | 0 | break; |
1190 | 0 | } |
1191 | | |
1192 | 0 | return noise_string; |
1193 | 0 | } |
1194 | | MagickExport NoiseType StringToNoiseType(const char *option) |
1195 | 0 | { |
1196 | 0 | NoiseType |
1197 | 0 | noise_type=UndefinedNoise; |
1198 | |
|
1199 | 0 | if (LocaleCompare("Uniform",option) == 0) |
1200 | 0 | noise_type=UniformNoise; |
1201 | 0 | else if (LocaleCompare("Gaussian",option) == 0) |
1202 | 0 | noise_type=GaussianNoise; |
1203 | 0 | else if (LocaleCompare("Multiplicative",option) == 0) |
1204 | 0 | noise_type=MultiplicativeGaussianNoise; |
1205 | 0 | else if (LocaleCompare("Impulse",option) == 0) |
1206 | 0 | noise_type=ImpulseNoise; |
1207 | 0 | else if (LocaleCompare("Laplacian",option) == 0) |
1208 | 0 | noise_type=LaplacianNoise; |
1209 | 0 | else if (LocaleCompare("Poisson",option) == 0) |
1210 | 0 | noise_type=PoissonNoise; |
1211 | 0 | else if (LocaleCompare("Random",option) == 0) |
1212 | 0 | noise_type=RandomNoise; |
1213 | 0 | else if (LocaleCompare("Undefined",option) == 0) |
1214 | 0 | noise_type=UndefinedNoise; |
1215 | 0 | return noise_type; |
1216 | 0 | } |
1217 | | |
1218 | | /* |
1219 | | OrientationType |
1220 | | */ |
1221 | | MagickExport const char *OrientationTypeToString(const OrientationType orientation_type) |
1222 | 4.33k | { |
1223 | 4.33k | const char * |
1224 | 4.33k | orientation = "?"; |
1225 | | |
1226 | 4.33k | switch (orientation_type) |
1227 | 4.33k | { |
1228 | 0 | case UndefinedOrientation: |
1229 | 0 | orientation = "Unknown"; |
1230 | 0 | break; |
1231 | 646 | case TopLeftOrientation: |
1232 | 646 | orientation = "TopLeft"; |
1233 | 646 | break; |
1234 | 1.20k | case TopRightOrientation: |
1235 | 1.20k | orientation = "TopRight"; |
1236 | 1.20k | break; |
1237 | 453 | case BottomRightOrientation: |
1238 | 453 | orientation = "BottomRight"; |
1239 | 453 | break; |
1240 | 2.01k | case BottomLeftOrientation: |
1241 | 2.01k | orientation = "BottomLeft"; |
1242 | 2.01k | break; |
1243 | 0 | case LeftTopOrientation: |
1244 | 0 | orientation = "LeftTop"; |
1245 | 0 | break; |
1246 | 19 | case RightTopOrientation: |
1247 | 19 | orientation = "RightTop"; |
1248 | 19 | break; |
1249 | 1 | case RightBottomOrientation: |
1250 | 1 | orientation = "RightBottom"; |
1251 | 1 | break; |
1252 | 0 | case LeftBottomOrientation: |
1253 | 0 | orientation = "LeftBottom"; |
1254 | 0 | break; |
1255 | 4.33k | } |
1256 | | |
1257 | 4.33k | return orientation; |
1258 | 4.33k | } |
1259 | | |
1260 | | MagickExport OrientationType StringToOrientationType(const char *option) |
1261 | 5.15k | { |
1262 | 5.15k | OrientationType |
1263 | 5.15k | orientation_type = UndefinedOrientation; |
1264 | | |
1265 | 5.15k | if ((LocaleCompare("Unknown",option) == 0) || |
1266 | 4.68k | (LocaleCompare("undefined",option) == 0)) |
1267 | 598 | orientation_type=UndefinedOrientation; |
1268 | 4.55k | else if ((LocaleCompare("TopLeft",option) == 0) || |
1269 | 4.55k | (LocaleCompare("top-left",option) == 0)) |
1270 | 0 | orientation_type=TopLeftOrientation; |
1271 | 4.55k | else if ((LocaleCompare("TopRight",option) == 0) || |
1272 | 4.35k | (LocaleCompare("top-right",option) == 0)) |
1273 | 393 | orientation_type=TopRightOrientation; |
1274 | 4.16k | else if ((LocaleCompare("BottomRight",option) == 0) || |
1275 | 3.86k | (LocaleCompare("bottom-right",option) == 0)) |
1276 | 495 | orientation_type=BottomRightOrientation; |
1277 | 3.66k | else if ((LocaleCompare("BottomLeft",option) == 0) || |
1278 | 3.66k | (LocaleCompare("bottom-left",option) == 0)) |
1279 | 0 | orientation_type=BottomLeftOrientation; |
1280 | 3.66k | else if ((LocaleCompare("LeftTop",option) == 0) || |
1281 | 3.66k | (LocaleCompare("left-top",option) == 0)) |
1282 | 0 | orientation_type=LeftTopOrientation; |
1283 | 3.66k | else if ((LocaleCompare("RightTop",option) == 0) || |
1284 | 3.26k | (LocaleCompare("right-top",option) == 0)) |
1285 | 836 | orientation_type=RightTopOrientation; |
1286 | 2.83k | else if ((LocaleCompare("RightBottom",option) == 0) || |
1287 | 2.24k | (LocaleCompare("right-bottom",option) == 0)) |
1288 | 1.85k | orientation_type=RightBottomOrientation; |
1289 | 976 | else if ((LocaleCompare("LeftBottom",option) == 0) || |
1290 | 976 | (LocaleCompare("left-bottom",option) == 0)) |
1291 | 0 | orientation_type=LeftBottomOrientation; |
1292 | | |
1293 | 5.15k | return orientation_type; |
1294 | 5.15k | } |
1295 | | |
1296 | | /* |
1297 | | PreviewType |
1298 | | */ |
1299 | | MagickExport PreviewType StringToPreviewType(const char *option) |
1300 | 0 | { |
1301 | 0 | PreviewType |
1302 | 0 | preview_type = UndefinedPreview; |
1303 | |
|
1304 | 0 | if (LocaleCompare("Rotate",option) == 0) |
1305 | 0 | preview_type=RotatePreview; |
1306 | 0 | else if (LocaleCompare("Shear",option) == 0) |
1307 | 0 | preview_type=ShearPreview; |
1308 | 0 | else if (LocaleCompare("Roll",option) == 0) |
1309 | 0 | preview_type=RollPreview; |
1310 | 0 | else if (LocaleCompare("Hue",option) == 0) |
1311 | 0 | preview_type=HuePreview; |
1312 | 0 | else if (LocaleCompare("Saturation",option) == 0) |
1313 | 0 | preview_type=SaturationPreview; |
1314 | 0 | else if (LocaleCompare("Brightness",option) == 0) |
1315 | 0 | preview_type=BrightnessPreview; |
1316 | 0 | else if (LocaleCompare("Gamma",option) == 0) |
1317 | 0 | preview_type=GammaPreview; |
1318 | 0 | else if (LocaleCompare("Spiff",option) == 0) |
1319 | 0 | preview_type=SpiffPreview; |
1320 | 0 | else if (LocaleCompare("Dull",option) == 0) |
1321 | 0 | preview_type=DullPreview; |
1322 | 0 | else if (LocaleCompare("Grayscale",option) == 0) |
1323 | 0 | preview_type=GrayscalePreview; |
1324 | 0 | else if (LocaleCompare("Quantize",option) == 0) |
1325 | 0 | preview_type=QuantizePreview; |
1326 | 0 | else if (LocaleCompare("Despeckle",option) == 0) |
1327 | 0 | preview_type=DespecklePreview; |
1328 | 0 | else if (LocaleCompare("ReduceNoise",option) == 0) |
1329 | 0 | preview_type=ReduceNoisePreview; |
1330 | 0 | else if (LocaleCompare("AddNoise",option) == 0) |
1331 | 0 | preview_type=AddNoisePreview; |
1332 | 0 | else if (LocaleCompare("Sharpen",option) == 0) |
1333 | 0 | preview_type=SharpenPreview; |
1334 | 0 | else if (LocaleCompare("Blur",option) == 0) |
1335 | 0 | preview_type=BlurPreview; |
1336 | 0 | else if (LocaleCompare("Threshold",option) == 0) |
1337 | 0 | preview_type=ThresholdPreview; |
1338 | 0 | else if (LocaleCompare("EdgeDetect",option) == 0) |
1339 | 0 | preview_type=EdgeDetectPreview; |
1340 | 0 | else if (LocaleCompare("Spread",option) == 0) |
1341 | 0 | preview_type=SpreadPreview; |
1342 | 0 | else if (LocaleCompare("Shade",option) == 0) |
1343 | 0 | preview_type=ShadePreview; |
1344 | 0 | else if (LocaleCompare("Raise",option) == 0) |
1345 | 0 | preview_type=RaisePreview; |
1346 | 0 | else if (LocaleCompare("Segment",option) == 0) |
1347 | 0 | preview_type=SegmentPreview; |
1348 | 0 | else if (LocaleCompare("Solarize",option) == 0) |
1349 | 0 | preview_type=SolarizePreview; |
1350 | 0 | else if (LocaleCompare("Swirl",option) == 0) |
1351 | 0 | preview_type=SwirlPreview; |
1352 | 0 | else if (LocaleCompare("Implode",option) == 0) |
1353 | 0 | preview_type=ImplodePreview; |
1354 | 0 | else if (LocaleCompare("Wave",option) == 0) |
1355 | 0 | preview_type=WavePreview; |
1356 | 0 | else if (LocaleCompare("OilPaint",option) == 0) |
1357 | 0 | preview_type=OilPaintPreview; |
1358 | 0 | else if (LocaleCompare("CharcoalDrawing",option) == 0) |
1359 | 0 | preview_type=CharcoalDrawingPreview; |
1360 | 0 | else if (LocaleCompare("JPEG",option) == 0) |
1361 | 0 | preview_type=JPEGPreview; |
1362 | |
|
1363 | 0 | return preview_type; |
1364 | 0 | } |
1365 | | |
1366 | | |
1367 | | /* |
1368 | | QuantumOperator |
1369 | | */ |
1370 | | MagickExport QuantumOperator StringToQuantumOperator(const char *option) |
1371 | 0 | { |
1372 | 0 | QuantumOperator |
1373 | 0 | quantum_operator; |
1374 | |
|
1375 | 0 | quantum_operator=UndefinedQuantumOp; |
1376 | 0 | if (LocaleCompare("add",option) == 0) |
1377 | 0 | quantum_operator=AddQuantumOp; |
1378 | 0 | else if (LocaleCompare("and",option) == 0) |
1379 | 0 | quantum_operator=AndQuantumOp; |
1380 | 0 | else if ((LocaleCompare("assign",option) == 0) || |
1381 | 0 | (LocaleCompare("Set",option) == 0)) |
1382 | 0 | quantum_operator=AssignQuantumOp; |
1383 | 0 | else if (LocaleCompare("divide",option) == 0) |
1384 | 0 | quantum_operator=DivideQuantumOp; |
1385 | 0 | else if ((LocaleCompare("lshift",option) == 0) || |
1386 | 0 | (LocaleCompare("LeftShift",option) == 0)) |
1387 | 0 | quantum_operator=LShiftQuantumOp; |
1388 | 0 | else if (LocaleCompare("multiply",option) == 0) |
1389 | 0 | quantum_operator=MultiplyQuantumOp; |
1390 | 0 | else if (LocaleCompare("or",option) == 0) |
1391 | 0 | quantum_operator=OrQuantumOp; |
1392 | 0 | else if ((LocaleCompare("rshift",option) == 0) || |
1393 | 0 | (LocaleCompare("RightShift",option) == 0)) |
1394 | 0 | quantum_operator=RShiftQuantumOp; |
1395 | 0 | else if (LocaleCompare("subtract",option) == 0) |
1396 | 0 | quantum_operator=SubtractQuantumOp; |
1397 | 0 | else if (LocaleCompare("threshold",option) == 0) |
1398 | 0 | quantum_operator=ThresholdQuantumOp; |
1399 | 0 | else if ((LocaleCompare("threshold-black",option) == 0) || |
1400 | 0 | (LocaleCompare("ThresholdBlack",option) == 0)) |
1401 | 0 | quantum_operator=ThresholdBlackQuantumOp; |
1402 | 0 | else if ((LocaleCompare("threshold-white",option) == 0) || |
1403 | 0 | (LocaleCompare("ThresholdWhite",option) == 0)) |
1404 | 0 | quantum_operator=ThresholdWhiteQuantumOp; |
1405 | 0 | else if ((LocaleCompare("threshold-black-negate",option) == 0) || |
1406 | 0 | (LocaleCompare("ThresholdBlackNegate",option) == 0)) |
1407 | 0 | quantum_operator=ThresholdBlackNegateQuantumOp; |
1408 | 0 | else if ((LocaleCompare("threshold-white-negate",option) == 0) || |
1409 | 0 | (LocaleCompare("ThresholdWhiteNegate",option) == 0)) |
1410 | 0 | quantum_operator=ThresholdWhiteNegateQuantumOp; |
1411 | 0 | else if (LocaleCompare("xor",option) == 0) |
1412 | 0 | quantum_operator=XorQuantumOp; |
1413 | 0 | else if ((LocaleCompare("noise-gaussian",option) == 0) || |
1414 | 0 | (LocaleCompare("GaussianNoise",option) == 0)) |
1415 | 0 | quantum_operator=NoiseGaussianQuantumOp; |
1416 | 0 | else if ((LocaleCompare("noise-impulse",option) == 0) || |
1417 | 0 | (LocaleCompare("ImpulseNoise",option) == 0)) |
1418 | 0 | quantum_operator=NoiseImpulseQuantumOp; |
1419 | 0 | else if ((LocaleCompare("noise-laplacian",option) == 0) || |
1420 | 0 | (LocaleCompare("LaplacianNoise",option) == 0)) |
1421 | 0 | quantum_operator=NoiseLaplacianQuantumOp; |
1422 | 0 | else if ((LocaleCompare("noise-multiplicative",option) == 0) || |
1423 | 0 | (LocaleCompare("MultiplicativeNoise",option) == 0)) |
1424 | 0 | quantum_operator=NoiseMultiplicativeQuantumOp; |
1425 | 0 | else if ((LocaleCompare("noise-poisson",option) == 0) || |
1426 | 0 | (LocaleCompare("PoissonNoise",option) == 0)) |
1427 | 0 | quantum_operator=NoisePoissonQuantumOp; |
1428 | 0 | else if ((LocaleCompare("noise-random",option) == 0) || |
1429 | 0 | (LocaleCompare("RandomNoise",option) == 0)) |
1430 | 0 | quantum_operator=NoiseRandomQuantumOp; |
1431 | 0 | else if ((LocaleCompare("noise-uniform",option) == 0) || |
1432 | 0 | (LocaleCompare("UniformNoise",option) == 0)) |
1433 | 0 | quantum_operator=NoiseUniformQuantumOp; |
1434 | 0 | else if (LocaleCompare("negate",option) == 0) |
1435 | 0 | quantum_operator=NegateQuantumOp; |
1436 | 0 | else if (LocaleCompare("gamma",option) == 0) |
1437 | 0 | quantum_operator=GammaQuantumOp; |
1438 | 0 | else if (LocaleCompare("depth",option) == 0) |
1439 | 0 | quantum_operator=DepthQuantumOp; |
1440 | 0 | else if (LocaleCompare("log",option) == 0) |
1441 | 0 | quantum_operator=LogQuantumOp; |
1442 | 0 | else if (LocaleCompare("max",option) == 0) |
1443 | 0 | quantum_operator=MaxQuantumOp; |
1444 | 0 | else if (LocaleCompare("min",option) == 0) |
1445 | 0 | quantum_operator=MinQuantumOp; |
1446 | 0 | else if (LocaleCompare("pow",option) == 0) |
1447 | 0 | quantum_operator=PowQuantumOp; |
1448 | |
|
1449 | 0 | return quantum_operator; |
1450 | 0 | } |
1451 | | MagickExport const char *QuantumOperatorToString(const QuantumOperator quantum_operator) |
1452 | 0 | { |
1453 | 0 | const char |
1454 | 0 | *operator_text = "?"; |
1455 | |
|
1456 | 0 | switch (quantum_operator) |
1457 | 0 | { |
1458 | 0 | case UndefinedQuantumOp: |
1459 | 0 | operator_text="undefined"; |
1460 | 0 | break; |
1461 | 0 | case AddQuantumOp: |
1462 | 0 | operator_text="add"; |
1463 | 0 | break; |
1464 | 0 | case AndQuantumOp: |
1465 | 0 | operator_text="and"; |
1466 | 0 | break; |
1467 | 0 | case AssignQuantumOp: |
1468 | 0 | operator_text="assign"; |
1469 | 0 | break; |
1470 | 0 | case DivideQuantumOp: |
1471 | 0 | operator_text="divide"; |
1472 | 0 | break; |
1473 | 0 | case LShiftQuantumOp: |
1474 | 0 | operator_text="lshift"; |
1475 | 0 | break; |
1476 | 0 | case MultiplyQuantumOp: |
1477 | 0 | operator_text="multiply"; |
1478 | 0 | break; |
1479 | 0 | case OrQuantumOp: |
1480 | 0 | operator_text="or"; |
1481 | 0 | break; |
1482 | 0 | case RShiftQuantumOp: |
1483 | 0 | operator_text="rshift"; |
1484 | 0 | break; |
1485 | 0 | case SubtractQuantumOp: |
1486 | 0 | operator_text="subtract"; |
1487 | 0 | break; |
1488 | 0 | case ThresholdQuantumOp: |
1489 | 0 | operator_text="threshold"; |
1490 | 0 | break; |
1491 | 0 | case ThresholdBlackQuantumOp: |
1492 | 0 | operator_text="threshold-black"; |
1493 | 0 | break; |
1494 | 0 | case ThresholdWhiteQuantumOp: |
1495 | 0 | operator_text="threshold-white"; |
1496 | 0 | break; |
1497 | 0 | case ThresholdBlackNegateQuantumOp: |
1498 | 0 | operator_text="threshold-black-negate"; |
1499 | 0 | break; |
1500 | 0 | case ThresholdWhiteNegateQuantumOp: |
1501 | 0 | operator_text="threshold-white-negate"; |
1502 | 0 | break; |
1503 | 0 | case XorQuantumOp: |
1504 | 0 | operator_text="xor"; |
1505 | 0 | break; |
1506 | 0 | case NoiseGaussianQuantumOp: |
1507 | 0 | operator_text="noise-gaussian"; |
1508 | 0 | break; |
1509 | 0 | case NoiseImpulseQuantumOp: |
1510 | 0 | operator_text="noise-impulse"; |
1511 | 0 | break; |
1512 | 0 | case NoiseLaplacianQuantumOp: |
1513 | 0 | operator_text="noise-laplacian"; |
1514 | 0 | break; |
1515 | 0 | case NoiseMultiplicativeQuantumOp: |
1516 | 0 | operator_text="noise-multiplicative"; |
1517 | 0 | break; |
1518 | 0 | case NoisePoissonQuantumOp: |
1519 | 0 | operator_text="noise-poisson"; |
1520 | 0 | break; |
1521 | 0 | case NoiseUniformQuantumOp: |
1522 | 0 | operator_text="noise-uniform"; |
1523 | 0 | break; |
1524 | 0 | case NegateQuantumOp: |
1525 | 0 | operator_text="negate"; |
1526 | 0 | break; |
1527 | 0 | case GammaQuantumOp: |
1528 | 0 | operator_text="gamma"; |
1529 | 0 | break; |
1530 | 0 | case DepthQuantumOp: |
1531 | 0 | operator_text="depth"; |
1532 | 0 | break; |
1533 | 0 | case LogQuantumOp: |
1534 | 0 | operator_text="log"; |
1535 | 0 | break; |
1536 | 0 | case MaxQuantumOp: |
1537 | 0 | operator_text="max"; |
1538 | 0 | break; |
1539 | 0 | case MinQuantumOp: |
1540 | 0 | operator_text="min"; |
1541 | 0 | break; |
1542 | 0 | case PowQuantumOp: |
1543 | 0 | operator_text="pow"; |
1544 | 0 | break; |
1545 | 0 | case NoiseRandomQuantumOp: |
1546 | 0 | operator_text="noise-random"; |
1547 | 0 | break; |
1548 | 0 | } |
1549 | | |
1550 | 0 | return operator_text; |
1551 | 0 | } |
1552 | | |
1553 | | /* |
1554 | | FilterTypes |
1555 | | */ |
1556 | | MagickExport const char *ResizeFilterToString(const FilterTypes filter) |
1557 | 0 | { |
1558 | 0 | const char * |
1559 | 0 | filter_string = "?"; |
1560 | |
|
1561 | 0 | switch (filter) |
1562 | 0 | { |
1563 | 0 | case UndefinedFilter: |
1564 | 0 | filter_string="Undefined"; |
1565 | 0 | break; |
1566 | 0 | case PointFilter: |
1567 | 0 | filter_string="Point"; |
1568 | 0 | break; |
1569 | 0 | case BoxFilter: |
1570 | 0 | filter_string="Box"; |
1571 | 0 | break; |
1572 | 0 | case TriangleFilter: |
1573 | 0 | filter_string="Triangle"; |
1574 | 0 | break; |
1575 | 0 | case HermiteFilter: |
1576 | 0 | filter_string="Hermite"; |
1577 | 0 | break; |
1578 | 0 | case HanningFilter: |
1579 | 0 | filter_string="Hanning"; |
1580 | 0 | break; |
1581 | 0 | case HammingFilter: |
1582 | 0 | filter_string="Hamming"; |
1583 | 0 | break; |
1584 | 0 | case BlackmanFilter: |
1585 | 0 | filter_string="Blackman"; |
1586 | 0 | break; |
1587 | 0 | case GaussianFilter: |
1588 | 0 | filter_string="Gaussian"; |
1589 | 0 | break; |
1590 | 0 | case QuadraticFilter: |
1591 | 0 | filter_string="Quadratic"; |
1592 | 0 | break; |
1593 | 0 | case CubicFilter: |
1594 | 0 | filter_string="Cubi"; |
1595 | 0 | break; |
1596 | 0 | case CatromFilter: |
1597 | 0 | filter_string="Catrom"; |
1598 | 0 | break; |
1599 | 0 | case MitchellFilter: |
1600 | 0 | filter_string="Mitchell"; |
1601 | 0 | break; |
1602 | 0 | case LanczosFilter: |
1603 | 0 | filter_string="Lanczos"; |
1604 | 0 | break; |
1605 | 0 | case BesselFilter: |
1606 | 0 | filter_string="Bessel"; |
1607 | 0 | break; |
1608 | 0 | case SincFilter: |
1609 | 0 | filter_string="Sinc"; |
1610 | 0 | break; |
1611 | 0 | } |
1612 | | |
1613 | 0 | return filter_string; |
1614 | 0 | } |
1615 | | |
1616 | | /* |
1617 | | ResolutionType |
1618 | | */ |
1619 | | MagickExport ResolutionType StringToResolutionType(const char *option) |
1620 | 0 | { |
1621 | 0 | ResolutionType |
1622 | 0 | resolution_type = UndefinedResolution; |
1623 | |
|
1624 | 0 | if (LocaleCompare("PixelsPerInch",option) == 0) |
1625 | 0 | resolution_type=PixelsPerInchResolution; |
1626 | 0 | else if (LocaleCompare("PixelsPerCentimeter",option) == 0) |
1627 | 0 | resolution_type=PixelsPerCentimeterResolution; |
1628 | |
|
1629 | 0 | return resolution_type; |
1630 | 0 | } |
1631 | | MagickExport const char *ResolutionTypeToString(const ResolutionType resolution_type) |
1632 | 50.7k | { |
1633 | 50.7k | switch (resolution_type) |
1634 | 50.7k | { |
1635 | 42.8k | case UndefinedResolution: return ("Undefined"); |
1636 | 7.22k | case PixelsPerInchResolution: return ("PixelsPerInch"); |
1637 | 735 | case PixelsPerCentimeterResolution: return ("PixelsPerCentimeter"); |
1638 | 50.7k | } |
1639 | 0 | return ("unknown"); |
1640 | 50.7k | } |
1641 | | |
1642 | | /* |
1643 | | ResourceType |
1644 | | */ |
1645 | | MagickExport ResourceType StringToResourceType(const char *option) |
1646 | 0 | { |
1647 | 0 | ResourceType |
1648 | 0 | resource_type = UndefinedResource; |
1649 | |
|
1650 | 0 | if (LocaleCompare("Disk",option) == 0) |
1651 | 0 | resource_type=DiskResource; |
1652 | 0 | else if (LocaleCompare("File",option) == 0) |
1653 | 0 | resource_type=FileResource; |
1654 | 0 | else if (LocaleCompare("Files",option) == 0) |
1655 | 0 | resource_type=FileResource; |
1656 | 0 | else if (LocaleCompare("Map",option) == 0) |
1657 | 0 | resource_type=MapResource; |
1658 | 0 | else if (LocaleCompare("Memory",option) == 0) |
1659 | 0 | resource_type=MemoryResource; |
1660 | 0 | else if (LocaleCompare("Pixels",option) == 0) |
1661 | 0 | resource_type=PixelsResource; |
1662 | 0 | else if (LocaleCompare("Threads",option) == 0) |
1663 | 0 | resource_type=ThreadsResource; |
1664 | 0 | else if (LocaleCompare("Width",option) == 0) |
1665 | 0 | resource_type=WidthResource; |
1666 | 0 | else if (LocaleCompare("Height",option) == 0) |
1667 | 0 | resource_type=HeightResource; |
1668 | 0 | else if (LocaleCompare("Read",option) == 0) |
1669 | 0 | resource_type=ReadResource; |
1670 | 0 | else if (LocaleCompare("Write",option) == 0) |
1671 | 0 | resource_type=WriteResource; |
1672 | 0 | else if (LocaleCompare("Images",option) == 0) |
1673 | 0 | resource_type=ImagesResource; |
1674 | 0 | return resource_type; |
1675 | 0 | } |
1676 | | |
1677 | | /* |
1678 | | StorageType |
1679 | | */ |
1680 | | MagickExport const char *StorageTypeToString(const StorageType storage_type) |
1681 | 0 | { |
1682 | 0 | const char |
1683 | 0 | *p = "?"; |
1684 | |
|
1685 | 0 | switch (storage_type) |
1686 | 0 | { |
1687 | 0 | case CharPixel: |
1688 | 0 | p="CharPixel"; |
1689 | 0 | break; |
1690 | 0 | case ShortPixel: |
1691 | 0 | p="ShortPixel"; |
1692 | 0 | break; |
1693 | 0 | case IntegerPixel: |
1694 | 0 | p="IntegerPixel"; |
1695 | 0 | break; |
1696 | 0 | case LongPixel: |
1697 | 0 | p="LongPixel"; |
1698 | 0 | break; |
1699 | 0 | case FloatPixel: |
1700 | 0 | p="FloatPixel"; |
1701 | 0 | break; |
1702 | 0 | case DoublePixel: |
1703 | 0 | p="DoublePixel"; |
1704 | 0 | break; |
1705 | 0 | } |
1706 | | |
1707 | 0 | return p; |
1708 | 0 | } |
1709 | | |
1710 | | /* |
1711 | | QuantumSampleType |
1712 | | */ |
1713 | | MagickExport const char *QuantumSampleTypeToString(const QuantumSampleType sample_type) |
1714 | 0 | { |
1715 | 0 | const char |
1716 | 0 | *p = "?"; |
1717 | |
|
1718 | 0 | switch (sample_type) |
1719 | 0 | { |
1720 | 0 | case UndefinedQuantumSampleType: |
1721 | 0 | p="UndefinedQuantumSampleType"; |
1722 | 0 | break; |
1723 | 0 | case UnsignedQuantumSampleType: |
1724 | 0 | p="UnsignedQuantumSampleType"; |
1725 | 0 | break; |
1726 | 0 | case FloatQuantumSampleType: |
1727 | 0 | p="FloatQuantumSampleType"; |
1728 | 0 | break; |
1729 | 0 | } |
1730 | | |
1731 | 0 | return p; |
1732 | 0 | } |
1733 | | |
1734 | | /* |
1735 | | StretchType |
1736 | | */ |
1737 | | MagickExport const char *StretchTypeToString(StretchType stretch) |
1738 | 0 | { |
1739 | 0 | switch(stretch) |
1740 | 0 | { |
1741 | 0 | case NormalStretch: return("normal"); |
1742 | 0 | case UltraCondensedStretch: return("ultra-condensed"); |
1743 | 0 | case ExtraCondensedStretch: return("extra-condensed"); |
1744 | 0 | case CondensedStretch: return("condensed"); |
1745 | 0 | case SemiCondensedStretch: return("semi-condensed"); |
1746 | 0 | case SemiExpandedStretch: return("semi-expanded"); |
1747 | 0 | case ExpandedStretch: return("expanded"); |
1748 | 0 | case ExtraExpandedStretch: return("extra-expanded"); |
1749 | 0 | case UltraExpandedStretch: return("ultra-expanded"); |
1750 | 0 | case AnyStretch: return("any"); |
1751 | 0 | default: break; |
1752 | 0 | } |
1753 | 0 | return("unknown"); |
1754 | 0 | } |
1755 | | |
1756 | | /* |
1757 | | StyleType |
1758 | | */ |
1759 | | MagickExport const char *StyleTypeToString(StyleType style) |
1760 | 0 | { |
1761 | 0 | switch(style) |
1762 | 0 | { |
1763 | 0 | case NormalStyle: return("normal"); |
1764 | 0 | case ItalicStyle: return("italic"); |
1765 | 0 | case ObliqueStyle: return("oblique"); |
1766 | 0 | case AnyStyle: return("any"); |
1767 | 0 | default: break; |
1768 | 0 | } |
1769 | 0 | return("unknown"); |
1770 | 0 | } |
1771 | | |
1772 | | /* |
1773 | | QuantumType |
1774 | | */ |
1775 | | MagickExport const char *QuantumTypeToString(const QuantumType quantum_type) |
1776 | 903k | { |
1777 | 903k | const char |
1778 | 903k | *p = "?"; |
1779 | | |
1780 | 903k | switch (quantum_type) |
1781 | 903k | { |
1782 | 6.18k | case UndefinedQuantum: |
1783 | 6.18k | p="UndefinedQuantum"; |
1784 | 6.18k | break; |
1785 | 92.1k | case IndexQuantum: |
1786 | 92.1k | p="IndexQuantum"; |
1787 | 92.1k | break; |
1788 | 633k | case GrayQuantum: |
1789 | 633k | p="GrayQuantum"; |
1790 | 633k | break; |
1791 | 174 | case IndexAlphaQuantum: |
1792 | 174 | p="IndexAlphaQuantum"; |
1793 | 174 | break; |
1794 | 2.18k | case GrayAlphaQuantum: |
1795 | 2.18k | p="GrayAlphaQuantum"; |
1796 | 2.18k | break; |
1797 | 811 | case RedQuantum: |
1798 | 811 | p="RedQuantum"; |
1799 | 811 | break; |
1800 | 717 | case CyanQuantum: |
1801 | 717 | p="CyanQuantum"; |
1802 | 717 | break; |
1803 | 356 | case GreenQuantum: |
1804 | 356 | p="GreenQuantum"; |
1805 | 356 | break; |
1806 | 328 | case YellowQuantum: |
1807 | 328 | p="YellowQuantum"; |
1808 | 328 | break; |
1809 | 324 | case BlueQuantum: |
1810 | 324 | p="BlueQuantum"; |
1811 | 324 | break; |
1812 | 330 | case MagentaQuantum: |
1813 | 330 | p="MagentaQuantum"; |
1814 | 330 | break; |
1815 | 417 | case AlphaQuantum: |
1816 | 417 | p="AlphaQuantum"; |
1817 | 417 | break; |
1818 | 328 | case BlackQuantum: |
1819 | 328 | p="BlackQuantum"; |
1820 | 328 | break; |
1821 | 139k | case RGBQuantum: |
1822 | 139k | p="RGBQuantum"; |
1823 | 139k | break; |
1824 | 7.01k | case RGBAQuantum: |
1825 | 7.01k | p="RGBAQuantum"; |
1826 | 7.01k | break; |
1827 | 2.11k | case CMYKQuantum: |
1828 | 2.11k | p="CMYKQuantum"; |
1829 | 2.11k | break; |
1830 | 781 | case CMYKAQuantum: |
1831 | 781 | p="CMYKAQuantum"; |
1832 | 781 | break; |
1833 | 14.5k | case CIEYQuantum: |
1834 | 14.5k | p="CIEYQuantum"; |
1835 | 14.5k | break; |
1836 | 1.81k | case CIEXYZQuantum: |
1837 | 1.81k | p="CIEXYZQuantum"; |
1838 | 1.81k | break; |
1839 | 903k | } |
1840 | | |
1841 | 903k | return p; |
1842 | 903k | } |
1843 | | |
1844 | | /* |
1845 | | VirtualPixelMethod |
1846 | | */ |
1847 | | MagickExport VirtualPixelMethod StringToVirtualPixelMethod(const char *option) |
1848 | 0 | { |
1849 | 0 | VirtualPixelMethod |
1850 | 0 | virtual_pixel_method = UndefinedVirtualPixelMethod; |
1851 | |
|
1852 | 0 | if (LocaleCompare("Constant",option) == 0) |
1853 | 0 | virtual_pixel_method=ConstantVirtualPixelMethod; |
1854 | 0 | else if (LocaleCompare("Edge",option) == 0) |
1855 | 0 | virtual_pixel_method=EdgeVirtualPixelMethod; |
1856 | 0 | else if (LocaleCompare("Mirror",option) == 0) |
1857 | 0 | virtual_pixel_method=MirrorVirtualPixelMethod; |
1858 | 0 | else if (LocaleCompare("Tile",option) == 0) |
1859 | 0 | virtual_pixel_method=TileVirtualPixelMethod; |
1860 | |
|
1861 | 0 | return virtual_pixel_method; |
1862 | 0 | } |