~ubuntu-branches/ubuntu/quantal/imagemagick/quantal

« back to all changes in this revision

Viewing changes to wand/magick-image.c

  • Committer: Bazaar Package Importer
  • Author(s): Muharem Hrnjadovic
  • Date: 2009-06-04 13:01:13 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090604130113-my9114jxmafpwew3
Tags: 7:6.5.1.0-1.1ubuntu1
* Merge from debian unstable, remaining changes:
  - (Build-)depend on libltdl7-dev instead of libltdl3-dev (the armel buildds
    currently have both available).
  - Don't build-dep on librsvg, it brings in excessive dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
%                                 August 2003                                 %
24
24
%                                                                             %
25
25
%                                                                             %
26
 
%  Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization      %
 
26
%  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
27
27
%  dedicated to making software imaging solutions freely available.           %
28
28
%                                                                             %
29
29
%  You may not use this file except in compliance with the License.  You may  %
2074
2074
%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2075
2075
%  occurs in scanned images because of the camera being misaligned,
2076
2076
%  imperfections in the scanning or surface, or simply because the paper was
2077
 
%  not placed completely flat when scanned. 
 
2077
%  not placed completely flat when scanned.
2078
2078
%
2079
2079
%  The format of the MagickDeskewImage method is:
2080
2080
%
2655
2655
%  The format of the MagickEvaluateImage method is:
2656
2656
%
2657
2657
%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2658
 
%        const MagickEvaluateOperator op,const double constant)
 
2658
%        const MagickEvaluateOperator operator,const double value)
2659
2659
%      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2660
 
%        const MagickEvaluateOperator op,const double constant)
 
2660
%        const ChannelType channel,const MagickEvaluateOperator op,
 
2661
%        const double value)
2661
2662
%
2662
2663
%  A description of each parameter follows:
2663
2664
%
2664
2665
%    o wand: the magick wand.
2665
2666
%
 
2667
%    o channel: the channel(s).
 
2668
%
2666
2669
%    o op: A channel operator.
2667
2670
%
2668
 
%    o constant: A constant value.
 
2671
%    o value: A value value.
2669
2672
%
2670
2673
*/
2671
2674
 
2672
2675
WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2673
 
  const MagickEvaluateOperator op,const double constant)
 
2676
  const MagickEvaluateOperator op,const double value)
2674
2677
{
2675
2678
  MagickBooleanType
2676
2679
    status;
2681
2684
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2682
2685
  if (wand->images == (Image *) NULL)
2683
2686
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2684
 
  status=EvaluateImage(wand->images,op,constant,&wand->images->exception);
 
2687
  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2685
2688
  if (status == MagickFalse)
2686
2689
    InheritException(wand->exception,&wand->images->exception);
2687
2690
  return(status);
2688
2691
}
2689
2692
 
2690
2693
WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2691
 
  const ChannelType channel,const MagickEvaluateOperator op,
2692
 
  const double constant)
 
2694
  const ChannelType channel,const MagickEvaluateOperator op,const double value)
2693
2695
{
2694
2696
  MagickBooleanType
2695
2697
    status;
2700
2702
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2701
2703
  if (wand->images == (Image *) NULL)
2702
2704
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2703
 
  status=EvaluateImageChannel(wand->images,channel,op,constant,
 
2705
  status=EvaluateImageChannel(wand->images,channel,op,value,
2704
2706
    &wand->images->exception);
2705
2707
  return(status);
2706
2708
}
2710
2712
%                                                                             %
2711
2713
%                                                                             %
2712
2714
%                                                                             %
 
2715
%   M a g i c k E x p o r t I m a g e P i x e l s                             %
 
2716
%                                                                             %
 
2717
%                                                                             %
 
2718
%                                                                             %
 
2719
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
2720
%
 
2721
%  MagickExportImagePixels() extracts pixel data from an image and returns it
 
2722
%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
 
2723
%  an error is encountered.  The data is returned as char, short int, int,
 
2724
%  long, float, or double in the order specified by map.
 
2725
%
 
2726
%  Suppose you want to extract the first scanline of a 640x480 image as
 
2727
%  character data in red-green-blue order:
 
2728
%
 
2729
%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
 
2730
%
 
2731
%  The format of the MagickExportImagePixels method is:
 
2732
%
 
2733
%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
 
2734
%        const long x,const long y,const unsigned long columns,
 
2735
%        const unsigned long rows,const char *map,const StorageType storage,
 
2736
%        void *pixels)
 
