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
00502 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
00503 const NoiseType noise_type)
00504 {
00505 MagickBooleanType
00506 status;
00507
00508 status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
00509 return(status);
00510 }
00511
00512 WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
00513 const ChannelType channel,const NoiseType noise_type)
00514 {
00515 Image
00516 *noise_image;
00517
00518 assert(wand != (MagickWand *) NULL);
00519 assert(wand->signature == WandSignature);
00520 if (wand->debug != MagickFalse)
00521 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00522 if (wand->images == (Image *) NULL)
00523 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00524 noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
00525 wand->exception);
00526 if (noise_image == (Image *) NULL)
00527 return(MagickFalse);
00528 ReplaceImageInList(&wand->images,noise_image);
00529 return(MagickTrue);
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
00558 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
00559 const DrawingWand *drawing_wand)
00560 {
00561 DrawInfo
00562 *draw_info;
00563
00564 Image
00565 *affine_image;
00566
00567 assert(wand != (MagickWand *) NULL);
00568 assert(wand->signature == WandSignature);
00569 if (wand->debug != MagickFalse)
00570 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00571 if (wand->images == (Image *) NULL)
00572 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00573 draw_info=PeekDrawingWand(drawing_wand);
00574 if (draw_info == (DrawInfo *) NULL)
00575 return(MagickFalse);
00576 affine_image=AffineTransformImage(wand->images,&draw_info->affine,
00577 wand->exception);
00578 draw_info=DestroyDrawInfo(draw_info);
00579 if (affine_image == (Image *) NULL)
00580 return(MagickFalse);
00581 ReplaceImageInList(&wand->images,affine_image);
00582 return(MagickTrue);
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
00619 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
00620 const DrawingWand *drawing_wand,const double x,const double y,
00621 const double angle,const char *text)
00622 {
00623 char
00624 geometry[MaxTextExtent];
00625
00626 DrawInfo
00627 *draw_info;
00628
00629 MagickBooleanType
00630 status;
00631
00632 assert(wand != (MagickWand *) NULL);
00633 assert(wand->signature == WandSignature);
00634 if (wand->debug != MagickFalse)
00635 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00636 if (wand->images == (Image *) NULL)
00637 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00638 draw_info=PeekDrawingWand(drawing_wand);
00639 if (draw_info == (DrawInfo *) NULL)
00640 return(MagickFalse);
00641 (void) CloneString(&draw_info->text,text);
00642 (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g",x,y);
00643 draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
00644 draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
00645 draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
00646 draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
00647 (void) CloneString(&draw_info->geometry,geometry);
00648 status=AnnotateImage(wand->images,draw_info);
00649 draw_info=DestroyDrawInfo(draw_info);
00650 if (status == MagickFalse)
00651 InheritException(wand->exception,&wand->images->exception);
00652 return(status);
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
00680 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
00681 const char *server_name)
00682 {
00683 MagickBooleanType
00684 status;
00685
00686 assert(wand != (MagickWand *) NULL);
00687 assert(wand->signature == WandSignature);
00688 if (wand->debug != MagickFalse)
00689 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00690 (void) CloneString(&wand->image_info->server_name,server_name);
00691 status=AnimateImages(wand->image_info,wand->images);
00692 if (status == MagickFalse)
00693 InheritException(wand->exception,&wand->images->exception);
00694 return(status);
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
00723 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
00724 const MagickBooleanType stack)
00725 {
00726 Image
00727 *append_image;
00728
00729 assert(wand != (MagickWand *) NULL);
00730 assert(wand->signature == WandSignature);
00731 if (wand->debug != MagickFalse)
00732 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00733 if (wand->images == (Image *) NULL)
00734 return((MagickWand *) NULL);
00735 append_image=AppendImages(wand->images,stack,wand->exception);
00736 if (append_image == (Image *) NULL)
00737 return((MagickWand *) NULL);
00738 return(CloneMagickWandFromImages(wand,append_image));
00739 }
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
00769 {
00770 MagickBooleanType
00771 status;
00772
00773 status=MagickAutoGammaImageChannel(wand,DefaultChannels);
00774 return(status);
00775 }
00776
00777 WandExport MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
00778 const ChannelType channel)
00779 {
00780 MagickBooleanType
00781 status;
00782
00783 assert(wand != (MagickWand *) NULL);
00784 assert(wand->signature == WandSignature);
00785 if (wand->debug != MagickFalse)
00786 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00787 if (wand->images == (Image *) NULL)
00788 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00789 status=AutoGammaImageChannel(wand->images,channel);
00790 if (status == MagickFalse)
00791 InheritException(wand->exception,&wand->images->exception);
00792 return(status);
00793 }
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
00823 {
00824 MagickBooleanType
00825 status;
00826
00827 status=MagickAutoLevelImageChannel(wand,DefaultChannels);
00828 return(status);
00829 }
00830
00831 WandExport MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
00832 const ChannelType channel)
00833 {
00834 MagickBooleanType
00835 status;
00836
00837 assert(wand != (MagickWand *) NULL);
00838 assert(wand->signature == WandSignature);
00839 if (wand->debug != MagickFalse)
00840 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00841 if (wand->images == (Image *) NULL)
00842 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00843 status=AutoLevelImageChannel(wand->images,channel);
00844 if (status == MagickFalse)
00845 InheritException(wand->exception,&wand->images->exception);
00846 return(status);
00847 }
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871 WandExport MagickWand *MagickAverageImages(MagickWand *wand)
00872 {
00873 Image
00874 *average_image;
00875
00876 assert(wand != (MagickWand *) NULL);
00877 assert(wand->signature == WandSignature);
00878 if (wand->debug != MagickFalse)
00879 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00880 if (wand->images == (Image *) NULL)
00881 return((MagickWand *) NULL);
00882 average_image=AverageImages(wand->images,wand->exception);
00883 if (average_image == (Image *) NULL)
00884 return((MagickWand *) NULL);
00885 return(CloneMagickWandFromImages(wand,average_image));
00886 }
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
00916 const PixelWand *threshold)
00917 {
00918 char
00919 thresholds[MaxTextExtent];
00920
00921 MagickBooleanType
00922 status;
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 (void) FormatMagickString(thresholds,MaxTextExtent,
00931 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
00932 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
00933 PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
00934 status=BlackThresholdImage(wand->images,thresholds);
00935 if (status == MagickFalse)
00936 InheritException(wand->exception,&wand->images->exception);
00937 return(status);
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 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
00967 const double factor)
00968 {
00969 Image
00970 *shift_image;
00971
00972 assert(wand != (MagickWand *) NULL);
00973 assert(wand->signature == WandSignature);
00974 if (wand->debug != MagickFalse)
00975 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00976 if (wand->images == (Image *) NULL)
00977 ThrowWandException(WandError,"ContainsNoImages",wand->name);
00978 shift_image=BlueShiftImage(wand->images,factor,wand->exception);
00979 if (shift_image == (Image *) NULL)
00980 return(MagickFalse);
00981 ReplaceImageInList(&wand->images,shift_image);
00982 return(MagickTrue);
00983 }
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
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 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
01022 const double radius,const double sigma)
01023 {
01024 MagickBooleanType
01025 status;
01026
01027 status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
01028 return(status);
01029 }
01030
01031 WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
01032 const ChannelType channel,const double radius,const double sigma)
01033 {
01034 Image
01035 *blur_image;
01036
01037 assert(wand != (MagickWand *) NULL);
01038 assert(wand->signature == WandSignature);
01039 if (wand->debug != MagickFalse)
01040 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01041 if (wand->images == (Image *) NULL)
01042 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01043 blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
01044 wand->exception);
01045 if (blur_image == (Image *) NULL)
01046 return(MagickFalse);
01047 ReplaceImageInList(&wand->images,blur_image);
01048 return(MagickTrue);
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
01079
01080
01081
01082 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
01083 const PixelWand *bordercolor,const unsigned long width,
01084 const unsigned long height)
01085 {
01086 Image
01087 *border_image;
01088
01089 RectangleInfo
01090 border_info;
01091
01092 assert(wand != (MagickWand *) NULL);
01093 assert(wand->signature == WandSignature);
01094 if (wand->debug != MagickFalse)
01095 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01096 if (wand->images == (Image *) NULL)
01097 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01098 border_info.width=width;
01099 border_info.height=height;
01100 border_info.x=0;
01101 border_info.y=0;
01102 PixelGetQuantumColor(bordercolor,&wand->images->border_color);
01103 border_image=BorderImage(wand->images,&border_info,wand->exception);
01104 if (border_image == (Image *) NULL)
01105 return(MagickFalse);
01106 ReplaceImageInList(&wand->images,border_image);
01107 return(MagickTrue);
01108 }
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
01139 const double radius,const double sigma)
01140 {
01141 Image
01142 *charcoal_image;
01143
01144 assert(wand != (MagickWand *) NULL);
01145 assert(wand->signature == WandSignature);
01146 if (wand->debug != MagickFalse)
01147 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01148 if (wand->images == (Image *) NULL)
01149 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01150 charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
01151 if (charcoal_image == (Image *) NULL)
01152 return(MagickFalse);
01153 ReplaceImageInList(&wand->images,charcoal_image);
01154 return(MagickTrue);
01155 }
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
01192 const unsigned long width,const unsigned long height,const long x,
01193 const long y)
01194 {
01195 Image
01196 *chop_image;
01197
01198 RectangleInfo
01199 chop;
01200
01201 assert(wand != (MagickWand *) NULL);
01202 assert(wand->signature == WandSignature);
01203 if (wand->debug != MagickFalse)
01204 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01205 if (wand->images == (Image *) NULL)
01206 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01207 chop.width=width;
01208 chop.height=height;
01209 chop.x=x;
01210 chop.y=y;
01211 chop_image=ChopImage(wand->images,&chop,wand->exception);
01212 if (chop_image == (Image *) NULL)
01213 return(MagickFalse);
01214 ReplaceImageInList(&wand->images,chop_image);
01215 return(MagickTrue);
01216 }
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
01246 {
01247 MagickBooleanType
01248 status;
01249
01250 status=MagickClampImageChannel(wand,DefaultChannels);
01251 return(status);
01252 }
01253
01254 WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
01255 const ChannelType channel)
01256 {
01257 MagickBooleanType
01258 status;
01259
01260 assert(wand != (MagickWand *) NULL);
01261 assert(wand->signature == WandSignature);
01262 if (wand->debug != MagickFalse)
01263 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01264 if (wand->images == (Image *) NULL)
01265 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01266 status=ClampImageChannel(wand->images,channel);
01267 if (status == MagickFalse)
01268 InheritException(wand->exception,&wand->images->exception);
01269 return(status);
01270 }
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
01296 {
01297 MagickBooleanType
01298 status;
01299
01300 assert(wand != (MagickWand *) NULL);
01301 assert(wand->signature == WandSignature);
01302 if (wand->debug != MagickFalse)
01303 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01304 if (wand->images == (Image *) NULL)
01305 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01306 status=ClipImage(wand->images);
01307 if (status == MagickFalse)
01308 InheritException(wand->exception,&wand->images->exception);
01309 return(status);
01310 }
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
01345 const char *pathname,const MagickBooleanType inside)
01346 {
01347 MagickBooleanType
01348 status;
01349
01350 assert(wand != (MagickWand *) NULL);
01351 assert(wand->signature == WandSignature);
01352 if (wand->debug != MagickFalse)
01353 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01354 if (wand->images == (Image *) NULL)
01355 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01356 status=ClipImagePath(wand->images,pathname,inside);
01357 if (status == MagickFalse)
01358 InheritException(wand->exception,&wand->images->exception);
01359 return(status);
01360 }
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
01391 const MagickWand *clut_wand)
01392 {
01393 MagickBooleanType
01394 status;
01395
01396 status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
01397 return(status);
01398 }
01399
01400 WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
01401 const ChannelType channel,const MagickWand *clut_wand)
01402 {
01403 MagickBooleanType
01404 status;
01405
01406 assert(wand != (MagickWand *) NULL);
01407 assert(wand->signature == WandSignature);
01408 if (wand->debug != MagickFalse)
01409 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01410 if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
01411 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01412 status=ClutImageChannel(wand->images,channel,clut_wand->images);
01413 if (status == MagickFalse)
01414 InheritException(wand->exception,&wand->images->exception);
01415 return(status);
01416 }
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
01446 {
01447 Image
01448 *coalesce_image;
01449
01450 assert(wand != (MagickWand *) NULL);
01451 assert(wand->signature == WandSignature);
01452 if (wand->debug != MagickFalse)
01453 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01454 if (wand->images == (Image *) NULL)
01455 return((MagickWand *) NULL);
01456 coalesce_image=CoalesceImages(wand->images,wand->exception);
01457 if (coalesce_image == (Image *) NULL)
01458 return((MagickWand *) NULL);
01459 return(CloneMagickWandFromImages(wand,coalesce_image));
01460 }
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
01506 const char *color_correction_collection)
01507 {
01508 MagickBooleanType
01509 status;
01510
01511 assert(wand != (MagickWand *) NULL);
01512 assert(wand->signature == WandSignature);
01513 if (wand->debug != MagickFalse)
01514 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01515 if (wand->images == (Image *) NULL)
01516 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01517 status=ColorDecisionListImage(wand->images,color_correction_collection);
01518 if (status == MagickFalse)
01519 InheritException(wand->exception,&wand->images->exception);
01520 return(status);
01521 }
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
01551 const PixelWand *colorize,const PixelWand *opacity)
01552 {
01553 char
01554 percent_opaque[MaxTextExtent];
01555
01556 Image
01557 *colorize_image;
01558
01559 PixelPacket
01560 target;
01561
01562 assert(wand != (MagickWand *) NULL);
01563 assert(wand->signature == WandSignature);
01564 if (wand->debug != MagickFalse)
01565 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01566 if (wand->images == (Image *) NULL)
01567 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01568 (void) FormatMagickString(percent_opaque,MaxTextExtent,"%g,%g,%g,%g",
01569 (double) (100.0*QuantumScale*PixelGetRedQuantum(opacity)),
01570 (double) (100.0*QuantumScale*PixelGetGreenQuantum(opacity)),
01571 (double) (100.0*QuantumScale*PixelGetBlueQuantum(opacity)),
01572 (double) (100.0*QuantumScale*PixelGetOpacityQuantum(opacity)));
01573 PixelGetQuantumColor(colorize,&target);
01574 colorize_image=ColorizeImage(wand->images,percent_opaque,target,
01575 wand->exception);
01576 if (colorize_image == (Image *) NULL)
01577 return(MagickFalse);
01578 ReplaceImageInList(&wand->images,colorize_image);
01579 return(MagickTrue);
01580 }
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
01611 const ChannelType channel)
01612 {
01613 Image
01614 *combine_image;
01615
01616 assert(wand != (MagickWand *) NULL);
01617 assert(wand->signature == WandSignature);
01618 if (wand->debug != MagickFalse)
01619 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01620 if (wand->images == (Image *) NULL)
01621 return((MagickWand *) NULL);
01622 combine_image=CombineImages(wand->images,channel,wand->exception);
01623 if (combine_image == (Image *) NULL)
01624 return((MagickWand *) NULL);
01625 return(CloneMagickWandFromImages(wand,combine_image));
01626 }
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
01654 const char *comment)
01655 {
01656 MagickBooleanType
01657 status;
01658
01659 assert(wand != (MagickWand *) NULL);
01660 assert(wand->signature == WandSignature);
01661 if (wand->debug != MagickFalse)
01662 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01663 if (wand->images == (Image *) NULL)
01664 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01665 status=SetImageProperty(wand->images,"comment",comment);
01666 if (status == MagickFalse)
01667 InheritException(wand->exception,&wand->images->exception);
01668 return(status);
01669 }
01670
01671
01672
01673
01674
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 WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
01705 const MagickWand *reference,const ChannelType channel,const MetricType metric,
01706 double *distortion)
01707 {
01708 Image
01709 *compare_image;
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) || (reference->images == (Image *) NULL))
01716 {
01717 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
01718 "ContainsNoImages","`%s'",wand->name);
01719 return((MagickWand *) NULL);
01720 }
01721 compare_image=CompareImageChannels(wand->images,reference->images,channel,
01722 metric,distortion,&wand->images->exception);
01723 if (compare_image == (Image *) NULL)
01724 return((MagickWand *) NULL);
01725 return(CloneMagickWandFromImages(wand,compare_image));
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 WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
01756 const ImageLayerMethod method)
01757 {
01758 Image
01759 *layers_image;
01760
01761 assert(wand != (MagickWand *) NULL);
01762 assert(wand->signature == WandSignature);
01763 if (wand->debug != MagickFalse)
01764 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01765 if (wand->images == (Image *) NULL)
01766 return((MagickWand *) NULL);
01767 layers_image=CompareImageLayers(wand->images,method,wand->exception);
01768 if (layers_image == (Image *) NULL)
01769 return((MagickWand *) NULL);
01770 return(CloneMagickWandFromImages(wand,layers_image));
01771 }
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803
01804 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
01805 const MagickWand *reference,const MetricType metric,double *distortion)
01806 {
01807 Image
01808 *compare_image;
01809
01810
01811 assert(wand != (MagickWand *) NULL);
01812 assert(wand->signature == WandSignature);
01813 if (wand->debug != MagickFalse)
01814 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01815 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
01816 {
01817 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
01818 "ContainsNoImages","`%s'",wand->name);
01819 return((MagickWand *) NULL);
01820 }
01821 compare_image=CompareImages(wand->images,reference->images,metric,distortion,
01822 &wand->images->exception);
01823 if (compare_image == (Image *) NULL)
01824 return((MagickWand *) NULL);
01825 return(CloneMagickWandFromImages(wand,compare_image));
01826 }
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
01873 const MagickWand *composite_wand,const CompositeOperator compose,const long x,
01874 const long y)
01875 {
01876 MagickBooleanType
01877 status;
01878
01879 status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
01880 compose,x,y);
01881 return(status);
01882 }
01883
01884 WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
01885 const ChannelType channel,const MagickWand *composite_wand,
01886 const CompositeOperator compose,const long x,const long y)
01887 {
01888 MagickBooleanType
01889 status;
01890
01891 assert(wand != (MagickWand *) NULL);
01892 assert(wand->signature == WandSignature);
01893 if (wand->debug != MagickFalse)
01894 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01895 if ((wand->images == (Image *) NULL) ||
01896 (composite_wand->images == (Image *) NULL))
01897 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01898 status=CompositeImageChannel(wand->images,channel,compose,
01899 composite_wand->images,x,y);
01900 if (status == MagickFalse)
01901 InheritException(wand->exception,&wand->images->exception);
01902 return(status);
01903 }
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
01934 const MagickBooleanType sharpen)
01935 {
01936 MagickBooleanType
01937 status;
01938
01939 assert(wand != (MagickWand *) NULL);
01940 assert(wand->signature == WandSignature);
01941 if (wand->debug != MagickFalse)
01942 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01943 if (wand->images == (Image *) NULL)
01944 ThrowWandException(WandError,"ContainsNoImages",wand->name);
01945 status=ContrastImage(wand->images,sharpen);
01946 if (status == MagickFalse)
01947 InheritException(wand->exception,&wand->images->exception);
01948 return(status);
01949 }
01950
01951
01952
01953
01954
01955
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 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
01988 const double black_point,const double white_point)
01989 {
01990 MagickBooleanType
01991 status;
01992
01993 status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
01994 white_point);
01995 return(status);
01996 }
01997
01998 WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
01999 const ChannelType channel,const double black_point,const double white_point)
02000 {
02001 MagickBooleanType
02002 status;
02003
02004 assert(wand != (MagickWand *) NULL);
02005 assert(wand->signature == WandSignature);
02006 if (wand->debug != MagickFalse)
02007 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02008 if (wand->images == (Image *) NULL)
02009 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02010 status=ContrastStretchImageChannel(wand->images,channel,black_point,
02011 white_point);
02012 if (status == MagickFalse)
02013 InheritException(wand->exception,&wand->images->exception);
02014 return(status);
02015 }
02016
02017
02018
02019
02020
02021
02022
02023
02024
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 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
02051 const unsigned long order,const double *kernel)
02052 {
02053 MagickBooleanType
02054 status;
02055
02056 status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
02057 return(status);
02058 }
02059
02060 WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
02061 const ChannelType channel,const unsigned long order,const double *kernel)
02062 {
02063 Image
02064 *convolve_image;
02065
02066 assert(wand != (MagickWand *) NULL);
02067 assert(wand->signature == WandSignature);
02068 if (wand->debug != MagickFalse)
02069 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02070 if (kernel == (const double *) NULL)
02071 return(MagickFalse);
02072 if (wand->images == (Image *) NULL)
02073 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02074 convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
02075 wand->exception);
02076 if (convolve_image == (Image *) NULL)
02077 return(MagickFalse);
02078 ReplaceImageInList(&wand->images,convolve_image);
02079 return(MagickTrue);
02080 }
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107
02108
02109
02110
02111
02112
02113
02114 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
02115 const unsigned long width,const unsigned long height,const long x,
02116 const long y)
02117 {
02118 Image
02119 *crop_image;
02120
02121 RectangleInfo
02122 crop;
02123
02124 assert(wand != (MagickWand *) NULL);
02125 assert(wand->signature == WandSignature);
02126 if (wand->debug != MagickFalse)
02127 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02128 if (wand->images == (Image *) NULL)
02129 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02130 crop.width=width;
02131 crop.height=height;
02132 crop.x=x;
02133 crop.y=y;
02134 crop_image=CropImage(wand->images,&crop,wand->exception);
02135 if (crop_image == (Image *) NULL)
02136 return(MagickFalse);
02137 ReplaceImageInList(&wand->images,crop_image);
02138 return(MagickTrue);
02139 }
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
02169 const long displace)
02170 {
02171 MagickBooleanType
02172 status;
02173
02174 assert(wand != (MagickWand *) NULL);
02175 assert(wand->signature == WandSignature);
02176 if (wand->debug != MagickFalse)
02177 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02178 if (wand->images == (Image *) NULL)
02179 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02180 status=CycleColormapImage(wand->images,displace);
02181 if (status == MagickFalse)
02182 InheritException(wand->exception,&wand->images->exception);
02183 return(status);
02184 }
02185
02186
02187
02188
02189
02190
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
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
02239 const unsigned long columns,const unsigned long rows,const char *map,
02240 const StorageType storage,const void *pixels)
02241 {
02242 Image
02243 *images;
02244
02245 assert(wand != (MagickWand *) NULL);
02246 assert(wand->signature == WandSignature);
02247 if (wand->debug != MagickFalse)
02248 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02249 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
02250 if (images == (Image *) NULL)
02251 return(MagickFalse);
02252 return(InsertImageInWand(wand,images));
02253 }
02254
02255
02256
02257
02258
02259
02260
02261
02262
02263
02264
02265
02266
02267
02268
02269
02270
02271
02272
02273
02274
02275
02276
02277
02278
02279
02280 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
02281 const char *passphrase)
02282 {
02283 assert(wand != (MagickWand *) NULL);
02284 assert(wand->signature == WandSignature);
02285 if (wand->debug != MagickFalse)
02286 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02287 if (wand->images == (Image *) NULL)
02288 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02289 return(DecipherImage(wand->images,passphrase,&wand->images->exception));
02290 }
02291
02292
02293
02294
02295
02296
02297
02298
02299
02300
02301
02302
02303
02304
02305
02306
02307
02308
02309
02310
02311
02312
02313
02314
02315
02316 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
02317 {
02318 Image
02319 *deconstruct_image;
02320
02321 assert(wand != (MagickWand *) NULL);
02322 assert(wand->signature == WandSignature);
02323 if (wand->debug != MagickFalse)
02324 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02325 if (wand->images == (Image *) NULL)
02326 return((MagickWand *) NULL);
02327 deconstruct_image=DeconstructImages(wand->images,wand->exception);
02328 if (deconstruct_image == (Image *) NULL)
02329 return((MagickWand *) NULL);
02330 return(CloneMagickWandFromImages(wand,deconstruct_image));
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 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
02362 const double threshold)
02363 {
02364 Image
02365 *sepia_image;
02366
02367 assert(wand != (MagickWand *) NULL);
02368 assert(wand->signature == WandSignature);
02369 if (wand->debug != MagickFalse)
02370 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02371 if (wand->images == (Image *) NULL)
02372 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02373 sepia_image=DeskewImage(wand->images,threshold,wand->exception);
02374 if (sepia_image == (Image *) NULL)
02375 return(MagickFalse);
02376 ReplaceImageInList(&wand->images,sepia_image);
02377 return(MagickTrue);
02378 }
02379
02380
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
02404 {
02405 Image
02406 *despeckle_image;
02407
02408 assert(wand != (MagickWand *) NULL);
02409 assert(wand->signature == WandSignature);
02410 if (wand->debug != MagickFalse)
02411 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02412 if (wand->images == (Image *) NULL)
02413 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02414 despeckle_image=DespeckleImage(wand->images,wand->exception);
02415 if (despeckle_image == (Image *) NULL)
02416 return(MagickFalse);
02417 ReplaceImageInList(&wand->images,despeckle_image);
02418 return(MagickTrue);
02419 }
02420
02421
02422
02423
02424
02425
02426
02427
02428
02429
02430
02431
02432
02433
02434
02435
02436
02437
02438
02439
02440
02441
02442
02443
02444 WandExport Image *MagickDestroyImage(Image *image)
02445 {
02446 return(DestroyImage(image));
02447 }
02448
02449
02450
02451
02452
02453
02454
02455
02456
02457
02458
02459
02460
02461
02462
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473
02474 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
02475 const char *server_name)
02476 {
02477 Image
02478 *image;
02479
02480 MagickBooleanType
02481 status;
02482
02483 assert(wand != (MagickWand *) NULL);
02484 assert(wand->signature == WandSignature);
02485 if (wand->debug != MagickFalse)
02486 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02487 if (wand->images == (Image *) NULL)
02488 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02489 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
02490 if (image == (Image *) NULL)
02491 return(MagickFalse);
02492 (void) CloneString(&wand->image_info->server_name,server_name);
02493 status=DisplayImages(wand->image_info,image);
02494 if (status == MagickFalse)
02495 InheritException(wand->exception,&image->exception);
02496 image=DestroyImage(image);
02497 return(status);
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 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
02526 const char *server_name)
02527 {
02528 MagickBooleanType
02529 status;
02530
02531 assert(wand != (MagickWand *) NULL);
02532 assert(wand->signature == WandSignature);
02533 if (wand->debug != MagickFalse)
02534 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02535 (void) CloneString(&wand->image_info->server_name,server_name);
02536 status=DisplayImages(wand->image_info,wand->images);
02537 if (status == MagickFalse)
02538 InheritException(wand->exception,&wand->images->exception);
02539 return(status);
02540 }
02541
02542
02543
02544
02545
02546
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
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589
02590
02591
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
02603 const DistortImageMethod method,const unsigned long number_arguments,
02604 const double *arguments,const MagickBooleanType bestfit)
02605 {
02606 Image
02607 *distort_image;
02608
02609 assert(wand != (MagickWand *) NULL);
02610 assert(wand->signature == WandSignature);
02611 if (wand->debug != MagickFalse)
02612 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02613 if (wand->images == (Image *) NULL)
02614 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02615 distort_image=DistortImage(wand->images,method,number_arguments,arguments,
02616 bestfit,wand->exception);
02617 if (distort_image == (Image *) NULL)
02618 return(MagickFalse);
02619 ReplaceImageInList(&wand->images,distort_image);
02620 return(MagickTrue);
02621 }
02622
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
02649 const DrawingWand *drawing_wand)
02650 {
02651 char
02652 *primitive;
02653
02654 DrawInfo
02655 *draw_info;
02656
02657 MagickBooleanType
02658 status;
02659
02660 assert(wand != (MagickWand *) NULL);
02661 assert(wand->signature == WandSignature);
02662 if (wand->debug != MagickFalse)
02663 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02664 if (wand->images == (Image *) NULL)
02665 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02666 draw_info=PeekDrawingWand(drawing_wand);
02667 if ((draw_info == (DrawInfo *) NULL) ||
02668 (draw_info->primitive == (char *) NULL))
02669 return(MagickFalse);
02670 primitive=AcquireString(draw_info->primitive);
02671 draw_info=DestroyDrawInfo(draw_info);
02672 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
02673 draw_info->primitive=primitive;
02674 status=DrawImage(wand->images,draw_info);
02675 if (status == MagickFalse)
02676 InheritException(wand->exception,&wand->images->exception);
02677 draw_info=DestroyDrawInfo(draw_info);
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 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
02708 const double radius)
02709 {
02710 Image
02711 *edge_image;
02712
02713 assert(wand != (MagickWand *) NULL);
02714 assert(wand->signature == WandSignature);
02715 if (wand->debug != MagickFalse)
02716 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02717 if (wand->images == (Image *) NULL)
02718 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02719 edge_image=EdgeImage(wand->images,radius,wand->exception);
02720 if (edge_image == (Image *) NULL)
02721 return(MagickFalse);
02722 ReplaceImageInList(&wand->images,edge_image);
02723 return(MagickTrue);
02724 }
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734
02735
02736
02737
02738
02739
02740
02741
02742
02743
02744
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
02759 const double radius,const double sigma)
02760 {
02761 Image
02762 *emboss_image;
02763
02764 assert(wand != (MagickWand *) NULL);
02765 assert(wand->signature == WandSignature);
02766 if (wand->debug != MagickFalse)
02767 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02768 if (wand->images == (Image *) NULL)
02769 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02770 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
02771 if (emboss_image == (Image *) NULL)
02772 return(MagickFalse);
02773 ReplaceImageInList(&wand->images,emboss_image);
02774 return(MagickTrue);
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 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
02803 const char *passphrase)
02804 {
02805 assert(wand != (MagickWand *) NULL);
02806 assert(wand->signature == WandSignature);
02807 if (wand->debug != MagickFalse)
02808 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02809 if (wand->images == (Image *) NULL)
02810 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02811 return(EncipherImage(wand->images,passphrase,&wand->images->exception));
02812 }
02813
02814
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824
02825
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836
02837 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
02838 {
02839 Image
02840 *enhance_image;
02841
02842 assert(wand != (MagickWand *) NULL);
02843 assert(wand->signature == WandSignature);
02844 if (wand->debug != MagickFalse)
02845 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02846 if (wand->images == (Image *) NULL)
02847 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02848 enhance_image=EnhanceImage(wand->images,wand->exception);
02849 if (enhance_image == (Image *) NULL)
02850 return(MagickFalse);
02851 ReplaceImageInList(&wand->images,enhance_image);
02852 return(MagickTrue);
02853 }
02854
02855
02856
02857
02858
02859
02860
02861
02862
02863
02864
02865
02866
02867
02868
02869
02870
02871
02872
02873
02874
02875
02876
02877
02878
02879
02880
02881
02882 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
02883 {
02884 MagickBooleanType
02885 status;
02886
02887 status=MagickEqualizeImageChannel(wand,DefaultChannels);
02888 return(status);
02889 }
02890
02891 WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
02892 const ChannelType channel)
02893 {
02894 MagickBooleanType
02895 status;
02896
02897 assert(wand != (MagickWand *) NULL);
02898 assert(wand->signature == WandSignature);
02899 if (wand->debug != MagickFalse)
02900 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02901 if (wand->images == (Image *) NULL)
02902 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02903 status=EqualizeImageChannel(wand->images,channel);
02904 if (status == MagickFalse)
02905 InheritException(wand->exception,&wand->images->exception);
02906 return(status);
02907 }
02908
02909
02910
02911
02912
02913
02914
02915
02916
02917
02918
02919
02920
02921
02922
02923
02924
02925
02926
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
02946 const MagickEvaluateOperator op,const double value)
02947 {
02948 MagickBooleanType
02949 status;
02950
02951 assert(wand != (MagickWand *) NULL);
02952 assert(wand->signature == WandSignature);
02953 if (wand->debug != MagickFalse)
02954 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02955 if (wand->images == (Image *) NULL)
02956 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02957 status=EvaluateImage(wand->images,op,value,&wand->images->exception);
02958 if (status == MagickFalse)
02959 InheritException(wand->exception,&wand->images->exception);
02960 return(status);
02961 }
02962
02963 WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
02964 const ChannelType channel,const MagickEvaluateOperator op,const double value)
02965 {
02966 MagickBooleanType
02967 status;
02968
02969 assert(wand != (MagickWand *) NULL);
02970 assert(wand->signature == WandSignature);
02971 if (wand->debug != MagickFalse)
02972 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02973 if (wand->images == (Image *) NULL)
02974 ThrowWandException(WandError,"ContainsNoImages",wand->name);
02975 status=EvaluateImageChannel(wand->images,channel,op,value,
02976 &wand->images->exception);
02977 return(status);
02978 }
02979
02980
02981
02982
02983
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993
02994
02995
02996
02997
02998
02999
03000
03001
03002
03003
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
03030
03031 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
03032 const long x,const long y,const unsigned long columns,
03033 const unsigned long rows,const char *map,const StorageType storage,
03034 void *pixels)
03035 {
03036 MagickBooleanType
03037 status;
03038
03039 assert(wand != (MagickWand *) NULL);
03040 assert(wand->signature == WandSignature);
03041 if (wand->debug != MagickFalse)
03042 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03043 if (wand->images == (Image *) NULL)
03044 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03045 status=ExportImagePixels(wand->images,x,y,columns,rows,map,
03046 storage,pixels,wand->exception);
03047 if (status == MagickFalse)
03048 InheritException(wand->exception,&wand->images->exception);
03049 return(status);
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
03086 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
03087 const unsigned long width,const unsigned long height,const long x,
03088 const long y)
03089 {
03090 Image
03091 *extent_image;
03092
03093 RectangleInfo
03094 extent;
03095
03096 assert(wand != (MagickWand *) NULL);
03097 assert(wand->signature == WandSignature);
03098 if (wand->debug != MagickFalse)
03099 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03100 if (wand->images == (Image *) NULL)
03101 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03102 extent.width=width;
03103 extent.height=height;
03104 extent.x=x;
03105 extent.y=y;
03106 extent_image=ExtentImage(wand->images,&extent,wand->exception);
03107 if (extent_image == (Image *) NULL)
03108 return(MagickFalse);
03109 ReplaceImageInList(&wand->images,extent_image);
03110 return(MagickTrue);
03111 }
03112
03113
03114
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
03137 {
03138 Image
03139 *flip_image;
03140
03141 assert(wand != (MagickWand *) NULL);
03142 assert(wand->signature == WandSignature);
03143 if (wand->debug != MagickFalse)
03144 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03145 if (wand->images == (Image *) NULL)
03146 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03147 flip_image=FlipImage(wand->images,wand->exception);
03148 if (flip_image == (Image *) NULL)
03149 return(MagickFalse);
03150 ReplaceImageInList(&wand->images,flip_image);
03151 return(MagickTrue);
03152 }
03153
03154
03155
03156
03157
03158
03159
03160
03161
03162
03163
03164
03165
03166
03167
03168
03169
03170
03171
03172
03173
03174
03175
03176
03177
03178
03179
03180
03181
03182
03183
03184
03185
03186
03187
03188
03189
03190
03191
03192
03193
03194
03195
03196
03197
03198
03199 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
03200 const ChannelType channel,const PixelWand *fill,const double fuzz,
03201 const PixelWand *bordercolor,const long x,const long y,
03202 const MagickBooleanType invert)
03203 {
03204 DrawInfo
03205 *draw_info;
03206
03207 MagickBooleanType
03208 status;
03209
03210 MagickPixelPacket
03211 target;
03212
03213 assert(wand != (MagickWand *) NULL);
03214 assert(wand->signature == WandSignature);
03215 if (wand->debug != MagickFalse)
03216 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03217 if (wand->images == (Image *) NULL)
03218 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03219 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
03220 PixelGetQuantumColor(fill,&draw_info->fill);
03221 (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
03222 y % wand->images->rows,&target,wand->exception);
03223 if (bordercolor != (PixelWand *) NULL)
03224 PixelGetMagickColor(bordercolor,&target);
03225 wand->images->fuzz=fuzz;
03226 status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
03227 invert);
03228 if (status == MagickFalse)
03229 InheritException(wand->exception,&wand->images->exception);
03230 draw_info=DestroyDrawInfo(draw_info);
03231 return(status);
03232 }
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
03258 {
03259 Image
03260 *flop_image;
03261
03262 assert(wand != (MagickWand *) NULL);
03263 assert(wand->signature == WandSignature);
03264 if (wand->debug != MagickFalse)
03265 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03266 if (wand->images == (Image *) NULL)
03267 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03268 flop_image=FlopImage(wand->images,wand->exception);
03269 if (flop_image == (Image *) NULL)
03270 return(MagickFalse);
03271 ReplaceImageInList(&wand->images,flop_image);
03272 return(MagickTrue);
03273 }
03274
03275
03276
03277
03278
03279
03280
03281
03282
03283
03284
03285
03286
03287
03288
03289
03290
03291
03292
03293
03294
03295
03296
03297
03298
03299
03300
03301
03302
03303 WandExport MagickBooleanType MagickForwardFourierTransformImage(
03304 MagickWand *wand,const MagickBooleanType magnitude)
03305 {
03306 Image
03307 *forward_image;
03308
03309 assert(wand != (MagickWand *) NULL);
03310 assert(wand->signature == WandSignature);
03311 if (wand->debug != MagickFalse)
03312 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03313 if (wand->images == (Image *) NULL)
03314 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03315 forward_image=ForwardFourierTransformImage(wand->images,magnitude,
03316 wand->exception);
03317 if (forward_image == (Image *) NULL)
03318 return(MagickFalse);
03319 ReplaceImageInList(&wand->images,forward_image);
03320 return(MagickTrue);
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
03350
03351
03352
03353
03354
03355
03356
03357
03358
03359
03360
03361 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
03362 const PixelWand *matte_color,const unsigned long width,
03363 const unsigned long height,const long inner_bevel,const long outer_bevel)
03364 {
03365 Image
03366 *frame_image;
03367
03368 FrameInfo
03369 frame_info;
03370
03371 assert(wand != (MagickWand *) NULL);
03372 assert(wand->signature == WandSignature);
03373 if (wand->debug != MagickFalse)
03374 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03375 if (wand->images == (Image *) NULL)
03376 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03377 (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
03378 frame_info.width=wand->images->columns+2*width;
03379 frame_info.height=wand->images->rows+2*height;
03380 frame_info.x=(long) width;
03381 frame_info.y=(long) height;
03382 frame_info.inner_bevel=inner_bevel;
03383 frame_info.outer_bevel=outer_bevel;
03384 PixelGetQuantumColor(matte_color,&wand->images->matte_color);
03385 frame_image=FrameImage(wand->images,&frame_info,wand->exception);
03386 if (frame_image == (Image *) NULL)
03387 return(MagickFalse);
03388 ReplaceImageInList(&wand->images,frame_image);
03389 return(MagickTrue);
03390 }
03391
03392
03393
03394
03395
03396
03397
03398
03399
03400
03401
03402
03403
03404
03405
03406
03407
03408
03409
03410
03411
03412
03413
03414
03415
03416
03417
03418
03419
03420
03421
03422
03423
03424
03425
03426
03427
03428
03429
03430
03431 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
03432 const MagickFunction function,const unsigned long number_arguments,
03433 const double *arguments)
03434 {
03435 MagickBooleanType
03436 status;
03437
03438 assert(wand != (MagickWand *) NULL);
03439 assert(wand->signature == WandSignature);
03440 if (wand->debug != MagickFalse)
03441 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03442 if (wand->images == (Image *) NULL)
03443 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03444 status=FunctionImage(wand->images,function,number_arguments,arguments,
03445 &wand->images->exception);
03446 if (status == MagickFalse)
03447 InheritException(wand->exception,&wand->images->exception);
03448 return(status);
03449 }
03450
03451 WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
03452 const ChannelType channel,const MagickFunction function,
03453 const unsigned long number_arguments,const double *arguments)
03454 {
03455 MagickBooleanType
03456 status;
03457
03458 assert(wand != (MagickWand *) NULL);
03459 assert(wand->signature == WandSignature);
03460 if (wand->debug != MagickFalse)
03461 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03462 if (wand->images == (Image *) NULL)
03463 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03464 status=FunctionImageChannel(wand->images,channel,function,number_arguments,
03465 arguments,&wand->images->exception);
03466 return(status);
03467 }
03468
03469
03470
03471
03472
03473
03474
03475
03476
03477
03478
03479
03480
03481
03482
03483
03484
03485
03486
03487
03488
03489
03490
03491
03492
03493
03494
03495
03496
03497
03498 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
03499 {
03500 MagickWand
03501 *fx_wand;
03502
03503 fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
03504 return(fx_wand);
03505 }
03506
03507 WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
03508 const ChannelType channel,const char *expression)
03509 {
03510 Image
03511 *fx_image;
03512
03513 assert(wand != (MagickWand *) NULL);
03514 assert(wand->signature == WandSignature);
03515 if (wand->debug != MagickFalse)
03516 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03517 if (wand->images == (Image *) NULL)
03518 return((MagickWand *) NULL);
03519 fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
03520 if (fx_image == (Image *) NULL)
03521 return((MagickWand *) NULL);
03522 return(CloneMagickWandFromImages(wand,fx_image));
03523 }
03524
03525
03526
03527
03528
03529
03530
03531
03532
03533
03534
03535
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 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
03562 const double gamma)
03563 {
03564 MagickBooleanType
03565 status;
03566
03567 status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
03568 return(status);
03569 }
03570
03571 WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
03572 const ChannelType channel,const double gamma)
03573 {
03574 MagickBooleanType
03575 status;
03576
03577 assert(wand != (MagickWand *) NULL);
03578 assert(wand->signature == WandSignature);
03579 if (wand->debug != MagickFalse)
03580 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03581 if (wand->images == (Image *) NULL)
03582 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03583 status=GammaImageChannel(wand->images,channel,gamma);
03584 if (status == MagickFalse)
03585 InheritException(wand->exception,&wand->images->exception);
03586 return(status);
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
03613
03614
03615
03616
03617
03618
03619
03620
03621
03622
03623
03624
03625 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
03626 const double radius,const double sigma)
03627 {
03628 MagickBooleanType
03629 status;
03630
03631 status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
03632 return(status);
03633 }
03634
03635 WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
03636 const ChannelType channel,const double radius,const double sigma)
03637 {
03638 Image
03639 *blur_image;
03640
03641 assert(wand != (MagickWand *) NULL);
03642 assert(wand->signature == WandSignature);
03643 if (wand->debug != MagickFalse)
03644 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03645 if (wand->images == (Image *) NULL)
03646 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03647 blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
03648 wand->exception);
03649 if (blur_image == (Image *) NULL)
03650 return(MagickFalse);
03651 ReplaceImageInList(&wand->images,blur_image);
03652 return(MagickTrue);
03653 }
03654
03655
03656
03657
03658
03659
03660
03661
03662
03663
03664
03665
03666
03667
03668
03669
03670
03671
03672
03673
03674
03675
03676
03677 WandExport MagickWand *MagickGetImage(MagickWand *wand)
03678 {
03679 Image
03680 *image;
03681
03682 assert(wand != (MagickWand *) NULL);
03683 assert(wand->signature == WandSignature);
03684 if (wand->debug != MagickFalse)
03685 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03686 if (wand->images == (Image *) NULL)
03687 {
03688 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03689 "ContainsNoImages","`%s'",wand->name);
03690 return((MagickWand *) NULL);
03691 }
03692 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
03693 if (image == (Image *) NULL)
03694 return((MagickWand *) NULL);
03695 return(CloneMagickWandFromImages(wand,image));
03696 }
03697
03698
03699
03700
03701
03702
03703
03704
03705
03706
03707
03708
03709
03710
03711
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
03723 {
03724 assert(wand != (MagickWand *) NULL);
03725 assert(wand->signature == WandSignature);
03726 if (wand->debug != MagickFalse)
03727 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03728 if (wand->images == (Image *) NULL)
03729 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03730 return(GetImageAlphaChannel(wand->images));
03731 }
03732
03733
03734
03735
03736
03737
03738
03739
03740
03741
03742
03743
03744
03745
03746
03747
03748
03749
03750
03751
03752
03753
03754
03755 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
03756 {
03757 Image
03758 *image;
03759
03760 assert(wand != (MagickWand *) NULL);
03761 assert(wand->signature == WandSignature);
03762 if (wand->debug != MagickFalse)
03763 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03764 if (wand->images == (Image *) NULL)
03765 {
03766 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03767 "ContainsNoImages","`%s'",wand->name);
03768 return((MagickWand *) NULL);
03769 }
03770 image=GetImageClipMask(wand->images,wand->exception);
03771 if (image == (Image *) NULL)
03772 return((MagickWand *) NULL);
03773 return(CloneMagickWandFromImages(wand,image));
03774 }
03775
03776
03777
03778
03779
03780
03781
03782
03783
03784
03785
03786
03787
03788
03789
03790
03791
03792
03793
03794
03795
03796
03797
03798
03799
03800
03801 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
03802 PixelWand *background_color)
03803 {
03804 assert(wand != (MagickWand *) NULL);
03805 assert(wand->signature == WandSignature);
03806 if (wand->debug != MagickFalse)
03807 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03808 if (wand->images == (Image *) NULL)
03809 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03810 PixelSetQuantumColor(background_color,&wand->images->background_color);
03811 return(MagickTrue);
03812 }
03813
03814
03815
03816
03817
03818
03819
03820
03821
03822
03823
03824
03825
03826
03827
03828
03829
03830
03831
03832
03833
03834
03835
03836
03837
03838
03839
03840
03841
03842 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
03843 {
03844 assert(wand != (MagickWand *) NULL);
03845 assert(wand->signature == WandSignature);
03846 if (wand->debug != MagickFalse)
03847 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03848 if (wand->images == (Image *) NULL)
03849 {
03850 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03851 "ContainsNoImages","`%s'",wand->name);
03852 return((unsigned char *) NULL);
03853 }
03854 return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
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
03886
03887
03888 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
03889 {
03890 unsigned char
03891 *blob;
03892
03893 assert(wand != (MagickWand *) NULL);
03894 assert(wand->signature == WandSignature);
03895 if (wand->debug != MagickFalse)
03896 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03897 if (wand->images == (Image *) NULL)
03898 {
03899 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03900 "ContainsNoImages","`%s'",wand->name);
03901 return((unsigned char *) NULL);
03902 }
03903 blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
03904 wand->exception);
03905 return(blob);
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
03933
03934
03935
03936 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
03937 double *x,double *y)
03938 {
03939 assert(wand != (MagickWand *) NULL);
03940 assert(wand->signature == WandSignature);
03941 if (wand->debug != MagickFalse)
03942 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03943 if (wand->images == (Image *) NULL)
03944 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03945 *x=wand->images->chromaticity.blue_primary.x;
03946 *y=wand->images->chromaticity.blue_primary.y;
03947 return(MagickTrue);
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 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
03976 PixelWand *border_color)
03977 {
03978 assert(wand != (MagickWand *) NULL);
03979 assert(wand->signature == WandSignature);
03980 if (wand->debug != MagickFalse)
03981 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03982 if (wand->images == (Image *) NULL)
03983 ThrowWandException(WandError,"ContainsNoImages",wand->name);
03984 PixelSetQuantumColor(border_color,&wand->images->border_color);
03985 return(MagickTrue);
03986 }
03987
03988
03989
03990
03991
03992
03993
03994
03995
03996
03997
03998
03999
04000
04001
04002
04003
04004
04005
04006
04007
04008
04009
04010
04011
04012
04013 WandExport unsigned long MagickGetImageChannelDepth(MagickWand *wand,
04014 const ChannelType channel)
04015 {
04016 assert(wand != (MagickWand *) NULL);
04017 assert(wand->signature == WandSignature);
04018 if (wand->debug != MagickFalse)
04019 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04020 if (wand->images == (Image *) NULL)
04021 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04022 return(GetImageChannelDepth(wand->images,channel,wand->exception));
04023 }
04024
04025
04026
04027
04028
04029
04030
04031
04032
04033
04034
04035
04036
04037
04038
04039
04040
04041
04042
04043
04044
04045
04046
04047
04048
04049
04050
04051
04052
04053
04054
04055
04056
04057
04058 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
04059 const MagickWand *reference,const ChannelType channel,const MetricType metric,
04060 double *distortion)
04061 {
04062 MagickBooleanType
04063 status;
04064
04065 assert(wand != (MagickWand *) NULL);
04066 assert(wand->signature == WandSignature);
04067 if (wand->debug != MagickFalse)
04068 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04069 assert(reference != (MagickWand *) NULL);
04070 assert(reference->signature == WandSignature);
04071 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
04072 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04073 status=GetImageChannelDistortion(wand->images,reference->images,channel,
04074 metric,distortion,&wand->images->exception);
04075 return(status);
04076 }
04077
04078
04079
04080
04081
04082
04083
04084
04085
04086
04087
04088
04089
04090
04091
04092
04093
04094
04095
04096
04097
04098
04099
04100
04101
04102
04103
04104
04105
04106
04107
04108 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
04109 const MagickWand *reference,const MetricType metric)
04110 {
04111 double
04112 *channel_distortion;
04113
04114 assert(wand != (MagickWand *) NULL);
04115 assert(wand->signature == WandSignature);
04116 if (wand->debug != MagickFalse)
04117 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04118 assert(reference != (MagickWand *) NULL);
04119 assert(reference->signature == WandSignature);
04120 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
04121 {
04122 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04123 "ContainsNoImages","`%s'",wand->name);
04124 return((double *) NULL);
04125 }
04126 channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
04127 metric,&wand->images->exception);
04128 return(channel_distortion);
04129 }
04130
04131
04132
04133
04134
04135
04136
04137
04138
04139
04140
04141
04142
04143
04144
04145
04146
04147
04148
04149
04150
04151
04152
04153
04154
04155
04156
04157
04158
04159
04160
04161 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
04162 const ChannelType channel,double *mean,double *standard_deviation)
04163 {
04164 MagickBooleanType
04165 status;
04166
04167 assert(wand != (MagickWand *) NULL);
04168 assert(wand->signature == WandSignature);
04169 if (wand->debug != MagickFalse)
04170 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04171 if (wand->images == (Image *) NULL)
04172 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04173 status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
04174 wand->exception);
04175 return(status);
04176 }
04177
04178
04179
04180
04181
04182
04183
04184
04185
04186
04187
04188
04189
04190
04191
04192
04193
04194
04195
04196
04197
04198
04199
04200
04201
04202
04203
04204
04205
04206
04207
04208 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
04209 const ChannelType channel,double *kurtosis,double *skewness)
04210 {
04211 MagickBooleanType
04212 status;
04213
04214 assert(wand != (MagickWand *) NULL);
04215 assert(wand->signature == WandSignature);
04216 if (wand->debug != MagickFalse)
04217 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04218 if (wand->images == (Image *) NULL)
04219 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04220 status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
04221 wand->exception);
04222 return(status);
04223 }
04224
04225
04226
04227
04228
04229
04230
04231
04232
04233
04234
04235
04236
04237
04238
04239
04240
04241
04242
04243
04244
04245
04246
04247
04248
04249
04250
04251
04252
04253
04254 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
04255 const ChannelType channel,double *minima,double *maxima)
04256 {
04257 MagickBooleanType
04258 status;
04259
04260 assert(wand != (MagickWand *) NULL);
04261 assert(wand->signature == WandSignature);
04262 if (wand->debug != MagickFalse)
04263 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04264 if (wand->images == (Image *) NULL)
04265 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04266 status=GetImageChannelRange(wand->images,channel,minima,maxima,
04267 wand->exception);
04268 return(status);
04269 }
04270
04271
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
04297
04298
04299
04300
04301 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
04302 {
04303 assert(wand != (MagickWand *) NULL);
04304 assert(wand->signature == WandSignature);
04305 if (wand->debug != MagickFalse)
04306 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04307 if (wand->images == (Image *) NULL)
04308 {
04309 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04310 "ContainsNoImages","`%s'",wand->name);
04311 return((ChannelStatistics *) NULL);
04312 }
04313 return(GetImageChannelStatistics(wand->images,wand->exception));
04314 }
04315
04316
04317
04318
04319
04320
04321
04322
04323
04324
04325
04326
04327
04328
04329
04330
04331
04332
04333
04334
04335
04336
04337
04338
04339
04340
04341
04342
04343
04344 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
04345 const unsigned long index,PixelWand *color)
04346 {
04347 assert(wand != (MagickWand *) NULL);
04348 assert(wand->signature == WandSignature);
04349 if (wand->debug != MagickFalse)
04350 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04351 if (wand->images == (Image *) NULL)
04352 ThrowWandException(WandError,"ContainsNoImages",wand->name);
04353 if ((wand->images->colormap == (PixelPacket *) NULL) ||
04354 (index >= wand->images->colors))
04355 {
04356 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04357 "InvalidColormapIndex","`%s'",wand->name);
04358 return(MagickFalse);
04359 }
04360 PixelSetQuantumColor(color,wand->images->colormap+index);
04361 return(MagickTrue);
04362 }
04363
04364
04365
04366
04367
04368
04369
04370
04371
04372
04373
04374
04375
04376
04377
04378
04379
04380
04381
04382
04383
04384
04385
04386 WandExport unsigned long MagickGetImageColors(MagickWand *wand)
04387 {
04388 assert(wand != (MagickWand *) NULL);
04389 assert(wand->signature == WandSignature);
04390 if (wand->debug != MagickFalse)
04391 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04392 if (wand->images == (Image *) NULL)
04393 {
04394 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04395 "ContainsNoImages","`%s'",wand->name);
04396 return(0);
04397 }
04398 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
04399 }
04400
04401
04402
04403
04404
04405
04406
04407
04408
04409
04410
04411
04412
04413
04414
04415
04416
04417
04418
04419
04420
04421
04422
04423 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
04424 {
04425 assert(wand != (MagickWand *) NULL);
04426 assert(wand->signature == WandSignature);
04427 if (wand->debug != MagickFalse)
04428 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04429 if (wand->images == (Image *) NULL)
04430 {
04431 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04432 "ContainsNoImages","`%s'",wand->name);
04433 return(UndefinedColorspace);
04434 }
04435 return(wand->images->colorspace);
04436 }
04437
04438
04439
04440
04441
04442
04443
04444
04445
04446
04447
04448
04449
04450
04451
04452
04453
04454
04455
04456
04457
04458
04459
04460
04461 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
04462 {
04463 assert(wand != (MagickWand *) NULL);
04464 assert(wand->signature == WandSignature);
04465 if (wand->debug != MagickFalse)
04466 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04467 if (wand->images == (Image *) NULL)
04468 {
04469 (void) ThrowMagickException(wand->