root/ImageMagick/trunk/wand/deprecate.c

Revision 327, 60.3 KB (checked in by cristy, 7 weeks ago)
Line 
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%        DDDD   EEEEE  PPPP   RRRR   EEEEE   CCCC   AAA   TTTTT  EEEEE        %
7%        D   D  E      P   P  R   R  E      C      A   A    T    E            %
8%        D   D  EEE    PPPPP  RRRR   EEE    C      AAAAA    T    EEE          %
9%        D   D  E      P      R R    E      C      A   A    T    E            %
10%        DDDD   EEEEE  P      R  R   EEEEE   CCCC  A   A    T    EEEEE        %
11%                                                                             %
12%                                                                             %
13%                       MagickWand Deprecated Methods                         %
14%                                                                             %
15%                              Software Design                                %
16%                                John Cristy                                  %
17%                                October 2002                                 %
18%                                                                             %
19%                                                                             %
20%  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
21%  dedicated to making software imaging solutions freely available.           %
22%                                                                             %
23%  You may not use this file except in compliance with the License.  You may  %
24%  obtain a copy of the License at                                            %
25%                                                                             %
26%    http://www.imagemagick.org/script/license.php                            %
27%                                                                             %
28%  Unless required by applicable law or agreed to in writing, software        %
29%  distributed under the License is distributed on an "AS IS" BASIS,          %
30%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
31%  See the License for the specific language governing permissions and        %
32%  limitations under the License.                                             %
33%                                                                             %
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35%
36%
37%
38*/
39
40/*
41  Include declarations.
42*/
43#include "wand/studio.h"
44#include "wand/MagickWand.h"
45#include "wand/magick-wand-private.h"
46#include "wand/wand.h"
47
48/*
49  Define declarations.
50*/
51#define ThrowWandException(severity,tag,context) \
52{ \
53  (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
54    tag,"`%s'",context); \
55  return(MagickFalse); \
56}
57
58#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED)
59
60/*
61%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62%                                                                             %
63%                                                                             %
64%                                                                             %
65%   M a g i c k C l i p P a t h I m a g e                                     %
66%                                                                             %
67%                                                                             %
68%                                                                             %
69%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70%
71%  MagickClipPathImage() clips along the named paths from the 8BIM profile, if
72%  present. Later operations take effect inside the path.  Id may be a number
73%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
74%  path.
75%
76%  The format of the MagickClipPathImage method is:
77%
78%      MagickBooleanType MagickClipPathImage(MagickWand *wand,
79%        const char *pathname,const MagickBooleanType inside)
80%
81%  A description of each parameter follows:
82%
83%    o wand: the magick wand.
84%
85%    o pathname: name of clipping path resource. If name is preceded by #, use
86%      clipping path numbered by name.
87%
88%    o inside: if non-zero, later operations take effect inside clipping path.
89%      Otherwise later operations take effect outside clipping path.
90%
91*/
92WandExport MagickBooleanType MagickClipPathImage(MagickWand *wand,
93  const char *pathname,const MagickBooleanType inside)
94{
95  return(MagickClipImagePath(wand,pathname,inside));
96}
97/*
98%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99%                                                                             %
100%                                                                             %
101%                                                                             %
102%   D r a w G e t F i l l A l p h a                                           %
103%                                                                             %
104%                                                                             %
105%                                                                             %
106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107%
108%  DrawGetFillAlpha() returns the alpha used when drawing using the fill
109%  color or fill texture.  Fully opaque is 1.0.
110%
111%  The format of the DrawGetFillAlpha method is:
112%
113%      double DrawGetFillAlpha(const DrawingWand *wand)
114%
115%  A description of each parameter follows:
116%
117%    o wand: the drawing wand.
118%
119*/
120WandExport double DrawGetFillAlpha(const DrawingWand *wand)
121{
122  return(DrawGetFillOpacity(wand));
123}
124
125/*
126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127%                                                                             %
128%                                                                             %
129%                                                                             %
130%   D r a w G e t S t r o k e A l p h a                                       %
131%                                                                             %
132%                                                                             %
133%                                                                             %
134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
135%
136%  DrawGetStrokeAlpha() returns the alpha of stroked object outlines.
137%
138%  The format of the DrawGetStrokeAlpha method is:
139%
140%      double DrawGetStrokeAlpha(const DrawingWand *wand)
141%
142%  A description of each parameter follows:
143%
144%    o wand: the drawing wand.
145*/
146WandExport double DrawGetStrokeAlpha(const DrawingWand *wand)
147{
148  return(DrawGetStrokeOpacity(wand));
149}
150
151/*
152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153%                                                                             %
154%                                                                             %
155%                                                                             %
156%   D r a w P e e k G r a p h i c W a n d                                     %
157%                                                                             %
158%                                                                             %
159%                                                                             %
160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161%
162%  DrawPeekGraphicWand() returns the current drawing wand.
163%
164%  The format of the PeekDrawingWand method is:
165%
166%      DrawInfo *DrawPeekGraphicWand(const DrawingWand *wand)
167%
168%  A description of each parameter follows:
169%
170%    o wand: the drawing wand.
171%
172*/
173WandExport DrawInfo *DrawPeekGraphicWand(const DrawingWand *wand)
174{
175  return(PeekDrawingWand(wand));
176}
177
178/*
179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180%                                                                             %
181%                                                                             %
182%                                                                             %
183%   D r a w P o p G r a p h i c C o n t e x t                                 %
184%                                                                             %
185%                                                                             %
186%                                                                             %
187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
188%
189%  DrawPopGraphicContext() destroys the current drawing wand and returns to the
190%  previously pushed drawing wand. Multiple drawing wands may exist. It is an
191%  error to attempt to pop more drawing wands than have been pushed, and it is
192%  proper form to pop all drawing wands which have been pushed.
193%
194%  The format of the DrawPopGraphicContext method is:
195%
196%      MagickBooleanType DrawPopGraphicContext(DrawingWand *wand)
197%
198%  A description of each parameter follows:
199%
200%    o wand: the drawing wand.
201%
202*/
203WandExport void DrawPopGraphicContext(DrawingWand *wand)
204{
205  (void) PopDrawingWand(wand);
206}
207
208/*
209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
210%                                                                             %
211%                                                                             %
212%                                                                             %
213%   D r a w P u s h G r a p h i c C o n t e x t                               %
214%                                                                             %
215%                                                                             %
216%                                                                             %
217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218%
219%  DrawPushGraphicContext() clones the current drawing wand to create a new
220%  drawing wand.  The original drawing wand(s) may be returned to by
221%  invoking PopDrawingWand().  The drawing wands are stored on a drawing wand
222%  stack.  For every Pop there must have already been an equivalent Push.
223%
224%  The format of the DrawPushGraphicContext method is:
225%
226%      MagickBooleanType DrawPushGraphicContext(DrawingWand *wand)
227%
228%  A description of each parameter follows:
229%
230%    o wand: the drawing wand.
231%
232*/
233WandExport void DrawPushGraphicContext(DrawingWand *wand)
234{
235  (void) PushDrawingWand(wand);
236}
237
238/*
239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
240%                                                                             %
241%                                                                             %
242%                                                                             %
243%   D r a w S e t F i l l A l p h a                                           %
244%                                                                             %
245%                                                                             %
246%                                                                             %
247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
248%
249%  DrawSetFillAlpha() sets the alpha to use when drawing using the fill
250%  color or fill texture.  Fully opaque is 1.0.
251%
252%  The format of the DrawSetFillAlpha method is:
253%
254%      void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha)
255%
256%  A description of each parameter follows:
257%
258%    o wand: the drawing wand.
259%
260%    o fill_alpha: fill alpha
261%
262*/
263WandExport void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha)
264{
265  DrawSetFillOpacity(wand,fill_alpha);
266}
267
268/*
269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
270%                                                                             %
271%                                                                             %
272%                                                                             %
273%   D r a w S e t S t r o k e A l p h a                                       %
274%                                                                             %
275%                                                                             %
276%                                                                             %
277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278%
279%  DrawSetStrokeAlpha() specifies the alpha of stroked object outlines.
280%
281%  The format of the DrawSetStrokeAlpha method is:
282%
283%      void DrawSetStrokeAlpha(DrawingWand *wand,const double stroke_alpha)
284%
285%  A description of each parameter follows:
286%
287%    o wand: the drawing wand.
288%
289%    o stroke_alpha: stroke alpha.  The value 1.0 is opaque.
290%
291*/
292WandExport void DrawSetStrokeAlpha(DrawingWand *wand,const double stroke_alpha)
293{
294  DrawSetStrokeOpacity(wand,stroke_alpha);
295}
296
297/*
298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
299%                                                                             %
300%                                                                             %
301%                                                                             %
302%   M a g i c k C o l o r F l o o d f i l l I m a g e                         %
303%                                                                             %
304%                                                                             %
305%                                                                             %
306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
307%
308%  MagickColorFloodfillImage() changes the color value of any pixel that matches
309%  target and is an immediate neighbor.  If the method FillToBorderMethod is
310%  specified, the color value is changed for any neighbor pixel that does not
311%  match the bordercolor member of image.
312%
313%  The format of the MagickColorFloodfillImage method is:
314%
315%      MagickBooleanType MagickColorFloodfillImage(MagickWand *wand,
316%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
317%        const long x,const long y)
318%
319%  A description of each parameter follows:
320%
321%    o wand: the magick wand.
322%
323%    o fill: the floodfill color pixel wand.
324%
325%    o fuzz: By default target must match a particular pixel color
326%      exactly.  However, in many cases two colors may differ by a small amount.
327%      The fuzz member of image defines how much tolerance is acceptable to
328%      consider two colors as the same.  For example, set fuzz to 10 and the
329%      color red at intensities of 100 and 102 respectively are now interpreted
330%      as the same color for the purposes of the floodfill.
331%
332%    o bordercolor: the border color pixel wand.
333%
334%    o x,y: the starting location of the operation.
335%
336*/
337WandExport MagickBooleanType MagickColorFloodfillImage(MagickWand *wand,
338  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
339  const long x,const long y)
340{
341  DrawInfo
342    *draw_info;
343
344  MagickBooleanType
345    status;
346
347  PixelPacket
348    target;
349
350  assert(wand != (MagickWand *) NULL);
351  assert(wand->signature == WandSignature);
352  if (wand->debug != MagickFalse)
353    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
354  if (wand->images == (Image *) NULL)
355    ThrowWandException(WandError,"ContainsNoImages",wand->name);
356  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
357  PixelGetQuantumColor(fill,&draw_info->fill);
358  (void) GetOneVirtualPixel(wand->images,x % wand->images->columns,
359    y % wand->images->rows,&target,wand->exception);
360  if (bordercolor != (PixelWand *) NULL)
361    PixelGetQuantumColor(bordercolor,&target);
362  wand->images->fuzz=fuzz;
363  status=ColorFloodfillImage(wand->images,draw_info,target,x,y,
364    bordercolor != (PixelWand *) NULL ? FillToBorderMethod : FloodfillMethod);
365  if (status == MagickFalse)
366    InheritException(wand->exception,&wand->images->exception);
367  draw_info=DestroyDrawInfo(draw_info);
368  return(status);
369}
370
371/*
372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
373%                                                                             %
374%                                                                             %
375%                                                                             %
376%   M a g i c k D e s c r i b e I m a g e                                     %
377%                                                                             %
378%                                                                             %
379%                                                                             %
380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
381%
382%  MagickDescribeImage() identifies an image by printing its attributes to the
383%  file.  Attributes include the image width, height, size, and others.
384%
385%  The format of the MagickDescribeImage method is:
386%
387%      const char *MagickDescribeImage(MagickWand *wand)
388%
389%  A description of each parameter follows:
390%
391%    o wand: the magick wand.
392%
393*/
394WandExport char *MagickDescribeImage(MagickWand *wand)
395{
396  return(MagickIdentifyImage(wand));
397}
398
399/*
400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401%                                                                             %
402%                                                                             %
403%                                                                             %
404%   M a g i c k F l a t t e n I m a g e s                                     %
405%                                                                             %
406%                                                                             %
407%                                                                             %
408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409%
410%  MagickFlattenImages() merges a sequence of images.  This useful for
411%  combining Photoshop layers into a single image.
412%
413%  The format of the MagickFlattenImages method is:
414%
415%      MagickWand *MagickFlattenImages(MagickWand *wand)
416%
417%  A description of each parameter follows:
418%
419%    o wand: the magick wand.
420%
421*/
422
423static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
424  Image *images)
425{
426  MagickWand
427    *clone_wand;
428
429  assert(wand != (MagickWand *) NULL);
430  assert(wand->signature == WandSignature);
431  if (wand->debug != MagickFalse)
432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
433  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
434  if (clone_wand == (MagickWand *) NULL)
435    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
436      images->filename);
437  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
438  clone_wand->id=AcquireWandId();
439  (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu",
440    MagickWandId,clone_wand->id);
441  clone_wand->exception=AcquireExceptionInfo();
442  InheritException(clone_wand->exception,wand->exception);
443  clone_wand->image_info=CloneImageInfo(wand->image_info);
444  clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
445  clone_wand->images=images;
446  clone_wand->debug=IsEventLogging();
447  if (clone_wand->debug != MagickFalse)
448    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
449  clone_wand->signature=WandSignature;
450  return(clone_wand);
451}
452
453WandExport MagickWand *MagickFlattenImages(MagickWand *wand)
454{
455  Image
456    *flatten_image;
457
458  assert(wand != (MagickWand *) NULL);
459  assert(wand->signature == WandSignature);
460  if (wand->debug != MagickFalse)
461    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
462  if (wand->images == (Image *) NULL)
463    return((MagickWand *) NULL);
464  flatten_image=FlattenImages(wand->images,wand->exception);
465  if (flatten_image == (Image *) NULL)
466    return((MagickWand *) NULL);
467  return(CloneMagickWandFromImages(wand,flatten_image));
468}
469
470/*
471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
472%                                                                             %
473%                                                                             %
474%                                                                             %
475%   M a g i c k G e t I m a g e A t t r i b u t e                             %
476%                                                                             %
477%                                                                             %
478%                                                                             %
479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
480%
481%  MagickGetImageAttribute() returns a value associated with the specified
482%  property.  Use MagickRelinquishMemory() to free the value when you are
483%  finished with it.
484%
485%  The format of the MagickGetImageAttribute method is:
486%
487%      char *MagickGetImageAttribute(MagickWand *wand,const char *property)
488%
489%  A description of each parameter follows:
490%
491%    o wand: the magick wand.
492%
493%    o property: the property.
494%
495*/
496WandExport char *MagickGetImageAttribute(MagickWand *wand,const char *property)
497{
498  return(MagickGetImageProperty(wand,property));
499}
500
501/*
502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
503%                                                                             %
504%                                                                             %
505%                                                                             %
506+   M a g i c k G e t I m a g e I n d e x                                     %
507%                                                                             %
508%                                                                             %
509%                                                                             %
510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
511%
512%  MagickGetImageIndex() returns the index of the current image.
513%
514%  The format of the MagickGetImageIndex method is:
515%
516%      long MagickGetImageIndex(MagickWand *wand)
517%
518%  A description of each parameter follows:
519%
520%    o wand: the magick wand.
521%
522*/
523WandExport long MagickGetImageIndex(MagickWand *wand)
524{
525  return(MagickGetIteratorIndex(wand));
526}
527
528/*
529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
530%                                                                             %
531%                                                                             %
532%                                                                             %
533+   M a g i c k G e t I m a g e C h a n n e l E x t r e m a                   %
534%                                                                             %
535%                                                                             %
536%                                                                             %
537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
538%
539%  MagickGetImageChannelExtrema() gets the extrema for one or more image
540%  channels.
541%
542%  The format of the MagickGetImageChannelExtrema method is:
543%
544%      MagickBooleanType MagickGetImageChannelExtrema(MagickWand *wand,
545%        const ChannelType channel,unsigned long *minima,unsigned long *maxima)
546%
547%  A description of each parameter follows:
548%
549%    o wand: the magick wand.
550%
551%    o channel: the image channel(s).
552%
553%    o minima:  The minimum pixel value for the specified channel(s).
554%
555%    o maxima:  The maximum pixel value for the specified channel(s).
556%
557*/
558WandExport MagickBooleanType MagickGetImageChannelExtrema(MagickWand *wand,
559  const ChannelType channel,unsigned long *minima,unsigned long *maxima)
560{
561  MagickBooleanType
562    status;
563
564  assert(wand != (MagickWand *) NULL);
565  assert(wand->signature == WandSignature);
566  if (wand->debug != MagickFalse)
567    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
568  if (wand->images == (Image *) NULL)
569    ThrowWandException(WandError,"ContainsNoImages",wand->name);
570  status=GetImageChannelExtrema(wand->images,channel,minima,maxima,
571    wand->exception);
572  return(status);
573}
574
575/*
576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
577%                                                                             %
578%                                                                             %
579%                                                                             %
580+   M a g i c k G e t I m a g e E x t r e m a                                 %
581%                                                                             %
582%                                                                             %
583%                                                                             %
584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
585%
586%  MagickGetImageExtrema() gets the extrema for the image.
587%
588%  The format of the MagickGetImageExtrema method is:
589%
590%      MagickBooleanType MagickGetImageExtrema(MagickWand *wand,
591%        unsigned long *minima,unsigned long *maxima)
592%
593%  A description of each parameter follows:
594%
595%    o wand: the magick wand.
596%
597%    o minima:  The minimum pixel value for the specified channel(s).
598%
599%    o maxima:  The maximum pixel value for the specified channel(s).
600%
601*/
602WandExport MagickBooleanType MagickGetImageExtrema(MagickWand *wand,
603  unsigned long *minima,unsigned long *maxima)
604{
605  MagickBooleanType
606    status;
607
608  assert(wand != (MagickWand *) NULL);
609  assert(wand->signature == WandSignature);
610  if (wand->debug != MagickFalse)
611    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
612  if (wand->images == (Image *) NULL)
613    ThrowWandException(WandError,"ContainsNoImages",wand->name);
614  status=GetImageExtrema(wand->images,minima,maxima,wand->exception);
615  return(status);
616}
617
618/*
619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
620%                                                                             %
621%                                                                             %
622%                                                                             %
623%   M a g i c k G e t I m a g e M a t t e                                     %
624%                                                                             %
625%                                                                             %
626%                                                                             %
627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
628%
629%  MagickGetImageMatte() returns MagickTrue if the image has a matte channel
630%  otherwise MagickFalse.
631%
632%  The format of the MagickGetImageMatte method is:
633%
634%      unsigned long MagickGetImageMatte(MagickWand *wand)
635%
636%  A description of each parameter follows:
637%
638%    o wand: the magick wand.
639%
640*/
641WandExport MagickBooleanType MagickGetImageMatte(MagickWand *wand)
642{
643  assert(wand != (MagickWand *) NULL);
644  assert(wand->signature == WandSignature);
645  if (wand->debug != MagickFalse)
646    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
647  if (wand->images == (Image *) NULL)
648    ThrowWandException(WandError,"ContainsNoImages",wand->name);
649  return(wand->images->matte);
650}
651
652/*
653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
654%                                                                             %
655%                                                                             %
656%                                                                             %
657%   M a g i c k G e t I m a g e P i x e l s                                   %
658%                                                                             %
659%                                                                             %
660%                                                                             %
661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
662%
663%  MagickGetImagePixels() extracts pixel data from an image and returns it to
664%  you.  The method returns MagickTrue on success otherwise MagickFalse if an
665%  error is encountered.  The data is returned as char, short int, int, long,
666%  float, or double in the order specified by map.
667%
668%  Suppose you want to extract the first scanline of a 640x480 image as
669%  character data in red-green-blue order:
670%
671%      MagickGetImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
672%
673%  The format of the MagickGetImagePixels method is:
674%
675%      MagickBooleanType MagickGetImagePixels(MagickWand *wand,
676%        const long x,const long y,const unsigned long columns,
677%        const unsigned long rows,const char *map,const StorageType storage,
678%        void *pixels)
679%
680%  A description of each parameter follows:
681%
682%    o wand: the magick wand.
683%
684%    o x, y, columns, rows:  These values define the perimeter
685%      of a region of pixels you want to extract.
686%
687%    o map:  This string reflects the expected ordering of the pixel array.
688%      It can be any combination or order of R = red, G = green, B = blue,
689%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
690%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
691%      P = pad.
692%
693%    o storage: Define the data type of the pixels.  Float and double types are
694%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
695%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
696%      LongPixel, QuantumPixel, or ShortPixel.
697%
698%    o pixels: This array of values contain the pixel components as defined by
699%      map and type.  You must preallocate this array where the expected
700%      length varies depending on the values of width, height, map, and type.
701%
702*/
703WandExport MagickBooleanType MagickGetImagePixels(MagickWand *wand,
704  const long x,const long y,const unsigned long columns,
705  const unsigned long rows,const char *map,const StorageType storage,
706  void *pixels)
707{
708  return(MagickExportImagePixels(wand,x,y,columns,rows,map,storage,pixels));
709}
710
711/*
712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
713%                                                                             %
714%                                                                             %
715%                                                                             %
716%   M a g i c k G e t I m a g e S i z e                                       %
717%                                                                             %
718%                                                                             %
719%                                                                             %
720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
721%
722%  MagickGetImageSize() returns the image length in bytes.
723%
724%  The format of the MagickGetImageSize method is:
725%
726%      MagickBooleanType MagickGetImageSize(MagickWand *wand,
727%        MagickSizeType *length)
728%
729%  A description of each parameter follows:
730%
731%    o wand: the magick wand.
732%
733%    o length: the image length in bytes.
734%
735*/
736WandExport MagickSizeType MagickGetImageSize(MagickWand *wand)
737{
738  assert(wand != (MagickWand *) NULL);
739  assert(wand->signature == WandSignature);
740  if (wand->debug != MagickFalse)
741    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
742  if (wand->images == (Image *) NULL)
743    ThrowWandException(WandError,"ContainsNoImages",wand->name);
744  return(GetBlobSize(wand->images));
745}
746
747/*
748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749%                                                                             %
750%                                                                             %
751%                                                                             %
752%   M a g i c k M a p I m a g e                                               %
753%                                                                             %
754%                                                                             %
755%                                                                             %
756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757%
758%  MagickMapImage() replaces the colors of an image with the closest color
759%  from a reference image.
760%
761%  The format of the MagickMapImage method is:
762%
763%      MagickBooleanType MagickMapImage(MagickWand *wand,
764%        const MagickWand *map_wand,const MagickBooleanType dither)
765%
766%  A description of each parameter follows:
767%
768%    o wand: the magick wand.
769%
770%    o map: the map wand.
771%
772%    o dither: Set this integer value to something other than zero to dither
773%      the mapped image.
774%
775*/
776WandExport MagickBooleanType MagickMapImage(MagickWand *wand,
777  const MagickWand *map_wand,const MagickBooleanType dither)
778{
779  MagickBooleanType
780    status;
781
782  assert(wand != (MagickWand *) NULL);
783  assert(wand->signature == WandSignature);
784  if (wand->debug != MagickFalse)
785    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
786  if ((wand->images == (Image *) NULL) || (map_wand->images == (Image *) NULL))
787    ThrowWandException(WandError,"ContainsNoImages",wand->name);
788  status=MapImage(wand->images,map_wand->images,dither);
789  if (status == MagickFalse)
790    InheritException(wand->exception,&wand->images->exception);
791  return(status);
792}
793
794/*
795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
796%                                                                             %
797%                                                                             %
798%                                                                             %
799%   M a g i c k M a t t e F l o o d f i l l I m a g e                         %
800%                                                                             %
801%                                                                             %
802%                                                                             %
803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
804%
805%  MagickMatteFloodfillImage() changes the transparency value of any pixel that
806%  matches target and is an immediate neighbor.  If the method
807%  FillToBorderMethod is specified, the transparency value is changed for any
808%  neighbor pixel that does not match the bordercolor member of image.
809%
810%  The format of the MagickMatteFloodfillImage method is:
811%
812%      MagickBooleanType MagickMatteFloodfillImage(MagickWand *wand,
813%        const double alpha,const double fuzz,const PixelWand *bordercolor,
814%        const long x,const long y)
815%
816%  A description of each parameter follows:
817%
818%    o wand: the magick wand.
819%
820%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
821%      transparent.
822%
823%    o fuzz: By default target must match a particular pixel color
824%      exactly.  However, in many cases two colors may differ by a small amount.
825%      The fuzz member of image defines how much tolerance is acceptable to
826%      consider two colors as the same.  For example, set fuzz to 10 and the
827%      color red at intensities of 100 and 102 respectively are now interpreted
828%      as the same color for the purposes of the floodfill.
829%
830%    o bordercolor: the border color pixel wand.
831%
832%    o x,y: the starting location of the operation.
833%
834*/
835WandExport MagickBooleanType MagickMatteFloodfillImage(MagickWand *wand,
836  const double alpha,const double fuzz,const PixelWand *bordercolor,
837  const long x,const long y)
838{
839  DrawInfo
840    *draw_info;
841
842  MagickBooleanType
843    status;
844
845  PixelPacket
846    target;
847
848  assert(wand != (MagickWand *) NULL);
849  assert(wand->signature == WandSignature);
850  if (wand->debug != MagickFalse)
851    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
852  if (wand->images == (Image *) NULL)
853    ThrowWandException(WandError,"ContainsNoImages",wand->name);
854  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
855  (void) GetOneVirtualPixel(wand->images,x % wand->images->columns,
856    y % wand->images->rows,&target,wand->exception);
857  if (bordercolor != (PixelWand *) NULL)
858    PixelGetQuantumColor(bordercolor,&target);
859  wand->images->fuzz=fuzz;
860  status=MatteFloodfillImage(wand->images,target,RoundToQuantum(
861    (MagickRealType) QuantumRange-QuantumRange*alpha),x,y,bordercolor !=
862    (PixelWand *) NULL ? FillToBorderMethod : FloodfillMethod);
863  if (status == MagickFalse)
864    InheritException(wand->exception,&wand->images->exception);
865  draw_info=DestroyDrawInfo(draw_info);
866  return(status);
867}
868
869/*
870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
871%                                                                             %
872%                                                                             %
873%                                                                             %
874%   M a g i c k M o s a i c I m a g e s                                       %
875%                                                                             %
876%                                                                             %
877%                                                                             %
878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
879%
880%  MagickMosaicImages() inlays an image sequence to form a single coherent
881%  picture.  It returns a wand with each image in the sequence composited at
882%  the location defined by the page offset of the image.
883%
884%  The format of the MagickMosaicImages method is:
885%
886%      MagickWand *MagickMosaicImages(MagickWand *wand)
887%
888%  A description of each parameter follows:
889%
890%    o wand: the magick wand.
891%
892*/
893WandExport MagickWand *MagickMosaicImages(MagickWand *wand)
894{
895  Image
896    *mosaic_image;
897
898  assert(wand != (MagickWand *) NULL);
899  assert(wand->signature == WandSignature);
900  if (wand->debug != MagickFalse)
901    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
902  if (wand->images == (Image *) NULL)
903    return((MagickWand *) NULL);
904  mosaic_image=MosaicImages(wand->images,wand->exception);
905  if (mosaic_image == (Image *) NULL)
906    return((MagickWand *) NULL);
907  return(CloneMagickWandFromImages(wand,mosaic_image));
908}
909
910/*
911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
912%                                                                             %
913%                                                                             %
914%                                                                             %
915%   M a g i c k O p a q u e I m a g e                                         %
916%                                                                             %
917%                                                                             %
918%                                                                             %
919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
920%
921%  MagickOpaqueImage() changes any pixel that matches color with the color
922%  defined by fill.
923%
924%  The format of the MagickOpaqueImage method is:
925%
926%      MagickBooleanType MagickOpaqueImage(MagickWand *wand,
927%        const PixelWand *target,const PixelWand *fill,const double fuzz)
928%
929%  A description of each parameter follows:
930%
931%    o wand: the magick wand.
932%
933%    o channel: the channel(s).
934%
935%    o target: Change this target color to the fill color within the image.
936%
937%    o fill: the fill pixel wand.
938%
939%    o fuzz: By default target must match a particular pixel color
940%      exactly.  However, in many cases two colors may differ by a small amount.
941%      The fuzz member of image defines how much tolerance is acceptable to
942%      consider two colors as the same.  For example, set fuzz to 10 and the
943%      color red at intensities of 100 and 102 respectively are now interpreted
944%      as the same color for the purposes of the floodfill.
945%
946*/
947WandExport MagickBooleanType MagickOpaqueImage(MagickWand *wand,
948  const PixelWand *target,const PixelWand *fill,const double fuzz)
949{
950  return(MagickPaintOpaqueImage(wand,target,fill,fuzz));
951}
952
953/*
954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
955%                                                                             %
956%                                                                             %
957%                                                                             %
958%   M a g i c k P a i n t F l o o d f i l l I m a g e                         %
959%                                                                             %
960%                                                                             %
961%                                                                             %
962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
963%
964%  MagickPaintFloodfillImage() changes the color value of any pixel that matches
965%  target and is an immediate neighbor.  If the method FillToBorderMethod is
966%  specified, the color value is changed for any neighbor pixel that does not
967%  match the bordercolor member of image.
968%
969%  The format of the MagickPaintFloodfillImage method is:
970%
971%      MagickBooleanType MagickPaintFloodfillImage(MagickWand *wand,
972%        const ChannelType channel,const PixelWand *fill,const double fuzz,
973%        const PixelWand *bordercolor,const long x,const long y)
974%
975%  A description of each parameter follows:
976%
977%    o wand: the magick wand.
978%
979%    o channel: the channel(s).
980%
981%    o fill: the floodfill color pixel wand.
982%
983%    o fuzz: By default target must match a particular pixel color
984%      exactly.  However, in many cases two colors may differ by a small amount.
985%      The fuzz member of image defines how much tolerance is acceptable to
986%      consider two colors as the same.  For example, set fuzz to 10 and the
987%      color red at intensities of 100 and 102 respectively are now interpreted
988%      as the same color for the purposes of the floodfill.
989%
990%    o bordercolor: the border color pixel wand.
991%
992%    o x,y: the starting location of the operation.
993%
994*/
995WandExport MagickBooleanType MagickPaintFloodfillImage(MagickWand *wand,
996  const ChannelType channel,const PixelWand *fill,const double fuzz,
997  const PixelWand *bordercolor,const long x,const long y)
998{
999  MagickBooleanType
1000    status;
1001
1002  status=MagickFloodfillPaintImage(wand,channel,fill,fuzz,bordercolor,x,y,
1003    MagickFalse);
1004  return(status);
1005}
1006
1007/*
1008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1009%                                                                             %
1010%                                                                             %
1011%                                                                             %
1012%   M a g i c k P a i n t O p a q u e I m a g e                               %
1013%                                                                             %
1014%                                                                             %
1015%                                                                             %
1016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017%
1018%  MagickPaintOpaqueImage() changes any pixel that matches color with the color
1019%  defined by fill.
1020%
1021%  The format of the MagickPaintOpaqueImage method is:
1022%
1023%      MagickBooleanType MagickPaintOpaqueImage(MagickWand *wand,
1024%        const PixelWand *target,const PixelWand *fill,const double fuzz)
1025%      MagickBooleanType MagickPaintOpaqueImageChannel(MagickWand *wand,
1026%        const ChannelType channel,const PixelWand *target,
1027%        const PixelWand *fill,const double fuzz)
1028%
1029%  A description of each parameter follows:
1030%
1031%    o wand: the magick wand.
1032%
1033%    o channel: the channel(s).
1034%
1035%    o target: Change this target color to the fill color within the image.
1036%
1037%    o fill: the fill pixel wand.
1038%
1039%    o fuzz: By default target must match a particular pixel color
1040%      exactly.  However, in many cases two colors may differ by a small amount.
1041%      The fuzz member of image defines how much tolerance is acceptable to
1042%      consider two colors as the same.  For example, set fuzz to 10 and the
1043%      color red at intensities of 100 and 102 respectively are now interpreted
1044%      as the same color for the purposes of the floodfill.
1045%
1046*/
1047
1048WandExport MagickBooleanType MagickPaintOpaqueImage(MagickWand *wand,
1049  const PixelWand *target,const PixelWand *fill,const double fuzz)
1050{
1051  return(MagickPaintOpaqueImageChannel(wand,DefaultChannels,target,fill,fuzz));
1052}
1053
1054WandExport MagickBooleanType MagickPaintOpaqueImageChannel(MagickWand *wand,
1055  const ChannelType channel,const PixelWand *target,const PixelWand *fill,
1056  const double fuzz)
1057{
1058  MagickBooleanType
1059    status;
1060
1061  status=MagickOpaquePaintImageChannel(wand,channel,target,fill,fuzz,
1062    MagickFalse);
1063  return(status);
1064}
1065
1066/*
1067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1068%                                                                             %
1069%                                                                             %
1070%                                                                             %
1071%   M a g i c k P a i n t T r a n s p a r e n t I m a g e                     %
1072%                                                                             %
1073%                                                                             %
1074%                                                                             %
1075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1076%
1077%  MagickPaintTransparentImage() changes any pixel that matches color with the
1078%  color defined by fill.
1079%
1080%  The format of the MagickPaintTransparentImage method is:
1081%
1082%      MagickBooleanType MagickPaintTransparentImage(MagickWand *wand,
1083%        const PixelWand *target,const double alpha,const double fuzz)
1084%
1085%  A description of each parameter follows:
1086%
1087%    o wand: the magick wand.
1088%
1089%    o target: Change this target color to specified opacity value within
1090%      the image.
1091%
1092%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
1093%      transparent.
1094%
1095%    o fuzz: By default target must match a particular pixel color
1096%      exactly.  However, in many cases two colors may differ by a small amount.
1097%      The fuzz member of image defines how much tolerance is acceptable to
1098%      consider two colors as the same.  For example, set fuzz to 10 and the
1099%      color red at intensities of 100 and 102 respectively are now interpreted
1100%      as the same color for the purposes of the floodfill.
1101%
1102*/
1103WandExport MagickBooleanType MagickPaintTransparentImage(MagickWand *wand,
1104  const PixelWand *target,const double alpha,const double fuzz)
1105{
1106  return(MagickTransparentPaintImage(wand,target,alpha,fuzz,MagickFalse));
1107}
1108
1109/*
1110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1111%                                                                             %
1112%                                                                             %
1113%                                                                             %
1114%   M a g i c k S e t I m a g e A t t r i b u t e                             %
1115%                                                                             %
1116%                                                                             %
1117%                                                                             %
1118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1119%
1120%  MagickSetImageAttribute() associates a property with an image.
1121%
1122%  The format of the MagickSetImageAttribute method is:
1123%
1124%      MagickBooleanType MagickSetImageAttribute(MagickWand *wand,
1125%        const char *property,const char *value)
1126%
1127%  A description of each parameter follows:
1128%
1129%    o wand: the magick wand.
1130%
1131%    o property: the property.
1132%
1133%    o value: the value.
1134%
1135*/
1136WandExport MagickBooleanType MagickSetImageAttribute(MagickWand *wand,
1137  const char *property,const char *value)
1138{
1139  return(SetImageProperty(wand->images,property,value));
1140}
1141
1142/*
1143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1144%                                                                             %
1145%                                                                             %
1146%                                                                             %
1147%   M a g i c k S e t I m a g e I n d e x                                     %
1148%                                                                             %
1149%                                                                             %
1150%                                                                             %
1151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1152%
1153%  MagickSetImageIndex() set the current image to the position of the list
1154%  specified with the index parameter.
1155%
1156%  The format of the MagickSetImageIndex method is:
1157%
1158%      MagickBooleanType MagickSetImageIndex(MagickWand *wand,const long index)
1159%
1160%  A description of each parameter follows:
1161%
1162%    o wand: the magick wand.
1163%
1164%    o index: the scene number.
1165%
1166*/
1167WandExport MagickBooleanType MagickSetImageIndex(MagickWand *wand,
1168  const long index)
1169{
1170  return(MagickSetIteratorIndex(wand,index));
1171}
1172
1173/*
1174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1175%                                                                             %
1176%                                                                             %
1177%                                                                             %
1178+   M a g i c k S e t I m a g e O p t i o n                                   %
1179%                                                                             %
1180%                                                                             %
1181%                                                                             %
1182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1183%
1184%  MagickSetImageOption() associates one or options with a particular image
1185%  format (.e.g MagickSetImageOption(wand,"jpeg","perserve","yes").
1186%
1187%  The format of the MagickSetImageOption method is:
1188%
1189%      MagickBooleanType MagickSetImageOption(MagickWand *wand,
1190%        const char *format,const char *key,const char *value)
1191%
1192%  A description of each parameter follows:
1193%
1194%    o wand: the magick wand.
1195%
1196%    o format: the image format.
1197%
1198%    o key:  The key.
1199%
1200%    o value:  The value.
1201%
1202*/
1203WandExport MagickBooleanType MagickSetImageOption(MagickWand *wand,
1204  const char *format,const char *key,const char *value)
1205{
1206  char
1207    option[MaxTextExtent];
1208
1209  assert(wand != (MagickWand *) NULL);
1210  assert(wand->signature == WandSignature);
1211  if (wand->debug != MagickFalse)
1212    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1213  (void) FormatMagickString(option,MaxTextExtent,"%s:%s=%s",format,key,value);
1214  return(DefineImageOption(wand->image_info,option));
1215}
1216
1217/*
1218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1219%                                                                             %
1220%                                                                             %
1221%                                                                             %
1222%   M a g i c k T r a n s p a r e n t I m a g e                               %
1223%                                                                             %
1224%                                                                             %
1225%                                                                             %
1226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1227%
1228%  MagickTransparentImage() changes any pixel that matches color with the
1229%  color defined by fill.
1230%
1231%  The format of the MagickTransparentImage method is:
1232%
1233%      MagickBooleanType MagickTransparentImage(MagickWand *wand,
1234%        const PixelWand *target,const double alpha,const double fuzz)
1235%
1236%  A description of each parameter follows:
1237%
1238%    o wand: the magick wand.
1239%
1240%    o target: Change this target color to specified opacity value within
1241%      the image.
1242%
1243%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
1244%      transparent.
1245%
1246%    o fuzz: By default target must match a particular pixel color
1247%      exactly.  However, in many cases two colors may differ by a small amount.
1248%      The fuzz member of image defines how much tolerance is acceptable to
1249%      consider two colors as the same.  For example, set fuzz to 10 and the
1250%      color red at intensities of 100 and 102 respectively are now interpreted
1251%      as the same color for the purposes of the floodfill.
1252%
1253*/
1254WandExport MagickBooleanType MagickTransparentImage(MagickWand *wand,
1255  const PixelWand *target,const double alpha,const double fuzz)
1256{
1257  return(MagickPaintTransparentImage(wand,target,alpha,fuzz));
1258}
1259
1260/*
1261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262%                                                                             %
1263%                                                                             %
1264%                                                                             %
1265%   M a g i c k R e g i o n O f I n t e r e s t I m a g e                     %
1266%                                                                             %
1267%                                                                             %
1268%                                                                             %
1269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1270%
1271%  MagickRegionOfInterestImage() extracts a region of the image and returns it
1272%  as a new wand.
1273%
1274%  The format of the MagickRegionOfInterestImage method is:
1275%
1276%      MagickWand *MagickRegionOfInterestImage(MagickWand *wand,
1277%        const unsigned long width,const unsigned long height,const long x,
1278%        const long y)
1279%
1280%  A description of each parameter follows:
1281%
1282%    o wand: the magick wand.
1283%
1284%    o width: the region width.
1285%
1286%    o height: the region height.
1287%
1288%    o x: the region x offset.
1289%
1290%    o y: the region y offset.
1291%
1292*/
1293WandExport MagickWand *MagickRegionOfInterestImage(MagickWand *wand,
1294  const unsigned long width,const unsigned long height,const long x,
1295  const long y)
1296{
1297  return(MagickGetImageRegion(wand,width,height,x,y));
1298}
1299
1300/*
1301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1302%                                                                             %
1303%                                                                             %
1304%                                                                             %
1305%   M a g i c k S e t I m a g e P i x e l s                                   %
1306%                                                                             %
1307%                                                                             %
1308%                                                                             %
1309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1310%
1311%  MagickSetImagePixels() accepts pixel datand stores it in the image at the
1312%  location you specify.  The method returns MagickFalse on success otherwise
1313%  MagickTrue if an error is encountered.  The pixel data can be either char,
1314%  short int, int, long, float, or double in the order specified by map.
1315%
1316%  Suppose your want to upload the first scanline of a 640x480 image from
1317%  character data in red-green-blue order:
1318%
1319%      MagickSetImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
1320%
1321%  The format of the MagickSetImagePixels method is:
1322%
1323%      MagickBooleanType MagickSetImagePixels(MagickWand *wand,
1324%        const long x,const long y,const unsigned long columns,
1325%        const unsigned long rows,const char *map,const StorageType storage,
1326%        const void *pixels)
1327%
1328%  A description of each parameter follows:
1329%
1330%    o wand: the magick wand.
1331%
1332%    o x, y, columns, rows:  These values define the perimeter of a region
1333%      of pixels you want to define.
1334%
1335%    o map:  This string reflects the expected ordering of the pixel array.
1336%      It can be any combination or order of R = red, G = green, B = blue,
1337%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
1338%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
1339%      P = pad.
1340%
1341%    o storage: Define the data type of the pixels.  Float and double types are
1342%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
1343%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
1344%      or DoublePixel.
1345%
1346%    o pixels: This array of values contain the pixel components as defined by
1347%      map and type.  You must preallocate this array where the expected
1348%      length varies depending on the values of width, height, map, and type.
1349%
1350*/
1351WandExport MagickBooleanType MagickSetImagePixels(MagickWand *wand,
1352  const long x,const long y,const unsigned long columns,
1353  const unsigned long rows,const char *map,const StorageType storage,
1354  const void *pixels)
1355{
1356  return(MagickImportImagePixels(wand,x,y,columns,rows,map,storage,pixels));
1357}
1358
1359/*
1360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1361%                                                                             %
1362%                                                                             %
1363%                                                                             %
1364%   M a g i c k W r i t e I m a g e B l o b                                   %
1365%                                                                             %
1366%                                                                             %
1367%                                                                             %
1368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1369%
1370%  MagickWriteImageBlob() implements direct to memory image formats.  It
1371%  returns the image as a blob and its length.   Use MagickSetFormat() to
1372%  set the format of the returned blob (GIF, JPEG,  PNG, etc.).
1373%
1374%  Use MagickRelinquishMemory() to free the blob when you are done with it.
1375%
1376%  The format of the MagickWriteImageBlob method is:
1377%
1378%      unsigned char *MagickWriteImageBlob(MagickWand *wand,size_t *length)
1379%
1380%  A description of each parameter follows:
1381%
1382%    o wand: the magick wand.
1383%
1384%    o length: the length of the blob.
1385%
1386*/
1387WandExport unsigned char *MagickWriteImageBlob(MagickWand *wand,size_t *length)
1388{
1389  return(MagickGetImageBlob(wand,length));
1390}
1391
1392/*
1393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1394%                                                                             %
1395%                                                                             %
1396%                                                                             %
1397%   P i x e l G e t N e x t R o w                                             %
1398%                                                                             %
1399%                                                                             %
1400%                                                                             %
1401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1402%
1403%  PixelGetNextRow() returns the next row as an array of pixel wands from the
1404%  pixel iterator.
1405%
1406%  The format of the PixelGetNextRow method is:
1407%
1408%      PixelWand **PixelGetNextRow(PixelIterator *iterator,
1409%        unsigned long *number_wands)
1410%
1411%  A description of each parameter follows:
1412%
1413%    o iterator: the pixel iterator.
1414%
1415%    o number_wands: the number of pixel wands.
1416%
1417*/
1418WandExport PixelWand **PixelGetNextRow(PixelIterator *iterator)
1419{
1420  unsigned long
1421    number_wands;
1422
1423  return(PixelGetNextIteratorRow(iterator,&number_wands));
1424}
1425
1426/*
1427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1428%                                                                             %
1429%                                                                             %
1430%                                                                             %
1431%   P i x e l I t e r a t o r G e t E x c e p t i o n                         %
1432%                                                                             %
1433%                                                                             %
1434%                                                                             %
1435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1436%
1437%  PixelIteratorGetException() returns the severity, reason, and description of
1438%  any error that occurs when using other methods in this API.
1439%
1440%  The format of the PixelIteratorGetException method is:
1441%
1442%      char *PixelIteratorGetException(const Pixeliterator *iterator,
1443%        ExceptionType *severity)
1444%
1445%  A description of each parameter follows:
1446%
1447%    o iterator: the pixel iterator.
1448%
1449%    o severity: the severity of the error is returned here.
1450%
1451*/
1452WandExport char *PixelIteratorGetException(const PixelIterator *iterator,
1453  ExceptionType *severity)
1454{
1455  return(PixelGetIteratorException(iterator,severity));
1456}
1457#endif
Note: See TracBrowser for help on using the browser.