2737
%
 
2738
%  A description of each parameter follows:
 
2739
%
 
2740
%    o wand: the magick wand.
 
2741
%
 
2742
%    o x, y, columns, rows:  These values define the perimeter
 
2743
%      of a region of pixels you want to extract.
 
2744
%
 
2745
%    o map:  This string reflects the expected ordering of the pixel array.
 
2746
%      It can be any combination or order of R = red, G = green, B = blue,
 
2747
%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
 
2748
%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
 
2749
%      P = pad.
 
2750
%
 
2751
%    o storage: Define the data type of the pixels.  Float and double types are
 
2752
%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
 
2753
%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
 
2754
%      LongPixel, QuantumPixel, or ShortPixel.
 
2755
%
 
2756
%    o pixels: This array of values contain the pixel components as defined by
 
2757
%      map and type.  You must preallocate this array where the expected
 
2758
%      length varies depending on the values of width, height, map, and type.
 
2759
%
 
2760
*/
 
2761
WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
 
2762
  const long x,const long y,const unsigned long columns,
 
2763
  const unsigned long rows,const char *map,const StorageType storage,
 
2764
  void *pixels)
 
2765
{
 
2766
  MagickBooleanType
 
2767
    status;
 
2768
 
 
2769
  assert(wand != (MagickWand *) NULL);
 
2770
  assert(wand->signature == WandSignature);
 
2771
  if (wand->debug != MagickFalse)
 
2772
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
 
2773
  if (wand->images == (Image *) NULL)
 
2774
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
 
2775
  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
 
2776
    storage,pixels,wand->exception);
 
2777
  if (status == MagickFalse)
 
2778
    InheritException(wand->exception,&wand->images->exception);
 
2779
  return(status);
 
2780
}
 
2781
 
 
2782
/*
 
2783
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
2784
%                                                                             %
 
2785
%                                                                             %
 
2786
%                                                                             %
2713
2787
%   M a g i c k E x t e n t I m a g e                                         %
2714
2788
%                                                                             %
2715
2789
%                                                                             %
2833
2907
%  A description of each parameter follows:
2834
2908
%
2835
2909
%    o wand: the magick wand.
2836
 
 
2910
%
2837
2911
%    o channel: the channel(s).
2838
2912
%
2839
2913
%    o fill: the floodfill color pixel wand.
2874
2948
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2875
2949
  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2876
2950
  PixelGetQuantumColor(fill,&draw_info->fill);
2877
 
  (void) AcquireOneMagickPixel(wand->images,x % wand->images->columns,
 
2951
  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
2878
2952
    y % wand->images->rows,&target,wand->exception);
2879
2953
  if (bordercolor != (PixelWand *) NULL)
2880
2954
    PixelGetMagickColor(bordercolor,&target);
3002
3076
%                                                                             %
3003
3077
%                                                                             %
3004
3078
%                                                                             %
 
3079
%   M a g i c k F u n c t i o n I m a g e                                     %
 
3080
%                                                                             %
 
3081
%                                                                             %
 
3082
%                                                                             %
 
3083
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
3084
%
 
3085
%  MagickFunctionImage() applys an arithmetic, relational, or logical
 
3086
%  expression to an image.  Use these operators to lighten or darken an image,
 
3087
%  to increase or decrease contrast in an image, or to produce the "negative"
 
3088
%  of an image.
 
3089
%
 
3090
%  The format of the MagickFunctionImage method is:
 
3091
%
 
3092
%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
 
3093
%        const MagickFunction function,const unsigned long number_arguments,
 
3094
%        const double *arguments)
 
3095
%      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
 
3096
%        const ChannelType channel,const MagickFunction function,
 
3097
%        const unsigned long number_arguments,const double *arguments)
 
3098
%
 
3099
%  A description of each parameter follows:
 
3100
%
 
3101
%    o wand: the magick wand.
 
3102
%
 
3103
%    o channel: the channel(s).
 
3104
%
 
3105
%    o function: the image function.
 
3106
%
 
3107
%    o number_arguments: the number of function arguments.
 
3108
%
 
3109
%    o arguments: the function arguments.
 
3110
%
 
3111
*/
 
