% February 1997 %
% %
% %
-% Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
{"gravity", MagickGravityOptions}, {"offset", StringReference},
{"dx", IntegerReference}, {"dy", IntegerReference} } },
{ "Color", { {"color", StringReference} } },
- { "WaveletDenoise", { {"threshold", StringReference},
+ { "WaveletDenoise", { {"geometry", StringReference},
+ {"threshold", RealReference}, {"softness", RealReference},
{"channel", MagickChannelOptions} } },
+ { "Colorspace", { {"colorspace", MagickColorspaceOptions} } },
+ { "AutoThreshold", { {"method", MagickAutoThresholdOptions} } },
};
static SplayTreeInfo
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'B':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'C':
break;
}
for ( ; image; image=image->next)
- (void) TransformImageColorspace(image,(ColorspaceType) sp,
- exception);
+ (void) SetImageColorspace(image,(ColorspaceType) sp,exception);
break;
}
if (LocaleCompare(attribute,"comment") == 0)
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'D':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'E':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'F':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'G':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'I':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'L':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'M':
if (LocaleCompare(attribute,"magick") == 0)
{
if (info)
- (void) FormatLocaleString(info->image_info->filename,MagickPathExtent,
- "%s:",SvPV(sval,na));
+ (void) FormatLocaleString(info->image_info->filename,
+ MagickPathExtent,"%s:",SvPV(sval,na));
for ( ; image; image=image->next)
- (void) CopyMagickString(image->magick,SvPV(sval,na),MagickPathExtent);
+ (void) CopyMagickString(image->magick,SvPV(sval,na),
+ MagickPathExtent);
break;
}
if (LocaleCompare(attribute,"map-limit") == 0)
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'O':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'P':
}
break;
}
- if (LocaleCompare(attribute,"preview") == 0)
- {
- sp=SvPOK(sval) ? ParseCommandOption(MagickPreviewOptions,MagickFalse,
- SvPV(sval,na)) : SvIV(sval);
- if (sp < 0)
- {
- ThrowPerlException(exception,OptionError,"UnrecognizedType",
- SvPV(sval,na));
- break;
- }
- if (info)
- info->image_info->preview_type=(PreviewType) sp;
- break;
- }
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'Q':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'R':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'S':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'T':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'U':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'V':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
case 'W':
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
default:
if (info)
SetImageOption(info->image_info,attribute,SvPV(sval,na));
for ( ; image; image=image->next)
- SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ {
+ (void) SetImageProperty(image,attribute,SvPV(sval,na),exception);
+ (void) SetImageArtifact(image,attribute,SvPV(sval,na));
+ }
break;
}
}
{
#define ChannelFeatures(channel,direction) \
{ \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].angular_second_moment[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].contrast[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].contrast[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].variance_sum_of_squares[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].inverse_difference_moment[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].sum_average[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].sum_variance[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].sum_entropy[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].entropy[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].difference_variance[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].difference_entropy[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].measure_of_correlation_1[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].measure_of_correlation_2[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_features[channel].maximum_correlation_coefficient[direction]); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
}
count=0;
for ( ; image; image=image->next)
{
+ register ssize_t
+ j;
+
channel_features=GetImageFeatures(image,distance,exception);
if (channel_features == (ChannelFeatures *) NULL)
continue;
count++;
- EXTEND(sp,280*count);
- for (i=0; i < 4; i++)
+ for (j=0; j < 4; j++)
{
- ChannelFeatures(RedChannel,i);
- ChannelFeatures(GreenChannel,i);
- ChannelFeatures(BlueChannel,i);
- if (image->colorspace == CMYKColorspace)
- ChannelFeatures(BlackChannel,i);
- if (image->alpha_trait != UndefinedPixelTrait)
- ChannelFeatures(AlphaChannel,i);
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+ {
+ PixelChannel channel=GetPixelChannelChannel(image,i);
+ PixelTrait traits=GetPixelChannelTraits(image,channel);
+ if (traits == UndefinedPixelTrait)
+ continue;
+ EXTEND(sp,14*(i+1)*count);
+ ChannelFeatures(channel,j);
+ }
}
channel_features=(ChannelFeatures *)
RelinquishMagickMemory(channel_features);
{
if (image == (Image *) NULL)
break;
- (void) FormatLocaleString(color,MagickPathExtent,"%.15g,%.15g",
+ (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
image->chromaticity.blue_primary.x,
image->chromaticity.blue_primary.y);
s=newSVpv(color,0);
if (image == (Image *) NULL)
break;
- (void) FormatLocaleString(geometry,MagickPathExtent,"%.15gx%.15g",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g",
image->resolution.x,image->resolution.y);
s=newSVpv(geometry,0);
PUSHs(s ? sv_2mortal(s) : &sv_undef);
{
if (image == (Image *) NULL)
break;
- (void) FormatLocaleString(color,MagickPathExtent,"%.15g,%.15g",
+ (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
image->chromaticity.green_primary.x,
image->chromaticity.green_primary.y);
s=newSVpv(color,0);
PUSHs(s ? sv_2mortal(s) : &sv_undef);
continue;
}
- if (LocaleCompare(attribute,"preview") == 0)
- {
- s=newSViv(info->image_info->preview_type);
- (void) sv_setpv(s,CommandOptionToMnemonic(MagickPreviewOptions,
- info->image_info->preview_type));
- SvIOK_on(s);
- PUSHs(s ? sv_2mortal(s) : &sv_undef);
- continue;
- }
ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
attribute);
break;
{
if (image == (Image *) NULL)
break;
- (void) FormatLocaleString(color,MagickPathExtent,"%.15g,%.15g",
+ (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
image->chromaticity.red_primary.x,
image->chromaticity.red_primary.y);
s=newSVpv(color,0);
{
if (image == (Image *) NULL)
break;
- (void) FormatLocaleString(color,MagickPathExtent,"%.15g,%.15g",
+ (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
image->chromaticity.white_point.x,
image->chromaticity.white_point.y);
s=newSVpv(color,0);
MeanShiftImage = 280
Kuwahara = 281
KuwaharaImage = 282
- ConnectedComponent = 283
- ConnectedComponentImage = 284
+ ConnectedComponents = 283
+ ConnectedComponentsImage = 284
CopyPixels = 285
CopyImagePixels = 286
Color = 287
ColorImage = 288
WaveletDenoise = 289
WaveletDenoiseImage= 290
+ Colorspace = 291
+ ColorspaceImage = 292
+ AutoThreshold = 293
+ AutoThresholdImage = 294
MogrifyRegion = 666
PPCODE:
{
if (attribute_flag[0] == 0)
{
(void) FormatLocaleString(message,MagickPathExtent,
- "%.15g,%.15g,%.15g",(double) argument_list[2].real_reference,
+ "%.20g,%.20g,%.20g",(double) argument_list[2].real_reference,
(double) argument_list[3].real_reference,
(double) argument_list[4].real_reference);
argument_list[0].string_reference=message;
geometry_info.rho=argument_list[6].real_reference;
SetImageArtifact(image,"modulate:colorspace","HWB");
}
- (void) FormatLocaleString(modulate,MagickPathExtent,"%.15g,%.15g,%.15g",
+ (void) FormatLocaleString(modulate,MagickPathExtent,"%.20g,%.20g,%.20g",
geometry_info.rho,geometry_info.sigma,geometry_info.xi);
(void) ModulateImage(image,modulate,exception);
break;
(void) SetImageChannelMask(image,channel_mask);
break;
}
- case 142: /* ConnectedComponent */
+ case 142: /* ConnectedComponents */
{
size_t
connectivity;
}
case 145: /* WaveletDenoise */
{
- if (attribute_flag[0] == 0)
- argument_list[0].string_reference="5%";
+ if (attribute_flag[0] != 0)
+ {
+ flags=ParseGeometry(argument_list[0].string_reference,
+ &geometry_info);
+ if ((flags & PercentValue) != 0)
+ {
+ geometry_info.rho=QuantumRange*geometry_info.rho/100.0;
+ geometry_info.sigma=QuantumRange*geometry_info.sigma/100.0;
+ }
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=0.0;
+ }
+ if (attribute_flag[1] != 0)
+ geometry_info.rho=argument_list[1].real_reference;
if (attribute_flag[2] != 0)
- channel=(ChannelType) argument_list[2].integer_reference;
- flags=ParseGeometry(argument_list[0].string_reference,&geometry_info);
- if ((flags & PercentValue) != 0)
- geometry_info.rho*=(double) (QuantumRange/100.0);
+ geometry_info.sigma=argument_list[2].real_reference;
+ if (attribute_flag[3] != 0)
+ channel=(ChannelType) argument_list[3].integer_reference;
channel_mask=SetImageChannelMask(image,channel);
- image=WaveletDenoiseImage(image,geometry_info.rho,exception);
+ image=WaveletDenoiseImage(image,geometry_info.rho,geometry_info.sigma,
+ exception);
if (image != (Image *) NULL)
(void) SetImageChannelMask(image,channel_mask);
break;
}
+ case 146: /* Colorspace */
+ {
+ ColorspaceType
+ colorspace;
+
+ colorspace=sRGBColorspace;
+ if (attribute_flag[0] != 0)
+ colorspace=(ColorspaceType) argument_list[0].integer_reference;
+ (void) TransformImageColorspace(image,colorspace,exception);
+ break;
+ }
+ case 147: /* AutoThreshold */
+ {
+ AutoThresholdMethod
+ method;
+
+ method=UndefinedThresholdMethod;
+ if (attribute_flag[0] != 0)
+ method=(AutoThresholdMethod) argument_list[0].integer_reference;
+ (void) AutoThresholdImage(image,method,exception);
+ break;
+ }
}
if (next != (Image *) NULL)
(void) CatchImageException(next);
{
draw_info->geometry=AcquireString((char *) NULL);
(void) FormatLocaleString(draw_info->geometry,MagickPathExtent,
- "%.15g,%.15g",x,y);
+ "%.20g,%.20g",x,y);
}
status=GetTypeMetrics(image,draw_info,&metrics,exception);
(void) CatchImageException(image);
{
draw_info->geometry=AcquireString((char *) NULL);
(void) FormatLocaleString(draw_info->geometry,MagickPathExtent,
- "%.15g,%.15g",x,y);
+ "%.20g,%.20g",x,y);
}
status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception);
(void) CatchException(exception);
(void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
(double) channel_statistics[channel].depth); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
- channel_statistics[channel].minima/scale); \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+ channel_statistics[channel].minima/QuantumRange); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
- channel_statistics[channel].maxima/scale); \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+ channel_statistics[channel].maxima/QuantumRange); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
- channel_statistics[channel].mean/scale); \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+ channel_statistics[channel].mean/QuantumRange); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
- channel_statistics[channel].standard_deviation/scale); \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+ channel_statistics[channel].standard_deviation/QuantumRange); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_statistics[channel].kurtosis); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_statistics[channel].skewness); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
- (void) FormatLocaleString(message,MagickPathExtent,"%.15g", \
+ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
channel_statistics[channel].entropy); \
PUSHs(sv_2mortal(newSVpv(message,0))); \
}
ChannelStatistics
*channel_statistics;
- double
- scale;
-
ExceptionInfo
*exception;
count=0;
for ( ; image; image=image->next)
{
+ register size_t
+ i;
+
channel_statistics=GetImageStatistics(image,exception);
if (channel_statistics == (ChannelStatistics *) NULL)
continue;
count++;
- EXTEND(sp,35*count);
- scale=(double) QuantumRange;
- ChannelStatistics(RedChannel);
- ChannelStatistics(GreenChannel);
- ChannelStatistics(BlueChannel);
- if (image->colorspace == CMYKColorspace)
- ChannelStatistics(BlackChannel);
- if (image->alpha_trait != UndefinedPixelTrait)
- ChannelStatistics(AlphaChannel);
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+ {
+ PixelChannel channel=GetPixelChannelChannel(image,i);
+ PixelTrait traits=GetPixelChannelTraits(image,channel);
+ if (traits == UndefinedPixelTrait)
+ continue;
+ EXTEND(sp,8*(i+1)*count);
+ ChannelStatistics(channel);
+ }
+ EXTEND(sp,8*(i+1)*count);
+ ChannelStatistics(CompositePixelChannel);
channel_statistics=(ChannelStatistics *)
RelinquishMagickMemory(channel_statistics);
}
# #
# #
# #
-# T r a n s f o r m #
-# #
-# #
-# #
-###############################################################################
-#
-#
-void
-Transform(ref,...)
- Image::Magick ref=NO_INIT
- ALIAS:
- TransformImage = 1
- transform = 2
- transformimage = 3
- PPCODE:
- {
- AV
- *av;
-
- char
- *attribute,
- *crop_geometry,
- *geometry;
-
- ExceptionInfo
- *exception;
-
- HV
- *hv;
-
- Image
- *clone,
- *image;
-
- register ssize_t
- i;
-
- struct PackageInfo
- *info;
-
- SV
- *av_reference,
- *perl_exception,
- *reference,
- *rv,
- *sv;
-
- PERL_UNUSED_VAR(ref);
- PERL_UNUSED_VAR(ix);
- exception=AcquireExceptionInfo();
- perl_exception=newSVpv("",0);
- sv=NULL;
- av=NULL;
- attribute=NULL;
- if (sv_isobject(ST(0)) == 0)
- {
- ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
- PackageName);
- goto PerlException;
- }
- reference=SvRV(ST(0));
- hv=SvSTASH(reference);
- av=newAV();
- av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
- SvREFCNT_dec(av);
- image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
- if (image == (Image *) NULL)
- {
- ThrowPerlException(exception,OptionError,"NoImagesDefined",
- PackageName);
- goto PerlException;
- }
- info=GetPackageInfo(aTHX_ (void *) av,info,exception);
- /*
- Get attribute.
- */
- crop_geometry=(char *) NULL;
- geometry=(char *) NULL;
- for (i=2; i < items; i+=2)
- {
- attribute=(char *) SvPV(ST(i-1),na);
- switch (*attribute)
- {
- case 'c':
- case 'C':
- {
- if (LocaleCompare(attribute,"crop") == 0)
- {
- crop_geometry=SvPV(ST(i),na);
- break;
- }
- ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
- attribute);
- break;
- }
- case 'g':
- case 'G':
- {
- if (LocaleCompare(attribute,"geometry") == 0)
- {
- geometry=SvPV(ST(i),na);
- break;
- }
- ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
- attribute);
- break;
- }
- default:
- {
- ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
- attribute);
- break;
- }
- }
- }
- for ( ; image; image=image->next)
- {
- clone=CloneImage(image,0,0,MagickTrue,exception);
- if (clone == (Image *) NULL)
- goto PerlException;
- TransformImage(&clone,crop_geometry,geometry,exception);
- for ( ; clone; clone=clone->next)
- {
- AddImageToRegistry(sv,clone);
- rv=newRV(sv);
- av_push(av,sv_bless(rv,hv));
- SvREFCNT_dec(sv);
- }
- }
- exception=DestroyExceptionInfo(exception);
- ST(0)=av_reference;
- SvREFCNT_dec(perl_exception); /* can't return warning messages */
- XSRETURN(1);
-
- PerlException:
- InheritPerlException(exception,perl_exception);
- exception=DestroyExceptionInfo(exception);
- sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
- SvPOK_on(perl_exception);
- ST(0)=sv_2mortal(perl_exception);
- XSRETURN(1);
- }
-\f
-#
-###############################################################################
-# #
-# #
-# #
# W r i t e #
# #
# #