00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #include "wand/studio.h"
00050 #include "wand/MagickWand.h"
00051 #include "wand/magick-wand-private.h"
00052 #include "wand/wand.h"
00053 #include "wand/pixel-wand-private.h"
00054
00055
00056
00057
00058 #define ThrowWandException(severity,tag,context) \
00059 { \
00060 (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
00061 tag,"`%s'",context); \
00062 return(MagickFalse); \
00063 }
00064 #define MagickWandId "MagickWand"
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
00093 Image *images)
00094 {
00095 MagickWand
00096 *clone_wand;
00097
00098 assert(wand != (MagickWand *) NULL);
00099 assert(wand->signature == WandSignature);
00100 if (wand->debug != MagickFalse)
00101 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00102 clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
00103 if (clone_wand == (MagickWand *) NULL)
00104 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
00105 images->filename);
00106 (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
00107 clone_wand->id=AcquireWandId();
00108 (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu",
00109 MagickWandId,clone_wand->id);
00110 clone_wand->exception=AcquireExceptionInfo();
00111 InheritException(clone_wand->exception,wand->exception);
00112 clone_wand->image_info=CloneImageInfo(wand->image_info);
00113 clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
00114 clone_wand->images=images;
00115 clone_wand->debug=IsEventLogging();
00116 if (clone_wand->debug != MagickFalse)
00117 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
00118 clone_wand->signature=WandSignature;
00119 return(clone_wand);
00120 }
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
00145 {
00146 assert(wand != (MagickWand *) NULL);
00147 assert(wand->signature == WandSignature);
00148 if (wand->debug != MagickFalse)
00149 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00150 if (wand->images == (Image *) NULL)
00151 {
00152 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
00153 "ContainsNoImages","`%s'",wand->name);
00154 return((Image *) NULL);
00155 }
00156 return(wand->images);
00157 }
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
00198 const double radius,const double sigma)
00199 {
00200 MagickBooleanType
00201 status;
00202
00203 status=MagickAdaptiveBlurImageChannel(wand,DefaultChannels,radius,sigma);
00204 return(status);
00205 }
00206
00207 WandExport MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
00208 const ChannelType channel,const double radius,const double sigma)
00209 {
00210 Image
00211 *sharp_image;
00212
00213 assert(wand != (MagickWand *) NULL);
00214 assert(wand->signature == WandSignature);
00215 if (wand->debug != MagickFalse)
00216 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00217 if (wand->images == (Image *) NULL)
00218 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00219 sharp_image=AdaptiveBlurImageChannel(wand->images,channel,radius,sigma,
00220 wand->exception);
00221 if (sharp_image == (Image *) NULL)
00222 return(MagickFalse);
00223 ReplaceImageInList(&wand->images,sharp_image);
00224 return(MagickTrue);
00225 }
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
00254 const unsigned long columns,const unsigned long rows)
00255 {
00256 Image
00257 *resize_image;
00258
00259 assert(wand != (MagickWand *) NULL);
00260 assert(wand->signature == WandSignature);
00261 if (wand->debug != MagickFalse)
00262 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00263 if (wand->images == (Image *) NULL)
00264 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00265 resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
00266 if (resize_image == (Image *) NULL)
00267 return(MagickFalse);
00268 ReplaceImageInList(&wand->images,resize_image);
00269 return(MagickTrue);
00270 }
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
00311 const double radius,const double sigma)
00312 {
00313 MagickBooleanType
00314 status;
00315
00316 status=MagickAdaptiveSharpenImageChannel(wand,DefaultChannels,radius,sigma);
00317 return(status);
00318 }
00319
00320 WandExport MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
00321 const ChannelType channel,const double radius,const double sigma)
00322 {
00323 Image
00324 *sharp_image;
00325
00326 assert(wand != (MagickWand *) NULL);
00327 assert(wand->signature == WandSignature);
00328 if (wand->debug != MagickFalse)
00329 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00330 if (wand->images == (Image *) NULL)
00331 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00332 sharp_image=AdaptiveSharpenImageChannel(wand->images,channel,radius,sigma,
00333 wand->exception);
00334 if (sharp_image == (Image *) NULL)
00335 return(MagickFalse);
00336 ReplaceImageInList(&wand->images,sharp_image);
00337 return(MagickTrue);
00338 }
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
00373 const unsigned long width,const unsigned long height,const long offset)
00374 {
00375 Image
00376 *threshold_image;
00377
00378 assert(wand != (MagickWand *) NULL);
00379 assert(wand->signature == WandSignature);
00380 if (wand->debug != MagickFalse)
00381 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00382 if (wand->images == (Image *) NULL)
00383 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00384 threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
00385 wand->exception);
00386 if (threshold_image == (Image *) NULL)
00387 return(MagickFalse);
00388 ReplaceImageInList(&wand->images,threshold_image);
00389 return(MagickTrue);
00390 }
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
00420 Image *images)
00421 {
00422 Image
00423 *sentinel;
00424
00425 sentinel=wand->images;
00426 if (sentinel == (Image *) NULL)
00427 {
00428 wand->images=GetFirstImageInList(images);
00429 return(MagickTrue);
00430 }
00431 if (wand->active == MagickFalse)
00432 {
00433 if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
00434 {
00435 AppendImageToList(&sentinel,images);
00436 wand->images=GetLastImageInList(images);
00437 return(MagickTrue);
00438 }
00439 if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
00440 {
00441 PrependImageToList(&sentinel,images);
00442 wand->images=GetFirstImageInList(images);
00443 return(MagickTrue);
00444 }
00445 }
00446 InsertImageInList(&sentinel,images);
00447 wand->images=GetFirstImageInList(images);
00448 return(MagickTrue);
00449 }
00450
00451 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
00452 const MagickWand *add_wand)
00453 {
00454 Image
00455 *images;
00456
00457 assert(wand != (MagickWand *) NULL);
00458 assert(wand->signature == WandSignature);
00459 if (wand->debug != MagickFalse)
00460 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00461 assert(add_wand != (MagickWand *) NULL);
00462 assert(add_wand->signature == WandSignature);
00463 if (add_wand->images == (Image *) NULL)
00464 ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
00465 images=CloneImageList(add_wand->images,wand->exception);
00466 if (images == (Image *) NULL)
00467 return(MagickFalse);
00468 return(InsertImageInWand(wand,images));
00469 }
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
00502 const NoiseType noise_type)
00503 {
00504 MagickBooleanType
00505 status;
00506
00507 status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
00508 return(status);
00509 }
00510
00511 WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
00512 const ChannelType channel,const NoiseType noise_type)
00513 {
00514 Image
00515 *noise_image;
00516
00517 assert(wand != (MagickWand *) NULL);
00518 assert(wand->signature == WandSignature);
00519 if (wand->debug != MagickFalse)
00520 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00521 if (wand->images == (Image *) NULL)
00522 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00523 noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
00524 wand->exception);
00525 if (noise_image == (Image *) NULL)
00526 return(MagickFalse);
00527 ReplaceImageInList(&wand->images,noise_image);
00528 return(MagickTrue);
00529 }
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
00558 const DrawingWand *drawing_wand)
00559 {
00560 DrawInfo
00561 *draw_info;
00562
00563 Image
00564 *affine_image;
00565
00566 assert(wand != (MagickWand *) NULL);
00567 assert(wand->signature == WandSignature);
00568 if (wand->debug != MagickFalse)
00569 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00570 if (wand->images == (Image *) NULL)
00571 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00572 draw_info=PeekDrawingWand(drawing_wand);
00573 if (draw_info == (DrawInfo *) NULL)
00574 return(MagickFalse);
00575 affine_image=AffineTransformImage(wand->images,&draw_info->affine,
00576 wand->exception);
00577 draw_info=DestroyDrawInfo(draw_info);
00578 if (affine_image == (Image *) NULL)
00579 return(MagickFalse);
00580 ReplaceImageInList(&wand->images,affine_image);
00581 return(MagickTrue);
00582 }
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
00619 const DrawingWand *drawing_wand,const double x,const double y,
00620 const double angle,const char *text)
00621 {
00622 char
00623 geometry[MaxTextExtent];
00624
00625 DrawInfo
00626 *draw_info;
00627
00628 MagickBooleanType
00629 status;
00630
00631 assert(wand != (MagickWand *) NULL);
00632 assert(wand->signature == WandSignature);
00633 if (wand->debug != MagickFalse)
00634 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00635 if (wand->images == (Image *) NULL)
00636 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00637 draw_info=PeekDrawingWand(drawing_wand);
00638 if (draw_info == (DrawInfo *) NULL)
00639 return(MagickFalse);
00640 (void) CloneString(&draw_info->text,text);
00641 (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g",x,y);
00642 draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
00643 draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
00644 draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
00645 draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
00646 (void) CloneString(&draw_info->geometry,geometry);
00647 status=AnnotateImage(wand->images,draw_info);
00648 draw_info=DestroyDrawInfo(draw_info);
00649 if (status == MagickFalse)
00650 InheritException(wand->exception,&wand->images->exception);
00651 return(status);
00652 }
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
00680 const char *server_name)
00681 {
00682 MagickBooleanType
00683 status;
00684
00685 assert(wand != (MagickWand *) NULL);
00686 assert(wand->signature == WandSignature);
00687 if (wand->debug != MagickFalse)
00688 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00689 (void) CloneString(&wand->image_info->server_name,server_name);
00690 status=AnimateImages(wand->image_info,wand->images);
00691 if (status == MagickFalse)
00692 InheritException(wand->exception,&wand->images->exception);
00693 return(status);
00694 }
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
00723 const MagickBooleanType stack)
00724 {
00725 Image
00726 *append_image;
00727
00728 assert(wand != (MagickWand *) NULL);
00729 assert(wand->signature == WandSignature);
00730 if (wand->debug != MagickFalse)
00731 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00732 if (wand->images == (Image *) NULL)
00733 return((MagickWand *) NULL);
00734 append_image=AppendImages(wand->images,stack,wand->exception);
00735 if (append_image == (Image *) NULL)
00736 return((MagickWand *) NULL);
00737 return(CloneMagickWandFromImages(wand,append_image));
00738 }
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762 WandExport MagickWand *MagickAverageImages(MagickWand *wand)
00763 {
00764 Image
00765 *average_image;
00766
00767 assert(wand != (MagickWand *) NULL);
00768 assert(wand->signature == WandSignature);
00769 if (wand->debug != MagickFalse)
00770 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00771 if (wand->images == (Image *) NULL)
00772 return((MagickWand *) NULL);
00773 average_image=AverageImages(wand->images,wand->exception);
00774 if (average_image == (Image *) NULL)
00775 return((MagickWand *) NULL);
00776 return(CloneMagickWandFromImages(wand,average_image));
00777 }
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
00807 const PixelWand *threshold)
00808 {
00809 char
00810 thresholds[MaxTextExtent];
00811
00812 MagickBooleanType
00813 status;
00814
00815 assert(wand != (MagickWand *) NULL);
00816 assert(wand->signature == WandSignature);
00817 if (wand->debug != MagickFalse)
00818 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00819 if (wand->images == (Image *) NULL)
00820 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00821 (void) FormatMagickString(thresholds,MaxTextExtent,
00822 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
00823 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
00824 PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
00825 status=BlackThresholdImage(wand->images,thresholds);
00826 if (status == MagickFalse)
00827 InheritException(wand->exception,&wand->images->exception);
00828 return(status);
00829 }
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand)
00855 {
00856 Image
00857 *shift_image;
00858
00859 assert(wand != (MagickWand *) NULL);
00860 assert(wand->signature == WandSignature);
00861 if (wand->debug != MagickFalse)
00862 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00863 if (wand->images == (Image *) NULL)
00864 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00865 shift_image=BlueShiftImage(wand->images,wand->exception);
00866 if (shift_image == (Image *) NULL)
00867 return(MagickFalse);
00868 ReplaceImageInList(&wand->images,shift_image);
00869 return(MagickTrue);
00870 }
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
00909 const double radius,const double sigma)
00910 {
00911 MagickBooleanType
00912 status;
00913
00914 status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
00915 return(status);
00916 }
00917
00918 WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
00919 const ChannelType channel,const double radius,const double sigma)
00920 {
00921 Image
00922 *blur_image;
00923
00924 assert(wand != (MagickWand *) NULL);
00925 assert(wand->signature == WandSignature);
00926 if (wand->debug != MagickFalse)
00927 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00928 if (wand->images == (Image *) NULL)
00929 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00930 blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
00931 wand->exception);
00932 if (blur_image == (Image *) NULL)
00933 return(MagickFalse);
00934 ReplaceImageInList(&wand->images,blur_image);
00935 return(MagickTrue);
00936 }
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
00970 const PixelWand *bordercolor,const unsigned long width,
00971 const unsigned long height)
00972 {
00973 Image
00974 *border_image;
00975
00976 RectangleInfo
00977 border_info;
00978
00979 assert(wand != (MagickWand *) NULL);
00980 assert(wand->signature == WandSignature);
00981 if (wand->debug != MagickFalse)
00982 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00983 if (wand->images == (Image *) NULL)
00984 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00985 border_info.width=width;
00986 border_info.height=height;
00987 border_info.x=0;
00988 border_info.y=0;
00989 PixelGetQuantumColor(bordercolor,&wand->images->border_color);
00990 border_image=BorderImage(wand->images,&border_info,wand->exception);
00991 if (border_image == (Image *) NULL)
00992 return(MagickFalse);
00993 ReplaceImageInList(&wand->images,border_image);
00994 return(MagickTrue);
00995 }
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
01026 const double radius,const double sigma)
01027 {
01028 Image
01029 *charcoal_image;
01030
01031 assert(wand != (MagickWand *) NULL);
01032 assert(wand->signature == WandSignature);
01033 if (wand->debug != MagickFalse)
01034 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01035 if (wand->images == (Image *) NULL)
01036 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01037 charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
01038 if (charcoal_image == (Image *) NULL)
01039 return(MagickFalse);
01040 ReplaceImageInList(&wand->images,charcoal_image);
01041 return(MagickTrue);
01042 }
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
01079 const unsigned long width,const unsigned long height,const long x,
01080 const long y)
01081 {
01082 Image
01083 *chop_image;
01084
01085 RectangleInfo
01086 chop;
01087
01088 assert(wand != (MagickWand *) NULL);
01089 assert(wand->signature == WandSignature);
01090 if (wand->debug != MagickFalse)
01091 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01092 if (wand->images == (Image *) NULL)
01093 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01094 chop.width=width;
01095 chop.height=height;
01096 chop.x=x;
01097 chop.y=y;
01098 chop_image=ChopImage(wand->images,&chop,wand->exception);
01099 if (chop_image == (Image *) NULL)
01100 return(MagickFalse);
01101 ReplaceImageInList(&wand->images,chop_image);
01102 return(MagickTrue);
01103 }
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
01129 {
01130 MagickBooleanType
01131 status;
01132
01133 assert(wand != (MagickWand *) NULL);
01134 assert(wand->signature == WandSignature);
01135 if (wand->debug != MagickFalse)
01136 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01137 if (wand->images == (Image *) NULL)
01138 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01139 status=ClipImage(wand->images);
01140 if (status == MagickFalse)
01141 InheritException(wand->exception,&wand->images->exception);
01142 return(status);
01143 }
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
01178 const char *pathname,const MagickBooleanType inside)
01179 {
01180 MagickBooleanType
01181 status;
01182
01183 assert(wand != (MagickWand *) NULL);
01184 assert(wand->signature == WandSignature);
01185 if (wand->debug != MagickFalse)
01186 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01187 if (wand->images == (Image *) NULL)
01188 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01189 status=ClipImagePath(wand->images,pathname,inside);
01190 if (status == MagickFalse)
01191 InheritException(wand->exception,&wand->images->exception);
01192 return(status);
01193 }
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
01224 const MagickWand *clut_wand)
01225 {
01226 MagickBooleanType
01227 status;
01228
01229 status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
01230 return(status);
01231 }
01232
01233 WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
01234 const ChannelType channel,const MagickWand *clut_wand)
01235 {
01236 MagickBooleanType
01237 status;
01238
01239 assert(wand != (MagickWand *) NULL);
01240 assert(wand->signature == WandSignature);
01241 if (wand->debug != MagickFalse)
01242 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01243 if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
01244 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01245 status=ClutImageChannel(wand->images,channel,clut_wand->images);
01246 if (status == MagickFalse)
01247 InheritException(wand->exception,&wand->images->exception);
01248 return(status);
01249 }
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
01279 {
01280 Image
01281 *coalesce_image;
01282
01283 assert(wand != (MagickWand *) NULL);
01284 assert(wand->signature == WandSignature);
01285 if (wand->debug != MagickFalse)
01286 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01287 if (wand->images == (Image *) NULL)
01288 return((MagickWand *) NULL);
01289 coalesce_image=CoalesceImages(wand->images,wand->exception);
01290 if (coalesce_image == (Image *) NULL)
01291 return((MagickWand *) NULL);
01292 return(CloneMagickWandFromImages(wand,coalesce_image));
01293 }
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
01323 const PixelWand *colorize,const PixelWand *opacity)
01324 {
01325 char
01326 percent_opaque[MaxTextExtent];
01327
01328 Image
01329 *colorize_image;
01330
01331 PixelPacket
01332 target;
01333
01334 assert(wand != (MagickWand *) NULL);
01335 assert(wand->signature == WandSignature);
01336 if (wand->debug != MagickFalse)
01337 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01338 if (wand->images == (Image *) NULL)
01339 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01340 (void) FormatMagickString(percent_opaque,MaxTextExtent,"%g,%g,%g,%g",
01341 (double) (100.0*QuantumScale*PixelGetRedQuantum(opacity)),
01342 (double) (100.0*QuantumScale*PixelGetGreenQuantum(opacity)),
01343 (double) (100.0*QuantumScale*PixelGetBlueQuantum(opacity)),
01344 (double) (100.0*QuantumScale*PixelGetOpacityQuantum(opacity)));
01345 PixelGetQuantumColor(colorize,&target);
01346 colorize_image=ColorizeImage(wand->images,percent_opaque,target,
01347 wand->exception);
01348 if (colorize_image == (Image *) NULL)
01349 return(MagickFalse);
01350 ReplaceImageInList(&wand->images,colorize_image);
01351 return(MagickTrue);
01352 }
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
01383 const ChannelType channel)
01384 {
01385 Image
01386 *combine_image;
01387
01388 assert(wand != (MagickWand *) NULL);
01389 assert(wand->signature == WandSignature);
01390 if (wand->debug != MagickFalse)
01391 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01392 if (wand->images == (Image *) NULL)
01393 return((MagickWand *) NULL);
01394 combine_image=CombineImages(wand->images,channel,wand->exception);
01395 if (combine_image == (Image *) NULL)
01396 return((MagickWand *) NULL);
01397 return(CloneMagickWandFromImages(wand,combine_image));
01398 }
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
01426 const char *comment)
01427 {
01428 MagickBooleanType
01429 status;
01430
01431 assert(wand != (MagickWand *) NULL);
01432 assert(wand->signature == WandSignature);
01433 if (wand->debug != MagickFalse)
01434 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01435 if (wand->images == (Image *) NULL)
01436 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01437 status=SetImageProperty(wand->images,"comment",comment);
01438 if (status == MagickFalse)
01439 InheritException(wand->exception,&wand->images->exception);
01440 return(status);
01441 }
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476 WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
01477 const MagickWand *reference,const ChannelType channel,const MetricType metric,
01478 double *distortion)
01479 {
01480 Image
01481 *compare_image;
01482
01483 assert(wand != (MagickWand *) NULL);
01484 assert(wand->signature == WandSignature);
01485 if (wand->debug != MagickFalse)
01486 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01487 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
01488 {
01489 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
01490 "ContainsNoImages","`%s'",wand->name);
01491 return((MagickWand *) NULL);
01492 }
01493 compare_image=CompareImageChannels(wand->images,reference->images,channel,
01494 metric,distortion,&wand->images->exception);
01495 if (compare_image == (Image *) NULL)
01496 return((MagickWand *) NULL);
01497 return(CloneMagickWandFromImages(wand,compare_image));
01498 }
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527 WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
01528 const ImageLayerMethod method)
01529 {
01530 Image
01531 *layers_image;
01532
01533 assert(wand != (MagickWand *) NULL);
01534 assert(wand->signature == WandSignature);
01535 if (wand->debug != MagickFalse)
01536 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01537 if (wand->images == (Image *) NULL)
01538 return((MagickWand *) NULL);
01539 layers_image=CompareImageLayers(wand->images,method,wand->exception);
01540 if (layers_image == (Image *) NULL)
01541 return((MagickWand *) NULL);
01542 return(CloneMagickWandFromImages(wand,layers_image));
01543 }
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
01577 const MagickWand *reference,const MetricType metric,double *distortion)
01578 {
01579 Image
01580 *compare_image;
01581
01582
01583 assert(wand != (MagickWand *) NULL);
01584 assert(wand->signature == WandSignature);
01585 if (wand->debug != MagickFalse)
01586 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01587 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
01588 {
01589 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
01590 "ContainsNoImages","`%s'",wand->name);
01591 return((MagickWand *) NULL);
01592 }
01593 compare_image=CompareImages(wand->images,reference->images,metric,distortion,
01594 &wand->images->exception);
01595 if (compare_image == (Image *) NULL)
01596 return((MagickWand *) NULL);
01597 return(CloneMagickWandFromImages(wand,compare_image));
01598 }
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
01645 const MagickWand *composite_wand,const CompositeOperator compose,const long x,
01646 const long y)
01647 {
01648 MagickBooleanType
01649 status;
01650
01651 status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
01652 compose,x,y);
01653 return(status);
01654 }
01655
01656 WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
01657 const ChannelType channel,const MagickWand *composite_wand,
01658 const CompositeOperator compose,const long x,const long y)
01659 {
01660 MagickBooleanType
01661 status;
01662
01663 assert(wand != (MagickWand *) NULL);
01664 assert(wand->signature == WandSignature);
01665 if (wand->debug != MagickFalse)
01666 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01667 if ((wand->images == (Image *) NULL) ||
01668 (composite_wand->images == (Image *) NULL))
01669 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01670 status=CompositeImageChannel(wand->images,channel,compose,
01671 composite_wand->images,x,y);
01672 if (status == MagickFalse)
01673 InheritException(wand->exception,&wand->images->exception);
01674 return(status);
01675 }
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
01706 const MagickBooleanType sharpen)
01707 {
01708 MagickBooleanType
01709 status;
01710
01711 assert(wand != (MagickWand *) NULL);
01712 assert(wand->signature == WandSignature);
01713 if (wand->debug != MagickFalse)
01714 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01715 if (wand->images == (Image *) NULL)
01716 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01717 status=ContrastImage(wand->images,sharpen);
01718 if (status == MagickFalse)
01719 InheritException(wand->exception,&wand->images->exception);
01720 return(status);
01721 }
01722
01723
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
01760 const double black_point,const double white_point)
01761 {
01762 MagickBooleanType
01763 status;
01764
01765 status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
01766 white_point);
01767 return(status);
01768 }
01769
01770 WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
01771 const ChannelType channel,const double black_point,const double white_point)
01772 {
01773 MagickBooleanType
01774 status;
01775
01776 assert(wand != (MagickWand *) NULL);
01777 assert(wand->signature == WandSignature);
01778 if (wand->debug != MagickFalse)
01779 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01780 if (wand->images == (Image *) NULL)
01781 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01782 status=ContrastStretchImageChannel(wand->images,channel,black_point,
01783 white_point);
01784 if (status == MagickFalse)
01785 InheritException(wand->exception,&wand->images->exception);
01786 return(status);
01787 }
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820
01821
01822 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
01823 const unsigned long order,const double *kernel)
01824 {
01825 MagickBooleanType
01826 status;
01827
01828 status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
01829 return(status);
01830 }
01831
01832 WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
01833 const ChannelType channel,const unsigned long order,const double *kernel)
01834 {
01835 Image
01836 *convolve_image;
01837
01838 assert(wand != (MagickWand *) NULL);
01839 assert(wand->signature == WandSignature);
01840 if (wand->debug != MagickFalse)
01841 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01842 if (kernel == (const double *) NULL)
01843 return(MagickFalse);
01844 if (wand->images == (Image *) NULL)
01845 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01846 convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
01847 wand->exception);
01848 if (convolve_image == (Image *) NULL)
01849 return(MagickFalse);
01850 ReplaceImageInList(&wand->images,convolve_image);
01851 return(MagickTrue);
01852 }
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
01887 const unsigned long width,const unsigned long height,const long x,
01888 const long y)
01889 {
01890 Image
01891 *crop_image;
01892
01893 RectangleInfo
01894 crop;
01895
01896 assert(wand != (MagickWand *) NULL);
01897 assert(wand->signature == WandSignature);
01898 if (wand->debug != MagickFalse)
01899 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01900 if (wand->images == (Image *) NULL)
01901 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01902 crop.width=width;
01903 crop.height=height;
01904 crop.x=x;
01905 crop.y=y;
01906 crop_image=CropImage(wand->images,&crop,wand->exception);
01907 if (crop_image == (Image *) NULL)
01908 return(MagickFalse);
01909 ReplaceImageInList(&wand->images,crop_image);
01910 return(MagickTrue);
01911 }
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
01941 const long displace)
01942 {
01943 MagickBooleanType
01944 status;
01945
01946 assert(wand != (MagickWand *) NULL);
01947 assert(wand->signature == WandSignature);
01948 if (wand->debug != MagickFalse)
01949 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01950 if (wand->images == (Image *) NULL)
01951 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01952 status=CycleColormapImage(wand->images,displace);
01953 if (status == MagickFalse)
01954 InheritException(wand->exception,&wand->images->exception);
01955 return(status);
01956 }
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
02011 const unsigned long columns,const unsigned long rows,const char *map,
02012 const StorageType storage,const void *pixels)
02013 {
02014 Image
02015 *images;
02016
02017 assert(wand != (MagickWand *) NULL);
02018 assert(wand->signature == WandSignature);
02019 if (wand->debug != MagickFalse)
02020 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02021 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
02022 if (images == (Image *) NULL)
02023 return(MagickFalse);
02024 return(InsertImageInWand(wand,images));
02025 }
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
02053 const char *passphrase)
02054 {
02055 assert(wand != (MagickWand *) NULL);
02056 assert(wand->signature == WandSignature);
02057 if (wand->debug != MagickFalse)
02058 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02059 if (wand->images == (Image *) NULL)
02060 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02061 return(DecipherImage(wand->images,passphrase,&wand->images->exception));
02062 }
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
02089 {
02090 Image
02091 *deconstruct_image;
02092
02093 assert(wand != (MagickWand *) NULL);
02094 assert(wand->signature == WandSignature);
02095 if (wand->debug != MagickFalse)
02096 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02097 if (wand->images == (Image *) NULL)
02098 return((MagickWand *) NULL);
02099 deconstruct_image=DeconstructImages(wand->images,wand->exception);
02100 if (deconstruct_image == (Image *) NULL)
02101 return((MagickWand *) NULL);
02102 return(CloneMagickWandFromImages(wand,deconstruct_image));
02103 }
02104
02105
02106
02107
02108
02109
02110
02111
02112
02113
02114
02115
02116
02117
02118
02119
02120
02121
02122
02123
02124
02125
02126
02127
02128
02129
02130
02131
02132
02133 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
02134 const double threshold)
02135 {
02136 Image
02137 *sepia_image;
02138
02139 assert(wand != (MagickWand *) NULL);
02140 assert(wand->signature == WandSignature);
02141 if (wand->debug != MagickFalse)
02142 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02143 if (wand->images == (Image *) NULL)
02144 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02145 sepia_image=DeskewImage(wand->images,threshold,wand->exception);
02146 if (sepia_image == (Image *) NULL)
02147 return(MagickFalse);
02148 ReplaceImageInList(&wand->images,sepia_image);
02149 return(MagickTrue);
02150 }
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171
02172
02173
02174
02175 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
02176 {
02177 Image
02178 *despeckle_image;
02179
02180 assert(wand != (MagickWand *) NULL);
02181 assert(wand->signature == WandSignature);
02182 if (wand->debug != MagickFalse)
02183 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02184 if (wand->images == (Image *) NULL)
02185 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02186 despeckle_image=DespeckleImage(wand->images,wand->exception);
02187 if (despeckle_image == (Image *) NULL)
02188 return(MagickFalse);
02189 ReplaceImageInList(&wand->images,despeckle_image);
02190 return(MagickTrue);
02191 }
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216 WandExport Image *MagickDestroyImage(Image *image)
02217 {
02218 return(DestroyImage(image));
02219 }
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245
02246 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
02247 const char *server_name)
02248 {
02249 Image
02250 *image;
02251
02252 MagickBooleanType
02253 status;
02254
02255 assert(wand != (MagickWand *) NULL);
02256 assert(wand->signature == WandSignature);
02257 if (wand->debug != MagickFalse)
02258 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02259 if (wand->images == (Image *) NULL)
02260 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02261 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
02262 if (image == (Image *) NULL)
02263 return(MagickFalse);
02264 (void) CloneString(&wand->image_info->server_name,server_name);
02265 status=DisplayImages(wand->image_info,image);
02266 if (status == MagickFalse)
02267 InheritException(wand->exception,&image->exception);
02268 image=DestroyImage(image);
02269 return(status);
02270 }
02271
02272
02273
02274
02275
02276
02277
02278
02279
02280
02281
02282
02283
02284
02285
02286
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296
02297 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
02298 const char *server_name)
02299 {
02300 MagickBooleanType
02301 status;
02302
02303 assert(wand != (MagickWand *) NULL);
02304 assert(wand->signature == WandSignature);
02305 if (wand->debug != MagickFalse)
02306 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02307 (void) CloneString(&wand->image_info->server_name,server_name);
02308 status=DisplayImages(wand->image_info,wand->images);
02309 if (status == MagickFalse)
02310 InheritException(wand->exception,&wand->images->exception);
02311 return(status);
02312 }
02313
02314
02315
02316
02317
02318
02319
02320
02321
02322
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338
02339
02340
02341
02342
02343
02344
02345
02346
02347
02348
02349
02350
02351
02352
02353
02354
02355
02356
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366
02367
02368
02369
02370
02371
02372
02373
02374 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
02375 const DistortImageMethod method,const unsigned long number_arguments,
02376 const double *arguments,const MagickBooleanType bestfit)
02377 {
02378 Image
02379 *distort_image;
02380
02381 assert(wand != (MagickWand *) NULL);
02382 assert(wand->signature == WandSignature);
02383 if (wand->debug != MagickFalse)
02384 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02385 if (wand->images == (Image *) NULL)
02386 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02387 distort_image=DistortImage(wand->images,method,number_arguments,arguments,
02388 bestfit,wand->exception);
02389 if (distort_image == (Image *) NULL)
02390 return(MagickFalse);
02391 ReplaceImageInList(&wand->images,distort_image);
02392 return(MagickTrue);
02393 }
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407
02408
02409
02410
02411
02412
02413
02414
02415
02416
02417
02418
02419
02420 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
02421 const DrawingWand *drawing_wand)
02422 {
02423 char
02424 *primitive;
02425
02426 DrawInfo
02427 *draw_info;
02428
02429 MagickBooleanType
02430 status;
02431
02432 assert(wand != (MagickWand *) NULL);
02433 assert(wand->signature == WandSignature);
02434 if (wand->debug != MagickFalse)
02435 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02436 if (wand->images == (Image *) NULL)
02437 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02438 draw_info=PeekDrawingWand(drawing_wand);
02439 if ((draw_info == (DrawInfo *) NULL) ||
02440 (draw_info->primitive == (char *) NULL))
02441 return(MagickFalse);
02442 primitive=AcquireString(draw_info->primitive);
02443 draw_info=DestroyDrawInfo(draw_info);
02444 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
02445 draw_info->primitive=primitive;
02446 status=DrawImage(wand->images,draw_info);
02447 if (status == MagickFalse)
02448 InheritException(wand->exception,&wand->images->exception);
02449 draw_info=DestroyDrawInfo(draw_info);
02450 return(status);
02451 }
02452
02453
02454
02455
02456
02457
02458
02459
02460
02461
02462
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473
02474
02475
02476
02477
02478
02479 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
02480 const double radius)
02481 {
02482 Image
02483 *edge_image;
02484
02485 assert(wand != (MagickWand *) NULL);
02486 assert(wand->signature == WandSignature);
02487 if (wand->debug != MagickFalse)
02488 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02489 if (wand->images == (Image *) NULL)
02490 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02491 edge_image=EdgeImage(wand->images,radius,wand->exception);
02492 if (edge_image == (Image *) NULL)
02493 return(MagickFalse);
02494 ReplaceImageInList(&wand->images,edge_image);
02495 return(MagickTrue);
02496 }
02497
02498
02499
02500
02501
02502
02503
02504
02505
02506
02507
02508
02509
02510
02511
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
02531 const double radius,const double sigma)
02532 {
02533 Image
02534 *emboss_image;
02535
02536 assert(wand != (MagickWand *) NULL);
02537 assert(wand->signature == WandSignature);
02538 if (wand->debug != MagickFalse)
02539 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02540 if (wand->images == (Image *) NULL)
02541 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02542 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
02543 if (emboss_image == (Image *) NULL)
02544 return(MagickFalse);
02545 ReplaceImageInList(&wand->images,emboss_image);
02546 return(MagickTrue);
02547 }
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560
02561
02562
02563
02564
02565
02566
02567
02568
02569
02570
02571
02572
02573
02574 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
02575 const char *passphrase)
02576 {
02577 assert(wand != (MagickWand *) NULL);
02578 assert(wand->signature == WandSignature);
02579 if (wand->debug != MagickFalse)
02580 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02581 if (wand->images == (Image *) NULL)
02582 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02583 return(EncipherImage(wand->images,passphrase,&wand->images->exception));
02584 }
02585
02586
02587
02588
02589
02590
02591
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606
02607
02608
02609 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
02610 {
02611 Image
02612 *enhance_image;
02613
02614 assert(wand != (MagickWand *) NULL);
02615 assert(wand->signature == WandSignature);
02616 if (wand->debug != MagickFalse)
02617 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02618 if (wand->images == (Image *) NULL)
02619 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02620 enhance_image=EnhanceImage(wand->images,wand->exception);
02621 if (enhance_image == (Image *) NULL)
02622 return(MagickFalse);
02623 ReplaceImageInList(&wand->images,enhance_image);
02624 return(MagickTrue);
02625 }
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648
02649
02650
02651
02652
02653
02654 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
02655 {
02656 MagickBooleanType
02657 status;
02658
02659 status=MagickEqualizeImageChannel(wand,DefaultChannels);
02660 return(status);
02661 }
02662
02663 WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
02664 const ChannelType channel)
02665 {
02666 MagickBooleanType
02667 status;
02668
02669 assert(wand != (MagickWand *) NULL);
02670 assert(wand->signature == WandSignature);
02671 if (wand->debug != MagickFalse)
02672 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02673 if (wand->images == (Image *) NULL)
02674 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02675 status=EqualizeImageChannel(wand->images,channel);
02676 if (status == MagickFalse)
02677 InheritException(wand->exception,&wand->images->exception);
02678 return(status);
02679 }
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689
02690
02691
02692
02693
02694
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705
02706
02707
02708
02709
02710
02711
02712
02713
02714
02715
02716
02717 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
02718 const MagickEvaluateOperator op,const double value)
02719 {
02720 MagickBooleanType
02721 status;
02722
02723 assert(wand != (MagickWand *) NULL);
02724 assert(wand->signature == WandSignature);
02725 if (wand->debug != MagickFalse)
02726 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02727 if (wand->images == (Image *) NULL)
02728 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02729 status=EvaluateImage(wand->images,op,value,&wand->images->exception);
02730 if (status == MagickFalse)
02731 InheritException(wand->exception,&wand->images->exception);
02732 return(status);
02733 }
02734
02735 WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
02736 const ChannelType channel,const MagickEvaluateOperator op,const double value)
02737 {
02738 MagickBooleanType
02739 status;
02740
02741 assert(wand != (MagickWand *) NULL);
02742 assert(wand->signature == WandSignature);
02743 if (wand->debug != MagickFalse)
02744 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02745 if (wand->images == (Image *) NULL)
02746 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02747 status=EvaluateImageChannel(wand->images,channel,op,value,
02748 &wand->images->exception);
02749 return(status);
02750 }
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762
02763
02764
02765
02766
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781
02782
02783
02784
02785
02786
02787
02788
02789
02790
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
02804 const long x,const long y,const unsigned long columns,
02805 const unsigned long rows,const char *map,const StorageType storage,
02806 void *pixels)
02807 {
02808 MagickBooleanType
02809 status;
02810
02811 assert(wand != (MagickWand *) NULL);
02812 assert(wand->signature == WandSignature);
02813 if (wand->debug != MagickFalse)
02814 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02815 if (wand->images == (Image *) NULL)
02816 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02817 status=ExportImagePixels(wand->images,x,y,columns,rows,map,
02818 storage,pixels,wand->exception);
02819 if (status == MagickFalse)
02820 InheritException(wand->exception,&wand->images->exception);
02821 return(status);
02822 }
02823
02824
02825
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836
02837
02838
02839
02840
02841
02842
02843
02844
02845
02846
02847
02848
02849
02850
02851
02852
02853
02854
02855
02856
02857
02858 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
02859 const unsigned long width,const unsigned long height,const long x,
02860 const long y)
02861 {
02862 Image
02863 *extent_image;
02864
02865 RectangleInfo
02866 extent;
02867
02868 assert(wand != (MagickWand *) NULL);
02869 assert(wand->signature == WandSignature);
02870 if (wand->debug != MagickFalse)
02871 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02872 if (wand->images == (Image *) NULL)
02873 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02874 extent.width=width;
02875 extent.height=height;
02876 extent.x=x;
02877 extent.y=y;
02878 extent_image=ExtentImage(wand->images,&extent,wand->exception);
02879 if (extent_image == (Image *) NULL)
02880 return(MagickFalse);
02881 ReplaceImageInList(&wand->images,extent_image);
02882 return(MagickTrue);
02883 }
02884
02885
02886
02887
02888
02889
02890
02891
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906
02907
02908 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
02909 {
02910 Image
02911 *flip_image;
02912
02913 assert(wand != (MagickWand *) NULL);
02914 assert(wand->signature == WandSignature);
02915 if (wand->debug != MagickFalse)
02916 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02917 if (wand->images == (Image *) NULL)
02918 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02919 flip_image=FlipImage(wand->images,wand->exception);
02920 if (flip_image == (Image *) NULL)
02921 return(MagickFalse);
02922 ReplaceImageInList(&wand->images,flip_image);
02923 return(MagickTrue);
02924 }
02925
02926
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955
02956
02957
02958
02959
02960
02961
02962
02963
02964
02965
02966
02967
02968
02969
02970
02971 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
02972 const ChannelType channel,const PixelWand *fill,const double fuzz,
02973 const PixelWand *bordercolor,const long x,const long y,
02974 const MagickBooleanType invert)
02975 {
02976 DrawInfo
02977 *draw_info;
02978
02979 MagickBooleanType
02980 status;
02981
02982 MagickPixelPacket
02983 target;
02984
02985 assert(wand != (MagickWand *) NULL);
02986 assert(wand->signature == WandSignature);
02987 if (wand->debug != MagickFalse)
02988 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02989 if (wand->images == (Image *) NULL)
02990 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02991 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
02992 PixelGetQuantumColor(fill,&draw_info->fill);
02993 (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
02994 y % wand->images->rows,&target,wand->exception);
02995 if (bordercolor != (PixelWand *) NULL)
02996 PixelGetMagickColor(bordercolor,&target);
02997 wand->images->fuzz=fuzz;
02998 status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
02999 invert);
03000 if (status == MagickFalse)
03001 InheritException(wand->exception,&wand->images->exception);
03002 draw_info=DestroyDrawInfo(draw_info);
03003 return(status);
03004 }
03005
03006
03007
03008
03009
03010
03011
03012
03013
03014
03015
03016
03017
03018
03019
03020
03021
03022
03023
03024
03025
03026
03027
03028
03029 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
03030 {
03031 Image
03032 *flop_image;
03033
03034 assert(wand != (MagickWand *) NULL);
03035 assert(wand->signature == WandSignature);
03036 if (wand->debug != MagickFalse)
03037 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03038 if (wand->images == (Image *) NULL)
03039 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03040 flop_image=FlopImage(wand->images,wand->exception);
03041 if (flop_image == (Image *) NULL)
03042 return(MagickFalse);
03043 ReplaceImageInList(&wand->images,flop_image);
03044 return(MagickTrue);
03045 }
03046
03047
03048
03049
03050
03051
03052
03053
03054
03055
03056
03057
03058
03059
03060
03061
03062
03063
03064
03065
03066
03067
03068
03069
03070
03071
03072
03073
03074
03075
03076
03077
03078
03079
03080
03081
03082
03083
03084
03085 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
03086 const PixelWand *matte_color,const unsigned long width,
03087 const unsigned long height,const long inner_bevel,const long outer_bevel)
03088 {
03089 Image
03090 *frame_image;
03091
03092 FrameInfo
03093 frame_info;
03094
03095 assert(wand != (MagickWand *) NULL);
03096 assert(wand->signature == WandSignature);
03097 if (wand->debug != MagickFalse)
03098 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03099 if (wand->images == (Image *) NULL)
03100 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03101 (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
03102 frame_info.width=wand->images->columns+2*width;
03103 frame_info.height=wand->images->rows+2*height;
03104 frame_info.x=(long) width;
03105 frame_info.y=(long) height;
03106 frame_info.inner_bevel=inner_bevel;
03107 frame_info.outer_bevel=outer_bevel;
03108 PixelGetQuantumColor(matte_color,&wand->images->matte_color);
03109 frame_image=FrameImage(wand->images,&frame_info,wand->exception);
03110 if (frame_image == (Image *) NULL)
03111 return(MagickFalse);
03112 ReplaceImageInList(&wand->images,frame_image);
03113 return(MagickTrue);
03114 }
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151
03152
03153
03154
03155 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
03156 const MagickFunction function,const unsigned long number_arguments,
03157 const double *arguments)
03158 {
03159 MagickBooleanType
03160 status;
03161
03162 assert(wand != (MagickWand *) NULL);
03163 assert(wand->signature == WandSignature);
03164 if (wand->debug != MagickFalse)
03165 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03166 if (wand->images == (Image *) NULL)
03167 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03168 status=FunctionImage(wand->images,function,number_arguments,arguments,
03169 &wand->images->exception);
03170 if (status == MagickFalse)
03171 InheritException(wand->exception,&wand->images->exception);
03172 return(status);
03173 }
03174
03175 WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
03176 const ChannelType channel,const MagickFunction function,
03177 const unsigned long number_arguments,const double *arguments)
03178 {
03179 MagickBooleanType
03180 status;
03181
03182 assert(wand != (MagickWand *) NULL);
03183 assert(wand->signature == WandSignature);
03184 if (wand->debug != MagickFalse)
03185 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03186 if (wand->images == (Image *) NULL)
03187 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03188 status=FunctionImageChannel(wand->images,channel,function,number_arguments,
03189 arguments,&wand->images->exception);
03190 return(status);
03191 }
03192
03193
03194
03195
03196
03197
03198
03199
03200
03201
03202
03203
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220
03221
03222 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
03223 {
03224 MagickWand
03225 *fx_wand;
03226
03227 fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
03228 return(fx_wand);
03229 }
03230
03231 WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
03232 const ChannelType channel,const char *expression)
03233 {
03234 Image
03235 *fx_image;
03236
03237 assert(wand != (MagickWand *) NULL);
03238 assert(wand->signature == WandSignature);
03239 if (wand->debug != MagickFalse)
03240 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03241 if (wand->images == (Image *) NULL)
03242 return((MagickWand *) NULL);
03243 fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
03244 if (fx_image == (Image *) NULL)
03245 return((MagickWand *) NULL);
03246 return(CloneMagickWandFromImages(wand,fx_image));
03247 }
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260
03261
03262
03263
03264
03265
03266
03267
03268
03269
03270
03271
03272
03273
03274
03275
03276
03277
03278
03279
03280
03281
03282
03283
03284
03285 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
03286 const double gamma)
03287 {
03288 MagickBooleanType
03289 status;
03290
03291 status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
03292 return(status);
03293 }
03294
03295 WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
03296 const ChannelType channel,const double gamma)
03297 {
03298 MagickBooleanType
03299 status;
03300
03301 assert(wand != (MagickWand *) NULL);
03302 assert(wand->signature == WandSignature);
03303 if (wand->debug != MagickFalse)
03304 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03305 if (wand->images == (Image *) NULL)
03306 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03307 status=GammaImageChannel(wand->images,channel,gamma);
03308 if (status == MagickFalse)
03309 InheritException(wand->exception,&wand->images->exception);
03310 return(status);
03311 }
03312
03313
03314
03315
03316
03317
03318
03319
03320
03321
03322
03323
03324
03325
03326
03327
03328
03329
03330
03331
03332
03333
03334
03335
03336
03337
03338
03339
03340
03341
03342
03343
03344
03345
03346
03347
03348
03349 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
03350 const double radius,const double sigma)
03351 {
03352 MagickBooleanType
03353 status;
03354
03355 status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
03356 return(status);
03357 }
03358
03359 WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
03360 const ChannelType channel,const double radius,const double sigma)
03361 {
03362 Image
03363 *blur_image;
03364
03365 assert(wand != (MagickWand *) NULL);
03366 assert(wand->signature == WandSignature);
03367 if (wand->debug != MagickFalse)
03368 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03369 if (wand->images == (Image *) NULL)
03370 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03371 blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
03372 wand->exception);
03373 if (blur_image == (Image *) NULL)
03374 return(MagickFalse);
03375 ReplaceImageInList(&wand->images,blur_image);
03376 return(MagickTrue);
03377 }
03378
03379
03380
03381
03382
03383
03384
03385
03386
03387
03388
03389
03390
03391
03392
03393
03394
03395
03396
03397
03398
03399
03400
03401 WandExport MagickWand *MagickGetImage(MagickWand *wand)
03402 {
03403 Image
03404 *image;
03405
03406 assert(wand != (MagickWand *) NULL);
03407 assert(wand->signature == WandSignature);
03408 if (wand->debug != MagickFalse)
03409 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03410 if (wand->images == (Image *) NULL)
03411 {
03412 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03413 "ContainsNoImages","`%s'",wand->name);
03414 return((MagickWand *) NULL);
03415 }
03416 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
03417 if (image == (Image *) NULL)
03418 return((MagickWand *) NULL);
03419 return(CloneMagickWandFromImages(wand,image));
03420 }
03421
03422
03423
03424
03425
03426
03427
03428
03429
03430
03431
03432
03433
03434
03435
03436
03437
03438
03439
03440
03441
03442
03443
03444
03445
03446 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
03447 {
03448 assert(wand != (MagickWand *) NULL);
03449 assert(wand->signature == WandSignature);
03450 if (wand->debug != MagickFalse)
03451 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03452 if (wand->images == (Image *) NULL)
03453 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03454 return(GetImageAlphaChannel(wand->images));
03455 }
03456
03457
03458
03459
03460
03461
03462
03463
03464
03465
03466
03467
03468
03469
03470
03471
03472
03473
03474
03475
03476
03477
03478
03479 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
03480 {
03481 Image
03482 *image;
03483
03484 assert(wand != (MagickWand *) NULL);
03485 assert(wand->signature == WandSignature);
03486 if (wand->debug != MagickFalse)
03487 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03488 if (wand->images == (Image *) NULL)
03489 {
03490 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03491 "ContainsNoImages","`%s'",wand->name);
03492 return((MagickWand *) NULL);
03493 }
03494 image=GetImageClipMask(wand->images,wand->exception);
03495 if (image == (Image *) NULL)
03496 return((MagickWand *) NULL);
03497 return(CloneMagickWandFromImages(wand,image));
03498 }
03499
03500
03501
03502
03503
03504
03505
03506
03507
03508
03509
03510
03511
03512
03513
03514
03515
03516
03517
03518
03519
03520
03521
03522
03523
03524
03525 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
03526 PixelWand *background_color)
03527 {
03528 assert(wand != (MagickWand *) NULL);
03529 assert(wand->signature == WandSignature);
03530 if (wand->debug != MagickFalse)
03531 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03532 if (wand->images == (Image *) NULL)
03533 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03534 PixelSetQuantumColor(background_color,&wand->images->background_color);
03535 return(MagickTrue);
03536 }
03537
03538
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549
03550
03551
03552
03553
03554
03555
03556
03557
03558
03559
03560
03561
03562
03563
03564
03565
03566 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
03567 {
03568 assert(wand != (MagickWand *) NULL);
03569 assert(wand->signature == WandSignature);
03570 if (wand->debug != MagickFalse)
03571 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03572 if (wand->images == (Image *) NULL)
03573 {
03574 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03575 "ContainsNoImages","`%s'",wand->name);
03576 return((unsigned char *) NULL);
03577 }
03578 return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
03579 }
03580
03581
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595
03596
03597
03598
03599
03600
03601
03602
03603
03604
03605
03606
03607
03608
03609
03610
03611
03612 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
03613 {
03614 unsigned char
03615 *blob;
03616
03617 assert(wand != (MagickWand *) NULL);
03618 assert(wand->signature == WandSignature);
03619 if (wand->debug != MagickFalse)
03620 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03621 if (wand->images == (Image *) NULL)
03622 {
03623 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03624 "ContainsNoImages","`%s'",wand->name);
03625 return((unsigned char *) NULL);
03626 }
03627 blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
03628 wand->exception);
03629 return(blob);
03630 }
03631
03632
03633
03634
03635
03636
03637
03638
03639
03640
03641
03642
03643
03644
03645
03646
03647
03648
03649
03650
03651
03652
03653
03654
03655
03656
03657
03658
03659
03660 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
03661 double *x,double *y)
03662 {
03663 assert(wand != (MagickWand *) NULL);
03664 assert(wand->signature == WandSignature);
03665 if (wand->debug != MagickFalse)
03666 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03667 if (wand->images == (Image *) NULL)
03668 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03669 *x=wand->images->chromaticity.blue_primary.x;
03670 *y=wand->images->chromaticity.blue_primary.y;
03671 return(MagickTrue);
03672 }
03673
03674
03675
03676
03677
03678
03679
03680
03681
03682
03683
03684
03685
03686
03687
03688
03689
03690
03691
03692
03693
03694
03695
03696
03697
03698
03699 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
03700 PixelWand *border_color)
03701 {
03702 assert(wand != (MagickWand *) NULL);
03703 assert(wand->signature == WandSignature);
03704 if (wand->debug != MagickFalse)
03705 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03706 if (wand->images == (Image *) NULL)
03707 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03708 PixelSetQuantumColor(border_color,&wand->images->border_color);
03709 return(MagickTrue);
03710 }
03711
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726
03727
03728
03729
03730
03731
03732
03733
03734
03735
03736
03737 WandExport unsigned long MagickGetImageChannelDepth(MagickWand *wand,
03738 const ChannelType channel)
03739 {
03740 assert(wand != (MagickWand *) NULL);
03741 assert(wand->signature == WandSignature);
03742 if (wand->debug != MagickFalse)
03743 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03744 if (wand->images == (Image *) NULL)
03745 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03746 return(GetImageChannelDepth(wand->images,channel,wand->exception));
03747 }
03748
03749
03750
03751
03752
03753
03754
03755
03756
03757
03758
03759
03760
03761
03762
03763
03764
03765
03766
03767
03768
03769
03770
03771
03772
03773
03774
03775
03776
03777
03778
03779
03780
03781
03782 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
03783 const MagickWand *reference,const ChannelType channel,const MetricType metric,
03784 double *distortion)
03785 {
03786 MagickBooleanType
03787 status;
03788
03789 assert(wand != (MagickWand *) NULL);
03790 assert(wand->signature == WandSignature);
03791 if (wand->debug != MagickFalse)
03792 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03793 assert(reference != (MagickWand *) NULL);
03794 assert(reference->signature == WandSignature);
03795 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
03796 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03797 status=GetImageChannelDistortion(wand->images,reference->images,channel,
03798 metric,distortion,&wand->images->exception);
03799 return(status);
03800 }
03801
03802
03803
03804
03805
03806
03807
03808
03809
03810
03811
03812
03813
03814
03815
03816
03817
03818
03819
03820
03821
03822
03823
03824
03825
03826
03827
03828
03829
03830
03831
03832 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
03833 const MagickWand *reference,const MetricType metric)
03834 {
03835 double
03836 *channel_distortion;
03837
03838 assert(wand != (MagickWand *) NULL);
03839 assert(wand->signature == WandSignature);
03840 if (wand->debug != MagickFalse)
03841 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03842 assert(reference != (MagickWand *) NULL);
03843 assert(reference->signature == WandSignature);
03844 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
03845 {
03846 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03847 "ContainsNoImages","`%s'",wand->name);
03848 return((double *) NULL);
03849 }
03850 channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
03851 metric,&wand->images->exception);
03852 return(channel_distortion);
03853 }
03854
03855
03856
03857
03858
03859
03860
03861
03862
03863
03864
03865
03866
03867
03868
03869
03870
03871
03872
03873
03874
03875
03876
03877
03878
03879
03880
03881
03882
03883
03884
03885 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
03886 const ChannelType channel,double *mean,double *standard_deviation)
03887 {
03888 MagickBooleanType
03889 status;
03890
03891 assert(wand != (MagickWand *) NULL);
03892 assert(wand->signature == WandSignature);
03893 if (wand->debug != MagickFalse)
03894 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03895 if (wand->images == (Image *) NULL)
03896 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03897 status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
03898 wand->exception);
03899 return(status);
03900 }
03901
03902
03903
03904
03905
03906
03907
03908
03909
03910
03911
03912
03913
03914
03915
03916
03917
03918
03919
03920
03921
03922
03923
03924
03925
03926
03927
03928
03929
03930
03931
03932 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
03933 const ChannelType channel,double *kurtosis,double *skewness)
03934 {
03935 MagickBooleanType
03936 status;
03937
03938 assert(wand != (MagickWand *) NULL);
03939 assert(wand->signature == WandSignature);
03940 if (wand->debug != MagickFalse)
03941 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03942 if (wand->images == (Image *) NULL)
03943 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03944 status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
03945 wand->exception);
03946 return(status);
03947 }
03948
03949
03950
03951
03952
03953
03954
03955
03956
03957
03958
03959
03960
03961
03962
03963
03964
03965
03966
03967
03968
03969
03970
03971
03972
03973
03974
03975
03976
03977
03978 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
03979 const ChannelType channel,double *minima,double *maxima)
03980 {
03981 MagickBooleanType
03982 status;
03983
03984 assert(wand != (MagickWand *) NULL);
03985 assert(wand->signature == WandSignature);
03986 if (wand->debug != MagickFalse)
03987 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03988 if (wand->images == (Image *) NULL)
03989 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03990 status=GetImageChannelRange(wand->images,channel,minima,maxima,
03991 wand->exception);
03992 return(status);
03993 }
03994
03995
03996
03997
03998
03999
04000
04001
04002
04003
04004
04005
04006
04007
04008
04009
04010
04011
04012
04013
04014
04015
04016
04017
04018
04019
04020
04021
04022
04023
04024
04025 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
04026 {
04027 assert(wand != (MagickWand *) NULL);
04028 assert(wand->signature == WandSignature);
04029 if (wand->debug != MagickFalse)
04030 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04031 if (wand->images == (Image *) NULL)
04032 {
04033 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04034 "ContainsNoImages","`%s'",wand->name);
04035 return((ChannelStatistics *) NULL);
04036 }
04037 return(GetImageChannelStatistics(wand->images,wand->exception));
04038 }
04039
04040
04041
04042
04043
04044
04045
04046
04047
04048
04049
04050
04051
04052
04053
04054
04055
04056
04057
04058
04059
04060
04061
04062
04063
04064
04065
04066
04067
04068 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
04069 const unsigned long index,PixelWand *color)
04070 {
04071 assert(wand != (MagickWand *) NULL);
04072 assert(wand->signature == WandSignature);
04073 if (wand->debug != MagickFalse)
04074 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04075 if (wand->images == (Image *) NULL)
04076 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04077 if ((wand->images->colormap == (PixelPacket *) NULL) ||
04078 (index >= wand->images->colors))
04079 {
04080 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04081 "InvalidColormapIndex","`%s'",wand->name);
04082 return(MagickFalse);
04083 }
04084 PixelSetQuantumColor(color,wand->images->colormap+index);
04085 return(MagickTrue);
04086 }
04087
04088
04089
04090
04091
04092
04093
04094
04095
04096
04097
04098
04099
04100
04101
04102
04103
04104
04105
04106
04107
04108
04109
04110 WandExport unsigned long MagickGetImageColors(MagickWand *wand)
04111 {
04112 assert(wand != (MagickWand *) NULL);
04113 assert(wand->signature == WandSignature);
04114 if (wand->debug != MagickFalse)
04115 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04116 if (wand->images == (Image *) NULL)
04117 {
04118 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04119 "ContainsNoImages","`%s'",wand->name);
04120 return(0);
04121 }
04122 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
04123 }
04124
04125
04126
04127
04128
04129
04130
04131
04132
04133
04134
04135
04136
04137
04138
04139
04140
04141
04142
04143
04144
04145
04146
04147 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
04148 {
04149 assert(wand != (MagickWand *) NULL);
04150 assert(wand->signature == WandSignature);
04151 if (wand->debug != MagickFalse)
04152 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04153 if (wand->images == (Image *) NULL)
04154 {
04155 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04156 "ContainsNoImages","`%s'",wand->name);
04157 return(UndefinedColorspace);
04158 }
04159 return(wand->images->colorspace);
04160 }
04161
04162
04163
04164
04165
04166
04167
04168
04169
04170
04171
04172
04173
04174
04175
04176
04177
04178
04179
04180
04181
04182
04183
04184
04185 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
04186 {
04187 assert(wand != (MagickWand *) NULL);
04188 assert(wand->signature == WandSignature);
04189 if (wand->debug != MagickFalse)
04190 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04191 if (wand->images == (Image *) NULL)
04192 {
04193 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04194 "ContainsNoImages","`%s'",wand->name);
04195 return(UndefinedCompositeOp);
04196 }
04197 return(wand->images->compose);
04198 }
04199
04200
04201
04202
04203
04204
04205
04206
04207
04208
04209
04210
04211
04212
04213
04214
04215
04216
04217
04218
04219
04220
04221
04222 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
04223 {
04224 assert(wand != (MagickWand *) NULL);
04225 assert(wand->signature == WandSignature);
04226 if (wand->debug != MagickFalse)
04227 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04228 if (wand->images == (Image *) NULL)
04229 {
04230 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04231 "ContainsNoImages","`%s'",wand->name);
04232 return(UndefinedCompression);
04233 }
04234 return(wand->images->compression);
04235 }
04236
04237
04238
04239
04240
04241
04242
04243
04244
04245
04246
04247
04248
04249
04250
04251
04252
04253
04254
04255
04256
04257
04258
04259 WandExport unsigned long MagickGetImageCompressionQuality(MagickWand *wand)
04260 {
04261 assert(wand != (MagickWand *) NULL);
04262 assert(wand->signature == WandSignature);
04263 if (wand->debug != MagickFalse)
04264 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04265 if (wand->images == (Image *) NULL)
04266 {
04267 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04268 "ContainsNoImages","`%s'",wand->name);
04269 return(0UL);
04270 }
04271 return(wand->images->quality);
04272 }
04273
04274
04275
04276
04277
04278
04279
04280
04281
04282
04283
04284
04285
04286
04287
04288
04289
04290
04291
04292
04293
04294
04295
04296 WandExport unsigned long MagickGetImageDelay(MagickWand *wand)
04297 {
04298 assert(wand != (MagickWand *) NULL);
04299 assert(wand->signature == WandSignature);
04300 if (wand->debug != MagickFalse)
04301 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04302 if (wand->images == (Image *) NULL)
04303 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04304 return(wand->images->delay);
04305 }
04306
04307
04308
04309
04310
04311
04312
04313
04314
04315
04316
04317
04318
04319
04320
04321
04322
04323
04324
04325
04326
04327
04328
04329 WandExport unsigned long MagickGetImageDepth(MagickWand *wand)
04330 {
04331 assert(wand != (MagickWand *) NULL);
04332 assert(wand->signature == WandSignature);
04333 if (wand->debug != MagickFalse)
04334 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04335 if (wand->images == (Image *) NULL)
04336 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04337 return(wand->images->depth);
04338 }
04339
04340
04341
04342
04343
04344
04345
04346
04347
04348
04349
04350
04351
04352
04353
04354
04355
04356
04357
04358
04359
04360
04361
04362
04363
04364
04365
04366
04367
04368
04369
04370
04371 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
04372 const MagickWand *reference,const MetricType metric,double *distortion)
04373 {
04374 MagickBooleanType
04375 status;
04376
04377
04378 assert(wand != (MagickWand *) NULL);
04379 assert(wand->signature == WandSignature);
04380 if (wand->debug != MagickFalse)
04381 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04382 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
04383 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04384 status=GetImageDistortion(wand->images,reference->images,metric,distortion,
04385 &wand->images->exception);
04386 return(status);
04387 }
04388
04389
04390
04391
04392
04393
04394
04395
04396
04397
04398
04399
04400
04401
04402
04403
04404
04405
04406
04407
04408
04409
04410
04411 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
04412 {
04413 assert(wand != (MagickWand *) NULL);
04414 assert(wand->signature == WandSignature);
04415 if (wand->debug != MagickFalse)
04416 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04417 if (wand->images == (Image *) NULL)
04418 {
04419 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04420 "ContainsNoImages","`%s'",wand->name);
04421 return(UndefinedDispose);
04422 }
04423 return((DisposeType) wand->images->dispose);
04424 }
04425
04426
04427
04428
04429
04430
04431
04432
04433
04434
04435
04436
04437
04438
04439
04440
04441
04442
04443
04444
04445
04446
04447
04448
04449 WandExport char *MagickGetImageFilename(MagickWand *wand)
04450 {
04451 assert(wand != (MagickWand *) NULL);
04452 assert(wand->signature == WandSignature);
04453 if (wand->debug != MagickFalse)
04454 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04455 if (wand->images == (Image *) NULL)
04456 {
04457 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04458 "ContainsNoImages","`%s'",wand->name);
04459 return((char *) NULL);
04460 }
04461 return(AcquireString(wand->images->filename));
04462 }
04463
04464
04465
04466
04467
04468
04469
04470
04471
04472
04473
04474
04475
04476
04477
04478
04479
04480
04481
04482