3112
 
 
3113
WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
 
3114
  const MagickFunction function,const unsigned long number_arguments,
 
3115
  const double *arguments)
 
3116
{
 
3117
  MagickBooleanType
 
3118
    status;
 
3119
 
 
3120
  assert(wand != (MagickWand *) NULL);
 
3121
  assert(wand->signature == WandSignature);
 
3122
  if (wand->debug != MagickFalse)
 
3123
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
 
3124
  if (wand->images == (Image *) NULL)
 
3125
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
 
3126
  status=FunctionImage(wand->images,function,number_arguments,arguments,
 
3127
    &wand->images->exception);
 
3128
  if (status == MagickFalse)
 
3129
    InheritException(wand->exception,&wand->images->exception);
 
3130
  return(status);
 
3131
}
 
3132
 
 
3133
WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
 
3134
  const ChannelType channel,const MagickFunction function,
 
3135
  const unsigned long number_arguments,const double *arguments)
 
3136
{
 
3137
  MagickBooleanType
 
3138
    status;
 
3139
 
 
3140
  assert(wand != (MagickWand *) NULL);
 
3141
  assert(wand->signature == WandSignature);
 
3142
  if (wand->debug != MagickFalse)
 
3143
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
 
3144
  if (wand->images == (Image *) NULL)
 
3145
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
 
3146
  status=FunctionImageChannel(wand->images,channel,function,number_arguments,
 
3147
    arguments,&wand->images->exception);
 
3148
  return(status);
 
3149
}
 
3150
 
 
3151
/*
 
3152
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
3153
%                                                                             %
 
3154
%                                                                             %
 
3155
%                                                                             %
3005
3156
%   M a g i c k F x I m a g e                                                 %
3006
3157
%                                                                             %
3007
3158
%                                                                             %
3711
3862
%                                                                             %
3712
3863
%                                                                             %
3713
3864
%                                                                             %
 
3865
%   M a g i c k G e t I m a g e C h a n n e l K u r t o s i s                 %
 
3866
%                                                                             %
 
3867
%                                                                             %
 
3868
%                                                                             %
 
3869
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
3870
%
 
3871
%  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
 
3872
%  more image channels.
 
3873
%
 
3874
%  The format of the MagickGetImageChannelKurtosis method is:
 
3875
%
 
3876
%      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
 
3877
%        const ChannelType channel,double *kurtosis,double *skewness)
 
3878
%
 
3879
%  A description of each parameter follows:
 
3880
%
 
3881
%    o wand: the magick wand.
 
3882
%
 
3883
%    o channel: the image channel(s).
 
3884
%
 
3885
%    o kurtosis:  The kurtosis for the specified channel(s).
 
3886
%
 
3887
%    o skewness:  The skewness for the specified channel(s).
 
3888
%
 
3889
*/
 
3890
WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
 
3891
  const ChannelType channel,double *kurtosis,double *skewness)
 
3892
{
 
3893
  MagickBooleanType
 
3894
    status;
 
3895
 
 
3896
  assert(wand != (MagickWand *) NULL);
 
3897
  assert(wand->signature == WandSignature);
 
3898
  if (wand->debug != MagickFalse)
 
3899
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
 
3900
  if (wand->images == (Image *) NULL)
 
3901
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
 
3902
  status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
 
3903
    wand->exception);
 
3904
  return(status);
 
3905
}
 
