1 diff -urN ImageMagick-6.9.7-0/PerlMagick/Magick.pm ImageMagick-6.9.6-6/PerlMagick/Magick.pm
2 --- ImageMagick-6.9.7-0/PerlMagick/Magick.pm 1970-01-01 01:00:00.000000000 +0100
3 +++ ImageMagick-6.9.6-6/PerlMagick/Magick.pm 2016-11-25 16:58:55.000000000 +0100
5 +package Image::Magick;
7 +# Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization
8 +# dedicated to making software imaging solutions freely available.
10 +# You may not use this file except in compliance with the License. You may
11 +# obtain a copy of the License at
13 +# http://www.imagemagick.org/script/license.php
15 +# Unless required by applicable law or agreed to in writing, software
16 +# distributed under the License is distributed on an "AS IS" BASIS,
17 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 +# See the License for the specific language governing permissions and
19 +# limitations under the License.
21 +# Initial version, written by Kyle Shorter.
25 +use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);
32 +@ISA = qw(Exporter DynaLoader);
33 +# Items to export into callers namespace by default. Note: do not export
34 +# names by default without a very good reason. Use EXPORT_OK instead.
35 +# Do not simply export all your public functions/methods/constants.
38 + Success Transparent Opaque QuantumDepth QuantumRange MaxRGB
39 + WarningException ResourceLimitWarning TypeWarning OptionWarning
40 + DelegateWarning MissingDelegateWarning CorruptImageWarning
41 + FileOpenWarning BlobWarning StreamWarning CacheWarning CoderWarning
42 + ModuleWarning DrawWarning ImageWarning XServerWarning RegistryWarning
43 + ConfigureWarning ErrorException ResourceLimitError TypeError
44 + OptionError DelegateError MissingDelegateError CorruptImageError
45 + FileOpenError BlobError StreamError CacheError CoderError
46 + ModuleError DrawError ImageError XServerError RegistryError
47 + ConfigureError FatalErrorException
53 + # This AUTOLOAD is used to 'autoload' constants from the constant()
54 + # XS function. If a constant is not found then control is passed
55 + # to the AUTOLOAD in AutoLoader.
58 + ($constname = $AUTOLOAD) =~ s/.*:://;
59 + die "&${AUTOLOAD} not defined. The required ImageMagick libraries are not installed or not installed properly.\n" if $constname eq 'constant';
60 + my $val = constant($constname, @_ ? $_[0] : 0);
62 + if ($! =~ /Invalid/) {
63 + $AutoLoader::AUTOLOAD = $AUTOLOAD;
64 + goto &AutoLoader::AUTOLOAD;
67 + my($pack,$file,$line) = caller;
68 + die "Your vendor has not defined PerlMagick macro $pack\:\:$constname, used at $file line $line.\n";
71 + eval "sub $AUTOLOAD { $val }";
75 +bootstrap Image::Magick $VERSION;
77 +# Preloaded methods go here.
82 + my $class = ref($this) || $this || "Image::Magick";
84 + bless $self, $class;
85 + $self->set(@_) if @_;
92 + my $class = ref($this) || $this || "Image::Magick";
94 + bless $self, $class;
95 + $self->set(@_) if @_;
99 +# Autoload methods go after =cut, and are processed by the autosplit program.
108 +Image::Magick - objected-oriented Perl interface to ImageMagick. Use it to create, edit, compose, or convert bitmap images from within a Perl script.
113 + $p = new Image::Magick;
114 + $p->Read("imagefile");
115 + $p->Set(attribute => value, ...)
116 + ($a, ...) = $p->Get("attribute", ...)
117 + $p->routine(parameter => value, ...)
118 + $p->Mogrify("Routine", parameter => value, ...)
119 + $p->Write("filename");
123 +This Perl extension allows the reading, manipulation and writing of
124 +a large number of image file formats using the ImageMagick library.
125 +It was originally developed to be used by CGI scripts for Web pages.
127 +A web page has been set up for this extension. See:
129 + file:///usr/share/doc/ImageMagick-6.8.0/www/perl-magick.html
130 + http://www.imagemagick.org/script/perl-magick.php
132 +If you have problems, go to
134 + http://www.imagemagick.org/discourse-server/viewforum.php?f=7
138 +Kyle Shorter magick-users@imagemagick.org
142 +Has all the bugs of ImageMagick and much, much more!
149 diff -urN ImageMagick-6.9.7-0/PerlMagick/Magick.xs ImageMagick-6.9.6-6/PerlMagick/Magick.xs
150 --- ImageMagick-6.9.7-0/PerlMagick/Magick.xs 1970-01-01 01:00:00.000000000 +0100
151 +++ ImageMagick-6.9.6-6/PerlMagick/Magick.xs 2016-11-25 16:58:55.000000000 +0100
154 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157 +% PPPP EEEEE RRRR L %
161 +% P EEEEE R R LLLLL %
163 +% M M AAA GGGG IIIII CCCC K K %
164 +% MM MM A A G I C K K %
165 +% M M M AAAAA G GGG I C KKK %
166 +% M M A A G G I C K K %
167 +% M M A A GGGG IIIII CCCC K K %
170 +% Object-oriented Perl interface to ImageMagick %
178 +% Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization %
179 +% dedicated to making software imaging solutions freely available. %
181 +% You may not use this file except in compliance with the License. You may %
182 +% obtain a copy of the License at %
184 +% http://www.imagemagick.org/script/license.php %
186 +% Unless required by applicable law or agreed to in writing, software %
187 +% distributed under the License is distributed on an "AS IS" BASIS, %
188 +% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
189 +% See the License for the specific language governing permissions and %
190 +% limitations under the License. %
192 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
194 +% PerlMagick is an objected-oriented Perl interface to ImageMagick. Use
195 +% the module to read, manipulate, or write an image or image sequence from
196 +% within a Perl script. This makes PerlMagick suitable for Web CGI scripts.
201 + Include declarations.
203 +#if defined(__cplusplus) || defined(c_plusplus)
207 +#define PERL_NO_GET_CONTEXT
212 +#include <magick/MagickCore.h>
215 +#if defined(__cplusplus) || defined(c_plusplus)
220 + Define declarations.
227 +#define DegreesToRadians(x) (MagickPI*(x)/180.0)
228 +#define EndOf(array) (&array[NumberOf(array)])
229 +#define MagickPI 3.14159265358979323846264338327950288419716939937510
230 +#define MaxArguments 33
234 +#define NumberOf(array) (sizeof(array)/sizeof(*array))
235 +#define PackageName "Image::Magick"
236 +#if PERL_VERSION <= 6
238 +#define PerlIO_importFILE(f, fl) (f)
239 +#define PerlIO_findFILE(f) NULL
242 +#define sv_undef PL_sv_undef
245 +#define AddImageToRegistry(sv,image) \
247 + if (magick_registry != (SplayTreeInfo *) NULL) \
249 + (void) AddValueToSplayTree(magick_registry,image,image); \
250 + (sv)=newSViv(PTR2IV(image)); \
254 +#define DeleteImageFromRegistry(reference,image) \
256 + if (magick_registry != (SplayTreeInfo *) NULL) \
258 + if (GetImageReferenceCount(image) == 1) \
259 + (void) DeleteNodeByValueFromSplayTree(magick_registry,image); \
260 + image=DestroyImage(image); \
261 + sv_setiv(reference,0); \
265 +#define InheritPerlException(exception,perl_exception) \
268 + message[MaxTextExtent]; \
270 + if ((exception)->severity != UndefinedException) \
272 + (void) FormatLocaleString(message,MaxTextExtent,"Exception %d: %s%s%s%s",\
273 + (exception)->severity, (exception)->reason ? \
274 + GetLocaleExceptionMessage((exception)->severity,(exception)->reason) : \
275 + "Unknown", (exception)->description ? " (" : "", \
276 + (exception)->description ? GetLocaleExceptionMessage( \
277 + (exception)->severity,(exception)->description) : "", \
278 + (exception)->description ? ")" : ""); \
279 + if ((perl_exception) != (SV *) NULL) \
281 + if (SvCUR(perl_exception)) \
282 + sv_catpv(perl_exception,"\n"); \
283 + sv_catpv(perl_exception,message); \
288 +#define ThrowPerlException(exception,severity,tag,reason) \
289 + (void) ThrowMagickException(exception,GetMagickModule(),severity, \
290 + tag,"`%s'",reason); \
293 + Typedef and structure declarations.
297 + ArrayReference = (~0),
298 + RealReference = (~0)-1,
299 + FileReference = (~0)-2,
300 + ImageReference = (~0)-3,
301 + IntegerReference = (~0)-4,
302 + StringReference = (~0)-5
305 +typedef struct _Arguments
345 + *Image__Magick; /* data type for the Image::Magick package */
348 + Static declarations.
357 + arguments[MaxArguments];
360 + { "Comment", { {"comment", StringReference} } },
361 + { "Label", { {"label", StringReference} } },
362 + { "AddNoise", { {"noise", MagickNoiseOptions},
363 + {"channel", MagickChannelOptions} } },
364 + { "Colorize", { {"fill", StringReference}, {"opacity", StringReference} } },
365 + { "Border", { {"geometry", StringReference}, {"width", IntegerReference},
366 + {"height", IntegerReference}, {"fill", StringReference},
367 + {"bordercolor", StringReference}, {"color", StringReference},
368 + {"compose", MagickComposeOptions} } },
369 + { "Blur", { {"geometry", StringReference}, {"radius", RealReference},
370 + {"sigma", RealReference}, {"channel", MagickChannelOptions} } },
371 + { "Chop", { {"geometry", StringReference}, {"width", IntegerReference},
372 + {"height", IntegerReference}, {"x", IntegerReference},
373 + {"y", IntegerReference}, {"gravity", MagickGravityOptions} } },
374 + { "Crop", { {"geometry", StringReference}, {"width", IntegerReference},
375 + {"height", IntegerReference}, {"x", IntegerReference},
376 + {"y", IntegerReference}, {"fuzz", StringReference},
377 + {"gravity", MagickGravityOptions} } },
379 + { "Edge", { {"radius", RealReference} } },
380 + { "Emboss", { {"geometry", StringReference}, {"radius", RealReference},
381 + {"sigma", RealReference} } },
385 + { "Frame", { {"geometry", StringReference}, {"width", IntegerReference},
386 + {"height", IntegerReference}, {"inner", IntegerReference},
387 + {"outer", IntegerReference}, {"fill", StringReference},
388 + {"color", StringReference}, {"compose", MagickComposeOptions} } },
389 + { "Implode", { {"amount", RealReference},
390 + {"interpolate", MagickInterpolateOptions} } },
392 + { "MedianFilter", { {"geometry", StringReference},
393 + {"width", IntegerReference},{"height", IntegerReference},
394 + {"channel", MagickChannelOptions} } },
396 + { "OilPaint", { {"radius", RealReference} } },
397 + { "ReduceNoise", { {"geometry", StringReference},
398 + {"width", IntegerReference},{"height", IntegerReference},
399 + {"channel", MagickChannelOptions} } },
400 + { "Roll", { {"geometry", StringReference}, {"x", IntegerReference},
401 + {"y", IntegerReference} } },
402 + { "Rotate", { {"degrees", RealReference}, {"fill", StringReference},
403 + {"color", StringReference}, {"background", StringReference} } },
404 + { "Sample", { {"geometry", StringReference}, {"width", IntegerReference},
405 + {"height", IntegerReference} } },
406 + { "Scale", { {"geometry", StringReference}, {"width", IntegerReference},
407 + {"height", IntegerReference} } },
408 + { "Shade", { {"geometry", StringReference}, {"azimuth", RealReference},
409 + {"elevation", RealReference}, {"gray", MagickBooleanOptions} } },
410 + { "Sharpen", { {"geometry", StringReference}, {"radius", RealReference},
411 + {"sigma", RealReference}, {"channel", MagickChannelOptions} } },
412 + { "Shear", { {"geometry", StringReference}, {"x", RealReference},
413 + {"y", RealReference}, { "fill", StringReference},
414 + {"color", StringReference} } },
415 + { "Spread", { {"radius", RealReference},
416 + {"interpolate", MagickInterpolateOptions} } },
417 + { "Swirl", { {"degrees", RealReference},
418 + {"interpolate", MagickInterpolateOptions} } },
419 + { "Resize", { {"geometry", StringReference}, {"width", IntegerReference},
420 + {"height", IntegerReference}, {"filter", MagickFilterOptions},
421 + {"support", StringReference }, {"blur", RealReference } } },
422 + { "Zoom", { {"geometry", StringReference}, {"width", IntegerReference},
423 + {"height", IntegerReference}, {"filter", MagickFilterOptions},
424 + {"support", RealReference }, {"blur", RealReference } } },
425 + { "Annotate", { {"text", StringReference}, {"font", StringReference},
426 + {"pointsize", RealReference}, {"density", StringReference},
427 + {"undercolor", StringReference}, {"stroke", StringReference},
428 + {"fill", StringReference}, {"geometry", StringReference},
429 + {"pen", StringReference}, {"x", RealReference},
430 + {"y", RealReference}, {"gravity", MagickGravityOptions},
431 + {"translate", StringReference}, {"scale", StringReference},
432 + {"rotate", RealReference}, {"skewX", RealReference},
433 + {"skewY", RealReference}, {"strokewidth", RealReference},
434 + {"antialias", MagickBooleanOptions}, {"family", StringReference},
435 + {"style", MagickStyleOptions}, {"stretch", MagickStretchOptions},
436 + {"weight", IntegerReference}, {"align", MagickAlignOptions},
437 + {"encoding", StringReference}, {"affine", ArrayReference},
438 + {"fill-pattern", ImageReference}, {"stroke-pattern", ImageReference},
439 + {"tile", ImageReference}, {"kerning", RealReference},
440 + {"interline-spacing", RealReference},
441 + {"interword-spacing", RealReference},
442 + {"direction", MagickDirectionOptions} } },
443 + { "ColorFloodfill", { {"geometry", StringReference},
444 + {"x", IntegerReference}, {"y", IntegerReference},
445 + {"fill", StringReference}, {"bordercolor", StringReference},
446 + {"fuzz", StringReference}, {"invert", MagickBooleanOptions} } },
447 + { "Composite", { {"image", ImageReference},
448 + {"compose", MagickComposeOptions}, {"geometry", StringReference},
449 + {"x", IntegerReference}, {"y", IntegerReference},
450 + {"gravity", MagickGravityOptions}, {"opacity", StringReference},
451 + {"tile", MagickBooleanOptions}, {"rotate", RealReference},
452 + {"color", StringReference}, {"mask", ImageReference},
453 + {"channel", MagickChannelOptions},
454 + {"interpolate", MagickInterpolateOptions}, {"args", StringReference},
455 + {"blend", StringReference} } },
456 + { "Contrast", { {"sharpen", MagickBooleanOptions} } },
457 + { "CycleColormap", { {"display", IntegerReference} } },
458 + { "Draw", { {"primitive", MagickPrimitiveOptions},
459 + {"points", StringReference}, {"method", MagickMethodOptions},
460 + {"stroke", StringReference}, {"fill", StringReference},
461 + {"strokewidth", RealReference}, {"font", StringReference},
462 + {"bordercolor", StringReference}, {"x", RealReference},
463 + {"y", RealReference}, {"translate", StringReference},
464 + {"scale", StringReference}, {"rotate", RealReference},
465 + {"skewX", RealReference}, {"skewY", RealReference},
466 + {"tile", ImageReference}, {"pointsize", RealReference},
467 + {"antialias", MagickBooleanOptions}, {"density", StringReference},
468 + {"linewidth", RealReference}, {"affine", ArrayReference},
469 + {"stroke-dashoffset", RealReference},
470 + {"stroke-dasharray", ArrayReference},
471 + {"interpolate", MagickInterpolateOptions},
472 + {"origin", StringReference}, {"text", StringReference},
473 + {"fill-pattern", ImageReference}, {"stroke-pattern", ImageReference},
474 + {"vector-graphics", StringReference}, {"kerning", RealReference},
475 + {"interline-spacing", RealReference},
476 + {"interword-spacing", RealReference},
477 + {"direction", MagickDirectionOptions} } },
478 + { "Equalize", { {"channel", MagickChannelOptions} } },
479 + { "Gamma", { {"gamma", StringReference}, {"channel", MagickChannelOptions},
480 + {"red", RealReference}, {"green", RealReference},
481 + {"blue", RealReference} } },
482 + { "Map", { {"image", ImageReference}, {"dither", MagickBooleanOptions},
483 + {"dither-method", MagickDitherOptions} } },
484 + { "MatteFloodfill", { {"geometry", StringReference},
485 + {"x", IntegerReference}, {"y", IntegerReference},
486 + {"opacity", StringReference}, {"bordercolor", StringReference},
487 + {"fuzz", StringReference}, {"invert", MagickBooleanOptions} } },
488 + { "Modulate", { {"factor", StringReference}, {"hue", RealReference},
489 + {"saturation", RealReference}, {"whiteness", RealReference},
490 + {"brightness", RealReference}, {"lightness", RealReference},
491 + {"blackness", RealReference} } },
492 + { "Negate", { {"gray", MagickBooleanOptions},
493 + {"channel", MagickChannelOptions} } },
494 + { "Normalize", { {"channel", MagickChannelOptions} } },
495 + { "NumberColors", },
496 + { "Opaque", { {"color", StringReference}, {"fill", StringReference},
497 + {"fuzz", StringReference}, {"channel", MagickChannelOptions},
498 + {"invert", MagickBooleanOptions} } },
499 + { "Quantize", { {"colors", IntegerReference},
500 + {"treedepth", IntegerReference}, {"colorspace", MagickColorspaceOptions},
501 + {"dither", MagickBooleanOptions}, {"measure", MagickBooleanOptions},
502 + {"global", MagickBooleanOptions}, {"transparent-color", StringReference},
503 + {"dither-method", MagickDitherOptions} } },
504 + { "Raise", { {"geometry", StringReference}, {"width", IntegerReference},
505 + {"height", IntegerReference}, {"raise", MagickBooleanOptions} } },
506 + { "Segment", { {"geometry", StringReference},
507 + {"cluster-threshold", RealReference},
508 + {"smoothing-threshold", RealReference},
509 + {"colorspace", MagickColorspaceOptions},
510 + {"verbose", MagickBooleanOptions} } },
512 + { "Solarize", { {"geometry", StringReference},
513 + {"threshold", StringReference}, {"channel", MagickChannelOptions} } },
515 + { "Texture", { {"texture", ImageReference} } },
516 + { "Evaluate", { {"value", RealReference},
517 + {"operator", MagickEvaluateOptions},
518 + {"channel", MagickChannelOptions} } },
519 + { "Transparent", { {"color", StringReference}, {"opacity", StringReference},
520 + {"fuzz", StringReference}, {"invert", MagickBooleanOptions} } },
521 + { "Threshold", { {"threshold", StringReference},
522 + {"channel", MagickChannelOptions} } },
523 + { "Charcoal", { {"geometry", StringReference}, {"radius", RealReference},
524 + {"sigma", RealReference} } },
525 + { "Trim", { {"fuzz", StringReference} } },
526 + { "Wave", { {"geometry", StringReference}, {"amplitude", RealReference},
527 + {"wavelength", RealReference},
528 + {"interpolate", MagickInterpolateOptions} } },
529 + { "Separate", { {"channel", MagickChannelOptions} } },
531 + { "Stereo", { {"image", ImageReference}, {"x", IntegerReference},
532 + {"y", IntegerReference} } },
533 + { "Stegano", { {"image", ImageReference}, {"offset", IntegerReference} } },
534 + { "Deconstruct", },
535 + { "GaussianBlur", { {"geometry", StringReference},
536 + {"radius", RealReference}, {"sigma", RealReference},
537 + {"channel", MagickChannelOptions} } },
538 + { "Convolve", { {"coefficients", ArrayReference},
539 + {"channel", MagickChannelOptions}, {"bias", StringReference} } },
540 + { "Profile", { {"name", StringReference}, {"profile", StringReference},
541 + { "rendering-intent", MagickIntentOptions},
542 + { "black-point-compensation", MagickBooleanOptions} } },
543 + { "UnsharpMask", { {"geometry", StringReference},
544 + {"radius", RealReference}, {"sigma", RealReference},
545 + {"amount", RealReference}, {"threshold", RealReference},
546 + {"channel", MagickChannelOptions} } },
547 + { "MotionBlur", { {"geometry", StringReference},
548 + {"radius", RealReference}, {"sigma", RealReference},
549 + {"angle", RealReference}, {"channel", MagickChannelOptions} } },
550 + { "OrderedDither", { {"threshold", StringReference},
551 + {"channel", MagickChannelOptions} } },
552 + { "Shave", { {"geometry", StringReference}, {"width", IntegerReference},
553 + {"height", IntegerReference} } },
554 + { "Level", { {"levels", StringReference}, {"black-point", RealReference},
555 + {"white-point", RealReference}, {"gamma", RealReference},
556 + {"channel", MagickChannelOptions}, {"level", StringReference} } },
557 + { "Clip", { {"id", StringReference}, {"inside", MagickBooleanOptions} } },
558 + { "AffineTransform", { {"affine", ArrayReference},
559 + {"translate", StringReference}, {"scale", StringReference},
560 + {"rotate", RealReference}, {"skewX", RealReference},
561 + {"skewY", RealReference}, {"interpolate", MagickInterpolateOptions},
562 + {"background", StringReference} } },
563 + { "Difference", { {"image", ImageReference}, {"fuzz", StringReference} } },
564 + { "AdaptiveThreshold", { {"geometry", StringReference},
565 + {"width", IntegerReference}, {"height", IntegerReference},
566 + {"offset", IntegerReference} } },
567 + { "Resample", { {"density", StringReference}, {"x", RealReference},
568 + {"y", RealReference}, {"filter", MagickFilterOptions},
569 + {"support", RealReference }, {"blur", RealReference } } },
570 + { "Describe", { {"file", FileReference} } },
571 + { "BlackThreshold", { {"threshold", StringReference},
572 + {"channel", MagickChannelOptions} } },
573 + { "WhiteThreshold", { {"threshold", StringReference},
574 + {"channel", MagickChannelOptions} } },
575 + { "RotationalBlur", { {"geometry", StringReference},
576 + {"angle", RealReference}, {"channel", MagickChannelOptions} } },
577 + { "Thumbnail", { {"geometry", StringReference}, {"width", IntegerReference},
578 + {"height", IntegerReference} } },
580 + { "Tint", { {"fill", StringReference}, {"opacity", StringReference} } },
581 + { "Channel", { {"channel", MagickChannelOptions} } },
582 + { "Splice", { {"geometry", StringReference}, {"width", IntegerReference},
583 + {"height", IntegerReference}, {"x", IntegerReference},
584 + {"y", IntegerReference}, {"fuzz", StringReference},
585 + {"background", StringReference}, {"gravity", MagickGravityOptions} } },
586 + { "Posterize", { {"levels", IntegerReference},
587 + {"dither", MagickBooleanOptions} } },
588 + { "Shadow", { {"geometry", StringReference}, {"opacity", RealReference},
589 + {"sigma", RealReference}, {"x", IntegerReference},
590 + {"y", IntegerReference} } },
591 + { "Identify", { {"file", FileReference}, {"features", StringReference},
592 + {"unique", MagickBooleanOptions} } },
593 + { "SepiaTone", { {"threshold", RealReference} } },
594 + { "SigmoidalContrast", { {"geometry", StringReference},
595 + {"contrast", RealReference}, {"mid-point", RealReference},
596 + {"channel", MagickChannelOptions}, {"sharpen", MagickBooleanOptions} } },
597 + { "Extent", { {"geometry", StringReference}, {"width", IntegerReference},
598 + {"height", IntegerReference}, {"x", IntegerReference},
599 + {"y", IntegerReference}, {"fuzz", StringReference},
600 + {"background", StringReference}, {"gravity", MagickGravityOptions} } },
601 + { "Vignette", { {"geometry", StringReference}, {"radius", RealReference},
602 + {"sigma", RealReference}, {"x", IntegerReference},
603 + {"y", IntegerReference}, {"background", StringReference} } },
604 + { "ContrastStretch", { {"levels", StringReference},
605 + {"black-point", RealReference},{"white-point", RealReference},
606 + {"channel", MagickChannelOptions} } },
609 + { "AdaptiveSharpen", { {"geometry", StringReference},
610 + {"radius", RealReference}, {"sigma", RealReference},
611 + {"channel", MagickChannelOptions} } },
615 + { "AdaptiveBlur", { {"geometry", StringReference},
616 + {"radius", RealReference}, {"sigma", RealReference},
617 + {"channel", MagickChannelOptions} } },
618 + { "Sketch", { {"geometry", StringReference},
619 + {"radius", RealReference}, {"sigma", RealReference},
620 + {"angle", RealReference} } },
621 + { "UniqueColors", },
622 + { "AdaptiveResize", { {"geometry", StringReference},
623 + {"width", IntegerReference}, {"height", IntegerReference},
624 + {"filter", MagickFilterOptions}, {"support", StringReference },
625 + {"blur", RealReference } } },
626 + { "ClipMask", { {"mask", ImageReference} } },
627 + { "LinearStretch", { {"levels", StringReference},
628 + {"black-point", RealReference},{"white-point", RealReference} } },
629 + { "Recolor", { {"matrix", ArrayReference} } },
630 + { "Mask", { {"mask", ImageReference} } },
631 + { "Polaroid", { {"caption", StringReference}, {"angle", RealReference},
632 + {"font", StringReference}, {"stroke", StringReference},
633 + {"fill", StringReference}, {"strokewidth", RealReference},
634 + {"pointsize", RealReference}, {"gravity", MagickGravityOptions},
635 + {"background", StringReference} } },
636 + { "FloodfillPaint", { {"geometry", StringReference},
637 + {"x", IntegerReference}, {"y", IntegerReference},
638 + {"fill", StringReference}, {"bordercolor", StringReference},
639 + {"fuzz", StringReference}, {"channel", MagickChannelOptions},
640 + {"invert", MagickBooleanOptions} } },
641 + { "Distort", { {"points", ArrayReference}, {"method", MagickDistortOptions},
642 + {"virtual-pixel", MagickVirtualPixelOptions},
643 + {"best-fit", MagickBooleanOptions} } },
644 + { "Clut", { {"image", ImageReference},
645 + {"channel", MagickChannelOptions} } },
646 + { "LiquidRescale", { {"geometry", StringReference},
647 + {"width", IntegerReference}, {"height", IntegerReference},
648 + {"delta-x", RealReference}, {"rigidity", RealReference } } },
649 + { "Encipher", { {"passphrase", StringReference} } },
650 + { "Decipher", { {"passphrase", StringReference} } },
651 + { "Deskew", { {"geometry", StringReference},
652 + {"threshold", StringReference} } },
653 + { "Remap", { {"image", ImageReference}, {"dither", MagickBooleanOptions},
654 + {"dither-method", MagickDitherOptions} } },
655 + { "SparseColor", { {"points", ArrayReference},
656 + {"method", MagickSparseColorOptions},
657 + {"virtual-pixel", MagickVirtualPixelOptions},
658 + {"channel", MagickChannelOptions} } },
659 + { "Function", { {"parameters", ArrayReference},
660 + {"function", MagickFunctionOptions},
661 + {"virtual-pixel", MagickVirtualPixelOptions} } },
662 + { "SelectiveBlur", { {"geometry", StringReference},
663 + {"radius", RealReference}, {"sigma", RealReference},
664 + {"threshold", RealReference}, {"channel", MagickChannelOptions} } },
665 + { "HaldClut", { {"image", ImageReference},
666 + {"channel", MagickChannelOptions} } },
667 + { "BlueShift", { {"factor", StringReference} } },
668 + { "ForwardFourierTransform", { {"magnitude", MagickBooleanOptions} } },
669 + { "InverseFourierTransform", { {"magnitude", MagickBooleanOptions} } },
670 + { "ColorDecisionList", {
671 + {"color-correction-collection", StringReference} } },
672 + { "AutoGamma", { {"channel", MagickChannelOptions} } },
673 + { "AutoLevel", { {"channel", MagickChannelOptions} } },
674 + { "LevelColors", { {"invert", MagickBooleanOptions},
675 + {"black-point", StringReference}, {"white-point", StringReference},
676 + {"channel", MagickChannelOptions}, {"invert", MagickBooleanOptions} } },
677 + { "Clamp", { {"channel", MagickChannelOptions} } },
678 + { "Filter", { {"kernel", StringReference},
679 + {"channel", MagickChannelOptions}, {"bias", StringReference} } },
680 + { "BrightnessContrast", { {"levels", StringReference},
681 + {"brightness", RealReference},{"contrast", RealReference},
682 + {"channel", MagickChannelOptions} } },
683 + { "Morphology", { {"kernel", StringReference},
684 + {"channel", MagickChannelOptions}, {"method", MagickMorphologyOptions},
685 + {"iterations", IntegerReference} } },
686 + { "ColorMatrix", { {"matrix", ArrayReference} } },
687 + { "Color", { {"color", StringReference} } },
688 + { "Mode", { {"geometry", StringReference},
689 + {"width", IntegerReference},{"height", IntegerReference},
690 + {"channel", MagickChannelOptions} } },
691 + { "Statistic", { {"geometry", StringReference},
692 + {"width", IntegerReference},{"height", IntegerReference},
693 + {"channel", MagickChannelOptions}, {"type", MagickStatisticOptions} } },
694 + { "Perceptible", { {"epsilon", RealReference},
695 + {"channel", MagickChannelOptions} } },
696 + { "Poly", { {"terms", ArrayReference},
697 + {"channel", MagickChannelOptions} } },
698 + { "Grayscale", { {"method", MagickPixelIntensityOptions} } },
699 + { "CannyEdge", { {"geometry", StringReference},
700 + {"radius", RealReference}, {"sigma", RealReference},
701 + {"lower-percent", RealReference}, {"upper-percent", RealReference} } },
702 + { "HoughLine", { {"geometry", StringReference},
703 + {"width", IntegerReference}, {"height", IntegerReference},
704 + {"threshold", IntegerReference} } },
705 + { "MeanShift", { {"geometry", StringReference},
706 + {"width", IntegerReference}, {"height", IntegerReference},
707 + {"distance", RealReference} } },
708 + { "Kuwahara", { {"geometry", StringReference}, {"radius", RealReference},
709 + {"sigma", RealReference}, {"channel", MagickChannelOptions} } },
710 + { "ConnectedComponents", { {"connectivity", IntegerReference} } },
711 + { "CopyPixels", { {"image", ImageReference}, {"geometry", StringReference},
712 + {"width", IntegerReference}, {"height", IntegerReference},
713 + {"x", IntegerReference}, {"y", IntegerReference},
714 + {"gravity", MagickGravityOptions}, {"offset", StringReference},
715 + {"dx", IntegerReference}, {"dy", IntegerReference} } },
716 + { "WaveletDenoise", { {"geometry", StringReference},
717 + {"threshold", RealReference}, {"softness", RealReference} } },
720 +static SplayTreeInfo
721 + *magick_registry = (SplayTreeInfo *) NULL;
724 + Forward declarations.
727 + *SetupList(pTHX_ SV *,struct PackageInfo **,SV ***,ExceptionInfo *);
730 + strEQcase(const char *,const char *);
733 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
737 +% C l o n e P a c k a g e I n f o %
741 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
743 +% ClonePackageInfo makes a duplicate of the given info, or if info is NULL,
746 +% The format of the ClonePackageInfo routine is:
748 +% struct PackageInfo *ClonePackageInfo(struct PackageInfo *info,
751 +% A description of each parameter follows:
753 +% o info: a structure of type info.
755 +% o exception: Return any errors or warnings in this structure.
758 +static struct PackageInfo *ClonePackageInfo(struct PackageInfo *info,
759 + ExceptionInfo *exception)
764 + clone_info=(struct PackageInfo *) AcquireQuantumMemory(1,sizeof(*clone_info));
765 + if (clone_info == (struct PackageInfo *) NULL)
767 + ThrowPerlException(exception,ResourceLimitError,
768 + "UnableToClonePackageInfo",PackageName);
769 + return((struct PackageInfo *) NULL);
771 + if (info == (struct PackageInfo *) NULL)
773 + clone_info->image_info=CloneImageInfo((ImageInfo *) NULL);
774 + return(clone_info);
776 + *clone_info=(*info);
777 + clone_info->image_info=CloneImageInfo(info->image_info);
778 + return(clone_info);
782 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
790 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
792 +% constant() returns a double value for the specified name.
794 +% The format of the constant routine is:
796 +% double constant(char *name,ssize_t sans)
798 +% A description of each parameter follows:
800 +% o value: Method constant returns a double value for the specified name.
802 +% o name: The name of the constant.
804 +% o sans: This integer value is not used.
807 +static double constant(char *name,ssize_t sans)
815 + if (strEQ(name,"BlobError"))
817 + if (strEQ(name,"BlobWarning"))
818 + return(BlobWarning);
823 + if (strEQ(name,"CacheError"))
824 + return(CacheError);
825 + if (strEQ(name,"CacheWarning"))
826 + return(CacheWarning);
827 + if (strEQ(name,"CoderError"))
828 + return(CoderError);
829 + if (strEQ(name,"CoderWarning"))
830 + return(CoderWarning);
831 + if (strEQ(name,"ConfigureError"))
832 + return(ConfigureError);
833 + if (strEQ(name,"ConfigureWarning"))
834 + return(ConfigureWarning);
835 + if (strEQ(name,"CorruptImageError"))
836 + return(CorruptImageError);
837 + if (strEQ(name,"CorruptImageWarning"))
838 + return(CorruptImageWarning);
843 + if (strEQ(name,"DelegateError"))
844 + return(DelegateError);
845 + if (strEQ(name,"DelegateWarning"))
846 + return(DelegateWarning);
847 + if (strEQ(name,"DrawError"))
849 + if (strEQ(name,"DrawWarning"))
850 + return(DrawWarning);
855 + if (strEQ(name,"ErrorException"))
856 + return(ErrorException);
857 + if (strEQ(name,"ExceptionError"))
858 + return(CoderError);
859 + if (strEQ(name,"ExceptionWarning"))
860 + return(CoderWarning);
865 + if (strEQ(name,"FatalErrorException"))
866 + return(FatalErrorException);
867 + if (strEQ(name,"FileOpenError"))
868 + return(FileOpenError);
869 + if (strEQ(name,"FileOpenWarning"))
870 + return(FileOpenWarning);
875 + if (strEQ(name,"ImageError"))
876 + return(ImageError);
877 + if (strEQ(name,"ImageWarning"))
878 + return(ImageWarning);
883 + if (strEQ(name,"MaxRGB"))
884 + return(QuantumRange);
885 + if (strEQ(name,"MissingDelegateError"))
886 + return(MissingDelegateError);
887 + if (strEQ(name,"MissingDelegateWarning"))
888 + return(MissingDelegateWarning);
889 + if (strEQ(name,"ModuleError"))
890 + return(ModuleError);
891 + if (strEQ(name,"ModuleWarning"))
892 + return(ModuleWarning);
897 + if (strEQ(name,"Opaque"))
898 + return(OpaqueOpacity);
899 + if (strEQ(name,"OptionError"))
900 + return(OptionError);
901 + if (strEQ(name,"OptionWarning"))
902 + return(OptionWarning);
907 + if (strEQ(name,"MAGICKCORE_QUANTUM_DEPTH"))
908 + return(MAGICKCORE_QUANTUM_DEPTH);
909 + if (strEQ(name,"QuantumDepth"))
910 + return(MAGICKCORE_QUANTUM_DEPTH);
911 + if (strEQ(name,"QuantumRange"))
912 + return(QuantumRange);
917 + if (strEQ(name,"ResourceLimitError"))
918 + return(ResourceLimitError);
919 + if (strEQ(name,"ResourceLimitWarning"))
920 + return(ResourceLimitWarning);
921 + if (strEQ(name,"RegistryError"))
922 + return(RegistryError);
923 + if (strEQ(name,"RegistryWarning"))
924 + return(RegistryWarning);
929 + if (strEQ(name,"StreamError"))
930 + return(StreamError);
931 + if (strEQ(name,"StreamWarning"))
932 + return(StreamWarning);
933 + if (strEQ(name,"Success"))
939 + if (strEQ(name,"Transparent"))
940 + return(TransparentOpacity);
941 + if (strEQ(name,"TypeError"))
943 + if (strEQ(name,"TypeWarning"))
944 + return(TypeWarning);
949 + if (strEQ(name,"WarningException"))
950 + return(WarningException);
955 + if (strEQ(name,"XServerError"))
956 + return(XServerError);
957 + if (strEQ(name,"XServerWarning"))
958 + return(XServerWarning);
967 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
971 +% D e s t r o y P a c k a g e I n f o %
975 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
977 +% Method DestroyPackageInfo frees a previously created info structure.
979 +% The format of the DestroyPackageInfo routine is:
981 +% DestroyPackageInfo(struct PackageInfo *info)
983 +% A description of each parameter follows:
985 +% o info: a structure of type info.
988 +static void DestroyPackageInfo(struct PackageInfo *info)
990 + info->image_info=DestroyImageInfo(info->image_info);
991 + info=(struct PackageInfo *) RelinquishMagickMemory(info);
995 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1003 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1005 +% Method GetList is recursively called by SetupList to traverse the
1006 +% Image__Magick reference. If building an reference_vector (see SetupList),
1007 +% *current is the current position in *reference_vector and *last is the final
1008 +% entry in *reference_vector.
1010 +% The format of the GetList routine is:
1014 +% A description of each parameter follows:
1016 +% o info: a structure of type info.
1019 +static Image *GetList(pTHX_ SV *reference,SV ***reference_vector,
1020 + ssize_t *current,ssize_t *last,ExceptionInfo *exception)
1025 + if (reference == (SV *) NULL)
1027 + switch (SvTYPE(reference))
1047 + previous=(Image *) NULL;
1048 + head=(Image *) NULL;
1049 + av=(AV *) reference;
1051 + for (i=0; i <= n; i++)
1056 + rv=av_fetch(av,i,0);
1057 + if (rv && *rv && sv_isobject(*rv))
1059 + image=GetList(aTHX_ SvRV(*rv),reference_vector,current,last,
1061 + if (image == (Image *) NULL)
1063 + if (image == previous)
1065 + image=CloneImage(image,0,0,MagickTrue,exception);
1066 + if (image == (Image *) NULL)
1069 + image->previous=previous;
1070 + *(previous ? &previous->next : &head)=image;
1071 + for (previous=image; previous->next; previous=previous->next) ;
1079 + Blessed scalar, one image.
1081 + image=INT2PTR(Image *,SvIV(reference));
1082 + if (image == (Image *) NULL)
1084 + image->previous=(Image *) NULL;
1085 + image->next=(Image *) NULL;
1086 + if (reference_vector)
1088 + if (*current == *last)
1091 + if (*reference_vector == (SV **) NULL)
1092 + *reference_vector=(SV **) AcquireQuantumMemory(*last,
1093 + sizeof(*reference_vector));
1095 + *reference_vector=(SV **) ResizeQuantumMemory(*reference_vector,
1096 + *last,sizeof(*reference_vector));
1098 + if (*reference_vector == (SV **) NULL)
1100 + ThrowPerlException(exception,ResourceLimitError,
1101 + "MemoryAllocationFailed",PackageName);
1102 + return((Image *) NULL);
1104 + (*reference_vector)[*current]=reference;
1105 + (*reference_vector)[++(*current)]=NULL;
1112 + (void) fprintf(stderr,"GetList: UnrecognizedType %.20g\n",
1113 + (double) SvTYPE(reference));
1114 + return((Image *) NULL);
1118 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1122 +% G e t P a c k a g e I n f o %
1126 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1128 +% Method GetPackageInfo looks up or creates an info structure for the given
1129 +% Image__Magick reference. If it does create a new one, the information in
1130 +% package_info is used to initialize it.
1132 +% The format of the GetPackageInfo routine is:
1134 +% struct PackageInfo *GetPackageInfo(void *reference,
1135 +% struct PackageInfo *package_info,ExceptionInfo *exception)
1137 +% A description of each parameter follows:
1139 +% o info: a structure of type info.
1141 +% o exception: Return any errors or warnings in this structure.
1144 +static struct PackageInfo *GetPackageInfo(pTHX_ void *reference,
1145 + struct PackageInfo *package_info,ExceptionInfo *exception)
1148 + message[MaxTextExtent];
1150 + struct PackageInfo
1156 + (void) FormatLocaleString(message,MaxTextExtent,"%s::package%s%p",
1157 + PackageName,XS_VERSION,reference);
1158 + sv=perl_get_sv(message,(TRUE | 0x02));
1159 + if (sv == (SV *) NULL)
1161 + ThrowPerlException(exception,ResourceLimitError,"UnableToGetPackageInfo",
1163 + return(package_info);
1165 + if (SvREFCNT(sv) == 0)
1166 + (void) SvREFCNT_inc(sv);
1167 + if (SvIOKp(sv) && (clone_info=INT2PTR(struct PackageInfo *,SvIV(sv))))
1168 + return(clone_info);
1169 + clone_info=ClonePackageInfo(package_info,exception);
1170 + sv_setiv(sv,PTR2IV(clone_info));
1171 + return(clone_info);
1175 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1179 +% S e t A t t r i b u t e %
1183 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1185 +% SetAttribute() sets the attribute to the value in sval. This can change
1186 +% either or both of image or info.
1188 +% The format of the SetAttribute routine is:
1190 +% SetAttribute(struct PackageInfo *info,Image *image,char *attribute,
1191 +% SV *sval,ExceptionInfo *exception)
1193 +% A description of each parameter follows:
1195 +% o list: a list of strings.
1197 +% o string: a character string.
1201 +static double SiPrefixToDoubleInterval(const char *string,const double interval)
1209 + value=InterpretSiPrefixValue(string,&q);
1211 + value*=interval/100.0;
1215 +static inline double StringToDouble(const char *string,char **sentinal)
1217 + return(InterpretLocaleValue(string,sentinal));
1220 +static double StringToDoubleInterval(const char *string,const double interval)
1228 + value=InterpretLocaleValue(string,&q);
1230 + value*=interval/100.0;
1234 +static inline ssize_t StringToLong(const char *value)
1236 + return(strtol(value,(char **) NULL,10));
1239 +static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
1240 + const char *attribute,SV *sval,ExceptionInfo *exception)
1262 + switch (*attribute)
1267 + if (LocaleCompare(attribute,"adjoin") == 0)
1269 + sp=SvPOK(sval) ? ParseCommandOption(MagickBooleanOptions,MagickFalse,
1270 + SvPV(sval,na)) : SvIV(sval);
1273 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
1278 + info->image_info->adjoin=sp != 0 ? MagickTrue : MagickFalse;
1281 + if (LocaleCompare(attribute,"alpha") == 0)
1283 + sp=SvPOK(sval) ? ParseCommandOption(MagickAlphaOptions,MagickFalse,
1284 + SvPV(sval,na)) : SvIV(sval);
1287 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
1291 + for ( ; image; image=image->next)
1292 + (void) SetImageAlphaChannel(image,(AlphaChannelType) sp);
1295 + if (LocaleCompare(attribute,"antialias") == 0)
1297 + sp=SvPOK(sval) ? ParseCommandOption(MagickBooleanOptions,MagickFalse,
1298 + SvPV(sval,na)) : SvIV(sval);
1301 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
1306 + info->image_info->antialias=sp != 0 ? MagickTrue : MagickFalse;
1309 + if (LocaleCompare(attribute,"area-limit") == 0)
1314 + limit=MagickResourceInfinity;
1315 + if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
1316 + limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
1318 + (void) SetMagickResourceLimit(AreaResource,limit);
1321 + if (LocaleCompare(attribute,"attenuate") == 0)
1324 + (void) SetImageOption(info->image_info,attribute,SvPV(sval,na));
1327 + if (LocaleCompare(attribute,"authenticate") == 0)
1330 + (void) CloneString(&info->image_info->authenticate,SvPV(sval,na));
1334 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1335 + for ( ; image; image=image->next)
1336 + SetImageProperty(image,attribute,SvPV(sval,na));
1342 + if (LocaleCompare(attribute,"background") == 0)
1344 + (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
1346 + info->image_info->background_color=target_color;
1347 + for ( ; image; image=image->next)
1348 + image->background_color=target_color;
1351 + if (LocaleCompare(attribute,"bias") == 0)
1353 + for ( ; image; image=image->next)
1354 + image->bias=StringToDoubleInterval(SvPV(sval,na),(double)
1355 + QuantumRange+1.0);
1358 + if (LocaleCompare(attribute,"blue-primary") == 0)
1360 + for ( ; image; image=image->next)
1362 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
1363 + image->chromaticity.blue_primary.x=geometry_info.rho;
1364 + image->chromaticity.blue_primary.y=geometry_info.sigma;
1365 + if ((flags & SigmaValue) == 0)
1366 + image->chromaticity.blue_primary.y=
1367 + image->chromaticity.blue_primary.x;
1371 + if (LocaleCompare(attribute,"bordercolor") == 0)
1373 + (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
1375 + info->image_info->border_color=target_color;
1376 + for ( ; image; image=image->next)
1377 + image->border_color=target_color;
1381 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1382 + for ( ; image; image=image->next)
1383 + SetImageProperty(image,attribute,SvPV(sval,na));
1389 + if (LocaleCompare(attribute,"cache-threshold") == 0)
1391 + (void) SetMagickResourceLimit(MemoryResource,(MagickSizeType)
1392 + SiPrefixToDoubleInterval(SvPV(sval,na),100.0));
1393 + (void) SetMagickResourceLimit(MapResource,(MagickSizeType)
1394 + (2.0*SiPrefixToDoubleInterval(SvPV(sval,na),100.0)));
1397 + if (LocaleCompare(attribute,"clip-mask") == 0)
1402 + clip_mask=(Image *) NULL;
1404 + clip_mask=SetupList(aTHX_ SvRV(sval),&info,(SV ***) NULL,exception);
1405 + for ( ; image; image=image->next)
1406 + SetImageClipMask(image,clip_mask);
1409 + if (LocaleNCompare(attribute,"colormap",8) == 0)
1411 + for ( ; image; image=image->next)
1419 + if (image->storage_class == DirectClass)
1422 + items=sscanf(attribute,"%*[^[][%ld",&i);
1424 + if (i > (ssize_t) image->colors)
1426 + if ((strchr(SvPV(sval,na),',') == 0) ||
1427 + (strchr(SvPV(sval,na),')') != 0))
1428 + QueryColorDatabase(SvPV(sval,na),image->colormap+i,exception);
1431 + color=image->colormap+i;
1432 + pixel.red=color->red;
1433 + pixel.green=color->green;
1434 + pixel.blue=color->blue;
1435 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
1436 + pixel.red=geometry_info.rho;
1437 + pixel.green=geometry_info.sigma;
1438 + pixel.blue=geometry_info.xi;
1439 + color->red=ClampToQuantum(pixel.red);
1440 + color->green=ClampToQuantum(pixel.green);
1441 + color->blue=ClampToQuantum(pixel.blue);
1446 + if (LocaleCompare(attribute,"colorspace") == 0)
1448 + sp=SvPOK(sval) ? ParseCommandOption(MagickColorspaceOptions,
1449 + MagickFalse,SvPV(sval,na)) : SvIV(sval);
1452 + ThrowPerlException(exception,OptionError,"UnrecognizedColorspace",
1456 + for ( ; image; image=image->next)
1457 + (void) TransformImageColorspace(image,(ColorspaceType) sp);
1460 + if (LocaleCompare(attribute,"comment") == 0)
1462 + for ( ; image; image=image->next)
1463 + (void) SetImageProperty(image,"Comment",InterpretImageProperties(
1464 + info ? info->image_info : (ImageInfo *) NULL,image,
1468 + if (LocaleCompare(attribute,"compression") == 0)
1470 + sp=SvPOK(sval) ? ParseCommandOption(MagickCompressOptions,
1471 + MagickFalse,SvPV(sval,na)) : SvIV(sval);
1474 + ThrowPerlException(exception,OptionError,
1475 + "UnrecognizedImageCompression",SvPV(sval,na));
1479 + info->image_info->compression=(CompressionType) sp;
1480 + for ( ; image; image=image->next)
1481 + image->compression=(CompressionType) sp;
1485 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1486 + for ( ; image; image=image->next)
1487 + SetImageProperty(image,attribute,SvPV(sval,na));
1493 + if (LocaleCompare(attribute,"debug") == 0)
1495 + SetLogEventMask(SvPV(sval,na));
1498 + if (LocaleCompare(attribute,"delay") == 0)
1500 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
1501 + for ( ; image; image=image->next)
1503 + image->delay=(size_t) floor(geometry_info.rho+0.5);
1504 + if ((flags & SigmaValue) != 0)
1505 + image->ticks_per_second=(ssize_t)
1506 + floor(geometry_info.sigma+0.5);
1510 + if (LocaleCompare(attribute,"disk-limit") == 0)
1515 + limit=MagickResourceInfinity;
1516 + if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
1517 + limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
1519 + (void) SetMagickResourceLimit(DiskResource,limit);
1522 + if (LocaleCompare(attribute,"density") == 0)
1524 + if (IsGeometry(SvPV(sval,na)) == MagickFalse)
1526 + ThrowPerlException(exception,OptionError,"MissingGeometry",
1531 + (void) CloneString(&info->image_info->density,SvPV(sval,na));
1532 + for ( ; image; image=image->next)
1534 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
1535 + image->x_resolution=geometry_info.rho;
1536 + image->y_resolution=geometry_info.sigma;
1537 + if ((flags & SigmaValue) == 0)
1538 + image->y_resolution=image->x_resolution;
1542 + if (LocaleCompare(attribute,"depth") == 0)
1545 + info->image_info->depth=SvIV(sval);
1546 + for ( ; image; image=image->next)
1547 + (void) SetImageDepth(image,SvIV(sval));
1550 + if (LocaleCompare(attribute,"dispose") == 0)
1552 + sp=SvPOK(sval) ? ParseCommandOption(MagickDisposeOptions,MagickFalse,
1553 + SvPV(sval,na)) : SvIV(sval);
1556 + ThrowPerlException(exception,OptionError,
1557 + "UnrecognizedDisposeMethod",SvPV(sval,na));
1560 + for ( ; image; image=image->next)
1561 + image->dispose=(DisposeType) sp;
1564 + if (LocaleCompare(attribute,"dither") == 0)
1568 + sp=SvPOK(sval) ? ParseCommandOption(MagickBooleanOptions,
1569 + MagickFalse,SvPV(sval,na)) : SvIV(sval);
1572 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
1576 + info->image_info->dither=sp != 0 ? MagickTrue : MagickFalse;
1580 + if (LocaleCompare(attribute,"display") == 0)
1584 + (void) CloneString(&info->image_info->server_name,SvPV(sval,na));
1588 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1589 + for ( ; image; image=image->next)
1590 + SetImageProperty(image,attribute,SvPV(sval,na));
1596 + if (LocaleCompare(attribute,"endian") == 0)
1598 + sp=SvPOK(sval) ? ParseCommandOption(MagickEndianOptions,MagickFalse,
1599 + SvPV(sval,na)) : SvIV(sval);
1602 + ThrowPerlException(exception,OptionError,"UnrecognizedEndianType",
1607 + info->image_info->endian=(EndianType) sp;
1608 + for ( ; image; image=image->next)
1609 + image->endian=(EndianType) sp;
1612 + if (LocaleCompare(attribute,"extract") == 0)
1615 + Set image extract geometry.
1617 + (void) CloneString(&info->image_info->extract,SvPV(sval,na));
1621 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1622 + for ( ; image; image=image->next)
1623 + SetImageProperty(image,attribute,SvPV(sval,na));
1629 + if (LocaleCompare(attribute,"filename") == 0)
1632 + (void) CopyMagickString(info->image_info->filename,SvPV(sval,na),
1634 + for ( ; image; image=image->next)
1635 + (void) CopyMagickString(image->filename,SvPV(sval,na),
1639 + if (LocaleCompare(attribute,"file") == 0)
1647 + if (info == (struct PackageInfo *) NULL)
1649 + io_info=IoIFP(sv_2io(sval));
1650 + if (io_info == (PerlIO *) NULL)
1652 + ThrowPerlException(exception,BlobError,"UnableToOpenFile",
1656 + file=PerlIO_findFILE(io_info);
1657 + if (file == (FILE *) NULL)
1659 + ThrowPerlException(exception,BlobError,"UnableToOpenFile",
1663 + SetImageInfoFile(info->image_info,file);
1666 + if (LocaleCompare(attribute,"fill") == 0)
1669 + (void) SetImageOption(info->image_info,"fill",SvPV(sval,na));
1672 + if (LocaleCompare(attribute,"font") == 0)
1675 + (void) CloneString(&info->image_info->font,SvPV(sval,na));
1678 + if (LocaleCompare(attribute,"foreground") == 0)
1680 + if (LocaleCompare(attribute,"fuzz") == 0)
1683 + info->image_info->fuzz=StringToDoubleInterval(SvPV(sval,na),(double)
1684 + QuantumRange+1.0);
1685 + for ( ; image; image=image->next)
1686 + image->fuzz=StringToDoubleInterval(SvPV(sval,na),(double)
1687 + QuantumRange+1.0);
1691 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1692 + for ( ; image; image=image->next)
1693 + SetImageProperty(image,attribute,SvPV(sval,na));
1699 + if (LocaleCompare(attribute,"gamma") == 0)
1701 + for ( ; image; image=image->next)
1702 + image->gamma=SvNV(sval);
1705 + if (LocaleCompare(attribute,"gravity") == 0)
1707 + sp=SvPOK(sval) ? ParseCommandOption(MagickGravityOptions,MagickFalse,
1708 + SvPV(sval,na)) : SvIV(sval);
1711 + ThrowPerlException(exception,OptionError,
1712 + "UnrecognizedGravityType",SvPV(sval,na));
1716 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1717 + for ( ; image; image=image->next)
1718 + image->gravity=(GravityType) sp;
1721 + if (LocaleCompare(attribute,"green-primary") == 0)
1723 + for ( ; image; image=image->next)
1725 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
1726 + image->chromaticity.green_primary.x=geometry_info.rho;
1727 + image->chromaticity.green_primary.y=geometry_info.sigma;
1728 + if ((flags & SigmaValue) == 0)
1729 + image->chromaticity.green_primary.y=
1730 + image->chromaticity.green_primary.x;
1735 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1736 + for ( ; image; image=image->next)
1737 + SetImageProperty(image,attribute,SvPV(sval,na));
1743 + if (LocaleNCompare(attribute,"index",5) == 0)
1754 + register PixelPacket
1760 + for ( ; image; image=image->next)
1762 + if (image->storage_class != PseudoClass)
1766 + items=sscanf(attribute,"%*[^[][%ld%*[,/]%ld",&x,&y);
1768 + image_view=AcquireAuthenticCacheView(image,exception);
1769 + p=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
1770 + if (p != (PixelPacket *) NULL)
1772 + indexes=GetCacheViewAuthenticIndexQueue(image_view);
1773 + items=sscanf(SvPV(sval,na),"%ld",&index);
1774 + if ((index >= 0) && (index < (ssize_t) image->colors))
1775 + SetPixelIndex(indexes,index);
1776 + (void) SyncCacheViewAuthenticPixels(image_view,exception);
1778 + image_view=DestroyCacheView(image_view);
1782 + if (LocaleCompare(attribute,"iterations") == 0)
1785 + for ( ; image; image=image->next)
1786 + image->iterations=SvIV(sval);
1789 + if (LocaleCompare(attribute,"interlace") == 0)
1791 + sp=SvPOK(sval) ? ParseCommandOption(MagickInterlaceOptions,
1792 + MagickFalse,SvPV(sval,na)) : SvIV(sval);
1795 + ThrowPerlException(exception,OptionError,
1796 + "UnrecognizedInterlaceType",SvPV(sval,na));
1800 + info->image_info->interlace=(InterlaceType) sp;
1801 + for ( ; image; image=image->next)
1802 + image->interlace=(InterlaceType) sp;
1806 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1807 + for ( ; image; image=image->next)
1808 + SetImageProperty(image,attribute,SvPV(sval,na));
1814 + if (LocaleCompare(attribute,"label") == 0)
1816 + for ( ; image; image=image->next)
1817 + (void) SetImageProperty(image,"label",InterpretImageProperties(
1818 + info ? info->image_info : (ImageInfo *) NULL,image,
1822 + if (LocaleCompare(attribute,"loop") == 0)
1825 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1826 + for ( ; image; image=image->next)
1827 + SetImageProperty(image,attribute,SvPV(sval,na));
1833 + if (LocaleCompare(attribute,"magick") == 0)
1836 + (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
1837 + "%s:",SvPV(sval,na));
1838 + for ( ; image; image=image->next)
1839 + (void) CopyMagickString(image->magick,SvPV(sval,na),MaxTextExtent);
1842 + if (LocaleCompare(attribute,"map-limit") == 0)
1847 + limit=MagickResourceInfinity;
1848 + if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
1849 + limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
1851 + (void) SetMagickResourceLimit(MapResource,limit);
1854 + if (LocaleCompare(attribute,"mask") == 0)
1859 + mask=(Image *) NULL;
1861 + mask=SetupList(aTHX_ SvRV(sval),&info,(SV ***) NULL,exception);
1862 + for ( ; image; image=image->next)
1863 + SetImageMask(image,mask);
1866 + if (LocaleCompare(attribute,"mattecolor") == 0)
1868 + (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
1870 + info->image_info->matte_color=target_color;
1871 + for ( ; image; image=image->next)
1872 + image->matte_color=target_color;
1875 + if (LocaleCompare(attribute,"matte") == 0)
1877 + sp=SvPOK(sval) ? ParseCommandOption(MagickBooleanOptions,MagickFalse,
1878 + SvPV(sval,na)) : SvIV(sval);
1881 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
1885 + for ( ; image; image=image->next)
1886 + image->matte=sp != 0 ? MagickTrue : MagickFalse;
1889 + if (LocaleCompare(attribute,"memory-limit") == 0)
1894 + limit=MagickResourceInfinity;
1895 + if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
1896 + limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
1898 + (void) SetMagickResourceLimit(MemoryResource,limit);
1901 + if (LocaleCompare(attribute,"monochrome") == 0)
1903 + sp=SvPOK(sval) ? ParseCommandOption(MagickBooleanOptions,MagickFalse,
1904 + SvPV(sval,na)) : SvIV(sval);
1907 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
1912 + info->image_info->monochrome=sp != 0 ? MagickTrue : MagickFalse;
1913 + for ( ; image; image=image->next)
1914 + (void) SetImageType(image,BilevelType);
1918 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1919 + for ( ; image; image=image->next)
1920 + SetImageProperty(image,attribute,SvPV(sval,na));
1926 + if (LocaleCompare(attribute,"option") == 0)
1929 + DefineImageOption(info->image_info,SvPV(sval,na));
1932 + if (LocaleCompare(attribute,"orientation") == 0)
1934 + sp=SvPOK(sval) ? ParseCommandOption(MagickOrientationOptions,
1935 + MagickFalse,SvPV(sval,na)) : SvIV(sval);
1938 + ThrowPerlException(exception,OptionError,
1939 + "UnrecognizedOrientationType",SvPV(sval,na));
1943 + info->image_info->orientation=(OrientationType) sp;
1944 + for ( ; image; image=image->next)
1945 + image->orientation=(OrientationType) sp;
1949 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
1950 + for ( ; image; image=image->next)
1951 + SetImageProperty(image,attribute,SvPV(sval,na));
1957 + if (LocaleCompare(attribute,"page") == 0)
1962 + geometry=GetPageGeometry(SvPV(sval,na));
1964 + (void) CloneString(&info->image_info->page,geometry);
1965 + for ( ; image; image=image->next)
1966 + (void) ParsePageGeometry(image,geometry,&image->page,exception);
1967 + geometry=(char *) RelinquishMagickMemory(geometry);
1970 + if (LocaleCompare(attribute,"pen") == 0)
1973 + (void) SetImageOption(info->image_info,"fill",SvPV(sval,na));
1976 + if (LocaleNCompare(attribute,"pixel",5) == 0)
1984 + register IndexPacket
1987 + register PixelPacket
1993 + for ( ; image; image=image->next)
1995 + if (SetImageStorageClass(image,DirectClass) == MagickFalse)
1999 + items=sscanf(attribute,"%*[^[][%ld%*[,/]%ld",&x,&y);
2001 + image_view=AcquireAuthenticCacheView(image,exception);
2002 + q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
2003 + indexes=GetCacheViewAuthenticIndexQueue(image_view);
2004 + if (q != (PixelPacket *) NULL)
2006 + if ((strchr(SvPV(sval,na),',') == 0) ||
2007 + (strchr(SvPV(sval,na),')') != 0))
2008 + QueryMagickColor(SvPV(sval,na),&pixel,exception);
2011 + GetMagickPixelPacket(image,&pixel);
2012 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
2013 + pixel.red=geometry_info.rho;
2014 + if ((flags & SigmaValue) != 0)
2015 + pixel.green=geometry_info.sigma;
2016 + if ((flags & XiValue) != 0)
2017 + pixel.blue=geometry_info.xi;
2018 + if ((flags & PsiValue) != 0)
2019 + pixel.opacity=geometry_info.psi;
2020 + if ((flags & ChiValue) != 0)
2021 + pixel.index=geometry_info.chi;
2023 + SetPixelRed(q,ClampToQuantum(pixel.red));
2024 + SetPixelGreen(q,ClampToQuantum(pixel.green));
2025 + SetPixelBlue(q,ClampToQuantum(pixel.blue));
2026 + SetPixelOpacity(q,ClampToQuantum(pixel.opacity));
2027 + if (((image->colorspace == CMYKColorspace) ||
2028 + (image->storage_class == PseudoClass)) &&
2029 + (indexes != (IndexPacket *) NULL))
2030 + SetPixelIndex(indexes,ClampToQuantum(pixel.index));
2031 + (void) SyncCacheViewAuthenticPixels(image_view,exception);
2033 + image_view=DestroyCacheView(image_view);
2037 + if (LocaleCompare(attribute,"pointsize") == 0)
2041 + (void) ParseGeometry(SvPV(sval,na),&geometry_info);
2042 + info->image_info->pointsize=geometry_info.rho;
2046 + if (LocaleCompare(attribute,"preview") == 0)
2048 + sp=SvPOK(sval) ? ParseCommandOption(MagickPreviewOptions,MagickFalse,
2049 + SvPV(sval,na)) : SvIV(sval);
2052 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
2057 + info->image_info->preview_type=(PreviewType) sp;
2061 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2062 + for ( ; image; image=image->next)
2063 + SetImageProperty(image,attribute,SvPV(sval,na));
2069 + if (LocaleCompare(attribute,"quality") == 0)
2072 + info->image_info->quality=SvIV(sval);
2073 + for ( ; image; image=image->next)
2074 + image->quality=SvIV(sval);
2078 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2079 + for ( ; image; image=image->next)
2080 + SetImageProperty(image,attribute,SvPV(sval,na));
2086 + if (LocaleCompare(attribute,"red-primary") == 0)
2088 + for ( ; image; image=image->next)
2090 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
2091 + image->chromaticity.red_primary.x=geometry_info.rho;
2092 + image->chromaticity.red_primary.y=geometry_info.sigma;
2093 + if ((flags & SigmaValue) == 0)
2094 + image->chromaticity.red_primary.y=
2095 + image->chromaticity.red_primary.x;
2099 + if (LocaleCompare(attribute,"render") == 0)
2101 + sp=SvPOK(sval) ? ParseCommandOption(MagickIntentOptions,MagickFalse,
2102 + SvPV(sval,na)) : SvIV(sval);
2105 + ThrowPerlException(exception,OptionError,"UnrecognizedIntentType",
2109 + for ( ; image; image=image->next)
2110 + image->rendering_intent=(RenderingIntent) sp;
2113 + if (LocaleCompare(attribute,"repage") == 0)
2118 + for ( ; image; image=image->next)
2120 + flags=ParseAbsoluteGeometry(SvPV(sval,na),&geometry);
2121 + if ((flags & WidthValue) != 0)
2123 + if ((flags & HeightValue) == 0)
2124 + geometry.height=geometry.width;
2125 + image->page.width=geometry.width;
2126 + image->page.height=geometry.height;
2128 + if ((flags & AspectValue) != 0)
2130 + if ((flags & XValue) != 0)
2131 + image->page.x+=geometry.x;
2132 + if ((flags & YValue) != 0)
2133 + image->page.y+=geometry.y;
2137 + if ((flags & XValue) != 0)
2139 + image->page.x=geometry.x;
2140 + if (((flags & WidthValue) != 0) && (geometry.x > 0))
2141 + image->page.width=image->columns+geometry.x;
2143 + if ((flags & YValue) != 0)
2145 + image->page.y=geometry.y;
2146 + if (((flags & HeightValue) != 0) && (geometry.y > 0))
2147 + image->page.height=image->rows+geometry.y;
2154 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2155 + for ( ; image; image=image->next)
2156 + SetImageProperty(image,attribute,SvPV(sval,na));
2162 + if (LocaleCompare(attribute,"sampling-factor") == 0)
2164 + if (IsGeometry(SvPV(sval,na)) == MagickFalse)
2166 + ThrowPerlException(exception,OptionError,"MissingGeometry",
2171 + (void) CloneString(&info->image_info->sampling_factor,
2175 + if (LocaleCompare(attribute,"scene") == 0)
2177 + for ( ; image; image=image->next)
2178 + image->scene=SvIV(sval);
2181 + if (LocaleCompare(attribute,"subimage") == 0)
2184 + info->image_info->subimage=SvIV(sval);
2187 + if (LocaleCompare(attribute,"subrange") == 0)
2190 + info->image_info->subrange=SvIV(sval);
2193 + if (LocaleCompare(attribute,"server") == 0)
2195 + if (LocaleCompare(attribute,"size") == 0)
2199 + if (IsGeometry(SvPV(sval,na)) == MagickFalse)
2201 + ThrowPerlException(exception,OptionError,"MissingGeometry",
2205 + (void) CloneString(&info->image_info->size,SvPV(sval,na));
2209 + if (LocaleCompare(attribute,"stroke") == 0)
2212 + (void) SetImageOption(info->image_info,"stroke",SvPV(sval,na));
2216 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2217 + for ( ; image; image=image->next)
2218 + SetImageProperty(image,attribute,SvPV(sval,na));
2224 + if (LocaleCompare(attribute,"texture") == 0)
2227 + (void) CloneString(&info->image_info->texture,SvPV(sval,na));
2230 + if (LocaleCompare(attribute,"thread-limit") == 0)
2235 + limit=MagickResourceInfinity;
2236 + if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
2237 + limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
2239 + (void) SetMagickResourceLimit(ThreadResource,limit);
2242 + if (LocaleCompare(attribute,"tile") == 0)
2245 + (void) CloneString(&info->image_info->tile,SvPV(sval,na));
2248 + if (LocaleCompare(attribute,"tile-offset") == 0)
2253 + geometry=GetPageGeometry(SvPV(sval,na));
2255 + (void) CloneString(&info->image_info->page,geometry);
2256 + for ( ; image; image=image->next)
2257 + (void) ParsePageGeometry(image,geometry,&image->tile_offset,
2259 + geometry=(char *) RelinquishMagickMemory(geometry);
2262 + if (LocaleCompare(attribute,"time-limit") == 0)
2267 + limit=MagickResourceInfinity;
2268 + if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
2269 + limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
2271 + (void) SetMagickResourceLimit(TimeResource,limit);
2274 + if (LocaleCompare(attribute,"transparent-color") == 0)
2276 + (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
2278 + info->image_info->transparent_color=target_color;
2279 + for ( ; image; image=image->next)
2280 + image->transparent_color=target_color;
2283 + if (LocaleCompare(attribute,"type") == 0)
2285 + sp=SvPOK(sval) ? ParseCommandOption(MagickTypeOptions,MagickFalse,
2286 + SvPV(sval,na)) : SvIV(sval);
2289 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
2294 + info->image_info->type=(ImageType) sp;
2295 + for ( ; image; image=image->next)
2296 + SetImageType(image,(ImageType) sp);
2300 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2301 + for ( ; image; image=image->next)
2302 + SetImageProperty(image,attribute,SvPV(sval,na));
2308 + if (LocaleCompare(attribute,"units") == 0)
2310 + sp=SvPOK(sval) ? ParseCommandOption(MagickResolutionOptions,
2311 + MagickFalse,SvPV(sval,na)) : SvIV(sval);
2314 + ThrowPerlException(exception,OptionError,"UnrecognizedUnitsType",
2319 + info->image_info->units=(ResolutionType) sp;
2320 + for ( ; image; image=image->next)
2325 + units=(ResolutionType) sp;
2326 + if (image->units != units)
2327 + switch (image->units)
2329 + case UndefinedResolution:
2330 + case PixelsPerInchResolution:
2332 + if (units == PixelsPerCentimeterResolution)
2334 + image->x_resolution*=2.54;
2335 + image->y_resolution*=2.54;
2339 + case PixelsPerCentimeterResolution:
2341 + if (units == PixelsPerInchResolution)
2343 + image->x_resolution/=2.54;
2344 + image->y_resolution/=2.54;
2349 + image->units=units;
2354 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2355 + for ( ; image; image=image->next)
2356 + SetImageProperty(image,attribute,SvPV(sval,na));
2362 + if (LocaleCompare(attribute,"verbose") == 0)
2364 + sp=SvPOK(sval) ? ParseCommandOption(MagickBooleanOptions,MagickFalse,
2365 + SvPV(sval,na)) : SvIV(sval);
2368 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
2373 + info->image_info->verbose=sp != 0 ? MagickTrue : MagickFalse;
2376 + if (LocaleCompare(attribute,"view") == 0)
2379 + (void) CloneString(&info->image_info->view,SvPV(sval,na));
2382 + if (LocaleCompare(attribute,"virtual-pixel") == 0)
2384 + sp=SvPOK(sval) ? ParseCommandOption(MagickVirtualPixelOptions,
2385 + MagickFalse,SvPV(sval,na)) : SvIV(sval);
2388 + ThrowPerlException(exception,OptionError,
2389 + "UnrecognizedVirtualPixelMethod",SvPV(sval,na));
2393 + info->image_info->virtual_pixel_method=(VirtualPixelMethod) sp;
2394 + for ( ; image; image=image->next)
2395 + SetImageVirtualPixelMethod(image,(VirtualPixelMethod) sp);
2399 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2400 + for ( ; image; image=image->next)
2401 + SetImageProperty(image,attribute,SvPV(sval,na));
2407 + if (LocaleCompare(attribute,"white-point") == 0)
2409 + for ( ; image; image=image->next)
2411 + flags=ParseGeometry(SvPV(sval,na),&geometry_info);
2412 + image->chromaticity.white_point.x=geometry_info.rho;
2413 + image->chromaticity.white_point.y=geometry_info.sigma;
2414 + if ((flags & SigmaValue) == 0)
2415 + image->chromaticity.white_point.y=
2416 + image->chromaticity.white_point.x;
2421 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2422 + for ( ; image; image=image->next)
2423 + SetImageProperty(image,attribute,SvPV(sval,na));
2429 + SetImageOption(info->image_info,attribute,SvPV(sval,na));
2430 + for ( ; image; image=image->next)
2431 + SetImageProperty(image,attribute,SvPV(sval,na));
2438 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2442 +% S e t u p L i s t %
2446 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2448 +% Method SetupList returns the list of all the images linked by their
2449 +% image->next and image->previous link lists for use with ImageMagick. If
2450 +% info is non-NULL, an info structure is returned in *info. If
2451 +% reference_vector is non-NULL,an array of SV* are returned in
2452 +% *reference_vector. Reference_vector is used when the images are going to be
2453 +% replaced with new Image*'s.
2455 +% The format of the SetupList routine is:
2457 +% Image *SetupList(SV *reference,struct PackageInfo **info,
2458 +% SV ***reference_vector,ExceptionInfo *exception)
2460 +% A description of each parameter follows:
2462 +% o list: a list of strings.
2464 +% o string: a character string.
2466 +% o exception: Return any errors or warnings in this structure.
2469 +static Image *SetupList(pTHX_ SV *reference,struct PackageInfo **info,
2470 + SV ***reference_vector,ExceptionInfo *exception)
2479 + if (reference_vector)
2480 + *reference_vector=NULL;
2485 + image=GetList(aTHX_ reference,reference_vector,¤t,&last,exception);
2486 + if (info && (SvTYPE(reference) == SVt_PVAV))
2487 + *info=GetPackageInfo(aTHX_ (void *) reference,(struct PackageInfo *) NULL,
2493 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2497 +% s t r E Q c a s e %
2501 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2503 +% strEQcase() compares two strings and returns 0 if they are the
2504 +% same or if the second string runs out first. The comparison is case
2507 +% The format of the strEQcase routine is:
2509 +% ssize_t strEQcase(const char *p,const char *q)
2511 +% A description of each parameter follows:
2513 +% o p: a character string.
2515 +% o q: a character string.
2519 +static ssize_t strEQcase(const char *p,const char *q)
2527 + for (i=0 ; (c=(*q)) != 0; i++)
2529 + if ((isUPPER((unsigned char) c) ? toLOWER(c) : c) !=
2530 + (isUPPER((unsigned char) *p) ? toLOWER(*p) : *p))
2535 + return(((*q == 0) && (*p == 0)) ? i : 0);
2539 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2543 +% I m a g e : : M a g i c k %
2547 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2551 +MODULE = Image::Magick PACKAGE = Image::Magick
2556 + MagickCoreGenesis("PerlMagick",MagickFalse);
2557 + SetWarningHandler(NULL);
2558 + SetErrorHandler(NULL);
2559 + magick_registry=NewSplayTree((int (*)(const void *,const void *))
2560 + NULL,(void *(*)(void *)) NULL,(void *(*)(void *)) NULL);
2566 + if (magick_registry != (SplayTreeInfo *) NULL)
2567 + magick_registry=DestroySplayTree(magick_registry);
2568 + MagickCoreTerminus();
2572 +constant(name,argument)
2577 +###############################################################################
2585 +###############################################################################
2590 + Image::Magick ref = NO_INIT
2606 + struct PackageInfo
2614 + PERL_UNUSED_VAR(ref);
2615 + PERL_UNUSED_VAR(ix);
2616 + exception=AcquireExceptionInfo();
2617 + perl_exception=newSVpv("",0);
2618 + package_info=(struct PackageInfo *) NULL;
2619 + if (sv_isobject(ST(0)) == 0)
2621 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
2623 + goto PerlException;
2625 + reference=SvRV(ST(0));
2626 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
2627 + if (image == (Image *) NULL)
2629 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
2631 + goto PerlException;
2633 + package_info=ClonePackageInfo(info,exception);
2635 + SetAttribute(aTHX_ package_info,NULL,"server",ST(1),exception);
2638 + for (i=2; i < items; i+=2)
2639 + SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),
2641 + (void) AnimateImages(package_info->image_info,image);
2642 + (void) CatchImageException(image);
2643 + InheritException(exception,&image->exception);
2646 + if (package_info != (struct PackageInfo *) NULL)
2647 + DestroyPackageInfo(package_info);
2648 + InheritPerlException(exception,perl_exception);
2649 + exception=DestroyExceptionInfo(exception);
2650 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
2651 + SvPOK_on(perl_exception);
2652 + ST(0)=sv_2mortal(perl_exception);
2657 +###############################################################################
2665 +###############################################################################
2670 + Image::Magick ref = NO_INIT
2698 + struct PackageInfo
2708 + PERL_UNUSED_VAR(ref);
2709 + PERL_UNUSED_VAR(ix);
2710 + exception=AcquireExceptionInfo();
2711 + perl_exception=newSVpv("",0);
2715 + if (sv_isobject(ST(0)) == 0)
2717 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
2719 + goto PerlException;
2721 + reference=SvRV(ST(0));
2722 + hv=SvSTASH(reference);
2724 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
2726 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
2727 + if (image == (Image *) NULL)
2729 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
2731 + goto PerlException;
2733 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
2738 + for (i=2; i < items; i+=2)
2740 + attribute=(char *) SvPV(ST(i-1),na);
2741 + switch (*attribute)
2746 + if (LocaleCompare(attribute,"stack") == 0)
2748 + stack=ParseCommandOption(MagickBooleanOptions,MagickFalse,
2752 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
2758 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
2764 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
2770 + image=AppendImages(image,stack != 0 ? MagickTrue : MagickFalse,exception);
2771 + if (image == (Image *) NULL)
2772 + goto PerlException;
2773 + for ( ; image; image=image->next)
2775 + AddImageToRegistry(sv,image);
2777 + av_push(av,sv_bless(rv,hv));
2780 + exception=DestroyExceptionInfo(exception);
2781 + ST(0)=av_reference;
2782 + SvREFCNT_dec(perl_exception);
2786 + InheritPerlException(exception,perl_exception);
2787 + exception=DestroyExceptionInfo(exception);
2788 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
2789 + SvPOK_on(perl_exception);
2790 + ST(0)=sv_2mortal(perl_exception);
2795 +###############################################################################
2803 +###############################################################################
2808 + Image::Magick ref = NO_INIT
2830 + struct PackageInfo
2839 + PERL_UNUSED_VAR(ref);
2840 + PERL_UNUSED_VAR(ix);
2841 + exception=AcquireExceptionInfo();
2842 + perl_exception=newSVpv("",0);
2844 + if (sv_isobject(ST(0)) == 0)
2846 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
2848 + goto PerlException;
2850 + reference=SvRV(ST(0));
2851 + hv=SvSTASH(reference);
2852 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
2853 + if (image == (Image *) NULL)
2855 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
2857 + goto PerlException;
2859 + image=EvaluateImages(image,MeanEvaluateOperator,exception);
2860 + if (image == (Image *) NULL)
2861 + goto PerlException;
2863 + Create blessed Perl array for the returned image.
2866 + ST(0)=sv_2mortal(sv_bless(newRV((SV *) av),hv));
2868 + AddImageToRegistry(sv,image);
2870 + av_push(av,sv_bless(rv,hv));
2872 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
2873 + (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
2874 + "average-%.*s",(int) (MaxTextExtent-9),
2875 + ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
2876 + (void) CopyMagickString(image->filename,info->image_info->filename,
2878 + SetImageInfo(info->image_info,0,exception);
2879 + exception=DestroyExceptionInfo(exception);
2880 + SvREFCNT_dec(perl_exception);
2884 + InheritPerlException(exception,perl_exception);
2885 + exception=DestroyExceptionInfo(exception);
2886 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
2887 + SvPOK_on(perl_exception);
2888 + ST(0)=sv_2mortal(perl_exception);
2893 +###############################################################################
2897 +# B l o b T o I m a g e #
2901 +###############################################################################
2905 +BlobToImage(ref,...)
2906 + Image::Magick ref = NO_INIT
2943 + struct PackageInfo
2952 + PERL_UNUSED_VAR(ref);
2953 + PERL_UNUSED_VAR(ix);
2954 + exception=AcquireExceptionInfo();
2955 + perl_exception=newSVpv("",0);
2958 + ac=(items < 2) ? 1 : items-1;
2959 + length=(STRLEN *) NULL;
2960 + list=(char **) AcquireQuantumMemory((size_t) ac+1UL,sizeof(*list));
2961 + if (list == (char **) NULL)
2963 + ThrowPerlException(exception,ResourceLimitError,
2964 + "MemoryAllocationFailed",PackageName);
2965 + goto PerlException;
2967 + length=(STRLEN *) AcquireQuantumMemory((size_t) ac+1UL,sizeof(*length));
2968 + if (length == (STRLEN *) NULL)
2970 + ThrowPerlException(exception,ResourceLimitError,
2971 + "MemoryAllocationFailed",PackageName);
2972 + goto PerlException;
2974 + if (sv_isobject(ST(0)) == 0)
2976 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
2978 + goto PerlException;
2980 + reference=SvRV(ST(0));
2981 + hv=SvSTASH(reference);
2982 + if (SvTYPE(reference) != SVt_PVAV)
2984 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
2986 + goto PerlException;
2988 + av=(AV *) reference;
2989 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
2994 + ThrowPerlException(exception,OptionError,"NoBlobDefined",PackageName);
2995 + goto PerlException;
2997 + for (n=0, i=0; i < ac; i++)
2999 + list[n]=(char *) (SvPV(ST(i+1),length[n]));
3000 + if ((items >= 3) && strEQcase((char *) SvPV(ST(i+1),na),"blob"))
3002 + list[n]=(char *) (SvPV(ST(i+2),length[n]));
3007 + list[n]=(char *) NULL;
3009 + for (i=number_images=0; i < n; i++)
3011 + image=BlobToImage(info->image_info,list[i],length[i],exception);
3012 + if (image == (Image *) NULL)
3014 + for ( ; image; image=image->next)
3016 + AddImageToRegistry(sv,image);
3018 + av_push(av,sv_bless(rv,hv));
3026 + for (i=0; i < n; i++)
3027 + if (list[i] != (char *) NULL)
3028 + for (p=keep; list[i] != *p++; )
3029 + if (*p == (char *) NULL)
3031 + list[i]=(char *) RelinquishMagickMemory(list[i]);
3037 + list=(char **) RelinquishMagickMemory(list);
3039 + length=(STRLEN *) RelinquishMagickMemory(length);
3040 + InheritPerlException(exception,perl_exception);
3041 + exception=DestroyExceptionInfo(exception);
3042 + sv_setiv(perl_exception,(IV) number_images);
3043 + SvPOK_on(perl_exception);
3044 + ST(0)=sv_2mortal(perl_exception);
3049 +###############################################################################
3057 +###############################################################################
3062 + Image::Magick ref = NO_INIT
3086 + struct PackageInfo
3095 + PERL_UNUSED_VAR(ref);
3096 + PERL_UNUSED_VAR(ix);
3097 + exception=AcquireExceptionInfo();
3098 + perl_exception=newSVpv("",0);
3100 + if (sv_isobject(ST(0)) == 0)
3102 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
3104 + goto PerlException;
3106 + reference=SvRV(ST(0));
3107 + hv=SvSTASH(reference);
3108 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
3109 + if (image == (Image *) NULL)
3111 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
3113 + goto PerlException;
3116 + Create blessed Perl array for the returned image.
3119 + ST(0)=sv_2mortal(sv_bless(newRV((SV *) av),hv));
3121 + for ( ; image; image=image->next)
3123 + clone=CloneImage(image,0,0,MagickTrue,exception);
3124 + if (clone == (Image *) NULL)
3126 + AddImageToRegistry(sv,clone);
3128 + av_push(av,sv_bless(rv,hv));
3131 + exception=DestroyExceptionInfo(exception);
3132 + SvREFCNT_dec(perl_exception);
3136 + InheritPerlException(exception,perl_exception);
3137 + exception=DestroyExceptionInfo(exception);
3138 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
3139 + SvPOK_on(perl_exception);
3140 + ST(0)=sv_2mortal(perl_exception);
3145 +###############################################################################
3153 +###############################################################################
3161 + PERL_UNUSED_VAR(ref);
3162 + if (magick_registry != (SplayTreeInfo *) NULL)
3167 + ResetSplayTreeIterator(magick_registry);
3168 + p=(Image *) GetNextKeyInSplayTree(magick_registry);
3169 + while (p != (Image *) NULL)
3171 + ReferenceImage(p);
3172 + p=(Image *) GetNextKeyInSplayTree(magick_registry);
3178 +###############################################################################
3182 +# C o a l e s c e #
3186 +###############################################################################
3191 + Image::Magick ref = NO_INIT
3210 + struct PackageInfo
3220 + PERL_UNUSED_VAR(ref);
3221 + PERL_UNUSED_VAR(ix);
3222 + exception=AcquireExceptionInfo();
3223 + perl_exception=newSVpv("",0);
3225 + if (sv_isobject(ST(0)) == 0)
3227 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
3229 + goto PerlException;
3231 + reference=SvRV(ST(0));
3232 + hv=SvSTASH(reference);
3234 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
3236 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
3237 + if (image == (Image *) NULL)
3239 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
3241 + goto PerlException;
3243 + image=CoalesceImages(image,exception);
3244 + if (image == (Image *) NULL)
3245 + goto PerlException;
3246 + for ( ; image; image=image->next)
3248 + AddImageToRegistry(sv,image);
3250 + av_push(av,sv_bless(rv,hv));
3253 + exception=DestroyExceptionInfo(exception);
3254 + ST(0)=av_reference;
3255 + SvREFCNT_dec(perl_exception);
3259 + InheritPerlException(exception,perl_exception);
3260 + exception=DestroyExceptionInfo(exception);
3261 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
3262 + SvPOK_on(perl_exception);
3263 + ST(0)=sv_2mortal(perl_exception);
3268 +###############################################################################
3276 +###############################################################################
3281 + Image::Magick ref = NO_INIT
3307 + *difference_image,
3309 + *reconstruct_image;
3320 + struct PackageInfo
3330 + PERL_UNUSED_VAR(ref);
3331 + PERL_UNUSED_VAR(ix);
3332 + exception=AcquireExceptionInfo();
3333 + perl_exception=newSVpv("",0);
3337 + if (sv_isobject(ST(0)) == 0)
3339 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
3341 + goto PerlException;
3343 + reference=SvRV(ST(0));
3344 + hv=SvSTASH(reference);
3346 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
3348 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
3349 + if (image == (Image *) NULL)
3351 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
3353 + goto PerlException;
3355 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
3359 + channel=DefaultChannels;
3360 + reconstruct_image=image;
3361 + metric=RootMeanSquaredErrorMetric;
3362 + for (i=2; i < items; i+=2)
3364 + attribute=(char *) SvPV(ST(i-1),na);
3365 + switch (*attribute)
3370 + if (LocaleCompare(attribute,"channel") == 0)
3375 + option=ParseChannelOption(SvPV(ST(i),na));
3378 + ThrowPerlException(exception,OptionError,
3379 + "UnrecognizedType",SvPV(ST(i),na));
3382 + channel=(ChannelType) option;
3385 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3392 + if (LocaleCompare(attribute,"fuzz") == 0)
3394 + image->fuzz=StringToDoubleInterval(SvPV(ST(i),na),100.0);
3397 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3404 + if (LocaleCompare(attribute,"image") == 0)
3406 + reconstruct_image=SetupList(aTHX_ SvRV(ST(i)),
3407 + (struct PackageInfo **) NULL,(SV ***) NULL,exception);
3410 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3417 + if (LocaleCompare(attribute,"metric") == 0)
3419 + option=ParseCommandOption(MagickMetricOptions,MagickFalse,
3423 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
3427 + metric=(MetricType) option;
3430 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3436 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3442 + difference_image=CompareImageChannels(image,reconstruct_image,channel,
3443 + metric,&distortion,exception);
3444 + if (difference_image != (Image *) NULL)
3446 + difference_image->error.mean_error_per_pixel=distortion;
3447 + AddImageToRegistry(sv,difference_image);
3449 + av_push(av,sv_bless(rv,hv));
3452 + exception=DestroyExceptionInfo(exception);
3453 + ST(0)=av_reference;
3454 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
3458 + InheritPerlException(exception,perl_exception);
3459 + exception=DestroyExceptionInfo(exception);
3460 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
3461 + SvPOK_on(perl_exception);
3462 + ST(0)=sv_2mortal(perl_exception);
3467 +###############################################################################
3471 +# C o m p a r e L a y e r s #
3475 +###############################################################################
3480 + Image::Magick ref = NO_INIT
3482 + CompareImageLayers = 1
3484 + compareimagelayers = 3
3511 + struct PackageInfo
3521 + PERL_UNUSED_VAR(ref);
3522 + PERL_UNUSED_VAR(ix);
3523 + exception=AcquireExceptionInfo();
3524 + perl_exception=newSVpv("",0);
3526 + if (sv_isobject(ST(0)) == 0)
3528 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
3530 + goto PerlException;
3532 + reference=SvRV(ST(0));
3533 + hv=SvSTASH(reference);
3535 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
3537 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
3538 + if (image == (Image *) NULL)
3540 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
3542 + goto PerlException;
3544 + method=CompareAnyLayer;
3545 + for (i=2; i < items; i+=2)
3547 + attribute=(char *) SvPV(ST(i-1),na);
3548 + switch (*attribute)
3553 + if (LocaleCompare(attribute,"method") == 0)
3555 + option=ParseCommandOption(MagickLayerOptions,MagickFalse,
3559 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
3563 + method=(ImageLayerMethod) option;
3566 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3572 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3578 + image=CompareImageLayers(image,method,exception);
3579 + if (image == (Image *) NULL)
3580 + goto PerlException;
3581 + for ( ; image; image=image->next)
3583 + AddImageToRegistry(sv,image);
3585 + av_push(av,sv_bless(rv,hv));
3588 + exception=DestroyExceptionInfo(exception);
3589 + ST(0)=av_reference;
3590 + SvREFCNT_dec(perl_exception);
3594 + InheritPerlException(exception,perl_exception);
3595 + exception=DestroyExceptionInfo(exception);
3596 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
3597 + SvPOK_on(perl_exception);
3598 + ST(0)=sv_2mortal(perl_exception);
3603 +###############################################################################
3607 +# C o m p l e x I m a g e s #
3611 +###############################################################################
3616 + Image::Magick ref = NO_INIT
3644 + struct PackageInfo
3653 + PERL_UNUSED_VAR(ref);
3654 + PERL_UNUSED_VAR(ix);
3655 + exception=AcquireExceptionInfo();
3656 + perl_exception=newSVpv("",0);
3658 + if (sv_isobject(ST(0)) == 0)
3660 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
3662 + goto PerlException;
3664 + reference=SvRV(ST(0));
3665 + hv=SvSTASH(reference);
3666 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
3667 + if (image == (Image *) NULL)
3669 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
3671 + goto PerlException;
3673 + op=UndefinedComplexOperator;
3679 + in=ParseCommandOption(MagickComplexOptions,MagickFalse,(char *)
3683 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
3687 + op=(ComplexOperator) in;
3690 + for (i=2; i < items; i+=2)
3692 + attribute=(char *) SvPV(ST(i-1),na);
3693 + switch (*attribute)
3698 + if (LocaleCompare(attribute,"operator") == 0)
3703 + in=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
3704 + MagickComplexOptions,MagickFalse,SvPV(ST(i),na));
3707 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
3711 + op=(ComplexOperator) in;
3714 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3720 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
3726 + image=ComplexImages(image,op,exception);
3727 + if (image == (Image *) NULL)
3728 + goto PerlException;
3730 + Create blessed Perl array for the returned image.
3733 + ST(0)=sv_2mortal(sv_bless(newRV((SV *) av),hv));
3735 + AddImageToRegistry(sv,image);
3737 + av_push(av,sv_bless(rv,hv));
3739 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
3740 + (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
3741 + "complex-%.*s",(int) (MaxTextExtent-9),
3742 + ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
3743 + (void) CopyMagickString(image->filename,info->image_info->filename,
3745 + SetImageInfo(info->image_info,0,exception);
3746 + exception=DestroyExceptionInfo(exception);
3747 + SvREFCNT_dec(perl_exception);
3751 + InheritPerlException(exception,perl_exception);
3752 + exception=DestroyExceptionInfo(exception);
3753 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
3754 + SvPOK_on(perl_exception);
3755 + ST(0)=sv_2mortal(perl_exception);
3760 +###############################################################################
3768 +###############################################################################
3773 + Image::Magick ref = NO_INIT
3779 + PERL_UNUSED_VAR(ref);
3780 + if (sv_isobject(ST(0)) == 0)
3781 + croak("ReferenceIsNotMyType");
3782 + reference=SvRV(ST(0));
3783 + switch (SvTYPE(reference))
3788 + message[MaxTextExtent];
3799 + struct PackageInfo
3806 + Array (AV *) reference
3808 + (void) FormatLocaleString(message,MaxTextExtent,"package%s%p",
3809 + XS_VERSION,reference);
3810 + hv=gv_stashpv(PackageName, FALSE);
3813 + gvp=(GV **) hv_fetch(hv,message,(long) strlen(message),FALSE);
3817 + if (sv && (SvREFCNT(sv) == 1) && SvIOK(sv))
3819 + info=INT2PTR(struct PackageInfo *,SvIV(sv));
3820 + DestroyPackageInfo(info);
3822 + key=hv_delete(hv,message,(long) strlen(message),G_DISCARD);
3832 + Blessed scalar = (Image *) SvIV(reference)
3834 + image=INT2PTR(Image *,SvIV(reference));
3835 + if (image != (Image *) NULL)
3836 + DeleteImageFromRegistry(reference,image);
3845 +###############################################################################
3853 +###############################################################################
3858 + Image::Magick ref = NO_INIT
3874 + struct PackageInfo
3882 + PERL_UNUSED_VAR(ref);
3883 + PERL_UNUSED_VAR(ix);
3884 + exception=AcquireExceptionInfo();
3885 + perl_exception=newSVpv("",0);
3886 + package_info=(struct PackageInfo *) NULL;
3887 + if (sv_isobject(ST(0)) == 0)
3889 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
3891 + goto PerlException;
3893 + reference=SvRV(ST(0));
3894 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
3895 + if (image == (Image *) NULL)
3897 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
3899 + goto PerlException;
3901 + package_info=ClonePackageInfo(info,exception);
3903 + SetAttribute(aTHX_ package_info,NULL,"server",ST(1),exception);
3906 + for (i=2; i < items; i+=2)
3907 + SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),
3909 + (void) DisplayImages(package_info->image_info,image);
3910 + (void) CatchImageException(image);
3911 + InheritException(exception,&image->exception);
3914 + if (package_info != (struct PackageInfo *) NULL)
3915 + DestroyPackageInfo(package_info);
3916 + InheritPerlException(exception,perl_exception);
3917 + exception=DestroyExceptionInfo(exception);
3918 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
3919 + SvPOK_on(perl_exception);
3920 + ST(0)=sv_2mortal(perl_exception);
3925 +###############################################################################
3929 +# E v a l u a t e I m a g e s #
3933 +###############################################################################
3937 +EvaluateImages(ref)
3938 + Image::Magick ref = NO_INIT
3940 + EvaluateImages = 1
3941 + evaluateimages = 2
3960 + MagickEvaluateOperator
3966 + struct PackageInfo
3975 + PERL_UNUSED_VAR(ref);
3976 + PERL_UNUSED_VAR(ix);
3977 + exception=AcquireExceptionInfo();
3978 + perl_exception=newSVpv("",0);
3980 + if (sv_isobject(ST(0)) == 0)
3982 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
3984 + goto PerlException;
3986 + reference=SvRV(ST(0));
3987 + hv=SvSTASH(reference);
3988 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
3989 + if (image == (Image *) NULL)
3991 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
3993 + goto PerlException;
3995 + op=MeanEvaluateOperator;
4001 + in=ParseCommandOption(MagickEvaluateOptions,MagickFalse,(char *)
4005 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
4009 + op=(MagickEvaluateOperator) in;
4012 + for (i=2; i < items; i+=2)
4014 + attribute=(char *) SvPV(ST(i-1),na);
4015 + switch (*attribute)
4020 + if (LocaleCompare(attribute,"operator") == 0)
4025 + in=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
4026 + MagickEvaluateOptions,MagickFalse,SvPV(ST(i),na));
4029 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
4033 + op=(MagickEvaluateOperator) in;
4036 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4042 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4048 + image=EvaluateImages(image,op,exception);
4049 + if (image == (Image *) NULL)
4050 + goto PerlException;
4052 + Create blessed Perl array for the returned image.
4055 + ST(0)=sv_2mortal(sv_bless(newRV((SV *) av),hv));
4057 + AddImageToRegistry(sv,image);
4059 + av_push(av,sv_bless(rv,hv));
4061 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
4062 + (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
4063 + "evaluate-%.*s",(int) (MaxTextExtent-9),
4064 + ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
4065 + (void) CopyMagickString(image->filename,info->image_info->filename,
4067 + SetImageInfo(info->image_info,0,exception);
4068 + exception=DestroyExceptionInfo(exception);
4069 + SvREFCNT_dec(perl_exception);
4073 + InheritPerlException(exception,perl_exception);
4074 + exception=DestroyExceptionInfo(exception);
4075 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
4076 + SvPOK_on(perl_exception);
4077 + ST(0)=sv_2mortal(perl_exception);
4082 +###############################################################################
4086 +# F e a t u r e s #
4090 +###############################################################################
4095 + Image::Magick ref = NO_INIT
4102 +#define ChannelFeatures(channel,direction) \
4104 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4105 + channel_features[channel].angular_second_moment[direction]); \
4106 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4107 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4108 + channel_features[channel].contrast[direction]); \
4109 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4110 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4111 + channel_features[channel].contrast[direction]); \
4112 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4113 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4114 + channel_features[channel].variance_sum_of_squares[direction]); \
4115 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4116 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4117 + channel_features[channel].inverse_difference_moment[direction]); \
4118 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4119 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4120 + channel_features[channel].sum_average[direction]); \
4121 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4122 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4123 + channel_features[channel].sum_variance[direction]); \
4124 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4125 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4126 + channel_features[channel].sum_entropy[direction]); \
4127 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4128 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4129 + channel_features[channel].entropy[direction]); \
4130 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4131 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4132 + channel_features[channel].difference_variance[direction]); \
4133 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4134 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4135 + channel_features[channel].difference_entropy[direction]); \
4136 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4137 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4138 + channel_features[channel].measure_of_correlation_1[direction]); \
4139 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4140 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4141 + channel_features[channel].measure_of_correlation_2[direction]); \
4142 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4143 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
4144 + channel_features[channel].maximum_correlation_coefficient[direction]); \
4145 + PUSHs(sv_2mortal(newSVpv(message,0))); \
4153 + message[MaxTextExtent];
4156 + *channel_features;
4173 + struct PackageInfo
4180 + PERL_UNUSED_VAR(ref);
4181 + PERL_UNUSED_VAR(ix);
4182 + exception=AcquireExceptionInfo();
4183 + perl_exception=newSVpv("",0);
4185 + if (sv_isobject(ST(0)) == 0)
4187 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
4189 + goto PerlException;
4191 + reference=SvRV(ST(0));
4194 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
4195 + if (image == (Image *) NULL)
4197 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
4199 + goto PerlException;
4202 + for (i=2; i < items; i+=2)
4204 + attribute=(char *) SvPV(ST(i-1),na);
4205 + switch (*attribute)
4210 + if (LocaleCompare(attribute,"distance") == 0)
4212 + distance=StringToLong((char *) SvPV(ST(1),na));
4215 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4221 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4228 + for ( ; image; image=image->next)
4230 + channel_features=GetImageChannelFeatures(image,distance,
4231 + &image->exception);
4232 + if (channel_features == (ChannelFeatures *) NULL)
4235 + EXTEND(sp,280*count);
4236 + for (i=0; i < 4; i++)
4238 + ChannelFeatures(RedChannel,i);
4239 + ChannelFeatures(GreenChannel,i);
4240 + ChannelFeatures(BlueChannel,i);
4241 + if (image->colorspace == CMYKColorspace)
4242 + ChannelFeatures(IndexChannel,i);
4243 + if (image->matte != MagickFalse)
4244 + ChannelFeatures(OpacityChannel,i);
4246 + channel_features=(ChannelFeatures *)
4247 + RelinquishMagickMemory(channel_features);
4251 + InheritPerlException(exception,perl_exception);
4252 + exception=DestroyExceptionInfo(exception);
4253 + SvREFCNT_dec(perl_exception);
4257 +###############################################################################
4265 +###############################################################################
4270 + Image::Magick ref = NO_INIT
4299 + struct PackageInfo
4308 + PERL_UNUSED_VAR(ref);
4309 + PERL_UNUSED_VAR(ix);
4310 + exception=AcquireExceptionInfo();
4311 + perl_exception=newSVpv("",0);
4313 + if (sv_isobject(ST(0)) == 0)
4315 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
4317 + goto PerlException;
4319 + reference=SvRV(ST(0));
4320 + hv=SvSTASH(reference);
4321 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
4322 + if (image == (Image *) NULL)
4324 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
4326 + goto PerlException;
4328 + background_color=image->background_color;
4330 + (void) QueryColorDatabase((char *) SvPV(ST(1),na),&background_color,
4333 + for (i=2; i < items; i+=2)
4335 + attribute=(char *) SvPV(ST(i-1),na);
4336 + switch (*attribute)
4341 + if (LocaleCompare(attribute,"background") == 0)
4343 + (void) QueryColorDatabase((char *) SvPV(ST(1),na),
4344 + &background_color,exception);
4347 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4353 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4359 + image->background_color=background_color;
4360 + image=MergeImageLayers(image,FlattenLayer,exception);
4361 + if (image == (Image *) NULL)
4362 + goto PerlException;
4364 + Create blessed Perl array for the returned image.
4367 + ST(0)=sv_2mortal(sv_bless(newRV((SV *) av),hv));
4369 + AddImageToRegistry(sv,image);
4371 + av_push(av,sv_bless(rv,hv));
4373 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
4374 + (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
4375 + "flatten-%.*s",(int) (MaxTextExtent-9),
4376 + ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
4377 + (void) CopyMagickString(image->filename,info->image_info->filename,
4379 + SetImageInfo(info->image_info,0,exception);
4380 + exception=DestroyExceptionInfo(exception);
4381 + SvREFCNT_dec(perl_exception);
4385 + InheritPerlException(exception,perl_exception);
4386 + exception=DestroyExceptionInfo(exception);
4387 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
4388 + SvPOK_on(perl_exception); /* return messages in string context */
4389 + ST(0)=sv_2mortal(perl_exception);
4394 +###############################################################################
4402 +###############################################################################
4407 + Image::Magick ref = NO_INIT
4419 + expression[MaxTextExtent];
4436 + struct PackageInfo
4446 + PERL_UNUSED_VAR(ref);
4447 + PERL_UNUSED_VAR(ix);
4448 + exception=AcquireExceptionInfo();
4449 + perl_exception=newSVpv("",0);
4453 + if (sv_isobject(ST(0)) == 0)
4455 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
4457 + goto PerlException;
4459 + reference=SvRV(ST(0));
4460 + hv=SvSTASH(reference);
4462 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
4464 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
4465 + if (image == (Image *) NULL)
4467 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
4469 + goto PerlException;
4471 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
4475 + channel=DefaultChannels;
4476 + (void) CopyMagickString(expression,"u",MaxTextExtent);
4478 + (void) CopyMagickString(expression,(char *) SvPV(ST(1),na),MaxTextExtent);
4480 + for (i=2; i < items; i+=2)
4482 + attribute=(char *) SvPV(ST(i-1),na);
4483 + switch (*attribute)
4488 + if (LocaleCompare(attribute,"channel") == 0)
4493 + option=ParseChannelOption(SvPV(ST(i),na));
4496 + ThrowPerlException(exception,OptionError,
4497 + "UnrecognizedType",SvPV(ST(i),na));
4500 + channel=(ChannelType) option;
4503 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4510 + if (LocaleCompare(attribute,"expression") == 0)
4512 + (void) CopyMagickString(expression,SvPV(ST(i),na),
4516 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4522 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4528 + image=FxImageChannel(image,channel,expression,exception);
4529 + if (image == (Image *) NULL)
4530 + goto PerlException;
4531 + for ( ; image; image=image->next)
4533 + AddImageToRegistry(sv,image);
4535 + av_push(av,sv_bless(rv,hv));
4538 + exception=DestroyExceptionInfo(exception);
4539 + ST(0)=av_reference;
4540 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
4544 + InheritPerlException(exception,perl_exception);
4545 + exception=DestroyExceptionInfo(exception);
4546 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
4547 + SvPOK_on(perl_exception);
4548 + ST(0)=sv_2mortal(perl_exception);
4553 +###############################################################################
4561 +###############################################################################
4566 + Image::Magick ref = NO_INIT
4577 + color[MaxTextExtent];
4594 + struct PackageInfo
4602 + PERL_UNUSED_VAR(ref);
4603 + PERL_UNUSED_VAR(ix);
4604 + exception=AcquireExceptionInfo();
4605 + perl_exception=newSVpv("",0);
4606 + if (sv_isobject(ST(0)) == 0)
4608 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
4612 + reference=SvRV(ST(0));
4613 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
4614 + if (image == (Image *) NULL && !info)
4617 + for (i=1; i < items; i++)
4619 + attribute=(char *) SvPV(ST(i),na);
4621 + switch (*attribute)
4626 + if (LocaleCompare(attribute,"adjoin") == 0)
4629 + s=newSViv((ssize_t) info->image_info->adjoin);
4630 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4633 + if (LocaleCompare(attribute,"antialias") == 0)
4636 + s=newSViv((ssize_t) info->image_info->antialias);
4637 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4640 + if (LocaleCompare(attribute,"area") == 0)
4642 + s=newSViv(GetMagickResource(AreaResource));
4643 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4646 + if (LocaleCompare(attribute,"attenuate") == 0)
4651 + value=GetImageProperty(image,attribute);
4652 + if (value != (const char *) NULL)
4653 + s=newSVpv(value,0);
4654 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4657 + if (LocaleCompare(attribute,"authenticate") == 0)
4660 + s=newSVpv(info->image_info->authenticate,0);
4661 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4664 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4671 + if (LocaleCompare(attribute,"background") == 0)
4673 + if (image == (Image *) NULL)
4675 + (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
4676 + QuantumFormat "," QuantumFormat "," QuantumFormat,
4677 + image->background_color.red,image->background_color.green,
4678 + image->background_color.blue,image->background_color.opacity);
4679 + s=newSVpv(color,0);
4680 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4683 + if (LocaleCompare(attribute,"base-columns") == 0)
4685 + if (image != (Image *) NULL)
4686 + s=newSViv((ssize_t) image->magick_columns);
4687 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4690 + if (LocaleCompare(attribute,"base-filename") == 0)
4692 + if (image != (Image *) NULL)
4693 + s=newSVpv(image->magick_filename,0);
4694 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4697 + if (LocaleCompare(attribute,"base-height") == 0)
4699 + if (image != (Image *) NULL)
4700 + s=newSViv((ssize_t) image->magick_rows);
4701 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4704 + if (LocaleCompare(attribute,"base-rows") == 0)
4706 + if (image != (Image *) NULL)
4707 + s=newSViv((ssize_t) image->magick_rows);
4708 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4711 + if (LocaleCompare(attribute,"base-width") == 0)
4713 + if (image != (Image *) NULL)
4714 + s=newSViv((ssize_t) image->magick_columns);
4715 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4718 + if (LocaleCompare(attribute,"bias") == 0)
4720 + if (image != (Image *) NULL)
4721 + s=newSVnv(image->bias);
4722 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4725 + if (LocaleCompare(attribute,"blue-primary") == 0)
4727 + if (image == (Image *) NULL)
4729 + (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
4730 + image->chromaticity.blue_primary.x,
4731 + image->chromaticity.blue_primary.y);
4732 + s=newSVpv(color,0);
4733 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4736 + if (LocaleCompare(attribute,"bordercolor") == 0)
4738 + if (image == (Image *) NULL)
4740 + (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
4741 + QuantumFormat "," QuantumFormat "," QuantumFormat,
4742 + image->border_color.red,image->border_color.green,
4743 + image->border_color.blue,image->border_color.opacity);
4744 + s=newSVpv(color,0);
4745 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4748 + if (LocaleCompare(attribute,"bounding-box") == 0)
4751 + geometry[MaxTextExtent];
4756 + if (image == (Image *) NULL)
4758 + page=GetImageBoundingBox(image,&image->exception);
4759 + (void) FormatLocaleString(geometry,MaxTextExtent,
4760 + "%.20gx%.20g%+.20g%+.20g",(double) page.width,(double)
4761 + page.height,(double) page.x,(double) page.y);
4762 + s=newSVpv(geometry,0);
4763 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4766 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4773 + if (LocaleCompare(attribute,"class") == 0)
4775 + if (image == (Image *) NULL)
4777 + s=newSViv(image->storage_class);
4778 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickClassOptions,
4779 + image->storage_class));
4781 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4784 + if (LocaleCompare(attribute,"clip-mask") == 0)
4786 + if (image != (Image *) NULL)
4792 + if (image->mask == (Image *) NULL)
4794 + if (image->mask != (Image *) NULL)
4796 + AddImageToRegistry(sv,image->mask);
4797 + s=sv_bless(newRV(sv),SvSTASH(reference));
4800 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4803 + if (LocaleCompare(attribute,"clip-path") == 0)
4805 + if (image != (Image *) NULL)
4811 + if (image->clip_mask == (Image *) NULL)
4813 + if (image->clip_mask != (Image *) NULL)
4815 + AddImageToRegistry(sv,image->clip_mask);
4816 + s=sv_bless(newRV(sv),SvSTASH(reference));
4819 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4822 + if (LocaleCompare(attribute,"compression") == 0)
4824 + j=info ? info->image_info->compression : image ?
4825 + image->compression : UndefinedCompression;
4827 + if (info->image_info->compression == UndefinedCompression)
4828 + j=image->compression;
4830 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickCompressOptions,
4833 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4836 + if (LocaleCompare(attribute,"colorspace") == 0)
4838 + j=image ? image->colorspace : RGBColorspace;
4840 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickColorspaceOptions,
4843 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4846 + if (LocaleCompare(attribute,"colors") == 0)
4848 + if (image != (Image *) NULL)
4849 + s=newSViv((ssize_t) GetNumberColors(image,(FILE *) NULL,
4850 + &image->exception));
4851 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4854 + if (LocaleNCompare(attribute,"colormap",8) == 0)
4859 + if (image == (Image *) NULL || !image->colormap)
4862 + items=sscanf(attribute,"%*[^[][%ld",&j);
4864 + if (j > (ssize_t) image->colors)
4866 + (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
4867 + QuantumFormat "," QuantumFormat "," QuantumFormat,
4868 + image->colormap[j].red,image->colormap[j].green,
4869 + image->colormap[j].blue,image->colormap[j].opacity);
4870 + s=newSVpv(color,0);
4871 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4874 + if (LocaleCompare(attribute,"columns") == 0)
4876 + if (image != (Image *) NULL)
4877 + s=newSViv((ssize_t) image->columns);
4878 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4881 + if (LocaleCompare(attribute,"comment") == 0)
4886 + value=GetImageProperty(image,attribute);
4887 + if (value != (const char *) NULL)
4888 + s=newSVpv(value,0);
4889 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4892 + if (LocaleCompare(attribute,"copyright") == 0)
4894 + s=newSVpv(GetMagickCopyright(),0);
4895 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4898 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4905 + if (LocaleCompare(attribute,"density") == 0)
4908 + geometry[MaxTextExtent];
4910 + if (image == (Image *) NULL)
4912 + (void) FormatLocaleString(geometry,MaxTextExtent,"%.15gx%.15g",
4913 + image->x_resolution,image->y_resolution);
4914 + s=newSVpv(geometry,0);
4915 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4918 + if (LocaleCompare(attribute,"delay") == 0)
4920 + if (image != (Image *) NULL)
4921 + s=newSViv((ssize_t) image->delay);
4922 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4925 + if (LocaleCompare(attribute,"depth") == 0)
4927 + s=newSViv(MAGICKCORE_QUANTUM_DEPTH);
4928 + if (image != (Image *) NULL)
4929 + s=newSViv((ssize_t) GetImageDepth(image,&image->exception));
4930 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4933 + if (LocaleCompare(attribute,"directory") == 0)
4935 + if (image && image->directory)
4936 + s=newSVpv(image->directory,0);
4937 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4940 + if (LocaleCompare(attribute,"dispose") == 0)
4942 + if (image == (Image *) NULL)
4945 + s=newSViv(image->dispose);
4946 + (void) sv_setpv(s,
4947 + CommandOptionToMnemonic(MagickDisposeOptions,image->dispose));
4949 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4952 + if (LocaleCompare(attribute,"disk") == 0)
4954 + s=newSViv(GetMagickResource(DiskResource));
4955 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4958 + if (LocaleCompare(attribute,"dither") == 0)
4961 + s=newSViv((ssize_t) info->image_info->dither);
4962 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4965 + if (LocaleCompare(attribute,"display") == 0) /* same as server */
4967 + if (info && info->image_info->server_name)
4968 + s=newSVpv(info->image_info->server_name,0);
4969 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4972 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
4979 + if (LocaleCompare(attribute,"elapsed-time") == 0)
4981 + if (image != (Image *) NULL)
4982 + s=newSVnv(GetElapsedTime(&image->timer));
4983 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4986 + if (LocaleCompare(attribute,"endian") == 0)
4988 + j=info ? info->image_info->endian : image ? image->endian :
4991 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickEndianOptions,j));
4993 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
4996 + if (LocaleCompare(attribute,"error") == 0)
4998 + if (image != (Image *) NULL)
4999 + s=newSVnv(image->error.mean_error_per_pixel);
5000 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5003 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5010 + if (LocaleCompare(attribute,"filesize") == 0)
5012 + if (image != (Image *) NULL)
5013 + s=newSViv((ssize_t) GetBlobSize(image));
5014 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5017 + if (LocaleCompare(attribute,"filename") == 0)
5019 + if (info && info->image_info->filename &&
5020 + *info->image_info->filename)
5021 + s=newSVpv(info->image_info->filename,0);
5022 + if (image != (Image *) NULL)
5023 + s=newSVpv(image->filename,0);
5024 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5027 + if (LocaleCompare(attribute,"filter") == 0)
5029 + s=image ? newSViv(image->filter) : newSViv(0);
5030 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickFilterOptions,
5033 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5036 + if (LocaleCompare(attribute,"font") == 0)
5038 + if (info && info->image_info->font)
5039 + s=newSVpv(info->image_info->font,0);
5040 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5043 + if (LocaleCompare(attribute,"foreground") == 0)
5045 + if (LocaleCompare(attribute,"format") == 0)
5050 + magick_info=(const MagickInfo *) NULL;
5051 + if (info && (*info->image_info->magick != '\0'))
5052 + magick_info=GetMagickInfo(info->image_info->magick,exception);
5053 + if (image != (Image *) NULL)
5054 + magick_info=GetMagickInfo(image->magick,&image->exception);
5055 + if ((magick_info != (const MagickInfo *) NULL) &&
5056 + (*magick_info->description != '\0'))
5057 + s=newSVpv((char *) magick_info->description,0);
5058 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5061 + if (LocaleCompare(attribute,"fuzz") == 0)
5064 + s=newSVnv(info->image_info->fuzz);
5065 + if (image != (Image *) NULL)
5066 + s=newSVnv(image->fuzz);
5067 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5070 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5077 + if (LocaleCompare(attribute,"gamma") == 0)
5079 + if (image != (Image *) NULL)
5080 + s=newSVnv(image->gamma);
5081 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5084 + if (LocaleCompare(attribute,"geometry") == 0)
5086 + if (image && image->geometry)
5087 + s=newSVpv(image->geometry,0);
5088 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5091 + if (LocaleCompare(attribute,"gravity") == 0)
5093 + s=image ? newSViv(image->gravity) : newSViv(0);
5094 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickGravityOptions,
5097 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5100 + if (LocaleCompare(attribute,"green-primary") == 0)
5102 + if (image == (Image *) NULL)
5104 + (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
5105 + image->chromaticity.green_primary.x,
5106 + image->chromaticity.green_primary.y);
5107 + s=newSVpv(color,0);
5108 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5111 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5118 + if (LocaleCompare(attribute,"height") == 0)
5120 + if (image != (Image *) NULL)
5121 + s=newSViv((ssize_t) image->rows);
5122 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5125 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5132 + if (LocaleCompare(attribute,"icc") == 0)
5134 + if (image != (Image *) NULL)
5139 + profile=GetImageProfile(image,"icc");
5140 + if (profile != (StringInfo *) NULL)
5141 + s=newSVpv((const char *) GetStringInfoDatum(profile),
5142 + GetStringInfoLength(profile));
5144 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5147 + if (LocaleCompare(attribute,"icm") == 0)
5149 + if (image != (Image *) NULL)
5154 + profile=GetImageProfile(image,"icm");
5155 + if (profile != (const StringInfo *) NULL)
5156 + s=newSVpv((const char *) GetStringInfoDatum(profile),
5157 + GetStringInfoLength(profile));
5159 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5162 + if (LocaleCompare(attribute,"id") == 0)
5164 + if (image != (Image *) NULL)
5167 + key[MaxTextExtent];
5175 + (void) FormatLocaleString(key,MaxTextExtent,"%.20g\n",(double)
5177 + status=SetImageRegistry(ImageRegistryType,key,image,
5178 + &image->exception);
5182 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5185 + if (LocaleNCompare(attribute,"index",5) == 0)
5188 + name[MaxTextExtent];
5197 + register const IndexPacket
5200 + register const PixelPacket
5206 + if (image == (Image *) NULL)
5208 + if (image->storage_class != PseudoClass)
5212 + items=sscanf(attribute,"%*[^[][%ld%*[,/]%ld",&x,&y);
5214 + image_view=AcquireVirtualCacheView(image,exception);
5215 + p=GetCacheViewVirtualPixels(image_view,x,y,1,1,&image->exception);
5216 + if (p != (const PixelPacket *) NULL)
5218 + indexes=GetCacheViewVirtualIndexQueue(image_view);
5219 + (void) FormatLocaleString(name,MaxTextExtent,QuantumFormat,
5220 + GetPixelIndex(indexes));
5221 + s=newSVpv(name,0);
5222 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5224 + image_view=DestroyCacheView(image_view);
5227 + if (LocaleCompare(attribute,"iptc") == 0)
5229 + if (image != (Image *) NULL)
5234 + profile=GetImageProfile(image,"iptc");
5235 + if (profile != (const StringInfo *) NULL)
5236 + s=newSVpv((const char *) GetStringInfoDatum(profile),
5237 + GetStringInfoLength(profile));
5239 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5242 + if (LocaleCompare(attribute,"iterations") == 0) /* same as loop */
5244 + if (image != (Image *) NULL)
5245 + s=newSViv((ssize_t) image->iterations);
5246 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5249 + if (LocaleCompare(attribute,"interlace") == 0)
5251 + j=info ? info->image_info->interlace : image ? image->interlace :
5252 + UndefinedInterlace;
5254 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickInterlaceOptions,
5257 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5260 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5267 + if (LocaleCompare(attribute,"label") == 0)
5272 + if (image == (Image *) NULL)
5274 + value=GetImageProperty(image,"Label");
5275 + if (value != (const char *) NULL)
5276 + s=newSVpv(value,0);
5277 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5280 + if (LocaleCompare(attribute,"loop") == 0) /* same as iterations */
5282 + if (image != (Image *) NULL)
5283 + s=newSViv((ssize_t) image->iterations);
5284 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5287 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5294 + if (LocaleCompare(attribute,"magick") == 0)
5296 + if (info && *info->image_info->magick)
5297 + s=newSVpv(info->image_info->magick,0);
5298 + if (image != (Image *) NULL)
5299 + s=newSVpv(image->magick,0);
5300 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5303 + if (LocaleCompare(attribute,"map") == 0)
5305 + s=newSViv(GetMagickResource(MapResource));
5306 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5309 + if (LocaleCompare(attribute,"maximum-error") == 0)
5311 + if (image != (Image *) NULL)
5312 + s=newSVnv(image->error.normalized_maximum_error);
5313 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5316 + if (LocaleCompare(attribute,"memory") == 0)
5318 + s=newSViv(GetMagickResource(MemoryResource));
5319 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5322 + if (LocaleCompare(attribute,"mean-error") == 0)
5324 + if (image != (Image *) NULL)
5325 + s=newSVnv(image->error.normalized_mean_error);
5326 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5329 + if (LocaleCompare(attribute,"mime") == 0)
5331 + if (info && *info->image_info->magick)
5332 + s=newSVpv(MagickToMime(info->image_info->magick),0);
5333 + if (image != (Image *) NULL)
5334 + s=newSVpv(MagickToMime(image->magick),0);
5335 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5338 + if (LocaleCompare(attribute,"mattecolor") == 0)
5340 + if (image == (Image *) NULL)
5342 + (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
5343 + QuantumFormat "," QuantumFormat "," QuantumFormat,
5344 + image->matte_color.red,image->matte_color.green,
5345 + image->matte_color.blue,image->matte_color.opacity);
5346 + s=newSVpv(color,0);
5347 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5350 + if (LocaleCompare(attribute,"matte") == 0)
5352 + if (image != (Image *) NULL)
5353 + s=newSViv((ssize_t) image->matte);
5354 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5357 + if (LocaleCompare(attribute,"mime") == 0)
5363 + if (info && *info->image_info->magick)
5364 + magick=info->image_info->magick;
5365 + if (image != (Image *) NULL)
5366 + magick=image->magick;
5372 + mime=MagickToMime(magick);
5373 + s=newSVpv(mime,0);
5374 + mime=(char *) RelinquishMagickMemory(mime);
5376 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5379 + if (LocaleCompare(attribute,"monochrome") == 0)
5381 + if (image == (Image *) NULL)
5383 + j=info ? info->image_info->monochrome :
5384 + IsMonochromeImage(image,&image->exception);
5386 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5389 + if (LocaleCompare(attribute,"montage") == 0)
5391 + if (image && image->montage)
5392 + s=newSVpv(image->montage,0);
5393 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5396 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5403 + if (LocaleCompare(attribute,"orientation") == 0)
5405 + j=info ? info->image_info->orientation : image ?
5406 + image->orientation : UndefinedOrientation;
5408 + (void) sv_setpv(s,CommandOptionToMnemonic(
5409 + MagickOrientationOptions,j));
5411 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5414 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5421 + if (LocaleCompare(attribute,"page") == 0)
5423 + if (info && info->image_info->page)
5424 + s=newSVpv(info->image_info->page,0);
5425 + if (image != (Image *) NULL)
5428 + geometry[MaxTextExtent];
5430 + (void) FormatLocaleString(geometry,MaxTextExtent,
5431 + "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,
5432 + (double) image->page.height,(double) image->page.x,(double)
5434 + s=newSVpv(geometry,0);
5436 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5439 + if (LocaleCompare(attribute,"page.x") == 0)
5441 + if (image != (Image *) NULL)
5442 + s=newSViv((ssize_t) image->page.x);
5443 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5446 + if (LocaleCompare(attribute,"page.y") == 0)
5448 + if (image != (Image *) NULL)
5449 + s=newSViv((ssize_t) image->page.y);
5450 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5453 + if (LocaleNCompare(attribute,"pixel",5) == 0)
5456 + tuple[MaxTextExtent];
5465 + register const PixelPacket
5468 + register const IndexPacket
5471 + if (image == (Image *) NULL)
5475 + items=sscanf(attribute,"%*[^[][%ld%*[,/]%ld",&x,&y);
5477 + p=GetVirtualPixels(image,x,y,1,1,exception);
5478 + indexes=GetVirtualIndexQueue(image);
5479 + if (image->colorspace != CMYKColorspace)
5480 + (void) FormatLocaleString(tuple,MaxTextExtent,QuantumFormat ","
5481 + QuantumFormat "," QuantumFormat "," QuantumFormat,
5482 + GetPixelRed(p),GetPixelGreen(p),
5483 + GetPixelBlue(p),GetPixelOpacity(p));
5485 + (void) FormatLocaleString(tuple,MaxTextExtent,QuantumFormat ","
5486 + QuantumFormat "," QuantumFormat "," QuantumFormat ","
5487 + QuantumFormat,GetPixelRed(p),
5488 + GetPixelGreen(p),GetPixelBlue(p),
5489 + GetPixelIndex(indexes),GetPixelOpacity(p));
5490 + s=newSVpv(tuple,0);
5491 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5494 + if (LocaleCompare(attribute,"pointsize") == 0)
5497 + s=newSViv((ssize_t) info->image_info->pointsize);
5498 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5501 + if (LocaleCompare(attribute,"preview") == 0)
5503 + s=newSViv(info->image_info->preview_type);
5504 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickPreviewOptions,
5505 + info->image_info->preview_type));
5507 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5510 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5517 + if (LocaleCompare(attribute,"quality") == 0)
5520 + s=newSViv((ssize_t) info->image_info->quality);
5521 + if (image != (Image *) NULL)
5522 + s=newSViv((ssize_t) image->quality);
5523 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5526 + if (LocaleCompare(attribute,"quantum") == 0)
5529 + s=newSViv((ssize_t) MAGICKCORE_QUANTUM_DEPTH);
5530 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5533 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5540 + if (LocaleCompare(attribute,"rendering-intent") == 0)
5542 + s=newSViv(image->rendering_intent);
5543 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickIntentOptions,
5544 + image->rendering_intent));
5546 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5549 + if (LocaleCompare(attribute,"red-primary") == 0)
5551 + if (image == (Image *) NULL)
5553 + (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
5554 + image->chromaticity.red_primary.x,
5555 + image->chromaticity.red_primary.y);
5556 + s=newSVpv(color,0);
5557 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5560 + if (LocaleCompare(attribute,"rows") == 0)
5562 + if (image != (Image *) NULL)
5563 + s=newSViv((ssize_t) image->rows);
5564 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5567 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5574 + if (LocaleCompare(attribute,"sampling-factor") == 0)
5576 + if (info && info->image_info->sampling_factor)
5577 + s=newSVpv(info->image_info->sampling_factor,0);
5578 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5581 + if (LocaleCompare(attribute,"subimage") == 0)
5584 + s=newSViv((ssize_t) info->image_info->subimage);
5585 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5588 + if (LocaleCompare(attribute,"subrange") == 0)
5591 + s=newSViv((ssize_t) info->image_info->subrange);
5592 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5595 + if (LocaleCompare(attribute,"server") == 0) /* same as display */
5597 + if (info && info->image_info->server_name)
5598 + s=newSVpv(info->image_info->server_name,0);
5599 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5602 + if (LocaleCompare(attribute,"size") == 0)
5604 + if (info && info->image_info->size)
5605 + s=newSVpv(info->image_info->size,0);
5606 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5609 + if (LocaleCompare(attribute,"scene") == 0)
5611 + if (image != (Image *) NULL)
5612 + s=newSViv((ssize_t) image->scene);
5613 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5616 + if (LocaleCompare(attribute,"scenes") == 0)
5618 + if (image != (Image *) NULL)
5619 + s=newSViv((ssize_t) info->image_info->number_scenes);
5620 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5623 + if (LocaleCompare(attribute,"signature") == 0)
5628 + if (image == (Image *) NULL)
5630 + (void) SignatureImage(image);
5631 + value=GetImageProperty(image,"Signature");
5632 + if (value != (const char *) NULL)
5633 + s=newSVpv(value,0);
5634 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5637 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5644 + if (LocaleCompare(attribute,"taint") == 0)
5646 + if (image != (Image *) NULL)
5647 + s=newSViv((ssize_t) IsTaintImage(image));
5648 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5651 + if (LocaleCompare(attribute,"tile") == 0)
5653 + if (info && info->image_info->tile)
5654 + s=newSVpv(info->image_info->tile,0);
5655 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5658 + if (LocaleCompare(attribute,"texture") == 0)
5660 + if (info && info->image_info->texture)
5661 + s=newSVpv(info->image_info->texture,0);
5662 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5665 + if (LocaleCompare(attribute,"total-ink-density") == 0)
5667 + s=newSViv(MAGICKCORE_QUANTUM_DEPTH);
5668 + if (image != (Image *) NULL)
5669 + s=newSVnv(GetImageTotalInkDensity(image));
5670 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5673 + if (LocaleCompare(attribute,"transparent-color") == 0)
5675 + if (image == (Image *) NULL)
5677 + (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
5678 + QuantumFormat "," QuantumFormat "," QuantumFormat,
5679 + image->transparent_color.red,image->transparent_color.green,
5680 + image->transparent_color.blue,image->transparent_color.opacity);
5681 + s=newSVpv(color,0);
5682 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5685 + if (LocaleCompare(attribute,"type") == 0)
5687 + if (image == (Image *) NULL)
5689 + j=(ssize_t) GetImageType(image,&image->exception);
5691 + (void) sv_setpv(s,CommandOptionToMnemonic(MagickTypeOptions,j));
5693 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5696 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5703 + if (LocaleCompare(attribute,"units") == 0)
5705 + j=info ? info->image_info->units : image ? image->units :
5706 + UndefinedResolution;
5707 + if (info && (info->image_info->units == UndefinedResolution))
5710 + if (j == UndefinedResolution)
5711 + s=newSVpv("undefined units",0);
5713 + if (j == PixelsPerInchResolution)
5714 + s=newSVpv("pixels / inch",0);
5716 + s=newSVpv("pixels / centimeter",0);
5717 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5720 + if (LocaleCompare(attribute,"user-time") == 0)
5722 + if (image != (Image *) NULL)
5723 + s=newSVnv(GetUserTime(&image->timer));
5724 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5727 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5734 + if (LocaleCompare(attribute,"verbose") == 0)
5737 + s=newSViv((ssize_t) info->image_info->verbose);
5738 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5741 + if (LocaleCompare(attribute,"version") == 0)
5743 + s=newSVpv(GetMagickVersion((size_t *) NULL),0);
5744 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5747 + if (LocaleCompare(attribute,"view") == 0)
5749 + if (info && info->image_info->view)
5750 + s=newSVpv(info->image_info->view,0);
5751 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5754 + if (LocaleCompare(attribute,"virtual-pixel") == 0)
5756 + if (image == (Image *) NULL)
5758 + j=(ssize_t) GetImageVirtualPixelMethod(image);
5760 + (void) sv_setpv(s,CommandOptionToMnemonic(
5761 + MagickVirtualPixelOptions,j));
5763 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5766 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5773 + if (LocaleCompare(attribute,"white-point") == 0)
5775 + if (image == (Image *) NULL)
5777 + (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
5778 + image->chromaticity.white_point.x,
5779 + image->chromaticity.white_point.y);
5780 + s=newSVpv(color,0);
5781 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5784 + if (LocaleCompare(attribute,"width") == 0)
5786 + if (image != (Image *) NULL)
5787 + s=newSViv((ssize_t) image->columns);
5788 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5791 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5798 + if (LocaleCompare(attribute,"xmp") == 0)
5800 + if (image != (Image *) NULL)
5805 + profile=GetImageProfile(image,"xmp");
5806 + if (profile != (StringInfo *) NULL)
5807 + s=newSVpv((const char *) GetStringInfoDatum(profile),
5808 + GetStringInfoLength(profile));
5810 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5813 + if (LocaleCompare(attribute,"x-resolution") == 0)
5815 + if (image != (Image *) NULL)
5816 + s=newSVnv(image->x_resolution);
5817 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5820 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5827 + if (LocaleCompare(attribute,"y-resolution") == 0)
5829 + if (image != (Image *) NULL)
5830 + s=newSVnv(image->y_resolution);
5831 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5834 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5841 + if (image == (Image *) NULL)
5842 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5846 + value=GetImageProperty(image,attribute);
5847 + if (value != (const char *) NULL)
5849 + s=newSVpv(value,0);
5850 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5853 + if (*attribute != '%')
5854 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5861 + meta=InterpretImageProperties(info ? info->image_info :
5862 + (ImageInfo *) NULL,image,attribute);
5863 + s=newSVpv(meta,0);
5864 + PUSHs(s ? sv_2mortal(s) : &sv_undef);
5865 + meta=(char *) RelinquishMagickMemory(meta);
5869 + exception=DestroyExceptionInfo(exception);
5870 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
5874 +###############################################################################
5878 +# G e t A u t h e n t i c P i x e l s #
5882 +###############################################################################
5886 +GetAuthenticPixels(ref,...)
5887 + Image::Magick ref = NO_INIT
5889 + getauthenticpixels = 1
5890 + GetImagePixels = 2
5891 + getimagepixels = 3
5909 + struct PackageInfo
5919 + PERL_UNUSED_VAR(ref);
5920 + PERL_UNUSED_VAR(ix);
5921 + exception=AcquireExceptionInfo();
5922 + perl_exception=newSVpv("",0);
5923 + if (sv_isobject(ST(0)) == 0)
5925 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
5927 + goto PerlException;
5929 + reference=SvRV(ST(0));
5931 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
5932 + if (image == (Image *) NULL)
5934 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
5936 + goto PerlException;
5941 + region.width=image->columns;
5944 + (void) ParseAbsoluteGeometry(SvPV(ST(1),na),®ion);
5945 + for (i=2; i < items; i+=2)
5947 + attribute=(char *) SvPV(ST(i-1),na);
5948 + switch (*attribute)
5953 + if (LocaleCompare(attribute,"geometry") == 0)
5955 + (void) ParseAbsoluteGeometry(SvPV(ST(i),na),®ion);
5958 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
5965 + if (LocaleCompare(attribute,"height") == 0)
5967 + region.height=SvIV(ST(i));
5970 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
5977 + if (LocaleCompare(attribute,"x") == 0)
5979 + region.x=SvIV(ST(i));
5982 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
5989 + if (LocaleCompare(attribute,"y") == 0)
5991 + region.y=SvIV(ST(i));
5994 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
6001 + if (LocaleCompare(attribute,"width") == 0)
6003 + region.width=SvIV(ST(i));
6006 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
6012 + blob=(void *) GetAuthenticPixels(image,region.x,region.y,region.width,
6013 + region.height,exception);
6014 + if (blob != (void *) NULL)
6018 + InheritPerlException(exception,perl_exception);
6019 + exception=DestroyExceptionInfo(exception);
6020 + SvREFCNT_dec(perl_exception); /* throw away all errors */
6029 +###############################################################################
6033 +# G e t V i r t u a l P i x e l s #
6037 +###############################################################################
6041 +GetVirtualPixels(ref,...)
6042 + Image::Magick ref = NO_INIT
6044 + getvirtualpixels = 1
6045 + AcquireImagePixels = 2
6046 + acquireimagepixels = 3
6067 + struct PackageInfo
6074 + PERL_UNUSED_VAR(ref);
6075 + PERL_UNUSED_VAR(ix);
6076 + exception=AcquireExceptionInfo();
6077 + perl_exception=newSVpv("",0);
6078 + if (sv_isobject(ST(0)) == 0)
6080 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
6082 + goto PerlException;
6084 + reference=SvRV(ST(0));
6086 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
6087 + if (image == (Image *) NULL)
6089 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
6091 + goto PerlException;
6096 + region.width=image->columns;
6099 + (void) ParseAbsoluteGeometry(SvPV(ST(1),na),®ion);
6100 + for (i=2; i < items; i+=2)
6102 + attribute=(char *) SvPV(ST(i-1),na);
6103 + switch (*attribute)
6108 + if (LocaleCompare(attribute,"geometry") == 0)
6110 + (void) ParseAbsoluteGeometry(SvPV(ST(i),na),®ion);
6113 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6120 + if (LocaleCompare(attribute,"height") == 0)
6122 + region.height=SvIV(ST(i));
6125 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
6132 + if (LocaleCompare(attribute,"x") == 0)
6134 + region.x=SvIV(ST(i));
6137 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
6144 + if (LocaleCompare(attribute,"y") == 0)
6146 + region.y=SvIV(ST(i));
6149 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
6156 + if (LocaleCompare(attribute,"width") == 0)
6158 + region.width=SvIV(ST(i));
6161 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
6167 + blob=(const void *) GetVirtualPixels(image,region.x,region.y,region.width,
6168 + region.height,exception);
6169 + if (blob != (void *) NULL)
6173 + InheritPerlException(exception,perl_exception);
6174 + exception=DestroyExceptionInfo(exception);
6175 + SvREFCNT_dec(perl_exception); /* throw away all errors */
6178 + RETVAL = (void *) blob;
6184 +###############################################################################
6188 +# G e t A u t h e n t i c I n d e x Q u e u e #
6192 +###############################################################################
6196 +GetAuthenticIndexQueue(ref,...)
6197 + Image::Magick ref = NO_INIT
6199 + getauthenticindexqueue = 1
6210 + struct PackageInfo
6220 + PERL_UNUSED_VAR(ref);
6221 + PERL_UNUSED_VAR(ix);
6222 + exception=AcquireExceptionInfo();
6223 + perl_exception=newSVpv("",0);
6224 + if (sv_isobject(ST(0)) == 0)
6226 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
6228 + goto PerlException;
6230 + reference=SvRV(ST(0));
6232 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
6233 + if (image == (Image *) NULL)
6235 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
6237 + goto PerlException;
6240 + blob=(void *) GetAuthenticIndexQueue(image);
6241 + if (blob != (void *) NULL)
6245 + InheritPerlException(exception,perl_exception);
6246 + exception=DestroyExceptionInfo(exception);
6247 + SvREFCNT_dec(perl_exception); /* throw away all errors */
6256 +###############################################################################
6260 +# G e t V i r t u a l I n d e x Q u e u e #
6264 +###############################################################################
6268 +GetVirtualIndexQueue(ref,...)
6269 + Image::Magick ref = NO_INIT
6271 + getvirtualindexqueue = 1
6280 + struct PackageInfo
6290 + PERL_UNUSED_VAR(ref);
6291 + PERL_UNUSED_VAR(ix);
6292 + exception=AcquireExceptionInfo();
6293 + perl_exception=newSVpv("",0);
6294 + if (sv_isobject(ST(0)) == 0)
6296 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
6298 + goto PerlException;
6300 + reference=SvRV(ST(0));
6302 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
6303 + if (image == (Image *) NULL)
6305 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
6307 + goto PerlException;
6310 + blob=(void *) GetVirtualIndexQueue(image);
6311 + if (blob != (void *) NULL)
6315 + InheritPerlException(exception,perl_exception);
6316 + exception=DestroyExceptionInfo(exception);
6317 + SvREFCNT_dec(perl_exception); /* throw away all errors */
6326 +###############################################################################
6330 +# H i s t o g r a m #
6334 +###############################################################################
6339 + Image::Magick ref = NO_INIT
6341 + HistogramImage = 1
6343 + histogramimage = 3
6350 + message[MaxTextExtent];
6367 + struct PackageInfo
6377 + PERL_UNUSED_VAR(ref);
6378 + PERL_UNUSED_VAR(ix);
6379 + exception=AcquireExceptionInfo();
6380 + perl_exception=newSVpv("",0);
6382 + if (sv_isobject(ST(0)) == 0)
6384 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
6386 + goto PerlException;
6388 + reference=SvRV(ST(0));
6391 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
6392 + if (image == (Image *) NULL)
6394 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
6396 + goto PerlException;
6399 + for ( ; image; image=image->next)
6401 + histogram=GetImageHistogram(image,&number_colors,&image->exception);
6402 + if (histogram == (ColorPacket *) NULL)
6404 + count+=(ssize_t) number_colors;
6405 + EXTEND(sp,6*count);
6406 + for (i=0; i < (ssize_t) number_colors; i++)
6408 + (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
6409 + histogram[i].pixel.red);
6410 + PUSHs(sv_2mortal(newSVpv(message,0)));
6411 + (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
6412 + histogram[i].pixel.green);
6413 + PUSHs(sv_2mortal(newSVpv(message,0)));
6414 + (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
6415 + histogram[i].pixel.blue);
6416 + PUSHs(sv_2mortal(newSVpv(message,0)));
6417 + if (image->colorspace == CMYKColorspace)
6419 + (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
6420 + histogram[i].index);
6421 + PUSHs(sv_2mortal(newSVpv(message,0)));
6423 + (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
6424 + histogram[i].pixel.opacity);
6425 + PUSHs(sv_2mortal(newSVpv(message,0)));
6426 + (void) FormatLocaleString(message,MaxTextExtent,"%.20g",(double)
6427 + histogram[i].count);
6428 + PUSHs(sv_2mortal(newSVpv(message,0)));
6430 + histogram=(ColorPacket *) RelinquishMagickMemory(histogram);
6434 + InheritPerlException(exception,perl_exception);
6435 + exception=DestroyExceptionInfo(exception);
6436 + SvREFCNT_dec(perl_exception);
6440 +###############################################################################
6444 +# G e t P i x e l #
6448 +###############################################################################
6453 + Image::Magick ref = NO_INIT
6480 + register const IndexPacket
6483 + register const PixelPacket
6492 + struct PackageInfo
6497 + *reference; /* reference is the SV* of ref=SvIV(reference) */
6499 + PERL_UNUSED_VAR(ref);
6500 + PERL_UNUSED_VAR(ix);
6501 + exception=AcquireExceptionInfo();
6502 + perl_exception=newSVpv("",0);
6503 + reference=SvRV(ST(0));
6504 + av=(AV *) reference;
6505 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
6507 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
6508 + if (image == (Image *) NULL)
6510 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
6512 + goto PerlException;
6514 + channel=DefaultChannels;
6515 + normalize=MagickTrue;
6518 + region.width=image->columns;
6521 + (void) ParseAbsoluteGeometry(SvPV(ST(1),na),®ion);
6522 + for (i=2; i < items; i+=2)
6524 + attribute=(char *) SvPV(ST(i-1),na);
6525 + switch (*attribute)
6530 + if (LocaleCompare(attribute,"channel") == 0)
6535 + option=ParseChannelOption(SvPV(ST(i),na));
6538 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
6542 + channel=(ChannelType) option;
6545 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6552 + if (LocaleCompare(attribute,"geometry") == 0)
6554 + (void) ParseAbsoluteGeometry(SvPV(ST(i),na),®ion);
6557 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6564 + if (LocaleCompare(attribute,"normalize") == 0)
6566 + option=ParseCommandOption(MagickBooleanOptions,MagickFalse,
6570 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
6574 + normalize=option != 0 ? MagickTrue : MagickFalse;
6577 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6584 + if (LocaleCompare(attribute,"x") == 0)
6586 + region.x=SvIV(ST(i));
6589 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6596 + if (LocaleCompare(attribute,"y") == 0)
6598 + region.y=SvIV(ST(i));
6601 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6607 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6613 + p=GetVirtualPixels(image,region.x,region.y,1,1,exception);
6614 + if (p == (const PixelPacket *) NULL)
6621 + indexes=GetVirtualIndexQueue(image);
6623 + if (normalize != MagickFalse)
6624 + scale=1.0/QuantumRange;
6625 + if ((channel & RedChannel) != 0)
6626 + PUSHs(sv_2mortal(newSVnv(scale*GetPixelRed(p))));
6627 + if ((channel & GreenChannel) != 0)
6628 + PUSHs(sv_2mortal(newSVnv(scale*GetPixelGreen(p))));
6629 + if ((channel & BlueChannel) != 0)
6630 + PUSHs(sv_2mortal(newSVnv(scale*GetPixelBlue(p))));
6631 + if (((channel & IndexChannel) != 0) &&
6632 + (image->colorspace == CMYKColorspace))
6633 + PUSHs(sv_2mortal(newSVnv(scale*GetPixelIndex(indexes))));
6634 + if ((channel & OpacityChannel) != 0)
6635 + PUSHs(sv_2mortal(newSVnv(scale*GetPixelOpacity(p))));
6639 + InheritPerlException(exception,perl_exception);
6640 + exception=DestroyExceptionInfo(exception);
6641 + SvREFCNT_dec(perl_exception);
6645 +###############################################################################
6649 +# G e t P i x e l s #
6653 +###############################################################################
6658 + Image::Magick ref = NO_INIT
6692 + struct PackageInfo
6697 + *reference; /* reference is the SV* of ref=SvIV(reference) */
6699 + PERL_UNUSED_VAR(ref);
6700 + PERL_UNUSED_VAR(ix);
6701 + exception=AcquireExceptionInfo();
6702 + perl_exception=newSVpv("",0);
6703 + reference=SvRV(ST(0));
6704 + av=(AV *) reference;
6705 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
6707 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
6708 + if (image == (Image *) NULL)
6710 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
6712 + goto PerlException;
6715 + if (image->matte != MagickFalse)
6717 + if (image->colorspace == CMYKColorspace)
6720 + if (image->matte != MagickFalse)
6723 + normalize=MagickFalse;
6726 + region.width=image->columns;
6729 + (void) ParseAbsoluteGeometry(SvPV(ST(1),na),®ion);
6730 + for (i=2; i < items; i+=2)
6732 + attribute=(char *) SvPV(ST(i-1),na);
6733 + switch (*attribute)
6738 + if (LocaleCompare(attribute,"geometry") == 0)
6740 + (void) ParseAbsoluteGeometry(SvPV(ST(i),na),®ion);
6743 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6750 + if (LocaleCompare(attribute,"height") == 0)
6752 + region.height=SvIV(ST(i));
6755 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6762 + if (LocaleCompare(attribute,"map") == 0)
6764 + map=SvPV(ST(i),na);
6767 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6774 + if (LocaleCompare(attribute,"normalize") == 0)
6776 + option=ParseCommandOption(MagickBooleanOptions,MagickFalse,
6780 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
6784 + normalize=option != 0 ? MagickTrue : MagickFalse;
6787 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6794 + if (LocaleCompare(attribute,"width") == 0)
6796 + region.width=SvIV(ST(i));
6799 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6806 + if (LocaleCompare(attribute,"x") == 0)
6808 + region.x=SvIV(ST(i));
6811 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6818 + if (LocaleCompare(attribute,"y") == 0)
6820 + region.y=SvIV(ST(i));
6823 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6829 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
6835 + if (normalize != MagickFalse)
6840 + pixels=(float *) AcquireQuantumMemory(strlen(map)*region.width,
6841 + region.height*sizeof(*pixels));
6842 + if (pixels == (float *) NULL)
6844 + ThrowPerlException(exception,ResourceLimitError,
6845 + "MemoryAllocationFailed",PackageName);
6846 + goto PerlException;
6848 + status=ExportImagePixels(image,region.x,region.y,region.width,
6849 + region.height,map,FloatPixel,pixels,exception);
6850 + if (status == MagickFalse)
6854 + EXTEND(sp,strlen(map)*region.width*region.height);
6855 + for (i=0; i < (ssize_t) (strlen(map)*region.width*region.height); i++)
6856 + PUSHs(sv_2mortal(newSVnv(pixels[i])));
6858 + pixels=(float *) RelinquishMagickMemory(pixels);
6865 + pixels=(Quantum *) AcquireQuantumMemory(strlen(map)*region.width,
6866 + region.height*sizeof(*pixels));
6867 + if (pixels == (Quantum *) NULL)
6869 + ThrowPerlException(exception,ResourceLimitError,
6870 + "MemoryAllocationFailed",PackageName);
6871 + goto PerlException;
6873 + status=ExportImagePixels(image,region.x,region.y,region.width,
6874 + region.height,map,QuantumPixel,pixels,exception);
6875 + if (status == MagickFalse)
6879 + EXTEND(sp,strlen(map)*region.width*region.height);
6880 + for (i=0; i < (ssize_t) (strlen(map)*region.width*region.height); i++)
6881 + PUSHs(sv_2mortal(newSViv(pixels[i])));
6883 + pixels=(Quantum *) RelinquishMagickMemory(pixels);
6887 + InheritPerlException(exception,perl_exception);
6888 + exception=DestroyExceptionInfo(exception);
6889 + SvREFCNT_dec(perl_exception);
6893 +###############################################################################
6897 +# I m a g e T o B l o b #
6901 +###############################################################################
6905 +ImageToBlob(ref,...)
6906 + Image::Magick ref = NO_INIT
6915 + filename[MaxTextExtent];
6927 + struct PackageInfo
6944 + PERL_UNUSED_VAR(ref);
6945 + PERL_UNUSED_VAR(ix);
6946 + exception=AcquireExceptionInfo();
6947 + perl_exception=newSVpv("",0);
6948 + package_info=(struct PackageInfo *) NULL;
6949 + if (sv_isobject(ST(0)) == 0)
6951 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
6953 + goto PerlException;
6955 + reference=SvRV(ST(0));
6956 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
6957 + if (image == (Image *) NULL)
6959 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
6961 + goto PerlException;
6963 + package_info=ClonePackageInfo(info,exception);
6964 + for (i=2; i < items; i+=2)
6965 + SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),exception);
6966 + (void) CopyMagickString(filename,package_info->image_info->filename,
6969 + for (next=image; next; next=next->next)
6971 + (void) CopyMagickString(next->filename,filename,MaxTextExtent);
6972 + next->scene=scene++;
6974 + SetImageInfo(package_info->image_info,(unsigned int)
6975 + GetImageListLength(image),&image->exception);
6976 + EXTEND(sp,(ssize_t) GetImageListLength(image));
6977 + for ( ; image; image=image->next)
6980 + blob=ImagesToBlob(package_info->image_info,image,&length,exception);
6981 + if (blob != (char *) NULL)
6983 + PUSHs(sv_2mortal(newSVpv((const char *) blob,length)));
6984 + blob=(unsigned char *) RelinquishMagickMemory(blob);
6986 + if (package_info->image_info->adjoin)
6991 + if (package_info != (struct PackageInfo *) NULL)
6992 + DestroyPackageInfo(package_info);
6993 + InheritPerlException(exception,perl_exception);
6994 + exception=DestroyExceptionInfo(exception);
6995 + SvREFCNT_dec(perl_exception); /* throw away all errors */
6999 +###############################################################################
7007 +###############################################################################
7012 + Image::Magick ref = NO_INIT
7016 + OptimizeImageLayers = 3
7017 + optimizelayers = 4
7018 + optimizeimagelayers = 5
7050 + struct PackageInfo
7060 + PERL_UNUSED_VAR(ref);
7061 + PERL_UNUSED_VAR(ix);
7062 + exception=AcquireExceptionInfo();
7063 + perl_exception=newSVpv("",0);
7065 + if (sv_isobject(ST(0)) == 0)
7067 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
7069 + goto PerlException;
7071 + reference=SvRV(ST(0));
7072 + hv=SvSTASH(reference);
7074 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
7076 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
7077 + if (image == (Image *) NULL)
7079 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
7081 + goto PerlException;
7083 + compose=image->compose;
7084 + method=OptimizeLayer;
7085 + for (i=2; i < items; i+=2)
7087 + attribute=(char *) SvPV(ST(i-1),na);
7088 + switch (*attribute)
7093 + if (LocaleCompare(attribute,"compose") == 0)
7095 + sp=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
7096 + MagickComposeOptions,MagickFalse,SvPV(ST(i),na));
7099 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
7103 + compose=(CompositeOperator) sp;
7106 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
7113 + if (LocaleCompare(attribute,"method") == 0)
7115 + option=ParseCommandOption(MagickLayerOptions,MagickFalse,
7119 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
7123 + method=(ImageLayerMethod) option;
7126 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
7132 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
7138 + layers=(Image *) NULL;
7141 + case CompareAnyLayer:
7142 + case CompareClearLayer:
7143 + case CompareOverlayLayer:
7146 + layers=CompareImageLayers(image,method,exception);
7150 + case FlattenLayer:
7153 + layers=MergeImageLayers(image,method,exception);
7156 + case DisposeLayer:
7158 + layers=DisposeImages(image,exception);
7161 + case OptimizeImageLayer:
7163 + layers=OptimizeImageLayers(image,exception);
7166 + case OptimizePlusLayer:
7168 + layers=OptimizePlusImageLayers(image,exception);
7171 + case OptimizeTransLayer:
7173 + OptimizeImageTransparency(image,exception);
7174 + InheritException(&(image->exception),exception);
7177 + case RemoveDupsLayer:
7179 + RemoveDuplicateLayers(&image,exception);
7180 + InheritException(&(image->exception),exception);
7183 + case RemoveZeroLayer:
7185 + RemoveZeroDelayLayers(&image,exception);
7186 + InheritException(&(image->exception),exception);
7189 + case OptimizeLayer:
7195 + General Purpose, GIF Animation Optimizer.
7197 + layers=CoalesceImages(image,exception);
7198 + if (layers == (Image *) NULL)
7200 + InheritException(&(layers->exception),exception);
7202 + layers=OptimizeImageLayers(image,exception);
7203 + if (layers == (Image *) NULL)
7205 + InheritException(&(layers->exception),exception);
7206 + image=DestroyImageList(image);
7208 + layers=(Image *) NULL;
7209 + OptimizeImageTransparency(image,exception);
7210 + InheritException(&(image->exception),exception);
7211 + quantize_info=AcquireQuantizeInfo(info->image_info);
7212 + (void) RemapImages(quantize_info,image,(Image *) NULL);
7213 + quantize_info=DestroyQuantizeInfo(quantize_info);
7216 + case CompositeLayer:
7225 + Split image sequence at the first 'NULL:' image.
7228 + while (source != (Image *) NULL)
7230 + source=GetNextImageInList(source);
7231 + if ((source != (Image *) NULL) &&
7232 + (LocaleCompare(source->magick,"NULL") == 0))
7235 + if (source != (Image *) NULL)
7237 + if ((GetPreviousImageInList(source) == (Image *) NULL) ||
7238 + (GetNextImageInList(source) == (Image *) NULL))
7239 + source=(Image *) NULL;
7243 + Separate the two lists, junk the null: image.
7245 + source=SplitImageList(source->previous);
7246 + DeleteImageFromList(&source);
7249 + if (source == (Image *) NULL)
7251 + (void) ThrowMagickException(exception,GetMagickModule(),
7252 + OptionError,"MissingNullSeparator","layers Composite");
7256 + Adjust offset with gravity and virtual canvas.
7258 + SetGeometry(image,&geometry);
7259 + (void) ParseAbsoluteGeometry(image->geometry,&geometry);
7260 + geometry.width=source->page.width != 0 ? source->page.width :
7262 + geometry.height=source->page.height != 0 ? source->page.height :
7264 + GravityAdjustGeometry(image->page.width != 0 ? image->page.width :
7265 + image->columns,image->page.height != 0 ? image->page.height :
7266 + image->rows,image->gravity,&geometry);
7267 + CompositeLayers(image,compose,source,geometry.x,geometry.y,exception);
7268 + source=DestroyImageList(source);
7269 + InheritException(&(image->exception),exception);
7273 + if (layers == (Image *) NULL)
7274 + image=CloneImage(image,0,0,MagickTrue,exception);
7277 + InheritException(&(layers->exception),exception);
7280 + if (image == (Image *) NULL)
7281 + goto PerlException;
7282 + for ( ; image; image=image->next)
7284 + AddImageToRegistry(sv,image);
7286 + av_push(av,sv_bless(rv,hv));
7289 + exception=DestroyExceptionInfo(exception);
7290 + ST(0)=av_reference;
7291 + SvREFCNT_dec(perl_exception);
7295 + InheritPerlException(exception,perl_exception);
7296 + exception=DestroyExceptionInfo(exception);
7297 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
7298 + SvPOK_on(perl_exception);
7299 + ST(0)=sv_2mortal(perl_exception);
7304 +###############################################################################
7308 +# M a g i c k T o M i m e #
7312 +###############################################################################
7316 +MagickToMime(ref,name)
7317 + Image::Magick ref = NO_INIT
7326 + PERL_UNUSED_VAR(ref);
7327 + PERL_UNUSED_VAR(ix);
7328 + mime=MagickToMime(name);
7329 + RETVAL=newSVpv(mime,0);
7330 + mime=(char *) RelinquishMagickMemory(mime);
7336 +###############################################################################
7344 +###############################################################################
7349 + Image::Magick ref = NO_INIT
7368 + DespeckleImage = 18
7386 + MedianFilterImage = 36
7390 + OilPaintImage = 40
7392 + ReduceNoiseImage = 42
7416 + AnnotateImage = 66
7417 + ColorFloodfill = 67
7418 + ColorFloodfillImage= 68
7420 + CompositeImage = 70
7422 + ContrastImage = 72
7423 + CycleColormap = 73
7424 + CycleColormapImage = 74
7428 + EqualizeImage = 78
7433 + MatteFloodfill = 83
7434 + MatteFloodfillImage= 84
7436 + ModulateImage = 86
7440 + NormalizeImage = 90
7442 + NumberColorsImage = 92
7446 + QuantizeImage = 96
7450 + SegmentImage = 100
7452 + SignatureImage = 102
7454 + SolarizeImage = 104
7458 + TextureImage = 108
7460 + EvaluateImage = 110
7462 + TransparentImage = 112
7464 + ThresholdImage = 114
7466 + CharcoalImage = 116
7472 + SeparateImage = 122
7476 + SteganoImage = 128
7478 + DeconstructImage = 130
7479 + GaussianBlur = 131
7480 + GaussianBlurImage = 132
7482 + ConvolveImage = 134
7484 + ProfileImage = 136
7486 + UnsharpMaskImage = 138
7488 + MotionBlurImage = 140
7489 + OrderedDither = 141
7490 + OrderedDitherImage = 142
7497 + AffineTransform = 149
7498 + AffineTransformImage = 150
7500 + DifferenceImage = 152
7501 + AdaptiveThreshold = 153
7502 + AdaptiveThresholdImage = 154
7504 + ResampleImage = 156
7506 + DescribeImage = 158
7507 + BlackThreshold = 159
7508 + BlackThresholdImage= 160
7509 + WhiteThreshold = 161
7510 + WhiteThresholdImage= 162
7511 + RotationalBlur = 163
7512 + RotationalBlurImage= 164
7514 + ThumbnailImage = 166
7520 + ChannelImage = 172
7524 + PosterizeImage = 176
7528 + IdentifyImage = 180
7530 + SepiaToneImage = 182
7531 + SigmoidalContrast = 183
7532 + SigmoidalContrastImage = 184
7536 + VignetteImage = 188
7537 + ContrastStretch = 189
7538 + ContrastStretchImage = 190
7543 + AdaptiveSharpen = 195
7544 + AdaptiveSharpenImage = 196
7546 + TransposeImage = 198
7548 + TransverseImage = 200
7550 + AutoOrientImage = 202
7551 + AdaptiveBlur = 203
7552 + AdaptiveBlurImage = 204
7555 + UniqueColors = 207
7556 + UniqueColorsImage = 208
7557 + AdaptiveResize = 209
7558 + AdaptiveResizeImage= 210
7560 + ClipMaskImage = 212
7561 + LinearStretch = 213
7562 + LinearStretchImage = 214
7563 + RecolorImage = 215
7568 + PolaroidImage = 220
7569 + FloodfillPaint = 221
7570 + FloodfillPaintImage= 222
7572 + DistortImage = 224
7575 + LiquidRescale = 227
7576 + LiquidRescaleImage = 228
7578 + EncipherImage = 230
7580 + DecipherImage = 232
7586 + SparseColorImage = 238
7588 + FunctionImage = 240
7589 + SelectiveBlur = 241
7590 + SelectiveBlurImage = 242
7592 + HaldClutImage = 244
7594 + BlueShiftImage = 246
7595 + ForwardFourierTransform = 247
7596 + ForwardFourierTransformImage = 248
7597 + InverseFourierTransform = 249
7598 + InverseFourierTransformImage = 250
7599 + ColorDecisionList = 251
7600 + ColorDecisionListImage = 252
7602 + AutoGammaImage = 254
7604 + AutoLevelImage = 256
7606 + LevelColorsImage = 258
7611 + BrightnessContrast = 263
7612 + BrightnessContrastImage = 264
7614 + MorphologyImage = 266
7616 + ColorMatrixImage = 268
7622 + StatisticImage = 274
7624 + PerceptibleImage = 276
7628 + GrayscaleImage = 280
7630 + CannyEdgeImage = 282
7632 + HoughLineImage = 284
7634 + MeanShiftImage = 286
7636 + KuwaharaImage = 288
7637 + ConnectedComponent = 289
7638 + ConnectedComponentImage = 290
7640 + CopyPixelsImage = 292
7641 + WaveletDenoise = 293
7642 + WaveletDenoiseImage= 294
7643 + MogrifyRegion = 666
7651 + attribute_flag[MaxArguments],
7652 + message[MaxTextExtent];
7702 + struct PackageInfo
7709 + **reference_vector;
7711 + struct ArgumentList
7712 + argument_list[MaxArguments];
7714 + PERL_UNUSED_VAR(ref);
7715 + PERL_UNUSED_VAR(ix);
7716 + exception=AcquireExceptionInfo();
7717 + perl_exception=newSVpv("",0);
7718 + reference_vector=NULL;
7719 + region_image=NULL;
7722 + if (sv_isobject(ST(0)) == 0)
7724 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
7726 + goto PerlException;
7728 + reference=SvRV(ST(0));
7729 + region_info.width=0;
7730 + region_info.height=0;
7733 + region_image=(Image *) NULL;
7734 + image=SetupList(aTHX_ reference,&info,&reference_vector,exception);
7735 + if (ix && (ix != 666))
7738 + Called as Method(...)
7741 + rp=(&Methods[ix-1]);
7742 + attribute=rp->name;
7747 + Called as Mogrify("Method",...)
7749 + attribute=(char *) SvPV(ST(1),na);
7752 + flags=ParseGravityGeometry(image,attribute,®ion_info,exception);
7753 + attribute=(char *) SvPV(ST(2),na);
7756 + for (rp=Methods; ; rp++)
7758 + if (rp >= EndOf(Methods))
7760 + ThrowPerlException(exception,OptionError,
7761 + "UnrecognizedPerlMagickMethod",attribute);
7762 + goto PerlException;
7764 + if (strEQcase(attribute,rp->name))
7770 + if (image == (Image *) NULL)
7772 + ThrowPerlException(exception,OptionError,"NoImagesDefined",attribute);
7773 + goto PerlException;
7775 + Zero(&argument_list,NumberOf(argument_list),struct ArgumentList);
7776 + Zero(&attribute_flag,NumberOf(attribute_flag),char);
7777 + for (i=base; (i < items) || ((i == items) && (base == items)); i+=2)
7786 + struct ArgumentList
7794 + pp=(Arguments *) NULL;
7802 + for (sv=ST(i), attribute=(char *) SvPV(ST(i-1),na); ; qq++)
7804 + if ((qq >= EndOf(rp->arguments)) || (qq->method == NULL))
7806 + if (strEQcase(attribute,qq->method) > ssize_test)
7809 + ssize_test=strEQcase(attribute,qq->method);
7812 + if (pp == (Arguments *) NULL)
7814 + ThrowPerlException(exception,OptionError,"UnrecognizedOption",
7816 + goto continue_outer_loop;
7818 + al=(&argument_list[pp-rp->arguments]);
7821 + case ArrayReference:
7823 + if (SvTYPE(sv) != SVt_RV)
7825 + (void) FormatLocaleString(message,MaxTextExtent,
7826 + "invalid %.60s value",pp->method);
7827 + ThrowPerlException(exception,OptionError,message,SvPV(sv,na));
7828 + goto continue_outer_loop;
7830 + al->array_reference=SvRV(sv);
7833 + case RealReference:
7835 + al->real_reference=SvNV(sv);
7838 + case FileReference:
7840 + al->file_reference=(FILE *) PerlIO_findFILE(IoIFP(sv_2io(sv)));
7843 + case ImageReference:
7845 + if (!sv_isobject(sv) ||
7846 + !(al->image_reference=SetupList(aTHX_ SvRV(sv),
7847 + (struct PackageInfo **) NULL,(SV ***) NULL,exception)))
7849 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
7851 + goto PerlException;
7855 + case IntegerReference:
7857 + al->integer_reference=SvIV(sv);
7860 + case StringReference:
7862 + al->string_reference=(char *) SvPV(sv,al->length);
7863 + if (sv_isobject(sv))
7864 + al->image_reference=SetupList(aTHX_ SvRV(sv),
7865 + (struct PackageInfo **) NULL,(SV ***) NULL,exception);
7871 + Is a string; look up name.
7873 + if ((al->length > 1) && (*(char *) SvPV(sv,al->length) == '@'))
7875 + al->string_reference=(char *) SvPV(sv,al->length);
7876 + al->integer_reference=(-1);
7879 + al->integer_reference=ParseCommandOption((CommandOption) pp->type,
7880 + MagickFalse,SvPV(sv,na));
7881 + if (pp->type == MagickChannelOptions)
7882 + al->integer_reference=ParseChannelOption(SvPV(sv,na));
7883 + if ((al->integer_reference < 0) && ((al->integer_reference=SvIV(sv)) <= 0))
7885 + (void) FormatLocaleString(message,MaxTextExtent,
7886 + "invalid %.60s value",pp->method);
7887 + ThrowPerlException(exception,OptionError,message,SvPV(sv,na));
7888 + goto continue_outer_loop;
7893 + attribute_flag[pp-rp->arguments]++;
7894 + continue_outer_loop: ;
7896 + (void) ResetMagickMemory((char *) &fill_color,0,sizeof(fill_color));
7897 + pv=reference_vector;
7898 + SetGeometryInfo(&geometry_info);
7899 + channel=DefaultChannels;
7900 + for (next=image; next; next=next->next)
7903 + SetGeometry(image,&geometry);
7904 + if ((region_info.width*region_info.height) != 0)
7906 + region_image=image;
7907 + image=CropImage(image,®ion_info,exception);
7913 + (void) FormatLocaleString(message,MaxTextExtent,"%.20g",(double) ix);
7914 + ThrowPerlException(exception,OptionError,
7915 + "UnrecognizedPerlMagickMethod",message);
7916 + goto PerlException;
7918 + case 1: /* Comment */
7920 + if (attribute_flag[0] == 0)
7921 + argument_list[0].string_reference=(char *) NULL;
7922 + (void) SetImageProperty(image,"comment",InterpretImageProperties(
7923 + info ? info->image_info : (ImageInfo *) NULL,image,
7924 + argument_list[0].string_reference));
7927 + case 2: /* Label */
7929 + if (attribute_flag[0] == 0)
7930 + argument_list[0].string_reference=(char *) NULL;
7931 + (void) SetImageProperty(image,"label",InterpretImageProperties(
7932 + info ? info->image_info : (ImageInfo *) NULL,image,
7933 + argument_list[0].string_reference));
7936 + case 3: /* AddNoise */
7938 + if (attribute_flag[0] == 0)
7939 + argument_list[0].integer_reference=UniformNoise;
7940 + if (attribute_flag[1] != 0)
7941 + channel=(ChannelType) argument_list[1].integer_reference;
7942 + image=AddNoiseImageChannel(image,channel,(NoiseType)
7943 + argument_list[0].integer_reference,exception);
7946 + case 4: /* Colorize */
7951 + (void) GetOneVirtualPixel(image,0,0,&target,exception);
7952 + if (attribute_flag[0] != 0)
7953 + (void) QueryColorDatabase(argument_list[0].string_reference,&target,
7955 + if (attribute_flag[1] == 0)
7956 + argument_list[1].string_reference="100%";
7957 + image=ColorizeImage(image,argument_list[1].string_reference,target,
7961 + case 5: /* Border */
7964 + geometry.height=0;
7965 + if (attribute_flag[0] != 0)
7966 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
7967 + &geometry,exception);
7968 + if (attribute_flag[1] != 0)
7969 + geometry.width=argument_list[1].integer_reference;
7970 + if (attribute_flag[2] != 0)
7971 + geometry.height=argument_list[2].integer_reference;
7972 + if (attribute_flag[3] != 0)
7973 + QueryColorDatabase(argument_list[3].string_reference,
7974 + &image->border_color,exception);
7975 + if (attribute_flag[4] != 0)
7976 + QueryColorDatabase(argument_list[4].string_reference,
7977 + &image->border_color,exception);
7978 + if (attribute_flag[5] != 0)
7979 + QueryColorDatabase(argument_list[5].string_reference,
7980 + &image->border_color,exception);
7981 + if (attribute_flag[6] != 0)
7982 + image->compose=(CompositeOperator)
7983 + argument_list[6].integer_reference;
7984 + image=BorderImage(image,&geometry,exception);
7987 + case 6: /* Blur */
7989 + if (attribute_flag[0] != 0)
7991 + flags=ParseGeometry(argument_list[0].string_reference,
7993 + if ((flags & SigmaValue) == 0)
7994 + geometry_info.sigma=1.0;
7996 + if (attribute_flag[1] != 0)
7997 + geometry_info.rho=argument_list[1].real_reference;
7998 + if (attribute_flag[2] != 0)
7999 + geometry_info.sigma=argument_list[2].real_reference;
8000 + if (attribute_flag[3] != 0)
8001 + channel=(ChannelType) argument_list[3].integer_reference;
8002 + image=BlurImageChannel(image,channel,geometry_info.rho,
8003 + geometry_info.sigma,exception);
8006 + case 7: /* Chop */
8008 + if (attribute_flag[5] != 0)
8009 + image->gravity=(GravityType) argument_list[5].integer_reference;
8010 + if (attribute_flag[0] != 0)
8011 + flags=ParseGravityGeometry(image,argument_list[0].string_reference,
8012 + &geometry,exception);
8013 + if (attribute_flag[1] != 0)
8014 + geometry.width=argument_list[1].integer_reference;
8015 + if (attribute_flag[2] != 0)
8016 + geometry.height=argument_list[2].integer_reference;
8017 + if (attribute_flag[3] != 0)
8018 + geometry.x=argument_list[3].integer_reference;
8019 + if (attribute_flag[4] != 0)
8020 + geometry.y=argument_list[4].integer_reference;
8021 + image=ChopImage(image,&geometry,exception);
8024 + case 8: /* Crop */
8026 + if (attribute_flag[6] != 0)
8027 + image->gravity=(GravityType) argument_list[6].integer_reference;
8028 + if (attribute_flag[0] != 0)
8029 + flags=ParseGravityGeometry(image,argument_list[0].string_reference,
8030 + &geometry,exception);
8031 + if (attribute_flag[1] != 0)
8032 + geometry.width=argument_list[1].integer_reference;
8033 + if (attribute_flag[2] != 0)
8034 + geometry.height=argument_list[2].integer_reference;
8035 + if (attribute_flag[3] != 0)
8036 + geometry.x=argument_list[3].integer_reference;
8037 + if (attribute_flag[4] != 0)
8038 + geometry.y=argument_list[4].integer_reference;
8039 + if (attribute_flag[5] != 0)
8040 + image->fuzz=StringToDoubleInterval(
8041 + argument_list[5].string_reference,(double) QuantumRange+1.0);
8042 + image=CropImage(image,&geometry,exception);
8045 + case 9: /* Despeckle */
8047 + image=DespeckleImage(image,exception);
8050 + case 10: /* Edge */
8052 + if (attribute_flag[0] != 0)
8053 + geometry_info.rho=argument_list[0].real_reference;
8054 + image=EdgeImage(image,geometry_info.rho,exception);
8057 + case 11: /* Emboss */
8059 + if (attribute_flag[0] != 0)
8061 + flags=ParseGeometry(argument_list[0].string_reference,
8063 + if ((flags & SigmaValue) == 0)
8064 + geometry_info.sigma=1.0;
8066 + if (attribute_flag[1] != 0)
8067 + geometry_info.rho=argument_list[1].real_reference;
8068 + if (attribute_flag[2] != 0)
8069 + geometry_info.sigma=argument_list[2].real_reference;
8070 + image=EmbossImage(image,geometry_info.rho,geometry_info.sigma,
8074 + case 12: /* Enhance */
8076 + image=EnhanceImage(image,exception);
8079 + case 13: /* Flip */
8081 + image=FlipImage(image,exception);
8084 + case 14: /* Flop */
8086 + image=FlopImage(image,exception);
8089 + case 15: /* Frame */
8094 + if (attribute_flag[0] != 0)
8096 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
8097 + &geometry,exception);
8098 + frame_info.width=geometry.width;
8099 + frame_info.height=geometry.height;
8100 + frame_info.outer_bevel=geometry.x;
8101 + frame_info.inner_bevel=geometry.y;
8103 + if (attribute_flag[1] != 0)
8104 + frame_info.width=argument_list[1].integer_reference;
8105 + if (attribute_flag[2] != 0)
8106 + frame_info.height=argument_list[2].integer_reference;
8107 + if (attribute_flag[3] != 0)
8108 + frame_info.inner_bevel=argument_list[3].integer_reference;
8109 + if (attribute_flag[4] != 0)
8110 + frame_info.outer_bevel=argument_list[4].integer_reference;
8111 + if (attribute_flag[5] != 0)
8112 + QueryColorDatabase(argument_list[5].string_reference,&fill_color,
8114 + if (attribute_flag[6] != 0)
8115 + QueryColorDatabase(argument_list[6].string_reference,&fill_color,
8117 + frame_info.x=(ssize_t) frame_info.width;
8118 + frame_info.y=(ssize_t) frame_info.height;
8119 + frame_info.width=image->columns+2*frame_info.x;
8120 + frame_info.height=image->rows+2*frame_info.y;
8121 + if ((attribute_flag[5] != 0) || (attribute_flag[6] != 0))
8122 + image->matte_color=fill_color;
8123 + if (attribute_flag[7] != 0)
8124 + image->compose=(CompositeOperator)
8125 + argument_list[7].integer_reference;
8126 + image=FrameImage(image,&frame_info,exception);
8129 + case 16: /* Implode */
8131 + if (attribute_flag[0] == 0)
8132 + argument_list[0].real_reference=0.5;
8133 + if (attribute_flag[1] != 0)
8134 + image->interpolate=(InterpolatePixelMethod)
8135 + argument_list[1].integer_reference;
8136 + image=ImplodeImage(image,argument_list[0].real_reference,
8140 + case 17: /* Magnify */
8142 + image=MagnifyImage(image,exception);
8145 + case 18: /* MedianFilter */
8147 + if (attribute_flag[0] != 0)
8149 + flags=ParseGeometry(argument_list[0].string_reference,
8151 + if ((flags & SigmaValue) == 0)
8152 + geometry_info.sigma=1.0;
8154 + if (attribute_flag[1] != 0)
8155 + geometry_info.rho=argument_list[1].real_reference;
8156 + if (attribute_flag[2] != 0)
8157 + geometry_info.sigma=argument_list[2].real_reference;
8158 + if (attribute_flag[3] != 0)
8159 + channel=(ChannelType) argument_list[3].integer_reference;
8160 + image=StatisticImageChannel(image,channel,MedianStatistic,
8161 + (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
8164 + case 19: /* Minify */
8166 + image=MinifyImage(image,exception);
8169 + case 20: /* OilPaint */
8171 + if (attribute_flag[0] == 0)
8172 + argument_list[0].real_reference=0.0;
8173 + image=OilPaintImage(image,argument_list[0].real_reference,
8177 + case 21: /* ReduceNoise */
8179 + if (attribute_flag[0] != 0)
8181 + flags=ParseGeometry(argument_list[0].string_reference,
8183 + if ((flags & SigmaValue) == 0)
8184 + geometry_info.sigma=1.0;
8186 + if (attribute_flag[1] != 0)
8187 + geometry_info.rho=argument_list[1].real_reference;
8188 + if (attribute_flag[2] != 0)
8189 + geometry_info.sigma=argument_list[2].real_reference;
8190 + if (attribute_flag[3] != 0)
8191 + channel=(ChannelType) argument_list[3].integer_reference;
8192 + image=StatisticImageChannel(image,channel,NonpeakStatistic,
8193 + (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
8196 + case 22: /* Roll */
8198 + if (attribute_flag[0] != 0)
8199 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
8200 + &geometry,exception);
8201 + if (attribute_flag[1] != 0)
8202 + geometry.x=argument_list[1].integer_reference;
8203 + if (attribute_flag[2] != 0)
8204 + geometry.y=argument_list[2].integer_reference;
8205 + image=RollImage(image,geometry.x,geometry.y,exception);
8208 + case 23: /* Rotate */
8210 + if (attribute_flag[0] == 0)
8211 + argument_list[0].real_reference=90.0;
8212 + if (attribute_flag[1] != 0)
8213 + QueryColorDatabase(argument_list[1].string_reference,
8214 + &image->background_color,exception);
8215 + if (attribute_flag[2] != 0)
8216 + QueryColorDatabase(argument_list[2].string_reference,
8217 + &image->background_color,exception);
8218 + if (attribute_flag[3] != 0)
8219 + QueryColorDatabase(argument_list[3].string_reference,
8220 + &image->background_color,exception);
8221 + image=RotateImage(image,argument_list[0].real_reference,exception);
8224 + case 24: /* Sample */
8226 + if (attribute_flag[0] != 0)
8227 + flags=ParseRegionGeometry(image,argument_list[0].string_reference,
8228 + &geometry,exception);
8229 + if (attribute_flag[1] != 0)
8230 + geometry.width=argument_list[1].integer_reference;
8231 + if (attribute_flag[2] != 0)
8232 + geometry.height=argument_list[2].integer_reference;
8233 + image=SampleImage(image,geometry.width,geometry.height,exception);
8236 + case 25: /* Scale */
8238 + if (attribute_flag[0] != 0)
8239 + flags=ParseRegionGeometry(image,argument_list[0].string_reference,
8240 + &geometry,exception);
8241 + if (attribute_flag[1] != 0)
8242 + geometry.width=argument_list[1].integer_reference;
8243 + if (attribute_flag[2] != 0)
8244 + geometry.height=argument_list[2].integer_reference;
8245 + image=ScaleImage(image,geometry.width,geometry.height,exception);
8248 + case 26: /* Shade */
8250 + if (attribute_flag[0] != 0)
8252 + flags=ParseGeometry(argument_list[0].string_reference,
8254 + if ((flags & SigmaValue) == 0)
8255 + geometry_info.sigma=0.0;
8257 + if (attribute_flag[1] != 0)
8258 + geometry_info.rho=argument_list[1].real_reference;
8259 + if (attribute_flag[2] != 0)
8260 + geometry_info.sigma=argument_list[2].real_reference;
8261 + image=ShadeImage(image,
8262 + argument_list[3].integer_reference != 0 ? MagickTrue : MagickFalse,
8263 + geometry_info.rho,geometry_info.sigma,exception);
8266 + case 27: /* Sharpen */
8268 + if (attribute_flag[0] != 0)
8270 + flags=ParseGeometry(argument_list[0].string_reference,
8272 + if ((flags & SigmaValue) == 0)
8273 + geometry_info.sigma=1.0;
8275 + if (attribute_flag[1] != 0)
8276 + geometry_info.rho=argument_list[1].real_reference;
8277 + if (attribute_flag[2] != 0)
8278 + geometry_info.sigma=argument_list[2].real_reference;
8279 + if (attribute_flag[3] != 0)
8280 + channel=(ChannelType) argument_list[3].integer_reference;
8281 + image=SharpenImageChannel(image,channel,geometry_info.rho,
8282 + geometry_info.sigma,exception);
8285 + case 28: /* Shear */
8287 + if (attribute_flag[0] != 0)
8289 + flags=ParseGeometry(argument_list[0].string_reference,
8291 + if ((flags & SigmaValue) == 0)
8292 + geometry_info.sigma=geometry_info.rho;
8294 + if (attribute_flag[1] != 0)
8295 + geometry_info.rho=argument_list[1].real_reference;
8296 + if (attribute_flag[2] != 0)
8297 + geometry_info.sigma=argument_list[2].real_reference;
8298 + if (attribute_flag[3] != 0)
8299 + QueryColorDatabase(argument_list[3].string_reference,
8300 + &image->background_color,exception);
8301 + if (attribute_flag[4] != 0)
8302 + QueryColorDatabase(argument_list[4].string_reference,
8303 + &image->background_color,exception);
8304 + image=ShearImage(image,geometry_info.rho,geometry_info.sigma,
8308 + case 29: /* Spread */
8310 + if (attribute_flag[0] == 0)
8311 + argument_list[0].real_reference=1.0;
8312 + image=SpreadImage(image,argument_list[0].real_reference,exception);
8315 + case 30: /* Swirl */
8317 + if (attribute_flag[0] == 0)
8318 + argument_list[0].real_reference=50.0;
8319 + if (attribute_flag[1] != 0)
8320 + image->interpolate=(InterpolatePixelMethod)
8321 + argument_list[1].integer_reference;
8322 + image=SwirlImage(image,argument_list[0].real_reference,exception);
8325 + case 31: /* Resize */
8326 + case 32: /* Zoom */
8328 + if (attribute_flag[0] != 0)
8329 + flags=ParseRegionGeometry(image,argument_list[0].string_reference,
8330 + &geometry,exception);
8331 + if (attribute_flag[1] != 0)
8332 + geometry.width=argument_list[1].integer_reference;
8333 + if (attribute_flag[2] != 0)
8334 + geometry.height=argument_list[2].integer_reference;
8335 + if (attribute_flag[3] == 0)
8336 + argument_list[3].integer_reference=(ssize_t) UndefinedFilter;
8337 + if (attribute_flag[4] != 0)
8338 + SetImageArtifact(image,"filter:support",
8339 + argument_list[4].string_reference);
8340 + if (attribute_flag[5] == 0)
8341 + argument_list[5].real_reference=1.0;
8342 + image=ResizeImage(image,geometry.width,geometry.height,
8343 + (FilterTypes) argument_list[3].integer_reference,
8344 + argument_list[5].real_reference,exception);
8347 + case 33: /* Annotate */
8352 + draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
8353 + (DrawInfo *) NULL);
8354 + if (attribute_flag[0] != 0)
8359 + text=InterpretImageProperties(info ? info->image_info :
8360 + (ImageInfo *) NULL,image,argument_list[0].string_reference);
8361 + (void) CloneString(&draw_info->text,text);
8362 + text=DestroyString(text);
8364 + if (attribute_flag[1] != 0)
8365 + (void) CloneString(&draw_info->font,
8366 + argument_list[1].string_reference);
8367 + if (attribute_flag[2] != 0)
8368 + draw_info->pointsize=argument_list[2].real_reference;
8369 + if (attribute_flag[3] != 0)
8370 + (void) CloneString(&draw_info->density,
8371 + argument_list[3].string_reference);
8372 + if (attribute_flag[4] != 0)
8373 + (void) QueryColorDatabase(argument_list[4].string_reference,
8374 + &draw_info->undercolor,exception);
8375 + if (attribute_flag[5] != 0)
8377 + (void) QueryColorDatabase(argument_list[5].string_reference,
8378 + &draw_info->stroke,exception);
8379 + if (argument_list[5].image_reference != (Image *) NULL)
8380 + draw_info->stroke_pattern=CloneImage(
8381 + argument_list[5].image_reference,0,0,MagickTrue,exception);
8383 + if (attribute_flag[6] != 0)
8385 + (void) QueryColorDatabase(argument_list[6].string_reference,
8386 + &draw_info->fill,exception);
8387 + if (argument_list[6].image_reference != (Image *) NULL)
8388 + draw_info->fill_pattern=CloneImage(
8389 + argument_list[6].image_reference,0,0,MagickTrue,exception);
8391 + if (attribute_flag[7] != 0)
8393 + (void) CloneString(&draw_info->geometry,
8394 + argument_list[7].string_reference);
8395 + flags=ParsePageGeometry(image,argument_list[7].string_reference,
8396 + &geometry,exception);
8397 + if (((flags & SigmaValue) == 0) && ((flags & XiValue) != 0))
8398 + geometry_info.sigma=geometry_info.xi;
8400 + if (attribute_flag[8] != 0)
8401 + (void) QueryColorDatabase(argument_list[8].string_reference,
8402 + &draw_info->fill,exception);
8403 + if (attribute_flag[11] != 0)
8404 + draw_info->gravity=(GravityType) argument_list[11].integer_reference;
8405 + if (attribute_flag[25] != 0)
8410 + av=(AV *) argument_list[25].array_reference;
8411 + if ((av_len(av) != 3) && (av_len(av) != 5))
8413 + ThrowPerlException(exception,OptionError,
8414 + "affine matrix must have 4 or 6 elements",PackageName);
8415 + goto PerlException;
8417 + draw_info->affine.sx=(double) SvNV(*(av_fetch(av,0,0)));
8418 + draw_info->affine.rx=(double) SvNV(*(av_fetch(av,1,0)));
8419 + draw_info->affine.ry=(double) SvNV(*(av_fetch(av,2,0)));
8420 + draw_info->affine.sy=(double) SvNV(*(av_fetch(av,3,0)));
8421 + if (fabs(draw_info->affine.sx*draw_info->affine.sy-
8422 + draw_info->affine.rx*draw_info->affine.ry) < MagickEpsilon)
8424 + ThrowPerlException(exception,OptionError,
8425 + "affine matrix is singular",PackageName);
8426 + goto PerlException;
8428 + if (av_len(av) == 5)
8430 + draw_info->affine.tx=(double) SvNV(*(av_fetch(av,4,0)));
8431 + draw_info->affine.ty=(double) SvNV(*(av_fetch(av,5,0)));
8434 + for (j=12; j < 17; j++)
8436 + if (attribute_flag[j] == 0)
8438 + value=argument_list[j].string_reference;
8439 + angle=argument_list[j].real_reference;
8440 + current=draw_info->affine;
8441 + GetAffineMatrix(&affine);
8449 + flags=ParseGeometry(value,&geometry_info);
8450 + affine.tx=geometry_info.xi;
8451 + affine.ty=geometry_info.psi;
8452 + if ((flags & PsiValue) == 0)
8453 + affine.ty=affine.tx;
8461 + flags=ParseGeometry(value,&geometry_info);
8462 + affine.sx=geometry_info.rho;
8463 + affine.sy=geometry_info.sigma;
8464 + if ((flags & SigmaValue) == 0)
8465 + affine.sy=affine.sx;
8475 + affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
8476 + affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
8477 + affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
8478 + affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
8486 + affine.ry=tan(DegreesToRadians(fmod(angle,360.0)));
8494 + affine.rx=tan(DegreesToRadians(fmod(angle,360.0)));
8498 + draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
8499 + draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
8500 + draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
8501 + draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
8502 + draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
8504 + draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
8507 + if (attribute_flag[9] == 0)
8508 + argument_list[9].real_reference=0.0;
8509 + if (attribute_flag[10] == 0)
8510 + argument_list[10].real_reference=0.0;
8511 + if ((attribute_flag[9] != 0) || (attribute_flag[10] != 0))
8514 + geometry[MaxTextExtent];
8516 + (void) FormatLocaleString(geometry,MaxTextExtent,"%+f%+f",
8517 + (double) argument_list[9].real_reference+draw_info->affine.tx,
8518 + (double) argument_list[10].real_reference+draw_info->affine.ty);
8519 + (void) CloneString(&draw_info->geometry,geometry);
8521 + if (attribute_flag[17] != 0)
8522 + draw_info->stroke_width=argument_list[17].real_reference;
8523 + if (attribute_flag[18] != 0)
8525 + draw_info->text_antialias=argument_list[18].integer_reference != 0 ?
8526 + MagickTrue : MagickFalse;
8527 + draw_info->stroke_antialias=draw_info->text_antialias;
8529 + if (attribute_flag[19] != 0)
8530 + (void) CloneString(&draw_info->family,
8531 + argument_list[19].string_reference);
8532 + if (attribute_flag[20] != 0)
8533 + draw_info->style=(StyleType) argument_list[20].integer_reference;
8534 + if (attribute_flag[21] != 0)
8535 + draw_info->stretch=(StretchType) argument_list[21].integer_reference;
8536 + if (attribute_flag[22] != 0)
8537 + draw_info->weight=argument_list[22].integer_reference;
8538 + if (attribute_flag[23] != 0)
8539 + draw_info->align=(AlignType) argument_list[23].integer_reference;
8540 + if (attribute_flag[24] != 0)
8541 + (void) CloneString(&draw_info->encoding,
8542 + argument_list[24].string_reference);
8543 + if (attribute_flag[25] != 0)
8544 + draw_info->fill_pattern=CloneImage(
8545 + argument_list[25].image_reference,0,0,MagickTrue,exception);
8546 + if (attribute_flag[26] != 0)
8547 + draw_info->fill_pattern=CloneImage(
8548 + argument_list[26].image_reference,0,0,MagickTrue,exception);
8549 + if (attribute_flag[27] != 0)
8550 + draw_info->stroke_pattern=CloneImage(
8551 + argument_list[27].image_reference,0,0,MagickTrue,exception);
8552 + if (attribute_flag[29] != 0)
8553 + draw_info->kerning=argument_list[29].real_reference;
8554 + if (attribute_flag[30] != 0)
8555 + draw_info->interline_spacing=argument_list[30].real_reference;
8556 + if (attribute_flag[31] != 0)
8557 + draw_info->interword_spacing=argument_list[31].real_reference;
8558 + if (attribute_flag[32] != 0)
8559 + draw_info->direction=(DirectionType)
8560 + argument_list[32].integer_reference;
8561 + (void) AnnotateImage(image,draw_info);
8562 + draw_info=DestroyDrawInfo(draw_info);
8565 + case 34: /* ColorFloodfill */
8576 + draw_info=CloneDrawInfo(info ? info->image_info :
8577 + (ImageInfo *) NULL,(DrawInfo *) NULL);
8578 + if (attribute_flag[0] != 0)
8579 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
8580 + &geometry,exception);
8581 + if (attribute_flag[1] != 0)
8582 + geometry.x=argument_list[1].integer_reference;
8583 + if (attribute_flag[2] != 0)
8584 + geometry.y=argument_list[2].integer_reference;
8585 + if (attribute_flag[3] != 0)
8586 + (void) QueryColorDatabase(argument_list[3].string_reference,
8587 + &draw_info->fill,exception);
8588 + (void) GetOneVirtualMagickPixel(image,geometry.x,geometry.y,&target,
8590 + invert=MagickFalse;
8591 + if (attribute_flag[4] != 0)
8593 + QueryMagickColor(argument_list[4].string_reference,&target,
8595 + invert=MagickTrue;
8597 + if (attribute_flag[5] != 0)
8598 + image->fuzz=StringToDoubleInterval(
8599 + argument_list[5].string_reference,(double) QuantumRange+1.0);
8600 + if (attribute_flag[6] != 0)
8601 + invert=(MagickBooleanType) argument_list[6].integer_reference;
8602 + (void) FloodfillPaintImage(image,DefaultChannels,draw_info,&target,
8603 + geometry.x,geometry.y,invert);
8604 + draw_info=DestroyDrawInfo(draw_info);
8607 + case 35: /* Composite */
8610 + composite_geometry[MaxTextExtent];
8616 + compose=OverCompositeOp;
8617 + if (attribute_flag[0] != 0)
8618 + composite_image=argument_list[0].image_reference;
8621 + ThrowPerlException(exception,OptionError,
8622 + "CompositeImageRequired",PackageName);
8623 + goto PerlException;
8626 + Parameter Handling used for BOTH normal and tiled composition.
8628 + if (attribute_flag[1] != 0) /* compose */
8629 + compose=(CompositeOperator) argument_list[1].integer_reference;
8630 + if (attribute_flag[6] != 0) /* opacity */
8632 + if (compose != DissolveCompositeOp)
8633 + (void) SetImageOpacity(composite_image,(Quantum) (QuantumRange-
8634 + StringToDoubleInterval(argument_list[6].string_reference,
8635 + (double) QuantumRange+1.0)));
8650 + register PixelPacket
8657 + Handle dissolve composite operator.
8659 + (void) CloneString(&image->geometry,
8660 + argument_list[6].string_reference);
8661 + opacity=(Quantum) (QuantumRange-StringToDoubleInterval(
8662 + argument_list[6].string_reference,(double) QuantumRange+
8664 + if (composite_image->matte != MagickTrue)
8665 + (void) SetImageOpacity(composite_image,OpaqueOpacity);
8666 + composite_view=AcquireAuthenticCacheView(composite_image,
8668 + for (y=0; y < (ssize_t) composite_image->rows ; y++)
8670 + q=GetCacheViewAuthenticPixels(composite_view,0,y,(ssize_t)
8671 + composite_image->columns,1,exception);
8672 + for (x=0; x < (ssize_t) composite_image->columns; x++)
8674 + if (q->opacity == OpaqueOpacity)
8675 + q->opacity=ClampToQuantum(opacity);
8678 + sync=SyncCacheViewAuthenticPixels(composite_view,exception);
8679 + if (sync == MagickFalse)
8682 + composite_view=DestroyCacheView(composite_view);
8685 + if (attribute_flag[9] != 0) /* "color=>" */
8686 + QueryColorDatabase(argument_list[9].string_reference,
8687 + &composite_image->background_color,exception);
8688 + if (attribute_flag[12] != 0) /* "interpolate=>" */
8689 + image->interpolate=(InterpolatePixelMethod)
8690 + argument_list[12].integer_reference;
8691 + if (attribute_flag[13] != 0) /* "args=>" */
8692 + (void) SetImageArtifact(composite_image,"compose:args",
8693 + argument_list[13].string_reference);
8694 + if (attribute_flag[14] != 0) /* "blend=>" depreciated */
8695 + (void) SetImageArtifact(composite_image,"compose:args",
8696 + argument_list[14].string_reference);
8698 + Tiling Composition (with orthogonal rotate).
8700 + rotate_image=(Image *) NULL;
8701 + if (attribute_flag[8] != 0) /* "rotate=>" */
8706 + rotate_image=RotateImage(composite_image,
8707 + argument_list[8].real_reference,exception);
8708 + if (rotate_image == (Image *) NULL)
8711 + if ((attribute_flag[7] != 0) &&
8712 + (argument_list[7].integer_reference != 0)) /* tile */
8719 + Tile the composite image.
8721 + if (attribute_flag[8] != 0) /* "tile=>" */
8722 + (void) SetImageArtifact(rotate_image,"compose:outside-overlay",
8725 + (void) SetImageArtifact(composite_image,
8726 + "compose:outside-overlay","false");
8727 + for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) composite_image->rows)
8728 + for (x=0; x < (ssize_t) image->columns; x+=(ssize_t) composite_image->columns)
8730 + if (attribute_flag[8] != 0) /* rotate */
8731 + (void) CompositeImage(image,compose,rotate_image,x,y);
8733 + (void) CompositeImage(image,compose,composite_image,x,y);
8735 + if (attribute_flag[8] != 0) /* rotate */
8736 + rotate_image=DestroyImage(rotate_image);
8740 + Parameter Handling used used ONLY for normal composition.
8742 + if (attribute_flag[5] != 0) /* gravity */
8743 + image->gravity=(GravityType) argument_list[5].integer_reference;
8744 + if (attribute_flag[2] != 0) /* geometry offset */
8746 + SetGeometry(image,&geometry);
8747 + (void) ParseAbsoluteGeometry(argument_list[2].string_reference,
8749 + GravityAdjustGeometry(image->columns,image->rows,image->gravity,
8752 + if (attribute_flag[3] != 0) /* x offset */
8753 + geometry.x=argument_list[3].integer_reference;
8754 + if (attribute_flag[4] != 0) /* y offset */
8755 + geometry.y=argument_list[4].integer_reference;
8756 + if (attribute_flag[10] != 0) /* mask */
8758 + if ((image->compose == DisplaceCompositeOp) ||
8759 + (image->compose == DistortCompositeOp))
8762 + Merge Y displacement into X displacement image.
8764 + composite_image=CloneImage(composite_image,0,0,MagickTrue,
8765 + &image->exception);
8766 + (void) CompositeImage(composite_image,CopyGreenCompositeOp,
8767 + argument_list[10].image_reference,0,0);
8772 + Set a blending mask for the composition.
8774 + image->mask=CloneImage(argument_list[10].image_reference,0,0,
8775 + MagickTrue,&image->exception);
8776 + (void) NegateImage(image->mask,MagickFalse);
8779 + if (attribute_flag[11] != 0) /* channel */
8780 + channel=(ChannelType) argument_list[11].integer_reference;
8782 + Composite two images (normal composition).
8784 + (void) FormatLocaleString(composite_geometry,MaxTextExtent,
8785 + "%.20gx%.20g%+.20g%+.20g",(double) composite_image->columns,
8786 + (double) composite_image->rows,(double) geometry.x,(double)
8788 + flags=ParseGravityGeometry(image,composite_geometry,&geometry,
8790 + if (attribute_flag[8] == 0) /* no rotate */
8791 + CompositeImageChannel(image,channel,compose,composite_image,
8792 + geometry.x,geometry.y);
8796 + Position adjust rotated image then composite.
8798 + geometry.x-=(ssize_t) (rotate_image->columns-
8799 + composite_image->columns)/2;
8800 + geometry.y-=(ssize_t) (rotate_image->rows-
8801 + composite_image->rows)/2;
8802 + CompositeImageChannel(image,channel,compose,rotate_image,
8803 + geometry.x,geometry.y);
8804 + rotate_image=DestroyImage(rotate_image);
8806 + if (attribute_flag[10] != 0) /* mask */
8808 + if ((image->compose == DisplaceCompositeOp) ||
8809 + (image->compose == DistortCompositeOp))
8810 + composite_image=DestroyImage(composite_image);
8812 + image->mask=DestroyImage(image->mask);
8816 + case 36: /* Contrast */
8818 + if (attribute_flag[0] == 0)
8819 + argument_list[0].integer_reference=0;
8820 + (void) ContrastImage(image,argument_list[0].integer_reference != 0 ?
8821 + MagickTrue : MagickFalse);
8824 + case 37: /* CycleColormap */
8826 + if (attribute_flag[0] == 0)
8827 + argument_list[0].integer_reference=6;
8828 + (void) CycleColormapImage(image,argument_list[0].integer_reference);
8831 + case 38: /* Draw */
8836 + draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
8837 + (DrawInfo *) NULL);
8838 + (void) CloneString(&draw_info->primitive,"point");
8839 + if (attribute_flag[0] != 0)
8841 + if (argument_list[0].integer_reference < 0)
8842 + (void) CloneString(&draw_info->primitive,
8843 + argument_list[0].string_reference);
8845 + (void) CloneString(&draw_info->primitive,CommandOptionToMnemonic(
8846 + MagickPrimitiveOptions,argument_list[0].integer_reference));
8848 + if (attribute_flag[1] != 0)
8850 + if (LocaleCompare(draw_info->primitive,"path") == 0)
8852 + (void) ConcatenateString(&draw_info->primitive," '");
8853 + ConcatenateString(&draw_info->primitive,
8854 + argument_list[1].string_reference);
8855 + (void) ConcatenateString(&draw_info->primitive,"'");
8859 + (void) ConcatenateString(&draw_info->primitive," ");
8860 + ConcatenateString(&draw_info->primitive,
8861 + argument_list[1].string_reference);
8864 + if (attribute_flag[2] != 0)
8866 + (void) ConcatenateString(&draw_info->primitive," ");
8867 + (void) ConcatenateString(&draw_info->primitive,
8868 + CommandOptionToMnemonic(MagickMethodOptions,
8869 + argument_list[2].integer_reference));
8871 + if (attribute_flag[3] != 0)
8873 + (void) QueryColorDatabase(argument_list[3].string_reference,
8874 + &draw_info->stroke,exception);
8875 + if (argument_list[3].image_reference != (Image *) NULL)
8876 + draw_info->stroke_pattern=CloneImage(
8877 + argument_list[3].image_reference,0,0,MagickTrue,exception);
8879 + if (attribute_flag[4] != 0)
8881 + (void) QueryColorDatabase(argument_list[4].string_reference,
8882 + &draw_info->fill,exception);
8883 + if (argument_list[4].image_reference != (Image *) NULL)
8884 + draw_info->fill_pattern=CloneImage(
8885 + argument_list[4].image_reference,0,0,MagickTrue,exception);
8887 + if (attribute_flag[5] != 0)
8888 + draw_info->stroke_width=argument_list[5].real_reference;
8889 + if (attribute_flag[6] != 0)
8890 + (void) CloneString(&draw_info->font,
8891 + argument_list[6].string_reference);
8892 + if (attribute_flag[7] != 0)
8893 + (void) QueryColorDatabase(argument_list[7].string_reference,
8894 + &draw_info->border_color,exception);
8895 + if (attribute_flag[8] != 0)
8896 + draw_info->affine.tx=argument_list[8].real_reference;
8897 + if (attribute_flag[9] != 0)
8898 + draw_info->affine.ty=argument_list[9].real_reference;
8899 + if (attribute_flag[20] != 0)
8904 + av=(AV *) argument_list[20].array_reference;
8905 + if ((av_len(av) != 3) && (av_len(av) != 5))
8907 + ThrowPerlException(exception,OptionError,
8908 + "affine matrix must have 4 or 6 elements",PackageName);
8909 + goto PerlException;
8911 + draw_info->affine.sx=(double) SvNV(*(av_fetch(av,0,0)));
8912 + draw_info->affine.rx=(double) SvNV(*(av_fetch(av,1,0)));
8913 + draw_info->affine.ry=(double) SvNV(*(av_fetch(av,2,0)));
8914 + draw_info->affine.sy=(double) SvNV(*(av_fetch(av,3,0)));
8915 + if (fabs(draw_info->affine.sx*draw_info->affine.sy-
8916 + draw_info->affine.rx*draw_info->affine.ry) < MagickEpsilon)
8918 + ThrowPerlException(exception,OptionError,
8919 + "affine matrix is singular",PackageName);
8920 + goto PerlException;
8922 + if (av_len(av) == 5)
8924 + draw_info->affine.tx=(double) SvNV(*(av_fetch(av,4,0)));
8925 + draw_info->affine.ty=(double) SvNV(*(av_fetch(av,5,0)));
8928 + for (j=10; j < 15; j++)
8930 + if (attribute_flag[j] == 0)
8932 + value=argument_list[j].string_reference;
8933 + angle=argument_list[j].real_reference;
8934 + current=draw_info->affine;
8935 + GetAffineMatrix(&affine);
8943 + flags=ParseGeometry(value,&geometry_info);
8944 + affine.tx=geometry_info.xi;
8945 + affine.ty=geometry_info.psi;
8946 + if ((flags & PsiValue) == 0)
8947 + affine.ty=affine.tx;
8955 + flags=ParseGeometry(value,&geometry_info);
8956 + affine.sx=geometry_info.rho;
8957 + affine.sy=geometry_info.sigma;
8958 + if ((flags & SigmaValue) == 0)
8959 + affine.sy=affine.sx;
8969 + affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
8970 + affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
8971 + affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
8972 + affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
8980 + affine.ry=tan(DegreesToRadians(fmod(angle,360.0)));
8988 + affine.rx=tan(DegreesToRadians(fmod(angle,360.0)));
8992 + draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
8993 + draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
8994 + draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
8995 + draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
8996 + draw_info->affine.tx=
8997 + current.sx*affine.tx+current.ry*affine.ty+current.tx;
8998 + draw_info->affine.ty=
8999 + current.rx*affine.tx+current.sy*affine.ty+current.ty;
9001 + if (attribute_flag[15] != 0)
9002 + draw_info->fill_pattern=CloneImage(
9003 + argument_list[15].image_reference,0,0,MagickTrue,exception);
9004 + if (attribute_flag[16] != 0)
9005 + draw_info->pointsize=argument_list[16].real_reference;
9006 + if (attribute_flag[17] != 0)
9008 + draw_info->stroke_antialias=argument_list[17].integer_reference != 0
9009 + ? MagickTrue : MagickFalse;
9010 + draw_info->text_antialias=draw_info->stroke_antialias;
9012 + if (attribute_flag[18] != 0)
9013 + (void) CloneString(&draw_info->density,
9014 + argument_list[18].string_reference);
9015 + if (attribute_flag[19] != 0)
9016 + draw_info->stroke_width=argument_list[19].real_reference;
9017 + if (attribute_flag[21] != 0)
9018 + draw_info->dash_offset=argument_list[21].real_reference;
9019 + if (attribute_flag[22] != 0)
9024 + av=(AV *) argument_list[22].array_reference;
9025 + draw_info->dash_pattern=(double *) AcquireQuantumMemory(
9026 + av_len(av)+2UL,sizeof(*draw_info->dash_pattern));
9027 + if (draw_info->dash_pattern != (double *) NULL)
9029 + for (i=0; i <= av_len(av); i++)
9030 + draw_info->dash_pattern[i]=(double)
9031 + SvNV(*(av_fetch(av,i,0)));
9032 + draw_info->dash_pattern[i]=0.0;
9035 + if (attribute_flag[23] != 0)
9036 + image->interpolate=(InterpolatePixelMethod)
9037 + argument_list[23].integer_reference;
9038 + if ((attribute_flag[24] != 0) &&
9039 + (draw_info->fill_pattern != (Image *) NULL))
9040 + flags=ParsePageGeometry(draw_info->fill_pattern,
9041 + argument_list[24].string_reference,
9042 + &draw_info->fill_pattern->tile_offset,exception);
9043 + if (attribute_flag[25] != 0)
9045 + (void) ConcatenateString(&draw_info->primitive," '");
9046 + (void) ConcatenateString(&draw_info->primitive,
9047 + argument_list[25].string_reference);
9048 + (void) ConcatenateString(&draw_info->primitive,"'");
9050 + if (attribute_flag[26] != 0)
9051 + draw_info->fill_pattern=CloneImage(
9052 + argument_list[26].image_reference,0,0,MagickTrue,exception);
9053 + if (attribute_flag[27] != 0)
9054 + draw_info->stroke_pattern=CloneImage(
9055 + argument_list[27].image_reference,0,0,MagickTrue,exception);
9056 + if (attribute_flag[28] != 0)
9057 + (void) CloneString(&draw_info->primitive,
9058 + argument_list[28].string_reference);
9059 + if (attribute_flag[29] != 0)
9060 + draw_info->kerning=argument_list[29].real_reference;
9061 + if (attribute_flag[30] != 0)
9062 + draw_info->interline_spacing=argument_list[30].real_reference;
9063 + if (attribute_flag[31] != 0)
9064 + draw_info->interword_spacing=argument_list[31].real_reference;
9065 + if (attribute_flag[32] != 0)
9066 + draw_info->direction=(DirectionType)
9067 + argument_list[32].integer_reference;
9068 + DrawImage(image,draw_info);
9069 + draw_info=DestroyDrawInfo(draw_info);
9072 + case 39: /* Equalize */
9074 + if (attribute_flag[0] != 0)
9075 + channel=(ChannelType) argument_list[0].integer_reference;
9076 + EqualizeImageChannel(image,channel);
9079 + case 40: /* Gamma */
9081 + if (attribute_flag[1] != 0)
9082 + channel=(ChannelType) argument_list[1].integer_reference;
9083 + if (attribute_flag[2] == 0)
9084 + argument_list[2].real_reference=1.0;
9085 + if (attribute_flag[3] == 0)
9086 + argument_list[3].real_reference=1.0;
9087 + if (attribute_flag[4] == 0)
9088 + argument_list[4].real_reference=1.0;
9089 + if (attribute_flag[0] == 0)
9091 + (void) FormatLocaleString(message,MaxTextExtent,
9092 + "%.15g,%.15g,%.15g",(double) argument_list[2].real_reference,
9093 + (double) argument_list[3].real_reference,
9094 + (double) argument_list[4].real_reference);
9095 + argument_list[0].string_reference=message;
9097 + if (strchr(argument_list[0].string_reference,',') != (char *) NULL)
9098 + (void) GammaImage(image,argument_list[0].string_reference);
9100 + (void) GammaImageChannel(image,channel,StringToDouble(
9101 + argument_list[0].string_reference,(char **) NULL));
9104 + case 41: /* Map */
9109 + if (attribute_flag[0] == 0)
9111 + ThrowPerlException(exception,OptionError,"MapImageRequired",
9113 + goto PerlException;
9115 + quantize_info=AcquireQuantizeInfo(info->image_info);
9116 + if (attribute_flag[1] != 0)
9117 + quantize_info->dither=(MagickBooleanType)
9118 + argument_list[1].integer_reference;
9119 + if (attribute_flag[2] != 0)
9120 + quantize_info->dither_method=(DitherMethod)
9121 + argument_list[2].integer_reference;
9122 + (void) RemapImages(quantize_info,image,
9123 + argument_list[0].image_reference);
9124 + quantize_info=DestroyQuantizeInfo(quantize_info);
9127 + case 42: /* MatteFloodfill */
9138 + draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
9139 + (DrawInfo *) NULL);
9140 + if (attribute_flag[0] != 0)
9141 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
9142 + &geometry,exception);
9143 + if (attribute_flag[1] != 0)
9144 + geometry.x=argument_list[1].integer_reference;
9145 + if (attribute_flag[2] != 0)
9146 + geometry.y=argument_list[2].integer_reference;
9147 + if (image->matte == MagickFalse)
9148 + (void) SetImageOpacity(image,OpaqueOpacity);
9149 + (void) GetOneVirtualMagickPixel(image,geometry.x,geometry.y,&target,
9151 + if (attribute_flag[4] != 0)
9152 + QueryMagickColor(argument_list[4].string_reference,&target,
9154 + if (attribute_flag[3] != 0)
9155 + target.opacity=StringToDoubleInterval(
9156 + argument_list[3].string_reference,(double) QuantumRange+1.0);
9157 + if (attribute_flag[5] != 0)
9158 + image->fuzz=StringToDoubleInterval(
9159 + argument_list[5].string_reference,(double) QuantumRange+1.0);
9160 + invert=MagickFalse;
9161 + if (attribute_flag[6] != 0)
9162 + invert=(MagickBooleanType) argument_list[6].integer_reference;
9163 + (void) FloodfillPaintImage(image,OpacityChannel,draw_info,&target,
9164 + geometry.x,geometry.y,invert);
9165 + draw_info=DestroyDrawInfo(draw_info);
9168 + case 43: /* Modulate */
9171 + modulate[MaxTextExtent];
9173 + geometry_info.rho=100.0;
9174 + geometry_info.sigma=100.0;
9175 + geometry_info.xi=100.0;
9176 + if (attribute_flag[0] != 0)
9177 + (void)ParseGeometry(argument_list[0].string_reference,
9179 + if (attribute_flag[1] != 0)
9180 + geometry_info.xi=argument_list[1].real_reference;
9181 + if (attribute_flag[2] != 0)
9182 + geometry_info.sigma=argument_list[2].real_reference;
9183 + if (attribute_flag[3] != 0)
9185 + geometry_info.sigma=argument_list[3].real_reference;
9186 + SetImageArtifact(image,"modulate:colorspace","HWB");
9188 + if (attribute_flag[4] != 0)
9190 + geometry_info.rho=argument_list[4].real_reference;
9191 + SetImageArtifact(image,"modulate:colorspace","HSB");
9193 + if (attribute_flag[5] != 0)
9195 + geometry_info.sigma=argument_list[5].real_reference;
9196 + SetImageArtifact(image,"modulate:colorspace","HSL");
9198 + if (attribute_flag[6] != 0)
9200 + geometry_info.rho=argument_list[6].real_reference;
9201 + SetImageArtifact(image,"modulate:colorspace","HWB");
9203 + (void) FormatLocaleString(modulate,MaxTextExtent,"%.15g,%.15g,%.15g",
9204 + geometry_info.rho,geometry_info.sigma,geometry_info.xi);
9205 + (void) ModulateImage(image,modulate);
9208 + case 44: /* Negate */
9210 + if (attribute_flag[0] == 0)
9211 + argument_list[0].integer_reference=0;
9212 + if (attribute_flag[1] != 0)
9213 + channel=(ChannelType) argument_list[1].integer_reference;
9214 + (void) NegateImageChannel(image,channel,
9215 + argument_list[0].integer_reference != 0 ? MagickTrue : MagickFalse);
9218 + case 45: /* Normalize */
9220 + if (attribute_flag[0] != 0)
9221 + channel=(ChannelType) argument_list[0].integer_reference;
9222 + NormalizeImageChannel(image,channel);
9225 + case 46: /* NumberColors */
9227 + case 47: /* Opaque */
9236 + (void) QueryMagickColor("none",&target,exception);
9237 + (void) QueryMagickColor("none",&fill_color,exception);
9238 + if (attribute_flag[0] != 0)
9239 + (void) QueryMagickColor(argument_list[0].string_reference,
9240 + &target,exception);
9241 + if (attribute_flag[1] != 0)
9242 + (void) QueryMagickColor(argument_list[1].string_reference,
9243 + &fill_color,exception);
9244 + if (attribute_flag[2] != 0)
9245 + image->fuzz=StringToDoubleInterval(
9246 + argument_list[2].string_reference,(double) QuantumRange+1.0);
9247 + if (attribute_flag[3] != 0)
9248 + channel=(ChannelType) argument_list[3].integer_reference;
9249 + invert=MagickFalse;
9250 + if (attribute_flag[4] != 0)
9251 + invert=(MagickBooleanType) argument_list[4].integer_reference;
9252 + (void) OpaquePaintImageChannel(image,channel,&target,&fill_color,
9256 + case 48: /* Quantize */
9261 + quantize_info=AcquireQuantizeInfo(info->image_info);
9262 + if (attribute_flag[0] != 0)
9263 + quantize_info->number_colors=(size_t)
9264 + argument_list[0].integer_reference;
9265 + if (attribute_flag[1] != 0)
9266 + quantize_info->tree_depth=(size_t)
9267 + argument_list[1].integer_reference;
9268 + if (attribute_flag[2] != 0)
9269 + quantize_info->colorspace=(ColorspaceType)
9270 + argument_list[2].integer_reference;
9271 + if (attribute_flag[3] != 0)
9272 + quantize_info->dither=argument_list[3].integer_reference != 0 ?
9273 + MagickTrue : MagickFalse;
9274 + if (attribute_flag[4] != 0)
9275 + quantize_info->measure_error=
9276 + argument_list[4].integer_reference != 0 ? MagickTrue : MagickFalse;
9277 + if (attribute_flag[6] != 0)
9278 + (void) QueryColorDatabase(argument_list[6].string_reference,
9279 + &image->transparent_color,exception);
9280 + if (attribute_flag[7] != 0)
9281 + quantize_info->dither_method=(DitherMethod)
9282 + argument_list[7].integer_reference;
9283 + if (attribute_flag[5] && argument_list[5].integer_reference)
9284 + (void) QuantizeImages(quantize_info,image);
9285 + else if ((image->storage_class == DirectClass) ||
9286 + (image->colors > quantize_info->number_colors) ||
9287 + (quantize_info->colorspace == GRAYColorspace))
9288 + (void) QuantizeImage(quantize_info,image);
9290 + CompressImageColormap(image);
9291 + quantize_info=DestroyQuantizeInfo(quantize_info);
9294 + case 49: /* Raise */
9296 + if (attribute_flag[0] != 0)
9297 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
9298 + &geometry,exception);
9299 + if (attribute_flag[1] != 0)
9300 + geometry.width=argument_list[1].integer_reference;
9301 + if (attribute_flag[2] != 0)
9302 + geometry.height=argument_list[2].integer_reference;
9303 + if (attribute_flag[3] == 0)
9304 + argument_list[3].integer_reference=1;
9305 + (void) RaiseImage(image,&geometry,argument_list[3].integer_reference
9306 + != 0 ? MagickTrue : MagickFalse);
9309 + case 50: /* Segment */
9315 + cluster_threshold,
9316 + smoothing_threshold;
9321 + cluster_threshold=1.0;
9322 + smoothing_threshold=1.5;
9323 + colorspace=sRGBColorspace;
9324 + verbose=MagickFalse;
9325 + if (attribute_flag[0] != 0)
9327 + flags=ParseGeometry(argument_list[0].string_reference,
9329 + cluster_threshold=geometry_info.rho;
9330 + if (flags & SigmaValue)
9331 + smoothing_threshold=geometry_info.sigma;
9333 + if (attribute_flag[1] != 0)
9334 + cluster_threshold=argument_list[1].real_reference;
9335 + if (attribute_flag[2] != 0)
9336 + smoothing_threshold=argument_list[2].real_reference;
9337 + if (attribute_flag[3] != 0)
9338 + colorspace=(ColorspaceType) argument_list[3].integer_reference;
9339 + if (attribute_flag[4] != 0)
9340 + verbose=argument_list[4].integer_reference != 0 ?
9341 + MagickTrue : MagickFalse;
9342 + (void) SegmentImage(image,colorspace,verbose,cluster_threshold,
9343 + smoothing_threshold);
9346 + case 51: /* Signature */
9348 + (void) SignatureImage(image);
9351 + case 52: /* Solarize */
9353 + geometry_info.rho=QuantumRange/2.0;
9354 + if (attribute_flag[0] != 0)
9355 + flags=ParseGeometry(argument_list[0].string_reference,
9357 + if (attribute_flag[1] != 0)
9358 + geometry_info.rho=StringToDoubleInterval(
9359 + argument_list[1].string_reference,(double) QuantumRange+1.0);
9360 + if (attribute_flag[2] != 0)
9361 + channel=(ChannelType) argument_list[2].integer_reference;
9362 + (void) SolarizeImageChannel(image,channel,geometry_info.rho,
9366 + case 53: /* Sync */
9368 + (void) SyncImage(image);
9371 + case 54: /* Texture */
9373 + if (attribute_flag[0] == 0)
9375 + TextureImage(image,argument_list[0].image_reference);
9378 + case 55: /* Evalute */
9380 + MagickEvaluateOperator
9383 + op=SetEvaluateOperator;
9384 + if (attribute_flag[0] == MagickFalse)
9385 + argument_list[0].real_reference=0.0;
9386 + if (attribute_flag[1] != MagickFalse)
9387 + op=(MagickEvaluateOperator) argument_list[1].integer_reference;
9388 + if (attribute_flag[2] != MagickFalse)
9389 + channel=(ChannelType) argument_list[2].integer_reference;
9390 + (void) EvaluateImageChannel(image,channel,op,
9391 + argument_list[0].real_reference,exception);
9394 + case 56: /* Transparent */
9405 + (void) QueryMagickColor("none",&target,exception);
9406 + if (attribute_flag[0] != 0)
9407 + (void) QueryMagickColor(argument_list[0].string_reference,&target,
9409 + opacity=TransparentOpacity;
9410 + if (attribute_flag[1] != 0)
9411 + opacity=StringToDoubleInterval(argument_list[1].string_reference,
9412 + (double) QuantumRange+1.0);
9413 + if (attribute_flag[2] != 0)
9414 + image->fuzz=StringToDoubleInterval(
9415 + argument_list[2].string_reference,(double) QuantumRange+1.0);
9416 + if (attribute_flag[3] == 0)
9417 + argument_list[3].integer_reference=0;
9418 + invert=MagickFalse;
9419 + if (attribute_flag[3] != 0)
9420 + invert=(MagickBooleanType) argument_list[3].integer_reference;
9421 + (void) TransparentPaintImage(image,&target,ClampToQuantum(opacity),
9425 + case 57: /* Threshold */
9430 + if (attribute_flag[0] == 0)
9431 + argument_list[0].string_reference="50%";
9432 + if (attribute_flag[1] != 0)
9433 + channel=(ChannelType) argument_list[1].integer_reference;
9434 + threshold=StringToDoubleInterval(argument_list[0].string_reference,
9435 + (double) QuantumRange+1.0);
9436 + (void) BilevelImageChannel(image,channel,threshold);
9439 + case 58: /* Charcoal */
9441 + if (attribute_flag[0] != 0)
9443 + flags=ParseGeometry(argument_list[0].string_reference,
9445 + if ((flags & SigmaValue) == 0)
9446 + geometry_info.sigma=1.0;
9448 + if (attribute_flag[1] != 0)
9449 + geometry_info.rho=argument_list[1].real_reference;
9450 + if (attribute_flag[2] != 0)
9451 + geometry_info.sigma=argument_list[2].real_reference;
9452 + image=CharcoalImage(image,geometry_info.rho,geometry_info.sigma,
9456 + case 59: /* Trim */
9458 + if (attribute_flag[0] != 0)
9459 + image->fuzz=StringToDoubleInterval(
9460 + argument_list[0].string_reference,(double) QuantumRange+1.0);
9461 + image=TrimImage(image,exception);
9464 + case 60: /* Wave */
9466 + if (attribute_flag[0] != 0)
9468 + flags=ParseGeometry(argument_list[0].string_reference,
9470 + if ((flags & SigmaValue) == 0)
9471 + geometry_info.sigma=1.0;
9473 + if (attribute_flag[1] != 0)
9474 + geometry_info.rho=argument_list[1].real_reference;
9475 + if (attribute_flag[2] != 0)
9476 + geometry_info.sigma=argument_list[2].real_reference;
9477 + if (attribute_flag[3] != 0)
9478 + image->interpolate=(InterpolatePixelMethod)
9479 + argument_list[3].integer_reference;
9480 + image=WaveImage(image,geometry_info.rho,geometry_info.sigma,
9484 + case 61: /* Separate */
9486 + if (attribute_flag[0] != 0)
9487 + channel=(ChannelType) argument_list[0].integer_reference;
9488 + (void) SeparateImageChannel(image,channel);
9491 + case 63: /* Stereo */
9493 + if (attribute_flag[0] == 0)
9495 + ThrowPerlException(exception,OptionError,"StereoImageRequired",
9497 + goto PerlException;
9499 + if (attribute_flag[1] != 0)
9500 + geometry.x=argument_list[1].integer_reference;
9501 + if (attribute_flag[2] != 0)
9502 + geometry.y=argument_list[2].integer_reference;
9503 + image=StereoAnaglyphImage(image,argument_list[0].image_reference,
9504 + geometry.x,geometry.y,exception);
9507 + case 64: /* Stegano */
9509 + if (attribute_flag[0] == 0)
9511 + ThrowPerlException(exception,OptionError,"SteganoImageRequired",
9513 + goto PerlException;
9515 + if (attribute_flag[1] == 0)
9516 + argument_list[1].integer_reference=0;
9517 + image->offset=argument_list[1].integer_reference;
9518 + image=SteganoImage(image,argument_list[0].image_reference,exception);
9521 + case 65: /* Deconstruct */
9523 + image=DeconstructImages(image,exception);
9526 + case 66: /* GaussianBlur */
9528 + if (attribute_flag[0] != 0)
9530 + flags=ParseGeometry(argument_list[0].string_reference,
9532 + if ((flags & SigmaValue) == 0)
9533 + geometry_info.sigma=1.0;
9535 + if (attribute_flag[1] != 0)
9536 + geometry_info.rho=argument_list[1].real_reference;
9537 + if (attribute_flag[2] != 0)
9538 + geometry_info.sigma=argument_list[2].real_reference;
9539 + if (attribute_flag[3] != 0)
9540 + channel=(ChannelType) argument_list[3].integer_reference;
9541 + image=GaussianBlurImageChannel(image,channel,geometry_info.rho,
9542 + geometry_info.sigma,exception);
9545 + case 67: /* Convolve */
9556 + if (attribute_flag[0] == 0)
9558 + if (attribute_flag[1] != 0)
9559 + channel=(ChannelType) argument_list[1].integer_reference;
9560 + if (attribute_flag[2] != 0)
9561 + image->bias=StringToDoubleInterval(
9562 + argument_list[2].string_reference,(double) QuantumRange+1.0);
9563 + av=(AV *) argument_list[0].array_reference;
9564 + order=(size_t) sqrt(av_len(av)+1);
9565 + kernel=(double *) AcquireQuantumMemory(order,order*sizeof(*kernel));
9566 + if (kernel == (double *) NULL)
9568 + ThrowPerlException(exception,ResourceLimitFatalError,
9569 + "MemoryAllocationFailed",PackageName);
9570 + goto PerlException;
9572 + for (j=0; (j < (ssize_t) (order*order)) && (j < (av_len(av)+1)); j++)
9573 + kernel[j]=(double) SvNV(*(av_fetch(av,j,0)));
9574 + for ( ; j < (ssize_t) (order*order); j++)
9576 + image=ConvolveImageChannel(image,channel,order,kernel,exception);
9577 + kernel=(double *) RelinquishMagickMemory(kernel);
9580 + case 68: /* Profile */
9595 + if (attribute_flag[0] != 0)
9596 + name=argument_list[0].string_reference;
9597 + if (attribute_flag[2] != 0)
9598 + image->rendering_intent=(RenderingIntent)
9599 + argument_list[2].integer_reference;
9600 + if (attribute_flag[3] != 0)
9601 + image->black_point_compensation=
9602 + argument_list[3].integer_reference != 0 ? MagickTrue : MagickFalse;
9603 + if (attribute_flag[1] != 0)
9605 + if (argument_list[1].length == 0)
9608 + Remove a profile from the image.
9610 + (void) ProfileImage(image,name,(const unsigned char *) NULL,0,
9615 + Associate user supplied profile with the image.
9617 + profile=AcquireStringInfo(argument_list[1].length);
9618 + SetStringInfoDatum(profile,(const unsigned char *)
9619 + argument_list[1].string_reference);
9620 + (void) ProfileImage(image,name,GetStringInfoDatum(profile),
9621 + (size_t) GetStringInfoLength(profile),MagickFalse);
9622 + profile=DestroyStringInfo(profile);
9626 + Associate a profile with the image.
9629 + CloneImageInfo(info ? info->image_info : (ImageInfo *) NULL);
9630 + (void) CopyMagickString(profile_info->filename,name,MaxTextExtent);
9631 + profile_image=ReadImages(profile_info,&image->exception);
9632 + if (profile_image == (Image *) NULL)
9634 + ResetImageProfileIterator(profile_image);
9635 + name=GetNextImageProfile(profile_image);
9636 + while (name != (const char *) NULL)
9641 + profile=GetImageProfile(profile_image,name);
9642 + if (profile != (const StringInfo *) NULL)
9643 + (void) ProfileImage(image,name,GetStringInfoDatum(profile),
9644 + (size_t) GetStringInfoLength(profile),MagickFalse);
9645 + name=GetNextImageProfile(profile_image);
9647 + profile_image=DestroyImage(profile_image);
9648 + profile_info=DestroyImageInfo(profile_info);
9651 + case 69: /* UnsharpMask */
9653 + if (attribute_flag[0] != 0)
9655 + flags=ParseGeometry(argument_list[0].string_reference,
9657 + if ((flags & SigmaValue) == 0)
9658 + geometry_info.sigma=1.0;
9659 + if ((flags & XiValue) == 0)
9660 + geometry_info.xi=1.0;
9661 + if ((flags & PsiValue) == 0)
9662 + geometry_info.psi=0.5;
9664 + if (attribute_flag[1] != 0)
9665 + geometry_info.rho=argument_list[1].real_reference;
9666 + if (attribute_flag[2] != 0)
9667 + geometry_info.sigma=argument_list[2].real_reference;
9668 + if (attribute_flag[3] != 0)
9669 + geometry_info.xi=argument_list[3].real_reference;
9670 + if (attribute_flag[4] != 0)
9671 + geometry_info.psi=argument_list[4].real_reference;
9672 + if (attribute_flag[5] != 0)
9673 + channel=(ChannelType) argument_list[5].integer_reference;
9674 + image=UnsharpMaskImageChannel(image,channel,geometry_info.rho,
9675 + geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception);
9678 + case 70: /* MotionBlur */
9680 + if (attribute_flag[0] != 0)
9682 + flags=ParseGeometry(argument_list[0].string_reference,
9684 + if ((flags & SigmaValue) == 0)
9685 + geometry_info.sigma=1.0;
9686 + if ((flags & XiValue) == 0)
9687 + geometry_info.xi=1.0;
9689 + if (attribute_flag[1] != 0)
9690 + geometry_info.rho=argument_list[1].real_reference;
9691 + if (attribute_flag[2] != 0)
9692 + geometry_info.sigma=argument_list[2].real_reference;
9693 + if (attribute_flag[3] != 0)
9694 + geometry_info.xi=argument_list[3].real_reference;
9695 + if (attribute_flag[4] != 0)
9696 + channel=(ChannelType) argument_list[4].integer_reference;
9697 + image=MotionBlurImageChannel(image,channel,geometry_info.rho,
9698 + geometry_info.sigma,geometry_info.xi,exception);
9701 + case 71: /* OrderedDither */
9703 + if (attribute_flag[0] == 0)
9704 + argument_list[0].string_reference="o8x8";
9705 + if (attribute_flag[1] != 0)
9706 + channel=(ChannelType) argument_list[1].integer_reference;
9707 + (void) OrderedPosterizeImageChannel(image,channel,
9708 + argument_list[0].string_reference,exception);
9711 + case 72: /* Shave */
9713 + if (attribute_flag[0] != 0)
9714 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
9715 + &geometry,exception);
9716 + if (attribute_flag[1] != 0)
9717 + geometry.width=argument_list[1].integer_reference;
9718 + if (attribute_flag[2] != 0)
9719 + geometry.height=argument_list[2].integer_reference;
9720 + image=ShaveImage(image,&geometry,exception);
9723 + case 73: /* Level */
9731 + white_point=(MagickRealType) image->columns*image->rows;
9733 + if (attribute_flag[0] != 0)
9735 + flags=ParseGeometry(argument_list[0].string_reference,
9737 + black_point=geometry_info.rho;
9738 + if ((flags & SigmaValue) != 0)
9739 + white_point=geometry_info.sigma;
9740 + if ((flags & XiValue) != 0)
9741 + gamma=geometry_info.xi;
9742 + if ((flags & PercentValue) != 0)
9744 + black_point*=(double) (QuantumRange/100.0);
9745 + white_point*=(double) (QuantumRange/100.0);
9747 + if ((flags & SigmaValue) == 0)
9748 + white_point=(double) QuantumRange-black_point;
9750 + if (attribute_flag[1] != 0)
9751 + black_point=argument_list[1].real_reference;
9752 + if (attribute_flag[2] != 0)
9753 + white_point=argument_list[2].real_reference;
9754 + if (attribute_flag[3] != 0)
9755 + gamma=argument_list[3].real_reference;
9756 + if (attribute_flag[4] != 0)
9757 + channel=(ChannelType) argument_list[4].integer_reference;
9758 + if (attribute_flag[5] != 0)
9760 + argument_list[0].real_reference=argument_list[5].real_reference;
9761 + attribute_flag[0]=attribute_flag[5];
9763 + (void) LevelImageChannel(image,channel,black_point,white_point,gamma);
9766 + case 74: /* Clip */
9768 + if (attribute_flag[0] == 0)
9769 + argument_list[0].string_reference="#1";
9770 + if (attribute_flag[1] == 0)
9771 + argument_list[1].integer_reference=MagickTrue;
9772 + (void) ClipImagePath(image,argument_list[0].string_reference,
9773 + argument_list[1].integer_reference != 0 ? MagickTrue : MagickFalse);
9776 + case 75: /* AffineTransform */
9781 + draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
9782 + (DrawInfo *) NULL);
9783 + if (attribute_flag[0] != 0)
9788 + av=(AV *) argument_list[0].array_reference;
9789 + if ((av_len(av) != 3) && (av_len(av) != 5))
9791 + ThrowPerlException(exception,OptionError,
9792 + "affine matrix must have 4 or 6 elements",PackageName);
9793 + goto PerlException;
9795 + draw_info->affine.sx=(double) SvNV(*(av_fetch(av,0,0)));
9796 + draw_info->affine.rx=(double) SvNV(*(av_fetch(av,1,0)));
9797 + draw_info->affine.ry=(double) SvNV(*(av_fetch(av,2,0)));
9798 + draw_info->affine.sy=(double) SvNV(*(av_fetch(av,3,0)));
9799 + if (fabs(draw_info->affine.sx*draw_info->affine.sy-
9800 + draw_info->affine.rx*draw_info->affine.ry) < MagickEpsilon)
9802 + ThrowPerlException(exception,OptionError,
9803 + "affine matrix is singular",PackageName);
9804 + goto PerlException;
9806 + if (av_len(av) == 5)
9808 + draw_info->affine.tx=(double) SvNV(*(av_fetch(av,4,0)));
9809 + draw_info->affine.ty=(double) SvNV(*(av_fetch(av,5,0)));
9812 + for (j=1; j < 6; j++)
9814 + if (attribute_flag[j] == 0)
9816 + value=argument_list[j].string_reference;
9817 + angle=argument_list[j].real_reference;
9818 + current=draw_info->affine;
9819 + GetAffineMatrix(&affine);
9827 + flags=ParseGeometry(value,&geometry_info);
9828 + affine.tx=geometry_info.xi;
9829 + affine.ty=geometry_info.psi;
9830 + if ((flags & PsiValue) == 0)
9831 + affine.ty=affine.tx;
9839 + flags=ParseGeometry(value,&geometry_info);
9840 + affine.sx=geometry_info.rho;
9841 + affine.sy=geometry_info.sigma;
9842 + if ((flags & SigmaValue) == 0)
9843 + affine.sy=affine.sx;
9853 + affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
9854 + affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
9855 + affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
9856 + affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
9864 + affine.ry=tan(DegreesToRadians(fmod(angle,360.0)));
9872 + affine.rx=tan(DegreesToRadians(fmod(angle,360.0)));
9876 + draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
9877 + draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
9878 + draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
9879 + draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
9880 + draw_info->affine.tx=
9881 + current.sx*affine.tx+current.ry*affine.ty+current.tx;
9882 + draw_info->affine.ty=
9883 + current.rx*affine.tx+current.sy*affine.ty+current.ty;
9885 + if (attribute_flag[6] != 0)
9886 + image->interpolate=(InterpolatePixelMethod)
9887 + argument_list[6].integer_reference;
9888 + if (attribute_flag[7] != 0)
9889 + QueryColorDatabase(argument_list[7].string_reference,
9890 + &image->background_color,exception);
9891 + image=AffineTransformImage(image,&draw_info->affine,exception);
9892 + draw_info=DestroyDrawInfo(draw_info);
9895 + case 76: /* Difference */
9897 + if (attribute_flag[0] == 0)
9899 + ThrowPerlException(exception,OptionError,
9900 + "ReferenceImageRequired",PackageName);
9901 + goto PerlException;
9903 + if (attribute_flag[1] != 0)
9904 + image->fuzz=StringToDoubleInterval(
9905 + argument_list[1].string_reference,(double) QuantumRange+1.0);
9906 + (void) IsImagesEqual(image,argument_list[0].image_reference);
9909 + case 77: /* AdaptiveThreshold */
9911 + if (attribute_flag[0] != 0)
9913 + flags=ParseGeometry(argument_list[0].string_reference,
9915 + if ((flags & PercentValue) != 0)
9916 + geometry_info.xi=QuantumRange*geometry_info.xi/100.0;
9918 + if (attribute_flag[1] != 0)
9919 + geometry_info.rho=argument_list[1].integer_reference;
9920 + if (attribute_flag[2] != 0)
9921 + geometry_info.sigma=argument_list[2].integer_reference;
9922 + if (attribute_flag[3] != 0)
9923 + geometry_info.xi=argument_list[3].integer_reference;;
9924 + image=AdaptiveThresholdImage(image,(size_t) geometry_info.rho,
9925 + (size_t) geometry_info.sigma,(ssize_t) geometry_info.xi,
9929 + case 78: /* Resample */
9935 + if (attribute_flag[0] != 0)
9937 + flags=ParseGeometry(argument_list[0].string_reference,
9939 + if ((flags & SigmaValue) == 0)
9940 + geometry_info.sigma=geometry_info.rho;
9942 + if (attribute_flag[1] != 0)
9943 + geometry_info.rho=argument_list[1].real_reference;
9944 + if (attribute_flag[2] != 0)
9945 + geometry_info.sigma=argument_list[2].real_reference;
9946 + if (attribute_flag[3] == 0)
9947 + argument_list[3].integer_reference=(ssize_t) UndefinedFilter;
9948 + if (attribute_flag[4] == 0)
9949 + SetImageArtifact(image,"filter:support",
9950 + argument_list[4].string_reference);
9951 + if (attribute_flag[5] != 0)
9952 + argument_list[5].real_reference=1.0;
9953 + width=(size_t) (geometry_info.rho*image->columns/
9954 + (image->x_resolution == 0.0 ? 72.0 : image->x_resolution)+0.5);
9955 + height=(size_t) (geometry_info.sigma*image->rows/
9956 + (image->y_resolution == 0.0 ? 72.0 : image->y_resolution)+0.5);
9957 + image=ResizeImage(image,width,height,(FilterTypes)
9958 + argument_list[3].integer_reference,argument_list[5].real_reference,
9960 + if (image != (Image *) NULL)
9962 + image->x_resolution=geometry_info.rho;
9963 + image->y_resolution=geometry_info.sigma;
9967 + case 79: /* Describe */
9969 + if (attribute_flag[0] == 0)
9970 + argument_list[0].file_reference=(FILE *) NULL;
9971 + if (attribute_flag[1] != 0)
9972 + (void) SetImageArtifact(image,"identify:features",
9973 + argument_list[1].string_reference);
9974 + (void) IdentifyImage(image,argument_list[0].file_reference,
9978 + case 80: /* BlackThreshold */
9980 + if (attribute_flag[0] == 0)
9981 + argument_list[0].string_reference="50%";
9982 + if (attribute_flag[2] != 0)
9983 + channel=(ChannelType) argument_list[2].integer_reference;
9984 + BlackThresholdImageChannel(image,channel,
9985 + argument_list[0].string_reference,exception);
9988 + case 81: /* WhiteThreshold */
9990 + if (attribute_flag[0] == 0)
9991 + argument_list[0].string_reference="50%";
9992 + if (attribute_flag[2] != 0)
9993 + channel=(ChannelType) argument_list[2].integer_reference;
9994 + WhiteThresholdImageChannel(image,channel,
9995 + argument_list[0].string_reference,exception);
9998 + case 82: /* RotationalBlur */
10000 + if (attribute_flag[0] != 0)
10002 + flags=ParseGeometry(argument_list[0].string_reference,
10004 + if ((flags & SigmaValue) == 0)
10005 + geometry_info.sigma=1.0;
10007 + if (attribute_flag[1] != 0)
10008 + geometry_info.rho=argument_list[1].real_reference;
10009 + if (attribute_flag[2] != 0)
10010 + channel=(ChannelType) argument_list[2].integer_reference;
10011 + image=RotationalBlurImageChannel(image,channel,geometry_info.rho,
10015 + case 83: /* Thumbnail */
10017 + if (attribute_flag[0] != 0)
10018 + flags=ParseRegionGeometry(image,argument_list[0].string_reference,
10019 + &geometry,exception);
10020 + if (attribute_flag[1] != 0)
10021 + geometry.width=argument_list[1].integer_reference;
10022 + if (attribute_flag[2] != 0)
10023 + geometry.height=argument_list[2].integer_reference;
10024 + image=ThumbnailImage(image,geometry.width,geometry.height,exception);
10027 + case 84: /* Strip */
10029 + (void) StripImage(image);
10032 + case 85: /* Tint */
10037 + (void) GetOneVirtualPixel(image,0,0,&target,exception);
10038 + if (attribute_flag[0] != 0)
10039 + (void) QueryColorDatabase(argument_list[0].string_reference,&target,
10041 + if (attribute_flag[1] == 0)
10042 + argument_list[1].string_reference="100";
10043 + image=TintImage(image,argument_list[1].string_reference,target,
10047 + case 86: /* Channel */
10049 + if (attribute_flag[0] != 0)
10050 + channel=(ChannelType) argument_list[0].integer_reference;
10051 + (void) SeparateImageChannel(image,channel);
10054 + case 87: /* Splice */
10056 + if (attribute_flag[7] != 0)
10057 + image->gravity=(GravityType) argument_list[7].integer_reference;
10058 + if (attribute_flag[0] != 0)
10059 + flags=ParseGravityGeometry(image,argument_list[0].string_reference,
10060 + &geometry,exception);
10061 + if (attribute_flag[1] != 0)
10062 + geometry.width=argument_list[1].integer_reference;
10063 + if (attribute_flag[2] != 0)
10064 + geometry.height=argument_list[2].integer_reference;
10065 + if (attribute_flag[3] != 0)
10066 + geometry.x=argument_list[3].integer_reference;
10067 + if (attribute_flag[4] != 0)
10068 + geometry.y=argument_list[4].integer_reference;
10069 + if (attribute_flag[5] != 0)
10070 + image->fuzz=StringToDoubleInterval(
10071 + argument_list[5].string_reference,(double) QuantumRange+1.0);
10072 + if (attribute_flag[6] != 0)
10073 + (void) QueryColorDatabase(argument_list[6].string_reference,
10074 + &image->background_color,exception);
10075 + image=SpliceImage(image,&geometry,exception);
10078 + case 88: /* Posterize */
10080 + if (attribute_flag[0] == 0)
10081 + argument_list[0].integer_reference=3;
10082 + if (attribute_flag[1] == 0)
10083 + argument_list[1].integer_reference=0;
10084 + (void) PosterizeImage(image,argument_list[0].integer_reference,
10085 + argument_list[1].integer_reference ? MagickTrue : MagickFalse);
10088 + case 89: /* Shadow */
10090 + if (attribute_flag[0] != 0)
10092 + flags=ParseGeometry(argument_list[0].string_reference,
10094 + if ((flags & SigmaValue) == 0)
10095 + geometry_info.sigma=1.0;
10096 + if ((flags & XiValue) == 0)
10097 + geometry_info.xi=4.0;
10098 + if ((flags & PsiValue) == 0)
10099 + geometry_info.psi=4.0;
10101 + if (attribute_flag[1] != 0)
10102 + geometry_info.rho=argument_list[1].real_reference;
10103 + if (attribute_flag[2] != 0)
10104 + geometry_info.sigma=argument_list[2].real_reference;
10105 + if (attribute_flag[3] != 0)
10106 + geometry_info.xi=argument_list[3].integer_reference;
10107 + if (attribute_flag[4] != 0)
10108 + geometry_info.psi=argument_list[4].integer_reference;
10109 + image=ShadowImage(image,geometry_info.rho,geometry_info.sigma,
10110 + (ssize_t) ceil(geometry_info.xi-0.5),(ssize_t) ceil(geometry_info.psi-
10114 + case 90: /* Identify */
10116 + if (attribute_flag[0] == 0)
10117 + argument_list[0].file_reference=(FILE *) NULL;
10118 + if (attribute_flag[1] != 0)
10119 + (void) SetImageArtifact(image,"identify:features",
10120 + argument_list[1].string_reference);
10121 + if ((attribute_flag[2] != 0) &&
10122 + (argument_list[2].integer_reference != 0))
10123 + (void) SetImageArtifact(image,"identify:unique","true");
10124 + (void) IdentifyImage(image,argument_list[0].file_reference,
10128 + case 91: /* SepiaTone */
10130 + if (attribute_flag[0] == 0)
10131 + argument_list[0].real_reference=80.0*QuantumRange/100.0;
10132 + image=SepiaToneImage(image,argument_list[0].real_reference,
10136 + case 92: /* SigmoidalContrast */
10138 + MagickBooleanType
10141 + if (attribute_flag[0] != 0)
10143 + flags=ParseGeometry(argument_list[0].string_reference,
10145 + if ((flags & SigmaValue) == 0)
10146 + geometry_info.sigma=QuantumRange/2.0;
10147 + if ((flags & PercentValue) != 0)
10148 + geometry_info.sigma=QuantumRange*geometry_info.sigma/100.0;
10150 + if (attribute_flag[1] != 0)
10151 + geometry_info.rho=argument_list[1].real_reference;
10152 + if (attribute_flag[2] != 0)
10153 + geometry_info.sigma=argument_list[2].real_reference;
10154 + if (attribute_flag[3] != 0)
10155 + channel=(ChannelType) argument_list[3].integer_reference;
10156 + sharpen=MagickTrue;
10157 + if (attribute_flag[4] != 0)
10158 + sharpen=argument_list[4].integer_reference != 0 ? MagickTrue :
10160 + (void) SigmoidalContrastImageChannel(image,channel,sharpen,
10161 + geometry_info.rho,geometry_info.sigma);
10164 + case 93: /* Extent */
10166 + if (attribute_flag[7] != 0)
10167 + image->gravity=(GravityType) argument_list[7].integer_reference;
10168 + if (attribute_flag[0] != 0)
10173 + flags=ParseGravityGeometry(image,
10174 + argument_list[0].string_reference,&geometry,exception);
10176 + if (geometry.width == 0)
10177 + geometry.width=image->columns;
10178 + if (geometry.height == 0)
10179 + geometry.height=image->rows;
10181 + if (attribute_flag[1] != 0)
10182 + geometry.width=argument_list[1].integer_reference;
10183 + if (attribute_flag[2] != 0)
10184 + geometry.height=argument_list[2].integer_reference;
10185 + if (attribute_flag[3] != 0)
10186 + geometry.x=argument_list[3].integer_reference;
10187 + if (attribute_flag[4] != 0)
10188 + geometry.y=argument_list[4].integer_reference;
10189 + if (attribute_flag[5] != 0)
10190 + image->fuzz=StringToDoubleInterval(
10191 + argument_list[5].string_reference,(double) QuantumRange+1.0);
10192 + if (attribute_flag[6] != 0)
10193 + (void) QueryColorDatabase(argument_list[6].string_reference,
10194 + &image->background_color,exception);
10195 + image=ExtentImage(image,&geometry,exception);
10198 + case 94: /* Vignette */
10200 + if (attribute_flag[0] != 0)
10202 + flags=ParseGeometry(argument_list[0].string_reference,
10204 + if ((flags & SigmaValue) == 0)
10205 + geometry_info.sigma=1.0;
10206 + if ((flags & XiValue) == 0)
10207 + geometry_info.xi=0.1*image->columns;
10208 + if ((flags & PsiValue) == 0)
10209 + geometry_info.psi=0.1*image->rows;
10211 + if (attribute_flag[1] != 0)
10212 + geometry_info.rho=argument_list[1].real_reference;
10213 + if (attribute_flag[2] != 0)
10214 + geometry_info.sigma=argument_list[2].real_reference;
10215 + if (attribute_flag[3] != 0)
10216 + geometry_info.xi=argument_list[3].integer_reference;
10217 + if (attribute_flag[4] != 0)
10218 + geometry_info.psi=argument_list[4].integer_reference;
10219 + if (attribute_flag[5] != 0)
10220 + (void) QueryColorDatabase(argument_list[5].string_reference,
10221 + &image->background_color,exception);
10222 + image=VignetteImage(image,geometry_info.rho,geometry_info.sigma,
10223 + (ssize_t) ceil(geometry_info.xi-0.5),(ssize_t) ceil(geometry_info.psi-
10227 + case 95: /* ContrastStretch */
10234 + white_point=(MagickRealType) image->columns*image->rows;
10235 + if (attribute_flag[0] != 0)
10237 + flags=ParseGeometry(argument_list[0].string_reference,
10239 + black_point=geometry_info.rho;
10240 + white_point=(flags & SigmaValue) != 0 ? geometry_info.sigma :
10242 + if ((flags & PercentValue) != 0)
10244 + black_point*=(double) image->columns*image->rows/100.0;
10245 + white_point*=(double) image->columns*image->rows/100.0;
10247 + white_point=(MagickRealType) image->columns*image->rows-
10250 + if (attribute_flag[1] != 0)
10251 + black_point=argument_list[1].real_reference;
10252 + if (attribute_flag[2] != 0)
10253 + white_point=argument_list[2].real_reference;
10254 + if (attribute_flag[4] != 0)
10255 + channel=(ChannelType) argument_list[4].integer_reference;
10256 + (void) ContrastStretchImageChannel(image,channel,black_point,
10260 + case 96: /* Sans0 */
10264 + case 97: /* Sans1 */
10268 + case 98: /* AdaptiveSharpen */
10270 + if (attribute_flag[0] != 0)
10272 + flags=ParseGeometry(argument_list[0].string_reference,
10274 + if ((flags & SigmaValue) == 0)
10275 + geometry_info.sigma=1.0;
10277 + if (attribute_flag[1] != 0)
10278 + geometry_info.rho=argument_list[1].real_reference;
10279 + if (attribute_flag[2] != 0)
10280 + geometry_info.sigma=argument_list[2].real_reference;
10281 + if (attribute_flag[3] != 0)
10282 + channel=(ChannelType) argument_list[3].integer_reference;
10283 + image=AdaptiveSharpenImageChannel(image,channel,geometry_info.rho,
10284 + geometry_info.sigma,exception);
10287 + case 99: /* Transpose */
10289 + image=TransposeImage(image,exception);
10292 + case 100: /* Tranverse */
10294 + image=TransverseImage(image,exception);
10297 + case 101: /* AutoOrient */
10299 + image=AutoOrientImage(image,image->orientation,exception);
10302 + case 102: /* AdaptiveBlur */
10304 + if (attribute_flag[0] != 0)
10306 + flags=ParseGeometry(argument_list[0].string_reference,
10308 + if ((flags & SigmaValue) == 0)
10309 + geometry_info.sigma=1.0;
10311 + if (attribute_flag[1] != 0)
10312 + geometry_info.rho=argument_list[1].real_reference;
10313 + if (attribute_flag[2] != 0)
10314 + geometry_info.sigma=argument_list[2].real_reference;
10315 + if (attribute_flag[3] != 0)
10316 + channel=(ChannelType) argument_list[3].integer_reference;
10317 + image=AdaptiveBlurImageChannel(image,channel,geometry_info.rho,
10318 + geometry_info.sigma,exception);
10321 + case 103: /* Sketch */
10323 + if (attribute_flag[0] != 0)
10325 + flags=ParseGeometry(argument_list[0].string_reference,
10327 + if ((flags & SigmaValue) == 0)
10328 + geometry_info.sigma=1.0;
10329 + if ((flags & XiValue) == 0)
10330 + geometry_info.xi=1.0;
10332 + if (attribute_flag[1] != 0)
10333 + geometry_info.rho=argument_list[1].real_reference;
10334 + if (attribute_flag[2] != 0)
10335 + geometry_info.sigma=argument_list[2].real_reference;
10336 + if (attribute_flag[3] != 0)
10337 + geometry_info.xi=argument_list[3].real_reference;
10338 + image=SketchImage(image,geometry_info.rho,geometry_info.sigma,
10339 + geometry_info.xi,exception);
10342 + case 104: /* UniqueColors */
10344 + image=UniqueImageColors(image,exception);
10347 + case 105: /* AdaptiveResize */
10349 + if (attribute_flag[0] != 0)
10350 + flags=ParseRegionGeometry(image,argument_list[0].string_reference,
10351 + &geometry,exception);
10352 + if (attribute_flag[1] != 0)
10353 + geometry.width=argument_list[1].integer_reference;
10354 + if (attribute_flag[2] != 0)
10355 + geometry.height=argument_list[2].integer_reference;
10356 + if (attribute_flag[3] != 0)
10357 + image->filter=(FilterTypes) argument_list[4].integer_reference;
10358 + if (attribute_flag[4] != 0)
10359 + SetImageArtifact(image,"filter:support",
10360 + argument_list[4].string_reference);
10361 + if (attribute_flag[5] != 0)
10362 + image->blur=argument_list[5].real_reference;
10363 + image=AdaptiveResizeImage(image,geometry.width,geometry.height,
10367 + case 106: /* ClipMask */
10369 + if (attribute_flag[0] == 0)
10371 + ThrowPerlException(exception,OptionError,"MaskImageRequired",
10373 + goto PerlException;
10375 + image->clip_mask=CloneImage(argument_list[0].image_reference,0,0,
10376 + MagickTrue,exception);
10377 + (void) NegateImage(image->clip_mask,MagickFalse);
10380 + case 107: /* LinearStretch */
10387 + white_point=(MagickRealType) image->columns*image->rows;
10388 + if (attribute_flag[0] != 0)
10390 + flags=ParseGeometry(argument_list[0].string_reference,
10392 + if ((flags & SigmaValue) != 0)
10393 + white_point=geometry_info.sigma;
10394 + if ((flags & PercentValue) != 0)
10396 + black_point*=(double) image->columns*image->rows/100.0;
10397 + white_point*=(double) image->columns*image->rows/100.0;
10399 + if ((flags & SigmaValue) == 0)
10400 + white_point=(double) image->columns*image->rows-black_point;
10402 + if (attribute_flag[1] != 0)
10403 + black_point=argument_list[1].real_reference;
10404 + if (attribute_flag[2] != 0)
10405 + white_point=argument_list[2].real_reference;
10406 + (void) LinearStretchImage(image,black_point,white_point);
10409 + case 109: /* Mask */
10411 + if (attribute_flag[0] == 0)
10413 + ThrowPerlException(exception,OptionError,"MaskImageRequired",
10415 + goto PerlException;
10417 + image->mask=CloneImage(argument_list[0].image_reference,0,0,
10418 + MagickTrue,exception);
10419 + (void) NegateImage(image->mask,MagickFalse);
10422 + case 110: /* Polaroid */
10430 + draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
10431 + (DrawInfo *) NULL);
10432 + if (attribute_flag[0] != 0)
10433 + (void) SetImageProperty(image,"caption",InterpretImageProperties(
10434 + info ? info->image_info : (ImageInfo *) NULL,image,
10435 + argument_list[0].string_reference));
10437 + if (attribute_flag[1] != 0)
10438 + angle=argument_list[1].real_reference;
10439 + if (attribute_flag[2] != 0)
10440 + (void) CloneString(&draw_info->font,
10441 + argument_list[2].string_reference);
10442 + if (attribute_flag[3] != 0)
10443 + (void) QueryColorDatabase(argument_list[3].string_reference,
10444 + &draw_info->stroke,exception);
10445 + if (attribute_flag[4] != 0)
10446 + (void) QueryColorDatabase(argument_list[4].string_reference,
10447 + &draw_info->fill,exception);
10448 + if (attribute_flag[5] != 0)
10449 + draw_info->stroke_width=argument_list[5].real_reference;
10450 + if (attribute_flag[6] != 0)
10451 + draw_info->pointsize=argument_list[6].real_reference;
10452 + if (attribute_flag[7] != 0)
10453 + draw_info->gravity=(GravityType) argument_list[7].integer_reference;
10454 + if (attribute_flag[8] != 0)
10455 + (void) QueryColorDatabase(argument_list[8].string_reference,
10456 + &image->background_color,exception);
10457 + image=PolaroidImage(image,draw_info,angle,exception);
10458 + draw_info=DestroyDrawInfo(draw_info);
10461 + case 111: /* FloodfillPaint */
10466 + MagickBooleanType
10469 + MagickPixelPacket
10472 + draw_info=CloneDrawInfo(info ? info->image_info :
10473 + (ImageInfo *) NULL,(DrawInfo *) NULL);
10474 + if (attribute_flag[0] != 0)
10475 + flags=ParsePageGeometry(image,argument_list[0].string_reference,
10476 + &geometry,exception);
10477 + if (attribute_flag[1] != 0)
10478 + geometry.x=argument_list[1].integer_reference;
10479 + if (attribute_flag[2] != 0)
10480 + geometry.y=argument_list[2].integer_reference;
10481 + if (attribute_flag[3] != 0)
10482 + (void) QueryColorDatabase(argument_list[3].string_reference,
10483 + &draw_info->fill,exception);
10484 + (void) GetOneVirtualMagickPixel(image,geometry.x,geometry.y,&target,
10486 + if (attribute_flag[4] != 0)
10487 + QueryMagickColor(argument_list[4].string_reference,&target,
10489 + if (attribute_flag[5] != 0)
10490 + image->fuzz=StringToDoubleInterval(
10491 + argument_list[5].string_reference,(double) QuantumRange+1.0);
10492 + if (attribute_flag[6] != 0)
10493 + channel=(ChannelType) argument_list[6].integer_reference;
10494 + invert=MagickFalse;
10495 + if (attribute_flag[7] != 0)
10496 + invert=(MagickBooleanType) argument_list[7].integer_reference;
10497 + (void) FloodfillPaintImage(image,channel,draw_info,&target,geometry.x,
10498 + geometry.y,invert);
10499 + draw_info=DestroyDrawInfo(draw_info);
10502 + case 112: /* Distort */
10510 + DistortImageMethod
10514 + number_coordinates;
10516 + VirtualPixelMethod
10519 + if (attribute_flag[0] == 0)
10521 + method=UndefinedDistortion;
10522 + if (attribute_flag[1] != 0)
10523 + method=(DistortImageMethod) argument_list[1].integer_reference;
10524 + av=(AV *) argument_list[0].array_reference;
10525 + number_coordinates=(size_t) av_len(av)+1;
10526 + coordinates=(double *) AcquireQuantumMemory(number_coordinates,
10527 + sizeof(*coordinates));
10528 + if (coordinates == (double *) NULL)
10530 + ThrowPerlException(exception,ResourceLimitFatalError,
10531 + "MemoryAllocationFailed",PackageName);
10532 + goto PerlException;
10534 + for (j=0; j < (ssize_t) number_coordinates; j++)
10535 + coordinates[j]=(double) SvNV(*(av_fetch(av,j,0)));
10536 + virtual_pixel=UndefinedVirtualPixelMethod;
10537 + if (attribute_flag[2] != 0)
10538 + virtual_pixel=SetImageVirtualPixelMethod(image,(VirtualPixelMethod)
10539 + argument_list[2].integer_reference);
10540 + image=DistortImage(image,method,number_coordinates,coordinates,
10541 + argument_list[3].integer_reference != 0 ? MagickTrue : MagickFalse,
10543 + if ((attribute_flag[2] != 0) && (image != (Image *) NULL))
10544 + virtual_pixel=SetImageVirtualPixelMethod(image,virtual_pixel);
10545 + coordinates=(double *) RelinquishMagickMemory(coordinates);
10548 + case 113: /* Clut */
10550 + if (attribute_flag[0] == 0)
10552 + ThrowPerlException(exception,OptionError,"ClutImageRequired",
10554 + goto PerlException;
10556 + if (attribute_flag[1] != 0)
10557 + channel=(ChannelType) argument_list[1].integer_reference;
10558 + (void) ClutImageChannel(image,channel,
10559 + argument_list[0].image_reference);
10562 + case 114: /* LiquidRescale */
10564 + if (attribute_flag[0] != 0)
10565 + flags=ParseRegionGeometry(image,argument_list[0].string_reference,
10566 + &geometry,exception);
10567 + if (attribute_flag[1] != 0)
10568 + geometry.width=argument_list[1].integer_reference;
10569 + if (attribute_flag[2] != 0)
10570 + geometry.height=argument_list[2].integer_reference;
10571 + if (attribute_flag[3] == 0)
10572 + argument_list[3].real_reference=1.0;
10573 + if (attribute_flag[4] == 0)
10574 + argument_list[4].real_reference=0.0;
10575 + image=LiquidRescaleImage(image,geometry.width,geometry.height,
10576 + argument_list[3].real_reference,argument_list[4].real_reference,
10580 + case 115: /* EncipherImage */
10582 + (void) EncipherImage(image,argument_list[0].string_reference,
10586 + case 116: /* DecipherImage */
10588 + (void) DecipherImage(image,argument_list[0].string_reference,
10592 + case 117: /* Deskew */
10594 + geometry_info.rho=QuantumRange/2.0;
10595 + if (attribute_flag[0] != 0)
10596 + flags=ParseGeometry(argument_list[0].string_reference,
10598 + if (attribute_flag[1] != 0)
10599 + geometry_info.rho=StringToDoubleInterval(
10600 + argument_list[1].string_reference,(double) QuantumRange+1.0);
10601 + image=DeskewImage(image,geometry_info.rho,exception);
10604 + case 118: /* Remap */
10609 + if (attribute_flag[0] == 0)
10611 + ThrowPerlException(exception,OptionError,"RemapImageRequired",
10613 + goto PerlException;
10615 + quantize_info=AcquireQuantizeInfo(info->image_info);
10616 + if (attribute_flag[1] != 0)
10617 + quantize_info->dither=(MagickBooleanType)
10618 + argument_list[1].integer_reference;
10619 + if (attribute_flag[2] != 0)
10620 + quantize_info->dither_method=(DitherMethod)
10621 + argument_list[2].integer_reference;
10622 + (void) RemapImages(quantize_info,image,
10623 + argument_list[0].image_reference);
10624 + quantize_info=DestroyQuantizeInfo(quantize_info);
10627 + case 119: /* SparseColor */
10635 + SparseColorMethod
10639 + number_coordinates;
10641 + VirtualPixelMethod
10644 + if (attribute_flag[0] == 0)
10646 + method=UndefinedColorInterpolate;
10647 + if (attribute_flag[1] != 0)
10648 + method=(SparseColorMethod) argument_list[1].integer_reference;
10649 + av=(AV *) argument_list[0].array_reference;
10650 + number_coordinates=(size_t) av_len(av)+1;
10651 + coordinates=(double *) AcquireQuantumMemory(number_coordinates,
10652 + sizeof(*coordinates));
10653 + if (coordinates == (double *) NULL)
10655 + ThrowPerlException(exception,ResourceLimitFatalError,
10656 + "MemoryAllocationFailed",PackageName);
10657 + goto PerlException;
10659 + for (j=0; j < (ssize_t) number_coordinates; j++)
10660 + coordinates[j]=(double) SvNV(*(av_fetch(av,j,0)));
10661 + virtual_pixel=UndefinedVirtualPixelMethod;
10662 + if (attribute_flag[2] != 0)
10663 + virtual_pixel=SetImageVirtualPixelMethod(image,(VirtualPixelMethod)
10664 + argument_list[2].integer_reference);
10665 + if (attribute_flag[3] != 0)
10666 + channel=(ChannelType) argument_list[3].integer_reference;
10667 + image=SparseColorImage(image,channel,method,number_coordinates,
10668 + coordinates,exception);
10669 + if ((attribute_flag[2] != 0) && (image != (Image *) NULL))
10670 + virtual_pixel=SetImageVirtualPixelMethod(image,virtual_pixel);
10671 + coordinates=(double *) RelinquishMagickMemory(coordinates);
10674 + case 120: /* Function */
10686 + number_parameters;
10688 + VirtualPixelMethod
10691 + if (attribute_flag[0] == 0)
10693 + function=UndefinedFunction;
10694 + if (attribute_flag[1] != 0)
10695 + function=(MagickFunction) argument_list[1].integer_reference;
10696 + av=(AV *) argument_list[0].array_reference;
10697 + number_parameters=(size_t) av_len(av)+1;
10698 + parameters=(double *) AcquireQuantumMemory(number_parameters,
10699 + sizeof(*parameters));
10700 + if (parameters == (double *) NULL)
10702 + ThrowPerlException(exception,ResourceLimitFatalError,
10703 + "MemoryAllocationFailed",PackageName);
10704 + goto PerlException;
10706 + for (j=0; j < (ssize_t) number_parameters; j++)
10707 + parameters[j]=(double) SvNV(*(av_fetch(av,j,0)));
10708 + virtual_pixel=UndefinedVirtualPixelMethod;
10709 + if (attribute_flag[2] != 0)
10710 + virtual_pixel=SetImageVirtualPixelMethod(image,(VirtualPixelMethod)
10711 + argument_list[2].integer_reference);
10712 + (void) FunctionImage(image,function,number_parameters,parameters,
10714 + if ((attribute_flag[2] != 0) && (image != (Image *) NULL))
10715 + virtual_pixel=SetImageVirtualPixelMethod(image,virtual_pixel);
10716 + parameters=(double *) RelinquishMagickMemory(parameters);
10719 + case 121: /* SelectiveBlur */
10721 + if (attribute_flag[0] != 0)
10723 + flags=ParseGeometry(argument_list[0].string_reference,
10725 + if ((flags & SigmaValue) == 0)
10726 + geometry_info.sigma=1.0;
10727 + if ((flags & PercentValue) != 0)
10728 + geometry_info.xi=QuantumRange*geometry_info.xi/100.0;
10730 + if (attribute_flag[1] != 0)
10731 + geometry_info.rho=argument_list[1].real_reference;
10732 + if (attribute_flag[2] != 0)
10733 + geometry_info.sigma=argument_list[2].real_reference;
10734 + if (attribute_flag[3] != 0)
10735 + geometry_info.xi=argument_list[3].integer_reference;;
10736 + if (attribute_flag[4] != 0)
10737 + channel=(ChannelType) argument_list[4].integer_reference;
10738 + image=SelectiveBlurImageChannel(image,channel,geometry_info.rho,
10739 + geometry_info.sigma,geometry_info.xi,exception);
10742 + case 122: /* HaldClut */
10744 + if (attribute_flag[0] == 0)
10746 + ThrowPerlException(exception,OptionError,"ClutImageRequired",
10748 + goto PerlException;
10750 + if (attribute_flag[1] != 0)
10751 + channel=(ChannelType) argument_list[1].integer_reference;
10752 + (void) HaldClutImageChannel(image,channel,
10753 + argument_list[0].image_reference);
10756 + case 123: /* BlueShift */
10758 + if (attribute_flag[0] != 0)
10759 + (void) ParseGeometry(argument_list[0].string_reference,
10761 + image=BlueShiftImage(image,geometry_info.rho,exception);
10764 + case 124: /* ForwardFourierTransformImage */
10766 + image=ForwardFourierTransformImage(image,
10767 + argument_list[0].integer_reference != 0 ? MagickTrue : MagickFalse,
10771 + case 125: /* InverseFourierTransformImage */
10773 + image=InverseFourierTransformImage(image,image->next,
10774 + argument_list[0].integer_reference != 0 ? MagickTrue : MagickFalse,
10778 + case 126: /* ColorDecisionList */
10780 + if (attribute_flag[0] == 0)
10781 + argument_list[0].string_reference=(char *) NULL;
10782 + (void) ColorDecisionListImage(image,
10783 + argument_list[0].string_reference);
10786 + case 127: /* AutoGamma */
10788 + if (attribute_flag[0] != 0)
10789 + channel=(ChannelType) argument_list[0].integer_reference;
10790 + (void) AutoGammaImageChannel(image,channel);
10793 + case 128: /* AutoLevel */
10795 + if (attribute_flag[0] != 0)
10796 + channel=(ChannelType) argument_list[0].integer_reference;
10797 + (void) AutoLevelImageChannel(image,channel);
10800 + case 129: /* LevelColors */
10802 + MagickPixelPacket
10806 + (void) QueryMagickColor("#000000",&black_point,exception);
10807 + (void) QueryMagickColor("#ffffff",&white_point,exception);
10808 + if (attribute_flag[1] != 0)
10809 + (void) QueryMagickColor(argument_list[1].string_reference,
10810 + &black_point,exception);
10811 + if (attribute_flag[2] != 0)
10812 + (void) QueryMagickColor(argument_list[2].string_reference,
10813 + &white_point,exception);
10814 + if (attribute_flag[3] != 0)
10815 + channel=(ChannelType) argument_list[3].integer_reference;
10816 + (void) LevelColorsImageChannel(image,channel,&black_point,
10817 + &white_point,argument_list[0].integer_reference != 0 ? MagickTrue :
10821 + case 130: /* Clamp */
10823 + if (attribute_flag[0] != 0)
10824 + channel=(ChannelType) argument_list[0].integer_reference;
10825 + (void) ClampImageChannel(image,channel);
10828 + case 131: /* Filter */
10833 + if (attribute_flag[0] == 0)
10835 + kernel=AcquireKernelInfo(argument_list[0].string_reference);
10836 + if (kernel == (KernelInfo *) NULL)
10838 + if (attribute_flag[1] != 0)
10839 + channel=(ChannelType) argument_list[1].integer_reference;
10840 + if (attribute_flag[2] != 0)
10841 + image->bias=StringToDoubleInterval(
10842 + argument_list[2].string_reference,(double) QuantumRange+1.0);
10843 + image=FilterImageChannel(image,channel,kernel,exception);
10844 + kernel=DestroyKernelInfo(kernel);
10847 + case 132: /* BrightnessContrast */
10855 + if (attribute_flag[0] != 0)
10857 + flags=ParseGeometry(argument_list[0].string_reference,
10859 + brightness=geometry_info.rho;
10860 + if ((flags & SigmaValue) == 0)
10861 + contrast=geometry_info.sigma;
10863 + if (attribute_flag[1] != 0)
10864 + brightness=argument_list[1].real_reference;
10865 + if (attribute_flag[2] != 0)
10866 + contrast=argument_list[2].real_reference;
10867 + if (attribute_flag[4] != 0)
10868 + channel=(ChannelType) argument_list[4].integer_reference;
10869 + (void) BrightnessContrastImageChannel(image,channel,brightness,
10873 + case 133: /* Morphology */
10884 + if (attribute_flag[0] == 0)
10886 + kernel=AcquireKernelInfo(argument_list[0].string_reference);
10887 + if (kernel == (KernelInfo *) NULL)
10889 + if (attribute_flag[1] != 0)
10890 + channel=(ChannelType) argument_list[1].integer_reference;
10891 + method=UndefinedMorphology;
10892 + if (attribute_flag[2] != 0)
10893 + method=argument_list[2].integer_reference;
10895 + if (attribute_flag[3] != 0)
10896 + iterations=argument_list[3].integer_reference;
10897 + image=MorphologyImageChannel(image,channel,method,iterations,kernel,
10899 + kernel=DestroyKernelInfo(kernel);
10902 + case 108: /* Recolor */
10903 + case 134: /* ColorMatrix */
10917 + if (attribute_flag[0] == 0)
10919 + av=(AV *) argument_list[0].array_reference;
10920 + order=(size_t) sqrt(av_len(av)+1);
10921 + color_matrix=(double *) AcquireQuantumMemory(order,order*
10922 + sizeof(*color_matrix));
10923 + if (color_matrix == (double *) NULL)
10925 + ThrowPerlException(exception,ResourceLimitFatalError,
10926 + "MemoryAllocationFailed",PackageName);
10927 + goto PerlException;
10929 + for (j=0; (j < (ssize_t) (order*order)) && (j < (av_len(av)+1)); j++)
10930 + color_matrix[j]=(double) SvNV(*(av_fetch(av,j,0)));
10931 + for ( ; j < (ssize_t) (order*order); j++)
10932 + color_matrix[j]=0.0;
10933 + kernel_info=AcquireKernelInfo("1");
10934 + if (kernel_info == (KernelInfo *) NULL)
10936 + kernel_info->width=order;
10937 + kernel_info->height=order;
10938 + kernel_info->values=color_matrix;
10939 + image=ColorMatrixImage(image,kernel_info,exception);
10940 + kernel_info->values=(double *) NULL;
10941 + kernel_info=DestroyKernelInfo(kernel_info);
10942 + color_matrix=(double *) RelinquishMagickMemory(color_matrix);
10945 + case 135: /* Color */
10947 + MagickPixelPacket
10950 + (void) QueryMagickColor("none",&color,exception);
10951 + if (attribute_flag[0] != 0)
10952 + (void) QueryMagickColor(argument_list[0].string_reference,
10953 + &color,exception);
10954 + (void) SetImageColor(image,&color);
10957 + case 136: /* Mode */
10959 + if (attribute_flag[0] != 0)
10961 + flags=ParseGeometry(argument_list[0].string_reference,
10963 + if ((flags & SigmaValue) == 0)
10964 + geometry_info.sigma=1.0;
10966 + if (attribute_flag[1] != 0)
10967 + geometry_info.rho=argument_list[1].real_reference;
10968 + if (attribute_flag[2] != 0)
10969 + geometry_info.sigma=argument_list[2].real_reference;
10970 + if (attribute_flag[3] != 0)
10971 + channel=(ChannelType) argument_list[3].integer_reference;
10972 + image=StatisticImageChannel(image,channel,ModeStatistic,
10973 + (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
10976 + case 137: /* Statistic */
10981 + statistic=UndefinedStatistic;
10982 + if (attribute_flag[0] != 0)
10984 + flags=ParseGeometry(argument_list[0].string_reference,
10986 + if ((flags & SigmaValue) == 0)
10987 + geometry_info.sigma=1.0;
10989 + if (attribute_flag[1] != 0)
10990 + geometry_info.rho=argument_list[1].real_reference;
10991 + if (attribute_flag[2] != 0)
10992 + geometry_info.sigma=argument_list[2].real_reference;
10993 + if (attribute_flag[3] != 0)
10994 + channel=(ChannelType) argument_list[3].integer_reference;
10995 + if (attribute_flag[4] != 0)
10996 + statistic=(StatisticType) argument_list[4].integer_reference;
10997 + image=StatisticImageChannel(image,channel,statistic,
10998 + (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
11001 + case 138: /* Perceptible */
11006 + epsilon=MagickEpsilon;
11007 + if (attribute_flag[0] != 0)
11008 + epsilon=argument_list[0].real_reference;
11009 + if (attribute_flag[1] != 0)
11010 + channel=(ChannelType) argument_list[1].integer_reference;
11011 + (void) PerceptibleImageChannel(image,channel,epsilon);
11014 + case 139: /* Poly */
11025 + if (attribute_flag[0] == 0)
11027 + if (attribute_flag[1] != 0)
11028 + channel=(ChannelType) argument_list[1].integer_reference;
11029 + av=(AV *) argument_list[0].array_reference;
11030 + number_terms=(size_t) av_len(av);
11031 + terms=(double *) AcquireQuantumMemory(number_terms,sizeof(*terms));
11032 + if (terms == (double *) NULL)
11034 + ThrowPerlException(exception,ResourceLimitFatalError,
11035 + "MemoryAllocationFailed",PackageName);
11036 + goto PerlException;
11038 + for (j=0; j < av_len(av); j++)
11039 + terms[j]=(double) SvNV(*(av_fetch(av,j,0)));
11040 + image=PolynomialImageChannel(image,channel,number_terms >> 1,terms,
11042 + terms=(double *) RelinquishMagickMemory(terms);
11045 + case 140: /* Grayscale */
11047 + PixelIntensityMethod
11050 + method=UndefinedPixelIntensityMethod;
11051 + if (attribute_flag[0] != 0)
11052 + method=(PixelIntensityMethod) argument_list[0].integer_reference;
11053 + (void) GrayscaleImage(image,method);
11056 + case 141: /* CannyEdge */
11058 + if (attribute_flag[0] != 0)
11060 + flags=ParseGeometry(argument_list[0].string_reference,
11062 + if ((flags & SigmaValue) == 0)
11063 + geometry_info.sigma=1.0;
11064 + if ((flags & XiValue) == 0)
11065 + geometry_info.xi=0.10;
11066 + if ((flags & PsiValue) == 0)
11067 + geometry_info.psi=0.30;
11068 + if ((flags & PercentValue) != 0)
11070 + geometry_info.xi/=100.0;
11071 + geometry_info.psi/=100.0;
11074 + if (attribute_flag[1] != 0)
11075 + geometry_info.rho=argument_list[1].real_reference;
11076 + if (attribute_flag[2] != 0)
11077 + geometry_info.sigma=argument_list[2].real_reference;
11078 + if (attribute_flag[3] != 0)
11079 + geometry_info.xi=argument_list[3].real_reference;
11080 + if (attribute_flag[4] != 0)
11081 + geometry_info.psi=argument_list[4].real_reference;
11082 + image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
11083 + geometry_info.xi,geometry_info.psi,exception);
11086 + case 142: /* HoughLine */
11088 + if (attribute_flag[0] != 0)
11090 + flags=ParseGeometry(argument_list[0].string_reference,
11092 + if ((flags & SigmaValue) == 0)
11093 + geometry_info.sigma=geometry_info.rho;
11094 + if ((flags & XiValue) == 0)
11095 + geometry_info.xi=40;
11097 + if (attribute_flag[1] != 0)
11098 + geometry_info.rho=(double) argument_list[1].integer_reference;
11099 + if (attribute_flag[2] != 0)
11100 + geometry_info.sigma=(double) argument_list[2].integer_reference;
11101 + if (attribute_flag[3] != 0)
11102 + geometry_info.xi=(double) argument_list[3].integer_reference;
11103 + image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
11104 + geometry_info.sigma,(size_t) geometry_info.xi,exception);
11107 + case 143: /* MeanShift */
11109 + if (attribute_flag[0] != 0)
11111 + flags=ParseGeometry(argument_list[0].string_reference,
11113 + if ((flags & SigmaValue) == 0)
11114 + geometry_info.sigma=geometry_info.rho;
11115 + if ((flags & XiValue) == 0)
11116 + geometry_info.xi=0.10*QuantumRange;
11117 + if ((flags & PercentValue) != 0)
11118 + geometry_info.xi=QuantumRange*geometry_info.xi/100.0;
11120 + if (attribute_flag[1] != 0)
11121 + geometry_info.rho=(double) argument_list[1].integer_reference;
11122 + if (attribute_flag[2] != 0)
11123 + geometry_info.sigma=(double) argument_list[2].integer_reference;
11124 + if (attribute_flag[3] != 0)
11125 + geometry_info.xi=(double) argument_list[3].real_reference;
11126 + image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
11127 + geometry_info.sigma,geometry_info.xi,exception);
11130 + case 144: /* Kuwahara */
11132 + if (attribute_flag[0] != 0)
11134 + flags=ParseGeometry(argument_list[0].string_reference,
11136 + if ((flags & SigmaValue) == 0)
11137 + geometry_info.sigma=geometry_info.rho-0.5;
11139 + if (attribute_flag[1] != 0)
11140 + geometry_info.rho=argument_list[1].real_reference;
11141 + if (attribute_flag[2] != 0)
11142 + geometry_info.sigma=argument_list[2].real_reference;
11143 + if (attribute_flag[3] != 0)
11144 + channel=(ChannelType) argument_list[3].integer_reference;
11145 + image=KuwaharaImageChannel(image,channel,geometry_info.rho,
11146 + geometry_info.sigma,exception);
11149 + case 145: /* ConnectedComponent */
11155 + if (attribute_flag[0] != 0)
11156 + connectivity=argument_list[0].integer_reference;
11157 + image=ConnectedComponentsImage(image,connectivity,exception);
11160 + case 146: /* Copy */
11171 + source_image=image;
11172 + if (attribute_flag[0] != 0)
11173 + source_image=argument_list[0].image_reference;
11174 + SetGeometry(source_image,&geometry);
11175 + if (attribute_flag[1] != 0)
11176 + flags=ParseGravityGeometry(source_image,
11177 + argument_list[1].string_reference,&geometry,exception);
11178 + if (attribute_flag[2] != 0)
11179 + geometry.width=argument_list[2].integer_reference;
11180 + if (attribute_flag[3] != 0)
11181 + geometry.height=argument_list[3].integer_reference;
11182 + if (attribute_flag[4] != 0)
11183 + geometry.x=argument_list[4].integer_reference;
11184 + if (attribute_flag[5] != 0)
11185 + geometry.y=argument_list[5].integer_reference;
11186 + if (attribute_flag[6] != 0)
11187 + image->gravity=(GravityType) argument_list[6].integer_reference;
11188 + SetGeometry(image,&offset_geometry);
11189 + if (attribute_flag[7] != 0)
11190 + flags=ParseGravityGeometry(image,argument_list[7].string_reference,
11191 + &offset_geometry,exception);
11192 + offset.x=offset_geometry.x;
11193 + offset.y=offset_geometry.y;
11194 + if (attribute_flag[8] != 0)
11195 + offset.x=argument_list[8].integer_reference;
11196 + if (attribute_flag[9] != 0)
11197 + offset.y=argument_list[9].integer_reference;
11198 + (void) CopyImagePixels(image,source_image,&geometry,&offset,
11202 + case 147: /* WaveletDenoise */
11204 + if (attribute_flag[0] != 0)
11206 + flags=ParseGeometry(argument_list[0].string_reference,
11208 + if ((flags & PercentValue) != 0)
11210 + geometry_info.rho=QuantumRange*geometry_info.rho/100.0;
11211 + geometry_info.sigma=QuantumRange*geometry_info.sigma/100.0;
11213 + if ((flags & SigmaValue) == 0)
11214 + geometry_info.sigma=0.0;
11216 + if (attribute_flag[1] != 0)
11217 + geometry_info.rho=argument_list[1].real_reference;
11218 + if (attribute_flag[2] != 0)
11219 + geometry_info.sigma=argument_list[2].real_reference;
11220 + image=WaveletDenoiseImage(image,geometry_info.rho,geometry_info.sigma,
11225 + if (next != (Image *) NULL)
11226 + (void) CatchImageException(next);
11227 + if (region_image != (Image *) NULL)
11230 + Composite region.
11232 + status=CompositeImage(region_image,CopyCompositeOp,image,
11233 + region_info.x,region_info.y);
11235 + (void) CatchImageException(region_image);
11236 + image=DestroyImage(image);
11237 + image=region_image;
11239 + if (image != (Image *) NULL)
11242 + if (next && (next != image))
11244 + image->next=next->next;
11245 + if (image->next != (Image *) NULL)
11246 + image->next->previous=image;
11247 + DeleteImageFromRegistry(*pv,next);
11249 + sv_setiv(*pv,PTR2IV(image));
11257 + if (reference_vector)
11258 + reference_vector=(SV **) RelinquishMagickMemory(reference_vector);
11259 + InheritPerlException(exception,perl_exception);
11260 + exception=DestroyExceptionInfo(exception);
11261 + sv_setiv(perl_exception,(IV) number_images);
11262 + SvPOK_on(perl_exception);
11263 + ST(0)=sv_2mortal(perl_exception);
11268 +###############################################################################
11276 +###############################################################################
11281 + Image::Magick ref = NO_INIT
11304 + MagickPixelPacket
11305 + transparent_color;
11316 + struct PackageInfo
11326 + PERL_UNUSED_VAR(ref);
11327 + PERL_UNUSED_VAR(ix);
11328 + exception=AcquireExceptionInfo();
11329 + perl_exception=newSVpv("",0);
11332 + if (sv_isobject(ST(0)) == 0)
11334 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
11336 + goto PerlException;
11338 + reference=SvRV(ST(0));
11339 + hv=SvSTASH(reference);
11341 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
11342 + SvREFCNT_dec(av);
11343 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
11344 + if (image == (Image *) NULL)
11346 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
11348 + goto PerlException;
11353 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
11354 + montage_info=CloneMontageInfo(info->image_info,(MontageInfo *) NULL);
11355 + (void) QueryMagickColor("none",&transparent_color,exception);
11356 + for (i=2; i < items; i+=2)
11358 + attribute=(char *) SvPV(ST(i-1),na);
11359 + switch (*attribute)
11364 + if (LocaleCompare(attribute,"background") == 0)
11366 + (void) QueryColorDatabase(SvPV(ST(i),na),
11367 + &montage_info->background_color,exception);
11368 + for (next=image; next; next=next->next)
11369 + next->background_color=montage_info->background_color;
11372 + if (LocaleCompare(attribute,"border") == 0)
11374 + montage_info->border_width=SvIV(ST(i));
11377 + if (LocaleCompare(attribute,"bordercolor") == 0)
11379 + (void) QueryColorDatabase(SvPV(ST(i),na),
11380 + &montage_info->border_color,exception);
11381 + for (next=image; next; next=next->next)
11382 + next->border_color=montage_info->border_color;
11385 + if (LocaleCompare(attribute,"borderwidth") == 0)
11387 + montage_info->border_width=SvIV(ST(i));
11390 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11397 + if (LocaleCompare(attribute,"compose") == 0)
11399 + sp=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
11400 + MagickComposeOptions,MagickFalse,SvPV(ST(i),na));
11403 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
11407 + for (next=image; next; next=next->next)
11408 + next->compose=(CompositeOperator) sp;
11411 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11418 + if (LocaleCompare(attribute,"fill") == 0)
11420 + (void) QueryColorDatabase(SvPV(ST(i),na),&montage_info->fill,
11424 + if (LocaleCompare(attribute,"font") == 0)
11426 + (void) CloneString(&montage_info->font,SvPV(ST(i),na));
11429 + if (LocaleCompare(attribute,"frame") == 0)
11434 + p=SvPV(ST(i),na);
11435 + if (IsGeometry(p) == MagickFalse)
11437 + ThrowPerlException(exception,OptionError,"MissingGeometry",
11441 + (void) CloneString(&montage_info->frame,p);
11443 + montage_info->frame=(char *) NULL;
11446 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11453 + if (LocaleCompare(attribute,"geometry") == 0)
11458 + p=SvPV(ST(i),na);
11459 + if (IsGeometry(p) == MagickFalse)
11461 + ThrowPerlException(exception,OptionError,"MissingGeometry",
11465 + (void) CloneString(&montage_info->geometry,p);
11467 + montage_info->geometry=(char *) NULL;
11470 + if (LocaleCompare(attribute,"gravity") == 0)
11475 + in=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
11476 + MagickGravityOptions,MagickFalse,SvPV(ST(i),na));
11479 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
11483 + montage_info->gravity=(GravityType) in;
11484 + for (next=image; next; next=next->next)
11485 + next->gravity=(GravityType) in;
11488 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11495 + if (LocaleCompare(attribute,"label") == 0)
11497 + for (next=image; next; next=next->next)
11498 + (void) SetImageProperty(next,"label",InterpretImageProperties(
11499 + info ? info->image_info : (ImageInfo *) NULL,next,
11500 + SvPV(ST(i),na)));
11503 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11510 + if (LocaleCompare(attribute,"mattecolor") == 0)
11512 + (void) QueryColorDatabase(SvPV(ST(i),na),
11513 + &montage_info->matte_color,exception);
11514 + for (next=image; next; next=next->next)
11515 + next->matte_color=montage_info->matte_color;
11518 + if (LocaleCompare(attribute,"mode") == 0)
11523 + in=!SvPOK(ST(i)) ? SvIV(ST(i)) :
11524 + ParseCommandOption(MagickModeOptions,MagickFalse,SvPV(ST(i),na));
11529 + ThrowPerlException(exception,OptionError,
11530 + "UnrecognizedModeType",SvPV(ST(i),na));
11535 + (void) CloneString(&montage_info->frame,"15x15+3+3");
11536 + montage_info->shadow=MagickTrue;
11539 + case UnframeMode:
11541 + montage_info->frame=(char *) NULL;
11542 + montage_info->shadow=MagickFalse;
11543 + montage_info->border_width=0;
11546 + case ConcatenateMode:
11548 + montage_info->frame=(char *) NULL;
11549 + montage_info->shadow=MagickFalse;
11550 + (void) CloneString(&montage_info->geometry,"+0+0");
11551 + montage_info->border_width=0;
11556 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11563 + if (LocaleCompare(attribute,"pointsize") == 0)
11565 + montage_info->pointsize=SvIV(ST(i));
11568 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11575 + if (LocaleCompare(attribute,"shadow") == 0)
11577 + sp=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
11578 + MagickBooleanOptions,MagickFalse,SvPV(ST(i),na));
11581 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
11585 + montage_info->shadow=sp != 0 ? MagickTrue : MagickFalse;
11588 + if (LocaleCompare(attribute,"stroke") == 0)
11590 + (void) QueryColorDatabase(SvPV(ST(i),na),&montage_info->stroke,
11594 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11601 + if (LocaleCompare(attribute,"texture") == 0)
11603 + (void) CloneString(&montage_info->texture,SvPV(ST(i),na));
11606 + if (LocaleCompare(attribute,"tile") == 0)
11608 + char *p=SvPV(ST(i),na);
11609 + if (IsGeometry(p) == MagickFalse)
11611 + ThrowPerlException(exception,OptionError,"MissingGeometry",
11615 + (void) CloneString(&montage_info->tile,p);
11617 + montage_info->tile=(char *) NULL;
11620 + if (LocaleCompare(attribute,"title") == 0)
11622 + (void) CloneString(&montage_info->title,SvPV(ST(i),na));
11625 + if (LocaleCompare(attribute,"transparent") == 0)
11627 + MagickPixelPacket
11628 + transparent_color;
11630 + QueryMagickColor(SvPV(ST(i),na),&transparent_color,exception);
11631 + for (next=image; next; next=next->next)
11632 + (void) TransparentPaintImage(next,&transparent_color,
11633 + TransparentOpacity,MagickFalse);
11636 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11642 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11648 + image=MontageImageList(info->image_info,montage_info,image,exception);
11649 + montage_info=DestroyMontageInfo(montage_info);
11650 + if (image == (Image *) NULL)
11651 + goto PerlException;
11652 + if (transparent_color.opacity != TransparentOpacity)
11653 + for (next=image; next; next=next->next)
11654 + (void) TransparentPaintImage(next,&transparent_color,
11655 + TransparentOpacity,MagickFalse);
11656 + for ( ; image; image=image->next)
11658 + AddImageToRegistry(sv,image);
11660 + av_push(av,sv_bless(rv,hv));
11661 + SvREFCNT_dec(sv);
11663 + exception=DestroyExceptionInfo(exception);
11664 + ST(0)=av_reference;
11665 + SvREFCNT_dec(perl_exception);
11669 + InheritPerlException(exception,perl_exception);
11670 + exception=DestroyExceptionInfo(exception);
11671 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
11672 + SvPOK_on(perl_exception);
11673 + ST(0)=sv_2mortal(perl_exception);
11678 +###############################################################################
11686 +###############################################################################
11691 + Image::Magick ref = NO_INIT
11719 + struct PackageInfo
11729 + PERL_UNUSED_VAR(ref);
11730 + PERL_UNUSED_VAR(ix);
11731 + exception=AcquireExceptionInfo();
11732 + perl_exception=newSVpv("",0);
11736 + if (sv_isobject(ST(0)) == 0)
11738 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
11740 + goto PerlException;
11742 + reference=SvRV(ST(0));
11743 + hv=SvSTASH(reference);
11745 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
11746 + SvREFCNT_dec(av);
11747 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
11748 + if (image == (Image *) NULL)
11750 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
11752 + goto PerlException;
11754 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
11758 + number_frames=30;
11759 + for (i=2; i < items; i+=2)
11761 + attribute=(char *) SvPV(ST(i-1),na);
11762 + switch (*attribute)
11767 + if (LocaleCompare(attribute,"frames") == 0)
11769 + number_frames=SvIV(ST(i));
11772 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11778 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
11784 + image=MorphImages(image,number_frames,exception);
11785 + if (image == (Image *) NULL)
11786 + goto PerlException;
11787 + for ( ; image; image=image->next)
11789 + AddImageToRegistry(sv,image);
11791 + av_push(av,sv_bless(rv,hv));
11792 + SvREFCNT_dec(sv);
11794 + exception=DestroyExceptionInfo(exception);
11795 + ST(0)=av_reference;
11796 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
11800 + InheritPerlException(exception,perl_exception);
11801 + exception=DestroyExceptionInfo(exception);
11802 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
11803 + SvPOK_on(perl_exception);
11804 + ST(0)=sv_2mortal(perl_exception);
11809 +###############################################################################
11817 +###############################################################################
11822 + Image::Magick ref = NO_INIT
11841 + struct PackageInfo
11850 + PERL_UNUSED_VAR(ref);
11851 + PERL_UNUSED_VAR(ix);
11852 + exception=AcquireExceptionInfo();
11853 + perl_exception=newSVpv("",0);
11855 + if (sv_isobject(ST(0)) == 0)
11857 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
11859 + goto PerlException;
11861 + reference=SvRV(ST(0));
11862 + hv=SvSTASH(reference);
11863 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
11864 + if (image == (Image *) NULL)
11866 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
11868 + goto PerlException;
11870 + image=MergeImageLayers(image,MosaicLayer,exception);
11872 + Create blessed Perl array for the returned image.
11875 + ST(0)=sv_2mortal(sv_bless(newRV((SV *) av),hv));
11876 + SvREFCNT_dec(av);
11877 + AddImageToRegistry(sv,image);
11879 + av_push(av,sv_bless(rv,hv));
11880 + SvREFCNT_dec(sv);
11881 + (void) CopyMagickString(info->image_info->filename,image->filename,
11883 + SetImageInfo(info->image_info,0,&image->exception);
11884 + exception=DestroyExceptionInfo(exception);
11885 + SvREFCNT_dec(perl_exception);
11889 + InheritPerlException(exception,perl_exception);
11890 + exception=DestroyExceptionInfo(exception);
11891 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
11892 + SvPOK_on(perl_exception); /* return messages in string context */
11893 + ST(0)=sv_2mortal(perl_exception);
11898 +###############################################################################
11906 +###############################################################################
11911 + Image::Magick ref = NO_INIT
11935 + MagickBooleanType
11950 + struct PackageInfo
11961 + PERL_UNUSED_VAR(ref);
11962 + PERL_UNUSED_VAR(ix);
11963 + exception=AcquireExceptionInfo();
11964 + perl_exception=newSVpv("",0);
11965 + package_info=(struct PackageInfo *) NULL;
11966 + ac=(items < 2) ? 1 : items-1;
11967 + list=(char **) AcquireQuantumMemory((size_t) ac+1UL,sizeof(*list));
11969 + length=(STRLEN *) NULL;
11970 + if (list == (char **) NULL)
11972 + ThrowPerlException(exception,ResourceLimitError,
11973 + "MemoryAllocationFailed",PackageName);
11974 + goto PerlException;
11977 + length=(STRLEN *) AcquireQuantumMemory((size_t) ac+1UL,sizeof(*length));
11978 + if (length == (STRLEN *) NULL)
11980 + ThrowPerlException(exception,ResourceLimitError,
11981 + "MemoryAllocationFailed",PackageName);
11982 + goto PerlException;
11984 + if (sv_isobject(ST(0)) == 0)
11986 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
11988 + goto PerlException;
11990 + reference=SvRV(ST(0));
11991 + if (SvTYPE(reference) != SVt_PVAV)
11993 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
11995 + goto PerlException;
11997 + av=(AV *) reference;
11998 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
12000 + package_info=ClonePackageInfo(info,exception);
12003 + *list=(char *) (*package_info->image_info->filename ?
12004 + package_info->image_info->filename : "XC:black");
12006 + for (n=0, i=0; i < ac; i++)
12008 + list[n]=(char *) SvPV(ST(i+1),length[n]);
12009 + if ((items >= 3) && strEQcase(list[n],"blob"))
12015 + blob=(void *) (SvPV(ST(i+1),length[n]));
12016 + SetImageInfoBlob(package_info->image_info,blob,(size_t) length[n]);
12018 + if ((items >= 3) && strEQcase(list[n],"filename"))
12020 + if ((items >= 3) && strEQcase(list[n],"file"))
12029 + io_info=IoIFP(sv_2io(ST(i+1)));
12030 + if (io_info == (PerlIO *) NULL)
12032 + ThrowPerlException(exception,BlobError,"UnableToOpenFile",
12036 + file=PerlIO_findFILE(io_info);
12037 + if (file == (FILE *) NULL)
12039 + ThrowPerlException(exception,BlobError,"UnableToOpenFile",
12043 + SetImageInfoFile(package_info->image_info,file);
12045 + if ((items >= 3) && strEQcase(list[n],"magick"))
12049 + list[n]=(char *) NULL;
12051 + status=ExpandFilenames(&n,&list);
12052 + if (status == MagickFalse)
12054 + ThrowPerlException(exception,ResourceLimitError,
12055 + "MemoryAllocationFailed",PackageName);
12056 + goto PerlException;
12059 + for (i=0; i < n; i++)
12061 + (void) CopyMagickString(package_info->image_info->filename,list[i],
12063 + image=PingImage(package_info->image_info,exception);
12064 + if (image == (Image *) NULL)
12066 + if ((package_info->image_info->file != (FILE *) NULL) ||
12067 + (package_info->image_info->blob != (void *) NULL))
12068 + DisassociateImageStream(image);
12069 + count+=GetImageListLength(image);
12070 + EXTEND(sp,4*count);
12071 + for (next=image; next; next=next->next)
12073 + PUSHs(sv_2mortal(newSViv(next->columns)));
12074 + PUSHs(sv_2mortal(newSViv(next->rows)));
12075 + PUSHs(sv_2mortal(newSViv((size_t) GetBlobSize(next))));
12076 + PUSHs(sv_2mortal(newSVpv(next->magick,0)));
12078 + image=DestroyImageList(image);
12083 + for (i=0; i < n; i++)
12084 + if (list[i] != (char *) NULL)
12085 + for (p=keep; list[i] != *p++; )
12088 + list[i]=(char *) RelinquishMagickMemory(list[i]);
12093 + if (package_info != (struct PackageInfo *) NULL)
12094 + DestroyPackageInfo(package_info);
12095 + if (list && (list != keep))
12096 + list=(char **) RelinquishMagickMemory(list);
12098 + keep=(char **) RelinquishMagickMemory(keep);
12100 + length=(STRLEN *) RelinquishMagickMemory(length);
12101 + InheritPerlException(exception,perl_exception);
12102 + exception=DestroyExceptionInfo(exception);
12103 + SvREFCNT_dec(perl_exception); /* throw away all errors */
12107 +###############################################################################
12115 +###############################################################################
12120 + Image::Magick ref = NO_INIT
12143 + struct PackageInfo
12153 + PERL_UNUSED_VAR(ref);
12154 + PERL_UNUSED_VAR(ix);
12155 + exception=AcquireExceptionInfo();
12156 + perl_exception=newSVpv("",0);
12159 + if (sv_isobject(ST(0)) == 0)
12161 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
12163 + goto PerlException;
12165 + reference=SvRV(ST(0));
12166 + hv=SvSTASH(reference);
12168 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
12169 + SvREFCNT_dec(av);
12170 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
12171 + if (image == (Image *) NULL)
12173 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
12175 + goto PerlException;
12177 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
12178 + preview_type=GammaPreview;
12180 + preview_type=(PreviewType)
12181 + ParseCommandOption(MagickPreviewOptions,MagickFalse,SvPV(ST(1),na));
12182 + for ( ; image; image=image->next)
12184 + preview_image=PreviewImage(image,preview_type,exception);
12185 + if (preview_image == (Image *) NULL)
12186 + goto PerlException;
12187 + AddImageToRegistry(sv,preview_image);
12189 + av_push(av,sv_bless(rv,hv));
12190 + SvREFCNT_dec(sv);
12192 + exception=DestroyExceptionInfo(exception);
12193 + ST(0)=av_reference;
12194 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
12198 + InheritPerlException(exception,perl_exception);
12199 + exception=DestroyExceptionInfo(exception);
12200 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
12201 + SvPOK_on(perl_exception);
12202 + ST(0)=sv_2mortal(perl_exception);
12207 +###############################################################################
12211 +# Q u e r y C o l o r #
12215 +###############################################################################
12219 +QueryColor(ref,...)
12220 + Image::Magick ref = NO_INIT
12231 + MagickPixelPacket
12240 + PERL_UNUSED_VAR(ref);
12241 + PERL_UNUSED_VAR(ix);
12242 + exception=AcquireExceptionInfo();
12243 + perl_exception=newSVpv("",0);
12252 + colorlist=GetColorInfoList("*",&colors,exception);
12253 + EXTEND(sp,colors);
12254 + for (i=0; i < (ssize_t) colors; i++)
12256 + PUSHs(sv_2mortal(newSVpv(colorlist[i]->name,0)));
12258 + colorlist=(const ColorInfo **)
12259 + RelinquishMagickMemory((ColorInfo **) colorlist);
12260 + goto PerlException;
12262 + EXTEND(sp,5*items);
12263 + for (i=1; i < items; i++)
12265 + name=(char *) SvPV(ST(i),na);
12266 + if (QueryMagickColor(name,&color,exception) == MagickFalse)
12268 + PUSHs(&sv_undef);
12271 + PUSHs(sv_2mortal(newSViv((size_t) floor(color.red+0.5))));
12272 + PUSHs(sv_2mortal(newSViv((size_t) floor(color.green+0.5))));
12273 + PUSHs(sv_2mortal(newSViv((size_t) floor(color.blue+0.5))));
12274 + if (color.matte != MagickFalse)
12275 + PUSHs(sv_2mortal(newSViv((size_t) floor(color.opacity+0.5))));
12276 + if (color.colorspace == CMYKColorspace)
12277 + PUSHs(sv_2mortal(newSViv((size_t) floor(color.index+0.5))));
12281 + InheritPerlException(exception,perl_exception);
12282 + exception=DestroyExceptionInfo(exception);
12283 + SvREFCNT_dec(perl_exception);
12287 +###############################################################################
12291 +# Q u e r y C o l o r N a m e #
12295 +###############################################################################
12299 +QueryColorname(ref,...)
12300 + Image::Magick ref = NO_INIT
12302 + querycolorname = 1
12309 + message[MaxTextExtent];
12323 + struct PackageInfo
12328 + *reference; /* reference is the SV* of ref=SvIV(reference) */
12330 + PERL_UNUSED_VAR(ref);
12331 + PERL_UNUSED_VAR(ix);
12332 + exception=AcquireExceptionInfo();
12333 + perl_exception=newSVpv("",0);
12334 + reference=SvRV(ST(0));
12335 + av=(AV *) reference;
12336 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
12338 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
12339 + if (image == (Image *) NULL)
12341 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
12343 + goto PerlException;
12345 + EXTEND(sp,items);
12346 + for (i=1; i < items; i++)
12348 + (void) QueryColorDatabase(SvPV(ST(i),na),&target_color,exception);
12349 + (void) QueryColorname(image,&target_color,SVGCompliance,message,
12351 + PUSHs(sv_2mortal(newSVpv(message,0)));
12355 + InheritPerlException(exception,perl_exception);
12356 + exception=DestroyExceptionInfo(exception);
12357 + SvREFCNT_dec(perl_exception);
12361 +###############################################################################
12365 +# Q u e r y F o n t #
12369 +###############################################################################
12373 +QueryFont(ref,...)
12374 + Image::Magick ref = NO_INIT
12381 + message[MaxTextExtent];
12392 + volatile const TypeInfo
12395 + PERL_UNUSED_VAR(ref);
12396 + PERL_UNUSED_VAR(ix);
12397 + exception=AcquireExceptionInfo();
12398 + perl_exception=newSVpv("",0);
12407 + typelist=GetTypeInfoList("*",&types,exception);
12408 + EXTEND(sp,types);
12409 + for (i=0; i < (ssize_t) types; i++)
12411 + PUSHs(sv_2mortal(newSVpv(typelist[i]->name,0)));
12413 + typelist=(const TypeInfo **) RelinquishMagickMemory((TypeInfo **)
12415 + goto PerlException;
12417 + EXTEND(sp,10*items);
12418 + for (i=1; i < items; i++)
12420 + name=(char *) SvPV(ST(i),na);
12421 + type_info=GetTypeInfo(name,exception);
12422 + if (type_info == (TypeInfo *) NULL)
12424 + PUSHs(&sv_undef);
12427 + if (type_info->name == (char *) NULL)
12428 + PUSHs(&sv_undef);
12430 + PUSHs(sv_2mortal(newSVpv(type_info->name,0)));
12431 + if (type_info->description == (char *) NULL)
12432 + PUSHs(&sv_undef);
12434 + PUSHs(sv_2mortal(newSVpv(type_info->description,0)));
12435 + if (type_info->family == (char *) NULL)
12436 + PUSHs(&sv_undef);
12438 + PUSHs(sv_2mortal(newSVpv(type_info->family,0)));
12439 + if (type_info->style == UndefinedStyle)
12440 + PUSHs(&sv_undef);
12442 + PUSHs(sv_2mortal(newSVpv(CommandOptionToMnemonic(MagickStyleOptions,
12443 + type_info->style),0)));
12444 + if (type_info->stretch == UndefinedStretch)
12445 + PUSHs(&sv_undef);
12447 + PUSHs(sv_2mortal(newSVpv(CommandOptionToMnemonic(MagickStretchOptions,
12448 + type_info->stretch),0)));
12449 + (void) FormatLocaleString(message,MaxTextExtent,"%.20g",(double)
12450 + type_info->weight);
12451 + PUSHs(sv_2mortal(newSVpv(message,0)));
12452 + if (type_info->encoding == (char *) NULL)
12453 + PUSHs(&sv_undef);
12455 + PUSHs(sv_2mortal(newSVpv(type_info->encoding,0)));
12456 + if (type_info->foundry == (char *) NULL)
12457 + PUSHs(&sv_undef);
12459 + PUSHs(sv_2mortal(newSVpv(type_info->foundry,0)));
12460 + if (type_info->format == (char *) NULL)
12461 + PUSHs(&sv_undef);
12463 + PUSHs(sv_2mortal(newSVpv(type_info->format,0)));
12464 + if (type_info->metrics == (char *) NULL)
12465 + PUSHs(&sv_undef);
12467 + PUSHs(sv_2mortal(newSVpv(type_info->metrics,0)));
12468 + if (type_info->glyphs == (char *) NULL)
12469 + PUSHs(&sv_undef);
12471 + PUSHs(sv_2mortal(newSVpv(type_info->glyphs,0)));
12475 + InheritPerlException(exception,perl_exception);
12476 + exception=DestroyExceptionInfo(exception);
12477 + SvREFCNT_dec(perl_exception);
12481 +###############################################################################
12485 +# Q u e r y F o n t M e t r i c s #
12489 +###############################################################################
12493 +QueryFontMetrics(ref,...)
12494 + Image::Magick ref = NO_INIT
12496 + queryfontmetrics = 1
12525 + MagickBooleanType
12537 + struct PackageInfo
12543 + *reference; /* reference is the SV* of ref=SvIV(reference) */
12548 + PERL_UNUSED_VAR(ref);
12549 + PERL_UNUSED_VAR(ix);
12550 + exception=AcquireExceptionInfo();
12551 + package_info=(struct PackageInfo *) NULL;
12552 + perl_exception=newSVpv("",0);
12553 + reference=SvRV(ST(0));
12554 + av=(AV *) reference;
12555 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
12557 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
12558 + if (image == (Image *) NULL)
12560 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
12562 + goto PerlException;
12564 + package_info=ClonePackageInfo(info,exception);
12565 + draw_info=CloneDrawInfo(package_info->image_info,(DrawInfo *) NULL);
12566 + CloneString(&draw_info->text,"");
12567 + current=draw_info->affine;
12568 + GetAffineMatrix(&affine);
12571 + EXTEND(sp,7*items);
12572 + for (i=2; i < items; i+=2)
12574 + attribute=(char *) SvPV(ST(i-1),na);
12575 + switch (*attribute)
12580 + if (LocaleCompare(attribute,"antialias") == 0)
12582 + type=ParseCommandOption(MagickBooleanOptions,MagickFalse,
12586 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
12590 + draw_info->text_antialias=type != 0 ? MagickTrue : MagickFalse;
12593 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12600 + if (LocaleCompare(attribute,"density") == 0)
12602 + CloneString(&draw_info->density,SvPV(ST(i),na));
12605 + if (LocaleCompare(attribute,"direction") == 0)
12607 + draw_info->direction=(DirectionType) ParseCommandOption(
12608 + MagickDirectionOptions,MagickFalse,SvPV(ST(i),na));
12611 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12618 + if (LocaleCompare(attribute,"encoding") == 0)
12620 + CloneString(&draw_info->encoding,SvPV(ST(i),na));
12623 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12630 + if (LocaleCompare(attribute,"family") == 0)
12632 + CloneString(&draw_info->family,SvPV(ST(i),na));
12635 + if (LocaleCompare(attribute,"fill") == 0)
12638 + (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->fill,
12639 + &image->exception);
12642 + if (LocaleCompare(attribute,"font") == 0)
12644 + CloneString(&draw_info->font,SvPV(ST(i),na));
12647 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12654 + if (LocaleCompare(attribute,"geometry") == 0)
12656 + CloneString(&draw_info->geometry,SvPV(ST(i),na));
12659 + if (LocaleCompare(attribute,"gravity") == 0)
12661 + draw_info->gravity=(GravityType) ParseCommandOption(
12662 + MagickGravityOptions,MagickFalse,SvPV(ST(i),na));
12665 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12672 + if (LocaleCompare(attribute,"interline-spacing") == 0)
12674 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12675 + draw_info->interline_spacing=geometry_info.rho;
12678 + if (LocaleCompare(attribute,"interword-spacing") == 0)
12680 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12681 + draw_info->interword_spacing=geometry_info.rho;
12684 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12691 + if (LocaleCompare(attribute,"kerning") == 0)
12693 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12694 + draw_info->kerning=geometry_info.rho;
12697 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12704 + if (LocaleCompare(attribute,"pointsize") == 0)
12706 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12707 + draw_info->pointsize=geometry_info.rho;
12710 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12717 + if (LocaleCompare(attribute,"rotate") == 0)
12719 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12720 + affine.rx=geometry_info.rho;
12721 + affine.ry=geometry_info.sigma;
12722 + if ((flags & SigmaValue) == 0)
12723 + affine.ry=affine.rx;
12726 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12733 + if (LocaleCompare(attribute,"scale") == 0)
12735 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12736 + affine.sx=geometry_info.rho;
12737 + affine.sy=geometry_info.sigma;
12738 + if ((flags & SigmaValue) == 0)
12739 + affine.sy=affine.sx;
12742 + if (LocaleCompare(attribute,"skew") == 0)
12748 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12749 + x_angle=geometry_info.rho;
12750 + y_angle=geometry_info.sigma;
12751 + if ((flags & SigmaValue) == 0)
12753 + affine.ry=tan(DegreesToRadians(fmod(x_angle,360.0)));
12754 + affine.rx=tan(DegreesToRadians(fmod(y_angle,360.0)));
12757 + if (LocaleCompare(attribute,"stroke") == 0)
12760 + (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->stroke,
12761 + &image->exception);
12764 + if (LocaleCompare(attribute,"style") == 0)
12766 + type=ParseCommandOption(MagickStyleOptions,MagickFalse,
12770 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
12774 + draw_info->style=(StyleType) type;
12777 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12784 + if (LocaleCompare(attribute,"text") == 0)
12786 + CloneString(&draw_info->text,SvPV(ST(i),na));
12789 + if (LocaleCompare(attribute,"translate") == 0)
12791 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12792 + affine.tx=geometry_info.rho;
12793 + affine.ty=geometry_info.sigma;
12794 + if ((flags & SigmaValue) == 0)
12795 + affine.ty=affine.tx;
12798 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12805 + if (LocaleCompare(attribute,"weight") == 0)
12807 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12808 + draw_info->weight=(size_t) geometry_info.rho;
12811 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12818 + if (LocaleCompare(attribute,"x") == 0)
12820 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12821 + x=geometry_info.rho;
12824 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12831 + if (LocaleCompare(attribute,"y") == 0)
12833 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
12834 + y=geometry_info.rho;
12837 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12843 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
12849 + draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
12850 + draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
12851 + draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
12852 + draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
12853 + draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
12854 + draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
12855 + if (draw_info->geometry == (char *) NULL)
12857 + draw_info->geometry=AcquireString((char *) NULL);
12858 + (void) FormatLocaleString(draw_info->geometry,MaxTextExtent,
12859 + "%.15g,%.15g",x,y);
12861 + status=GetTypeMetrics(image,draw_info,&metrics);
12862 + (void) CatchImageException(image);
12863 + if (status == MagickFalse)
12864 + PUSHs(&sv_undef);
12867 + PUSHs(sv_2mortal(newSVnv(metrics.pixels_per_em.x)));
12868 + PUSHs(sv_2mortal(newSVnv(metrics.pixels_per_em.y)));
12869 + PUSHs(sv_2mortal(newSVnv(metrics.ascent)));
12870 + PUSHs(sv_2mortal(newSVnv(metrics.descent)));
12871 + PUSHs(sv_2mortal(newSVnv(metrics.width)));
12872 + PUSHs(sv_2mortal(newSVnv(metrics.height)));
12873 + PUSHs(sv_2mortal(newSVnv(metrics.max_advance)));
12874 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.x1)));
12875 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.y1)));
12876 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.x2)));
12877 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.y2)));
12878 + PUSHs(sv_2mortal(newSVnv(metrics.origin.x)));
12879 + PUSHs(sv_2mortal(newSVnv(metrics.origin.y)));
12881 + draw_info=DestroyDrawInfo(draw_info);
12884 + if (package_info != (struct PackageInfo *) NULL)
12885 + DestroyPackageInfo(package_info);
12886 + InheritPerlException(exception,perl_exception);
12887 + exception=DestroyExceptionInfo(exception);
12888 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
12892 +###############################################################################
12896 +# Q u e r y M u l t i l i n e F o n t M e t r i c s #
12900 +###############################################################################
12904 +QueryMultilineFontMetrics(ref,...)
12905 + Image::Magick ref = NO_INIT
12907 + querymultilinefontmetrics = 1
12936 + MagickBooleanType
12948 + struct PackageInfo
12954 + *reference; /* reference is the SV* of ref=SvIV(reference) */
12959 + PERL_UNUSED_VAR(ref);
12960 + PERL_UNUSED_VAR(ix);
12961 + exception=AcquireExceptionInfo();
12962 + package_info=(struct PackageInfo *) NULL;
12963 + perl_exception=newSVpv("",0);
12964 + reference=SvRV(ST(0));
12965 + av=(AV *) reference;
12966 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
12968 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
12969 + if (image == (Image *) NULL)
12971 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
12973 + goto PerlException;
12975 + package_info=ClonePackageInfo(info,exception);
12976 + draw_info=CloneDrawInfo(package_info->image_info,(DrawInfo *) NULL);
12977 + CloneString(&draw_info->text,"");
12978 + current=draw_info->affine;
12979 + GetAffineMatrix(&affine);
12982 + EXTEND(sp,7*items);
12983 + for (i=2; i < items; i+=2)
12985 + attribute=(char *) SvPV(ST(i-1),na);
12986 + switch (*attribute)
12991 + if (LocaleCompare(attribute,"antialias") == 0)
12993 + type=ParseCommandOption(MagickBooleanOptions,MagickFalse,
12997 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
13001 + draw_info->text_antialias=type != 0 ? MagickTrue : MagickFalse;
13004 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13011 + if (LocaleCompare(attribute,"density") == 0)
13013 + CloneString(&draw_info->density,SvPV(ST(i),na));
13016 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13023 + if (LocaleCompare(attribute,"encoding") == 0)
13025 + CloneString(&draw_info->encoding,SvPV(ST(i),na));
13028 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13035 + if (LocaleCompare(attribute,"family") == 0)
13037 + CloneString(&draw_info->family,SvPV(ST(i),na));
13040 + if (LocaleCompare(attribute,"fill") == 0)
13043 + (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->fill,
13044 + &image->exception);
13047 + if (LocaleCompare(attribute,"font") == 0)
13049 + CloneString(&draw_info->font,SvPV(ST(i),na));
13052 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13059 + if (LocaleCompare(attribute,"geometry") == 0)
13061 + CloneString(&draw_info->geometry,SvPV(ST(i),na));
13064 + if (LocaleCompare(attribute,"gravity") == 0)
13066 + draw_info->gravity=(GravityType) ParseCommandOption(
13067 + MagickGravityOptions,MagickFalse,SvPV(ST(i),na));
13070 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13077 + if (LocaleCompare(attribute,"pointsize") == 0)
13079 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13080 + draw_info->pointsize=geometry_info.rho;
13083 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13090 + if (LocaleCompare(attribute,"rotate") == 0)
13092 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13093 + affine.rx=geometry_info.rho;
13094 + affine.ry=geometry_info.sigma;
13095 + if ((flags & SigmaValue) == 0)
13096 + affine.ry=affine.rx;
13099 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13106 + if (LocaleCompare(attribute,"scale") == 0)
13108 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13109 + affine.sx=geometry_info.rho;
13110 + affine.sy=geometry_info.sigma;
13111 + if ((flags & SigmaValue) == 0)
13112 + affine.sy=affine.sx;
13115 + if (LocaleCompare(attribute,"skew") == 0)
13121 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13122 + x_angle=geometry_info.rho;
13123 + y_angle=geometry_info.sigma;
13124 + if ((flags & SigmaValue) == 0)
13126 + affine.ry=tan(DegreesToRadians(fmod(x_angle,360.0)));
13127 + affine.rx=tan(DegreesToRadians(fmod(y_angle,360.0)));
13130 + if (LocaleCompare(attribute,"stroke") == 0)
13133 + (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->stroke,
13134 + &image->exception);
13137 + if (LocaleCompare(attribute,"style") == 0)
13139 + type=ParseCommandOption(MagickStyleOptions,MagickFalse,
13143 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
13147 + draw_info->style=(StyleType) type;
13150 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13157 + if (LocaleCompare(attribute,"text") == 0)
13159 + CloneString(&draw_info->text,SvPV(ST(i),na));
13162 + if (LocaleCompare(attribute,"translate") == 0)
13164 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13165 + affine.tx=geometry_info.rho;
13166 + affine.ty=geometry_info.sigma;
13167 + if ((flags & SigmaValue) == 0)
13168 + affine.ty=affine.tx;
13171 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13178 + if (LocaleCompare(attribute,"weight") == 0)
13180 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13181 + draw_info->weight=(size_t) geometry_info.rho;
13184 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13191 + if (LocaleCompare(attribute,"x") == 0)
13193 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13194 + x=geometry_info.rho;
13197 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13204 + if (LocaleCompare(attribute,"y") == 0)
13206 + flags=ParseGeometry(SvPV(ST(i),na),&geometry_info);
13207 + y=geometry_info.rho;
13210 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13216 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13222 + draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
13223 + draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
13224 + draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
13225 + draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
13226 + draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
13227 + draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty;
13228 + if (draw_info->geometry == (char *) NULL)
13230 + draw_info->geometry=AcquireString((char *) NULL);
13231 + (void) FormatLocaleString(draw_info->geometry,MaxTextExtent,
13232 + "%.15g,%.15g",x,y);
13234 + status=GetMultilineTypeMetrics(image,draw_info,&metrics);
13235 + (void) CatchImageException(image);
13236 + if (status == MagickFalse)
13237 + PUSHs(&sv_undef);
13240 + PUSHs(sv_2mortal(newSVnv(metrics.pixels_per_em.x)));
13241 + PUSHs(sv_2mortal(newSVnv(metrics.pixels_per_em.y)));
13242 + PUSHs(sv_2mortal(newSVnv(metrics.ascent)));
13243 + PUSHs(sv_2mortal(newSVnv(metrics.descent)));
13244 + PUSHs(sv_2mortal(newSVnv(metrics.width)));
13245 + PUSHs(sv_2mortal(newSVnv(metrics.height)));
13246 + PUSHs(sv_2mortal(newSVnv(metrics.max_advance)));
13247 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.x1)));
13248 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.y1)));
13249 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.x2)));
13250 + PUSHs(sv_2mortal(newSVnv(metrics.bounds.y2)));
13251 + PUSHs(sv_2mortal(newSVnv(metrics.origin.x)));
13252 + PUSHs(sv_2mortal(newSVnv(metrics.origin.y)));
13254 + draw_info=DestroyDrawInfo(draw_info);
13257 + if (package_info != (struct PackageInfo *) NULL)
13258 + DestroyPackageInfo(package_info);
13259 + InheritPerlException(exception,perl_exception);
13260 + exception=DestroyExceptionInfo(exception);
13261 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
13265 +###############################################################################
13269 +# Q u e r y F o r m a t #
13273 +###############################################################################
13277 +QueryFormat(ref,...)
13278 + Image::Magick ref = NO_INIT
13295 + volatile const MagickInfo
13298 + PERL_UNUSED_VAR(ref);
13299 + PERL_UNUSED_VAR(ix);
13300 + exception=AcquireExceptionInfo();
13301 + perl_exception=newSVpv("",0);
13305 + format[MaxTextExtent];
13313 + format_list=GetMagickInfoList("*",&types,exception);
13314 + EXTEND(sp,types);
13315 + for (i=0; i < (ssize_t) types; i++)
13317 + (void) CopyMagickString(format,format_list[i]->name,MaxTextExtent);
13318 + LocaleLower(format);
13319 + PUSHs(sv_2mortal(newSVpv(format,0)));
13321 + format_list=(const MagickInfo **)
13322 + RelinquishMagickMemory((MagickInfo *) format_list);
13323 + goto PerlException;
13325 + EXTEND(sp,8*items);
13326 + for (i=1; i < items; i++)
13328 + name=(char *) SvPV(ST(i),na);
13329 + magick_info=GetMagickInfo(name,exception);
13330 + if (magick_info == (const MagickInfo *) NULL)
13332 + PUSHs(&sv_undef);
13335 + PUSHs(sv_2mortal(newSViv(magick_info->adjoin)));
13336 + PUSHs(sv_2mortal(newSViv(magick_info->blob_support)));
13337 + PUSHs(sv_2mortal(newSViv(magick_info->raw)));
13338 + PUSHs(sv_2mortal(newSViv((long) magick_info->decoder)));
13339 + PUSHs(sv_2mortal(newSViv((long) magick_info->encoder)));
13340 + if (magick_info->description == (char *) NULL)
13341 + PUSHs(&sv_undef);
13343 + PUSHs(sv_2mortal(newSVpv(magick_info->description,0)));
13344 + if (magick_info->module == (char *) NULL)
13345 + PUSHs(&sv_undef);
13347 + PUSHs(sv_2mortal(newSVpv(magick_info->module,0)));
13351 + InheritPerlException(exception,perl_exception);
13352 + exception=DestroyExceptionInfo(exception);
13353 + SvREFCNT_dec(perl_exception);
13357 +###############################################################################
13361 +# Q u e r y O p t i o n #
13365 +###############################################################################
13369 +QueryOption(ref,...)
13370 + Image::Magick ref = NO_INIT
13391 + PERL_UNUSED_VAR(ref);
13392 + PERL_UNUSED_VAR(ix);
13393 + exception=AcquireExceptionInfo();
13394 + perl_exception=newSVpv("",0);
13395 + EXTEND(sp,8*items);
13396 + for (i=1; i < items; i++)
13398 + option=ParseCommandOption(MagickListOptions,MagickFalse,(char *)
13400 + options=GetCommandOptions((CommandOption) option);
13401 + if (options == (char **) NULL)
13402 + PUSHs(&sv_undef);
13405 + for (j=0; options[j] != (char *) NULL; j++)
13406 + PUSHs(sv_2mortal(newSVpv(options[j],0)));
13407 + options=DestroyStringList(options);
13411 + InheritPerlException(exception,perl_exception);
13412 + exception=DestroyExceptionInfo(exception);
13413 + SvREFCNT_dec(perl_exception);
13417 +###############################################################################
13425 +###############################################################################
13430 + Image::Magick ref = NO_INIT
13456 + MagickBooleanType
13472 + struct PackageInfo
13477 + *perl_exception, /* Perl variable for storing messages */
13482 + PERL_UNUSED_VAR(ref);
13483 + PERL_UNUSED_VAR(ix);
13484 + exception=AcquireExceptionInfo();
13485 + perl_exception=newSVpv("",0);
13487 + package_info=(struct PackageInfo *) NULL;
13489 + ac=(items < 2) ? 1 : items-1;
13490 + list=(char **) AcquireQuantumMemory((size_t) ac+1UL,sizeof(*list));
13492 + length=(STRLEN *) NULL;
13493 + if (list == (char **) NULL)
13495 + ThrowPerlException(exception,ResourceLimitError,
13496 + "MemoryAllocationFailed",PackageName);
13497 + goto PerlException;
13499 + length=(STRLEN *) AcquireQuantumMemory((size_t) ac+1UL,sizeof(*length));
13500 + if (length == (STRLEN *) NULL)
13502 + ThrowPerlException(exception,ResourceLimitError,
13503 + "MemoryAllocationFailed",PackageName);
13504 + goto PerlException;
13506 + if (sv_isobject(ST(0)) == 0)
13508 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
13510 + goto PerlException;
13512 + reference=SvRV(ST(0));
13513 + hv=SvSTASH(reference);
13514 + if (SvTYPE(reference) != SVt_PVAV)
13516 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
13518 + goto PerlException;
13520 + av=(AV *) reference;
13521 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
13523 + package_info=ClonePackageInfo(info,exception);
13526 + *list=(char *) (*package_info->image_info->filename ?
13527 + package_info->image_info->filename : "XC:black");
13529 + for (n=0, i=0; i < ac; i++)
13531 + list[n]=(char *) SvPV(ST(i+1),length[n]);
13532 + if ((items >= 3) && strEQcase(list[n],"blob"))
13538 + blob=(void *) (SvPV(ST(i+1),length[n]));
13539 + SetImageInfoBlob(package_info->image_info,blob,(size_t) length[n]);
13541 + if ((items >= 3) && strEQcase(list[n],"filename"))
13543 + if ((items >= 3) && strEQcase(list[n],"file"))
13552 + io_info=IoIFP(sv_2io(ST(i+1)));
13553 + if (io_info == (PerlIO *) NULL)
13555 + ThrowPerlException(exception,BlobError,"UnableToOpenFile",
13559 + file=PerlIO_findFILE(io_info);
13560 + if (file == (FILE *) NULL)
13562 + ThrowPerlException(exception,BlobError,"UnableToOpenFile",
13566 + SetImageInfoFile(package_info->image_info,file);
13568 + if ((items >= 3) && strEQcase(list[n],"magick"))
13572 + list[n]=(char *) NULL;
13574 + status=ExpandFilenames(&n,&list);
13575 + if (status == MagickFalse)
13577 + ThrowPerlException(exception,ResourceLimitError,
13578 + "MemoryAllocationFailed",PackageName);
13579 + goto PerlException;
13582 + for (i=0; i < n; i++)
13584 + if ((package_info->image_info->file != (FILE *) NULL) ||
13585 + (package_info->image_info->blob != (void *) NULL))
13587 + image=ReadImages(package_info->image_info,exception);
13588 + if (image != (Image *) NULL)
13589 + DisassociateImageStream(image);
13593 + (void) CopyMagickString(package_info->image_info->filename,list[i],
13595 + image=ReadImages(package_info->image_info,exception);
13597 + if (image == (Image *) NULL)
13599 + for ( ; image; image=image->next)
13601 + AddImageToRegistry(sv,image);
13603 + av_push(av,sv_bless(rv,hv));
13604 + SvREFCNT_dec(sv);
13611 + for (i=0; i < n; i++)
13612 + if (list[i] != (char *) NULL)
13613 + for (p=keep; list[i] != *p++; )
13614 + if (*p == (char *) NULL)
13616 + list[i]=(char *) RelinquishMagickMemory(list[i]);
13621 + if (package_info != (struct PackageInfo *) NULL)
13622 + DestroyPackageInfo(package_info);
13623 + if (list && (list != keep))
13624 + list=(char **) RelinquishMagickMemory(list);
13626 + keep=(char **) RelinquishMagickMemory(keep);
13628 + length=(STRLEN *) RelinquishMagickMemory(length);
13629 + InheritPerlException(exception,perl_exception);
13630 + exception=DestroyExceptionInfo(exception);
13631 + sv_setiv(perl_exception,(IV) number_images);
13632 + SvPOK_on(perl_exception);
13633 + ST(0)=sv_2mortal(perl_exception);
13638 +###############################################################################
13646 +###############################################################################
13651 + Image::Magick ref = NO_INIT
13653 + RemoteCommand = 1
13655 + remoteCommand = 3
13671 + struct PackageInfo
13674 + PERL_UNUSED_VAR(ref);
13675 + PERL_UNUSED_VAR(ix);
13676 + exception=AcquireExceptionInfo();
13677 + perl_exception=newSVpv("",0);
13678 + reference=SvRV(ST(0));
13679 + av=(AV *) reference;
13680 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
13682 + for (i=1; i < items; i++)
13683 + (void) RemoteDisplayCommand(info->image_info,(char *) NULL,(char *)
13684 + SvPV(ST(i),na),exception);
13685 + InheritPerlException(exception,perl_exception);
13686 + exception=DestroyExceptionInfo(exception);
13687 + SvREFCNT_dec(perl_exception); /* throw away all errors */
13691 +###############################################################################
13699 +###############################################################################
13704 + Image::Magick ref = NO_INIT
13706 + SetAttributes = 1
13709 + setattributes = 4
13722 + struct PackageInfo
13727 + *reference; /* reference is the SV* of ref=SvIV(reference) */
13729 + PERL_UNUSED_VAR(ref);
13730 + PERL_UNUSED_VAR(ix);
13731 + exception=AcquireExceptionInfo();
13732 + perl_exception=newSVpv("",0);
13733 + if (sv_isobject(ST(0)) == 0)
13735 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
13737 + goto PerlException;
13739 + reference=SvRV(ST(0));
13740 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
13742 + SetAttribute(aTHX_ info,image,"size",ST(1),exception);
13744 + for (i=2; i < items; i+=2)
13745 + SetAttribute(aTHX_ info,image,SvPV(ST(i-1),na),ST(i),exception);
13748 + InheritPerlException(exception,perl_exception);
13749 + exception=DestroyExceptionInfo(exception);
13750 + sv_setiv(perl_exception,(IV) (SvCUR(perl_exception) != 0));
13751 + SvPOK_on(perl_exception);
13752 + ST(0)=sv_2mortal(perl_exception);
13757 +###############################################################################
13761 +# S e t P i x e l #
13765 +###############################################################################
13770 + Image::Magick ref = NO_INIT
13791 + MagickBooleanType
13797 + register IndexPacket
13803 + register PixelPacket
13809 + struct PackageInfo
13814 + *reference; /* reference is the SV* of ref=SvIV(reference) */
13816 + PERL_UNUSED_VAR(ref);
13817 + PERL_UNUSED_VAR(ix);
13818 + exception=AcquireExceptionInfo();
13819 + perl_exception=newSVpv("",0);
13820 + reference=SvRV(ST(0));
13821 + av=(AV *) reference;
13822 + info=GetPackageInfo(aTHX_ (void *) av,(struct PackageInfo *) NULL,
13824 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
13825 + if (image == (Image *) NULL)
13827 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
13829 + goto PerlException;
13832 + channel=DefaultChannels;
13833 + normalize=MagickTrue;
13836 + region.width=image->columns;
13839 + (void) ParseAbsoluteGeometry(SvPV(ST(1),na),®ion);
13840 + for (i=2; i < items; i+=2)
13842 + attribute=(char *) SvPV(ST(i-1),na);
13843 + switch (*attribute)
13848 + if (LocaleCompare(attribute,"channel") == 0)
13853 + option=ParseChannelOption(SvPV(ST(i),na));
13856 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
13860 + channel=(ChannelType) option;
13863 + if (LocaleCompare(attribute,"color") == 0)
13865 + if (SvTYPE(ST(i)) != SVt_RV)
13868 + message[MaxTextExtent];
13870 + (void) FormatLocaleString(message,MaxTextExtent,
13871 + "invalid %.60s value",attribute);
13872 + ThrowPerlException(exception,OptionError,message,
13875 + av=(AV *) SvRV(ST(i));
13878 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13885 + if (LocaleCompare(attribute,"geometry") == 0)
13887 + (void) ParseAbsoluteGeometry(SvPV(ST(i),na),®ion);
13890 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13897 + if (LocaleCompare(attribute,"normalize") == 0)
13899 + option=ParseCommandOption(MagickBooleanOptions,MagickFalse,
13903 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
13907 + normalize=option != 0 ? MagickTrue : MagickFalse;
13910 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13917 + if (LocaleCompare(attribute,"x") == 0)
13919 + region.x=SvIV(ST(i));
13922 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13929 + if (LocaleCompare(attribute,"y") == 0)
13931 + region.y=SvIV(ST(i));
13934 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13940 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
13946 + (void) SetImageStorageClass(image,DirectClass);
13947 + q=GetAuthenticPixels(image,region.x,region.y,1,1,exception);
13948 + if ((q == (PixelPacket *) NULL) || (av == (AV *) NULL) ||
13949 + (SvTYPE(av) != SVt_PVAV))
13950 + PUSHs(&sv_undef);
13960 + indexes=GetAuthenticIndexQueue(image);
13962 + if (normalize != MagickFalse)
13963 + scale=QuantumRange;
13964 + if (((channel & RedChannel) != 0) && (i <= av_len(av)))
13966 + SetPixelRed(q,ClampToQuantum(scale*SvNV(*(
13967 + av_fetch(av,i,0)))));
13970 + if (((channel & GreenChannel) != 0) && (i <= av_len(av)))
13972 + SetPixelGreen(q,ClampToQuantum(scale*SvNV(*(
13973 + av_fetch(av,i,0)))));
13976 + if (((channel & BlueChannel) != 0) && (i <= av_len(av)))
13978 + SetPixelBlue(q,ClampToQuantum(scale*SvNV(*(
13979 + av_fetch(av,i,0)))));
13982 + if ((((channel & IndexChannel) != 0) &&
13983 + (image->colorspace == CMYKColorspace)) && (i <= av_len(av)))
13985 + SetPixelIndex(indexes,ClampToQuantum(scale*
13986 + SvNV(*(av_fetch(av,i,0)))));
13989 + if (((channel & OpacityChannel) != 0) && (i <= av_len(av)))
13991 + SetPixelOpacity(q,ClampToQuantum(scale*
13992 + SvNV(*(av_fetch(av,i,0)))));
13995 + (void) SyncAuthenticPixels(image,exception);
13999 + InheritPerlException(exception,perl_exception);
14000 + exception=DestroyExceptionInfo(exception);
14001 + SvREFCNT_dec(perl_exception);
14005 +###############################################################################
14013 +###############################################################################
14018 + Image::Magick ref = NO_INIT
14047 + struct PackageInfo
14057 + PERL_UNUSED_VAR(ref);
14058 + PERL_UNUSED_VAR(ix);
14059 + exception=AcquireExceptionInfo();
14060 + perl_exception=newSVpv("",0);
14064 + if (sv_isobject(ST(0)) == 0)
14066 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
14068 + goto PerlException;
14070 + reference=SvRV(ST(0));
14071 + hv=SvSTASH(reference);
14073 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
14074 + SvREFCNT_dec(av);
14075 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
14076 + if (image == (Image *) NULL)
14078 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
14080 + goto PerlException;
14082 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
14087 + stack=MagickTrue;
14088 + for (i=2; i < items; i+=2)
14090 + attribute=(char *) SvPV(ST(i-1),na);
14091 + switch (*attribute)
14096 + if (LocaleCompare(attribute,"offset") == 0)
14098 + offset=(ssize_t) StringToLong((char *) SvPV(ST(1),na));
14101 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
14108 + if (LocaleCompare(attribute,"stack") == 0)
14110 + stack=ParseCommandOption(MagickBooleanOptions,MagickFalse,
14114 + ThrowPerlException(exception,OptionError,"UnrecognizedType",
14120 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
14126 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
14132 + image=SmushImages(image,stack != 0 ? MagickTrue : MagickFalse,offset,
14134 + if (image == (Image *) NULL)
14135 + goto PerlException;
14136 + for ( ; image; image=image->next)
14138 + AddImageToRegistry(sv,image);
14140 + av_push(av,sv_bless(rv,hv));
14141 + SvREFCNT_dec(sv);
14143 + exception=DestroyExceptionInfo(exception);
14144 + ST(0)=av_reference;
14145 + SvREFCNT_dec(perl_exception);
14149 + InheritPerlException(exception,perl_exception);
14150 + exception=DestroyExceptionInfo(exception);
14151 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
14152 + SvPOK_on(perl_exception);
14153 + ST(0)=sv_2mortal(perl_exception);
14158 +###############################################################################
14162 +# S t a t i s t i c s #
14166 +###############################################################################
14170 +Statistics(ref,...)
14171 + Image::Magick ref = NO_INIT
14173 + StatisticsImage = 1
14175 + statisticsimage = 3
14178 +#define ChannelStatistics(channel) \
14180 + (void) FormatLocaleString(message,MaxTextExtent,"%.20g", \
14181 + (double) channel_statistics[channel].depth); \
14182 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14183 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
14184 + channel_statistics[channel].minima/scale); \
14185 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14186 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
14187 + channel_statistics[channel].maxima/scale); \
14188 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14189 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
14190 + channel_statistics[channel].mean/scale); \
14191 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14192 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
14193 + channel_statistics[channel].standard_deviation/scale); \
14194 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14195 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
14196 + channel_statistics[channel].kurtosis); \
14197 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14198 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
14199 + channel_statistics[channel].skewness); \
14200 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14201 + (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
14202 + channel_statistics[channel].entropy); \
14203 + PUSHs(sv_2mortal(newSVpv(message,0))); \
14210 + message[MaxTextExtent];
14212 + ChannelStatistics
14213 + *channel_statistics;
14227 + struct PackageInfo
14234 + PERL_UNUSED_VAR(ref);
14235 + PERL_UNUSED_VAR(ix);
14236 + exception=AcquireExceptionInfo();
14237 + perl_exception=newSVpv("",0);
14239 + if (sv_isobject(ST(0)) == 0)
14241 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
14243 + goto PerlException;
14245 + reference=SvRV(ST(0));
14247 + SvREFCNT_dec(av);
14248 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
14249 + if (image == (Image *) NULL)
14251 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
14253 + goto PerlException;
14256 + for ( ; image; image=image->next)
14258 + channel_statistics=GetImageChannelStatistics(image,&image->exception);
14259 + if (channel_statistics == (ChannelStatistics *) NULL)
14262 + EXTEND(sp,35*count);
14263 + scale=(double) QuantumRange;
14264 + ChannelStatistics(RedChannel);
14265 + ChannelStatistics(GreenChannel);
14266 + ChannelStatistics(BlueChannel);
14267 + if (image->colorspace == CMYKColorspace)
14268 + ChannelStatistics(IndexChannel);
14269 + if (image->matte != MagickFalse)
14270 + ChannelStatistics(OpacityChannel);
14271 + channel_statistics=(ChannelStatistics *)
14272 + RelinquishMagickMemory(channel_statistics);
14276 + InheritPerlException(exception,perl_exception);
14277 + exception=DestroyExceptionInfo(exception);
14278 + SvREFCNT_dec(perl_exception);
14282 +###############################################################################
14286 +# S y n c A u t h e n t i c P i x e l s #
14290 +###############################################################################
14294 +SyncAuthenticPixels(ref,...)
14295 + Image::Magick ref = NO_INIT
14297 + Syncauthenticpixels = 1
14298 + SyncImagePixels = 2
14299 + syncimagepixels = 3
14308 + MagickBooleanType
14311 + struct PackageInfo
14318 + PERL_UNUSED_VAR(ref);
14319 + PERL_UNUSED_VAR(ix);
14320 + exception=AcquireExceptionInfo();
14321 + perl_exception=newSVpv("",0);
14322 + if (sv_isobject(ST(0)) == 0)
14324 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
14326 + goto PerlException;
14329 + reference=SvRV(ST(0));
14330 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
14331 + if (image == (Image *) NULL)
14333 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
14335 + goto PerlException;
14338 + status=SyncAuthenticPixels(image,exception);
14339 + if (status != MagickFalse)
14341 + InheritException(exception,&image->exception);
14344 + InheritPerlException(exception,perl_exception);
14345 + exception=DestroyExceptionInfo(exception);
14346 + SvREFCNT_dec(perl_exception); /* throw away all errors */
14350 +###############################################################################
14354 +# T r a n s f o r m #
14358 +###############################################################################
14362 +Transform(ref,...)
14363 + Image::Magick ref = NO_INIT
14365 + TransformImage = 1
14367 + transformimage = 3
14391 + struct PackageInfo
14401 + PERL_UNUSED_VAR(ref);
14402 + PERL_UNUSED_VAR(ix);
14403 + exception=AcquireExceptionInfo();
14404 + perl_exception=newSVpv("",0);
14408 + if (sv_isobject(ST(0)) == 0)
14410 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
14412 + goto PerlException;
14414 + reference=SvRV(ST(0));
14415 + hv=SvSTASH(reference);
14417 + av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
14418 + SvREFCNT_dec(av);
14419 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
14420 + if (image == (Image *) NULL)
14422 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
14424 + goto PerlException;
14426 + info=GetPackageInfo(aTHX_ (void *) av,info,exception);
14430 + crop_geometry=(char *) NULL;
14431 + geometry=(char *) NULL;
14432 + for (i=2; i < items; i+=2)
14434 + attribute=(char *) SvPV(ST(i-1),na);
14435 + switch (*attribute)
14440 + if (LocaleCompare(attribute,"crop") == 0)
14442 + crop_geometry=SvPV(ST(i),na);
14445 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
14452 + if (LocaleCompare(attribute,"geometry") == 0)
14454 + geometry=SvPV(ST(i),na);
14457 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
14463 + ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
14469 + for ( ; image; image=image->next)
14471 + clone=CloneImage(image,0,0,MagickTrue,exception);
14472 + if (clone == (Image *) NULL)
14473 + goto PerlException;
14474 + TransformImage(&clone,crop_geometry,geometry);
14475 + for ( ; clone; clone=clone->next)
14477 + AddImageToRegistry(sv,clone);
14479 + av_push(av,sv_bless(rv,hv));
14480 + SvREFCNT_dec(sv);
14483 + exception=DestroyExceptionInfo(exception);
14484 + ST(0)=av_reference;
14485 + SvREFCNT_dec(perl_exception); /* can't return warning messages */
14489 + InheritPerlException(exception,perl_exception);
14490 + exception=DestroyExceptionInfo(exception);
14491 + sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
14492 + SvPOK_on(perl_exception);
14493 + ST(0)=sv_2mortal(perl_exception);
14498 +###############################################################################
14506 +###############################################################################
14511 + Image::Magick ref = NO_INIT
14519 + filename[MaxTextExtent];
14535 + struct PackageInfo
14543 + PERL_UNUSED_VAR(ref);
14544 + PERL_UNUSED_VAR(ix);
14545 + exception=AcquireExceptionInfo();
14546 + perl_exception=newSVpv("",0);
14548 + package_info=(struct PackageInfo *) NULL;
14549 + if (sv_isobject(ST(0)) == 0)
14551 + ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
14553 + goto PerlException;
14555 + reference=SvRV(ST(0));
14556 + image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
14557 + if (image == (Image *) NULL)
14559 + ThrowPerlException(exception,OptionError,"NoImagesDefined",
14561 + goto PerlException;
14563 + package_info=ClonePackageInfo(info,exception);
14565 + SetAttribute(aTHX_ package_info,NULL,"filename",ST(1),exception);
14568 + for (i=2; i < items; i+=2)
14569 + SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),
14571 + (void) CopyMagickString(filename,package_info->image_info->filename,
14574 + for (next=image; next; next=next->next)
14576 + (void) CopyMagickString(next->filename,filename,MaxTextExtent);
14577 + next->scene=scene++;
14579 + *package_info->image_info->magick='\0';
14580 + SetImageInfo(package_info->image_info,(unsigned int)
14581 + GetImageListLength(image),&image->exception);
14582 + for (next=image; next; next=next->next)
14584 + (void) WriteImage(package_info->image_info,next);
14585 + if (next->exception.severity >= ErrorException)
14586 + InheritException(exception,&next->exception);
14587 + GetImageException(next,exception);
14589 + if (package_info->image_info->adjoin)
14594 + if (package_info != (struct PackageInfo *) NULL)
14595 + DestroyPackageInfo(package_info);
14596 + InheritPerlException(exception,perl_exception);
14597 + exception=DestroyExceptionInfo(exception);
14598 + sv_setiv(perl_exception,(IV) number_images);
14599 + SvPOK_on(perl_exception);
14600 + ST(0)=sv_2mortal(perl_exception);