3906
 
 
3907
/*
 
3908
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
3909
%                                                                             %
 
3910
%                                                                             %
 
3911
%                                                                             %
3714
3912
%   M a g i c k G e t I m a g e C h a n n e l R a n g e                       %
3715
3913
%                                                                             %
3716
3914
%                                                                             %
3764
3962
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3765
3963
%
3766
3964
%  MagickGetImageChannelStatistics() returns statistics for each channel in the
3767
 
%  image.  The statistics incude the channel depth, its minimand
3768
 
%  maxima, the mean, and the standard deviation.  You can access the red
3769
 
%  channel mean, for example, like this:
 
3965
%  image.  The statistics include the channel depth, its minima and
 
3966
%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
 
3967
%  You can access the red channel mean, for example, like this:
3770
3968
%
3771
3969
%      channel_statistics=MagickGetImageChannelStatistics(image,excepton);
3772
3970
%      red_mean=channel_statistics[RedChannel].mean;
4785
4983
  if (wand->images == (Image *) NULL)
4786
4984
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4787
4985
  image_view=AcquireCacheView(wand->images);
4788
 
  p=AcquireCacheViewPixels(image_view,x,y,1,1,wand->exception);
 
4986
  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
4789
4987
  if (p == (const PixelPacket *) NULL)
4790
4988
    {
4791
4989
      image_view=DestroyCacheView(image_view);
4792
4990
      return(MagickFalse);
4793
4991
    }
4794
 
  indexes=GetCacheViewIndexes(image_view);
 
4992
  indexes=GetCacheViewAuthenticIndexQueue(image_view);
4795
4993
  PixelSetQuantumColor(color,p);
4796
4994
  if (GetCacheViewColorspace(image_view) == CMYKColorspace)
4797
4995
    PixelSetBlackQuantum(color,*indexes);
4807
5005
%                                                                             %
4808
5006
%                                                                             %
4809
5007
%                                                                             %
4810
 
%   M a g i c k G e t I m a g e P i x e l s                                   %
4811
 
%                                                                             %
4812
 
%                                                                             %
4813
 
%                                                                             %
4814
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4815
 
%
4816
 
%  MagickGetImagePixels() extracts pixel data from an image and returns it to
4817
 
%  you.  The method returns MagickTrue on success otherwise MagickFalse if an
4818
 
%  error is encountered.  The data is returned as char, short int, int, long,
4819
 
%  float, or double in the order specified by map.
4820
 
%
4821
 
%  Suppose you want to extract the first scanline of a 640x480 image as
4822
 
%  character data in red-green-blue order:
4823
 
%
4824
 
%      MagickGetImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
4825
 
%
4826
 
%  The format of the MagickGetImagePixels method is:
4827
 
%
4828
 
%      MagickBooleanType MagickGetImagePixels(MagickWand *wand,
4829
 
%        const long x,const long y,const unsigned long columns,
4830
 
%        const unsigned long rows,const char *map,const StorageType storage,
4831
 
%        void *pixels)
4832
 
%
4833
 
%  A description of each parameter follows:
4834
 
%
4835
 
%    o wand: the magick wand.
4836
 
%
4837
 
%    o x, y, columns, rows:  These values define the perimeter
4838
 
%      of a region of pixels you want to extract.
4839
 
%
4840
 
%    o map:  This string reflects the expected ordering of the pixel array.
4841
 
%      It can be any combination or order of R = red, G = green, B = blue,
4842
 
%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
4843
 
%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
4844
 
%      P = pad.
4845
 
%
4846
 
%    o storage: Define the data type of the pixels.  Float and double types are
4847
 
%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
4848
 
%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
4849
 
%      LongPixel, QuantumPixel, or ShortPixel.
4850
 
%
4851
 
%    o pixels: This array of values contain the pixel components as defined by
4852
 
%      map and type.  You must preallocate this array where the expected
4853
 
%      length varies depending on the values of width, height, map, and type.
4854
 
%
4855
 
%
4856
 
*/
4857
 
WandExport MagickBooleanType MagickGetImagePixels(MagickWand *wand,
4858
 
  const long x,const long y,const unsigned long columns,
4859
 
  const unsigned long rows,const char *map,const StorageType storage,
4860
 
  void *pixels)
4861
 
{
4862
 
  MagickBooleanType
4863
 
    status;
4864
 
 
4865
 
  assert(wand != (MagickWand *) NULL);
4866
 
  assert(wand->signature == WandSignature);
4867
 
  if (wand->debug != MagickFalse)
4868
 
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4869
 
  if (wand->images == (Image *) NULL)
4870
 
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4871
 
  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
4872
 
    storage,pixels,wand->exception);
4873
 
  if (status == MagickFalse)
4874
 
    InheritException(wand->exception,&wand->images->exception);
4875
 
  return(status);
4876
 
}
4877
 
 
4878
 
/*
4879
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4880
 
%                                                                             %
4881
 
%                                                                             %
4882
 
%                                                                             %
4883
5008
+   M a g i c k G e t I m a g e R a n g e                                     %
4884
5009
%                                                                             %
4885
5010
%                                                                             %
5663
5788
%                                                                             %
5664
5789
%                                                                             %
5665
5790
%                                                                             %
 
5791
%   M a g i c k I m p o r t I m a g e P i x e l s                             %
 
5792
%                                                                             %
 
5793
%                                                                             %
 
5794
%                                                                             %
 
5795
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
5796
%
 
5797
%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
 
5798
%  location you specify.  The method returns MagickFalse on success otherwise
 
5799
%  MagickTrue if an error is encountered.  The pixel data can be either char,
 
5800
%  short int, int, long, float, or double in the order specified by map.
 
5801
%
 
5802
%  Suppose your want to upload the first scanline of a 640x480 image from
 
5803
%  character data in red-green-blue order:
 
5804
%
 
5805
%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
 
5806
%
 
5807
%  The format of the MagickImportImagePixels method is:
 
5808
%
 
5809
%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
 
5810
%        const long x,const long y,const unsigned long columns,
 
5811
%        const unsigned long rows,const char *map,const StorageType storage,
 
5812
%        const void *pixels)
 
5813
%
 
5814
%  A description of each parameter follows:
 
5815
%
 
5816
%    o wand: the magick wand.
 
5817
%
 
5818
%    o x, y, columns, rows:  These values define the perimeter of a region
 
5819
%      of pixels you want to define.
 
5820
%
 
5821
%    o map:  This string reflects the expected ordering of the pixel array.
 
5822
%      It can be any combination or order of R = red, G = green, B = blue,
 
5823
%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
 
5824
%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
 
5825
%      P = pad.
 
5826
%
 
5827
%    o storage: Define the data type of the pixels.  Float and double types are
 
5828
%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
 
5829
%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
 
5830
%      or DoublePixel.
 
5831
%
 
5832
%    o pixels: This array of values contain the pixel components as defined by
 
5833
%      map and type.  You must preallocate this array where the expected
 
5834
%      length varies depending on the values of width, height, map, and type.
 
5835
%
 
5836
*/
 
5837
WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
 
5838
  const long x,const long y,const unsigned long columns,
 
5839
  const unsigned long rows,const char *map,const StorageType storage,
 
5840
  const void *pixels)
 
5841
{
 
5842
  MagickBooleanType
 
5843
    status;
 
5844
 
 
5845
  assert(wand != (MagickWand *) NULL);
 
5846
  assert(wand->signature == WandSignature);
 
5847
  if (wand->debug != MagickFalse)
 
5848
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
 
5849
  if (wand->images == (Image *) NULL)
 
5850
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
 
5851
  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
 
5852
  if (status == MagickFalse)
 
5853
    InheritException(wand->exception,&wand->images->exception);
 
5854
  return(status);
 
5855
}
 
5856
 
 
5857
/*
 
5858
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
5859
%                                                                             %
 
5860
%                                                                             %
 
5861
%                                                                             %
5666
5862
%   M a g i c k L a b e l I m a g e                                           %
5667
5863
%                                                                             %
5668
5864
%                                                                             %
6458
6654
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6459
6655
  PixelGetMagickColor(background,&pixel);
6460
6656
  images=NewMagickImage(wand->image_info,width,height,&pixel);
 
6657
  if (images == (Image *) NULL)
 
6658
    return(MagickFalse);
6461
6659
  if (images->exception.severity != UndefinedException)
6462
6660
    InheritException(wand->exception,&images->exception);
6463
6661
  return(InsertImageInWand(wand,images));
8254
8452
%                                                                             %
8255
8453
%                                                                             %
8256
8454
%                                                                             %
 
8455
%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
 
8456
%                                                                             %
 
8457
%                                                                             %
 
8458
%                                                                             %
 
8459
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
8460
%
 
8461
%  MagickSelectiveBlurImage() selectively blur an image within a contrast
 
8462
%  threshold. It is similar to the unsharpen mask that sharpens everything with
 
8463
%  contrast above a certain threshold.
 
8464
%
 
8465
%  The format of the MagickSelectiveBlurImage method is:
 
8466
%
 
8467
%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
 
8468
%        const double radius,const double sigma,const double threshold)
 
8469
%      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
 
8470
%        const ChannelType channel,const double radius,const double sigma,
 
8471
%        const double threshold)
 
8472
%
 
8473
%  A description of each parameter follows:
 
8474
%
 
8475
%    o wand: the magick wand.
 
8476
%
 
8477
%    o channel: the image channel(s).
 
8478
%
 
8479
%    o radius: the radius of the gaussian, in pixels, not counting the center
 
8480
%      pixel.
 
8481
%
 
8482
%    o sigma: the standard deviation of the gaussian, in pixels.
 
8483
%
 
8484
%    o threshold: only pixels within this contrast threshold are included
 
8485
%      in the blur operation 
 
8486
%
 
8487
*/
 
8488
 
 
8489
WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
 
8490
  const double radius,const double sigma,const double threshold)
 
8491
{
 
8492
  MagickBooleanType
 
8493
    status;
 
8494
 
 
8495
  status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
 
8496
    threshold);
 
8497
  return(status);
 
8498
}
 
8499
 
 
8500
WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
 
8501
  const ChannelType channel,const double radius,const double sigma,
 
8502
  const double threshold)
 
8503
{
 
8504
  Image
 
8505
    *blur_image;
 
8506
 
 
8507
  assert(wand != (MagickWand *) NULL);
 
8508
  assert(wand->signature == WandSignature);
 
8509
  if (wand->debug != MagickFalse)
 
8510
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
 
8511
  if (wand->images == (Image *) NULL)
 
8512
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
 
8513
  blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
 
8514
    threshold,wand->exception);
 
8515
  if (blur_image == (Image *) NULL)
 
8516
    return(MagickFalse);
 
8517
  ReplaceImageInList(&wand->images,blur_image);
 
8518
  return(MagickTrue);
 
8519
}
 
8520
 
 
8521
/*
 
8522
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
8523
%                                                                             %
 
8524
%                                                                             %
 
8525
%                                                                             %
8257
8526
%   M a g i c k S e p a r a t e I m a g e C h a n n e l                       %
8258
8527
%                                                                             %
8259
8528
%                                                                             %
9563
9832
%                                                                             %
9564
9833
%                                                                             %
9565
9834
%                                                                             %
9566
 
%   M a g i c k S e t I m a g e P i x e l s                                   %
9567
 
%                                                                             %
9568
 
%                                                                             %
9569
 
%                                                                             %
9570
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9571
 
%
9572
 
%  MagickSetImagePixels() accepts pixel datand stores it in the image at the
9573
 
%  location you specify.  The method returns MagickFalse on success otherwise
9574
 
%  MagickTrue if an error is encountered.  The pixel data can be either char,
9575
 
%  short int, int, long, float, or double in the order specified by map.
9576
 
%
9577
 
%  Suppose your want to upload the first scanline of a 640x480 image from
9578
 
%  character data in red-green-blue order:
9579
 
%
9580
 
%      MagickSetImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
9581
 
%
9582
 
%  The format of the MagickSetImagePixels method is:
9583
 
%
9584
 
%      MagickBooleanType MagickSetImagePixels(MagickWand *wand,
9585
 
%        const long x,const long y,const unsigned long columns,
9586
 
%        const unsigned long rows,const char *map,const StorageType storage,
9587
 
%        const void *pixels)
9588
 
%
9589
 
%  A description of each parameter follows:
9590
 
%
9591
 
%    o wand: the magick wand.
9592
 
%
9593
 
%    o x, y, columns, rows:  These values define the perimeter of a region
9594
 
%      of pixels you want to define.
9595
 
%
9596
 
%    o map:  This string reflects the expected ordering of the pixel array.
9597
 
%      It can be any combination or order of R = red, G = green, B = blue,
9598
 
%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
9599
 
%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
9600
 
%      P = pad.
9601
 
%
9602
 
%    o storage: Define the data type of the pixels.  Float and double types are
9603
 
%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
9604
 
%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
9605
 
%      or DoublePixel.
9606
 
%
9607
 
%    o pixels: This array of values contain the pixel components as defined by
9608
 
%      map and type.  You must preallocate this array where the expected
9609
 
%      length varies depending on the values of width, height, map, and type.
9610
 
%
9611
 
%
9612
 
*/
9613
 
WandExport MagickBooleanType MagickSetImagePixels(MagickWand *wand,
9614
 
  const long x,const long y,const unsigned long columns,
9615
 
  const unsigned long rows,const char *map,const StorageType storage,
9616
 
  const void *pixels)
9617
 
{
9618
 
  MagickBooleanType
9619
 
    status;
9620
 
 
9621
 
  assert(wand != (MagickWand *) NULL);
9622
 
  assert(wand->signature == WandSignature);
9623
 
  if (wand->debug != MagickFalse)
9624
 
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9625
 
  if (wand->images == (Image *) NULL)
9626
 
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9627
 
  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
9628
 
  if (status == MagickFalse)
9629
 
    InheritException(wand->exception,&wand->images->exception);
9630
 
  return(status);
9631
 
}
9632
 
 
9633
 
/*
9634
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9635
 
%                                                                             %
9636
 
%                                                                             %
9637
 
%                                                                             %
9638
9835
%   M a g i c k S e t I m a g e P r o g r e s s M o n i t o r                 %
9639
9836
%                                                                             %
9640
9837
%                                                                             %
9969
10166
%                                                                             %
9970
10167
%                                                                             %
9971
10168
%                                                                             %
 
10169
%   M a g i c k S e t I m a g e V i r t u a l P i x e l M e t h o d           %
 
10170
%                                                                             %
 
10171
%                                                                             %
 
10172
%                                                                             %
 
10173
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
10174
%
 
10175
%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
 
10176
%
 
10177
%  The format of the MagickSetImageVirtualPixelMethod method is:
 
10178
%
 
10179
%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
 
10180
%        const VirtualPixelMethod method)
 
10181
%
 
10182
%  A description of each parameter follows:
 
10183
%
 
10184
%    o wand: the magick wand.
 
10185
%
 
10186
%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
 
10187
%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
 
10188
%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
 
10189
%
 
10190
*/
 
10191
WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
 
10192
  const VirtualPixelMethod method)
 
10193
{
 
10194
  assert(wand != (MagickWand *) NULL);
 
10195
  assert(wand->signature == WandSignature);
 
10196
  if (wand->debug != MagickFalse)
 
10197
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
 
10198
  if (wand->images == (Image *) NULL)
 
10199
    return(UndefinedVirtualPixelMethod);
 
10200
  return(SetImageVirtualPixelMethod(wand->images,method));
 
10201
}
 
10202
 
 
10203
/*
 
10204
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
10205
%                                                                             %
 
10206
%                                                                             %
 
10207
%                                                                             %
9972
10208
%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
9973
10209
%                                                                             %
9974
10210
%                                                                             %
9990
10226
%
9991
10227
%    o y: the white y-point.
9992
10228
%
9993
 
%
9994
10229
*/
9995
10230
WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
9996
10231
  const double x,const double y)