(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- noise_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
+ noise_image=CloneImage(image,0,0,MagickTrue,exception);
if (noise_image == (Image *) NULL)
return((Image *) NULL);
if (SetImageStorageClass(noise_image,DirectClass) == MagickFalse)
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- register ssize_t
- i;
-
- for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
- {
- PixelChannel
- channel;
-
- PixelTrait
- noise_traits,
- traits;
-
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- if (traits == UndefinedPixelTrait)
- continue;
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
- noise_traits=GetPixelChannelMapTraits(noise_image,channel);
- if (noise_traits == UndefinedPixelTrait)
- continue;
- if ((noise_traits & CopyPixelTrait) != 0)
- {
- q[channel]=p[i];
- continue;
- }
- q[channel]=ClampToQuantum(GenerateDifferentialNoise(random_info[id],
- p[i],noise_type,attenuate));
- }
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
+ SetPixelRed(noise_image,ClampToQuantum(GenerateDifferentialNoise(
+ random_info[id],GetPixelRed(image,p),noise_type,attenuate)),q);
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
+ SetPixelGreen(noise_image,ClampToQuantum(GenerateDifferentialNoise(
+ random_info[id],GetPixelGreen(image,p),noise_type,attenuate)),q);
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
+ SetPixelBlue(noise_image,ClampToQuantum(GenerateDifferentialNoise(
+ random_info[id],GetPixelBlue(image,p),noise_type,attenuate)),q);
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
+ (image->colorspace == CMYKColorspace))
+ SetPixelBlack(noise_image,ClampToQuantum(GenerateDifferentialNoise(
+ random_info[id],GetPixelBlack(image,p),noise_type,attenuate)),q);
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
+ SetPixelAlpha(noise_image,ClampToQuantum(GenerateDifferentialNoise(
+ random_info[id],GetPixelAlpha(image,p),noise_type,attenuate)),q);
p+=GetPixelChannels(image);
q+=GetPixelChannels(noise_image);
}
alpha=(MagickRealType) (QuantumScale*pixel.alpha);
return(alpha);
}
- case DefaultPixelChannels:
+ case IntensityPixelChannel:
{
return(QuantumScale*GetPixelInfoIntensity(&pixel));
}
alpha=0.0;
(void) FxEvaluateChannelExpression(fx_info[id],(PixelChannel) i,x,y,
&alpha,exception);
- q[channel]=ClampToQuantum((MagickRealType) QuantumRange*alpha);
+ q[i]=ClampToQuantum((MagickRealType) QuantumRange*alpha);
}
p+=GetPixelChannels(image);
q+=GetPixelChannels(fx_image);
% The format of the VignetteImage method is:
%
% Image *VignetteImage(const Image *image,const double radius,
-% const double sigma,const ssize_t x,const ssize_t y,
-% ExceptionInfo *exception)
+% const double sigma,const ssize_t x,const ssize_t y,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
return((Image *) NULL);
}
canvas_image->matte=MagickTrue;
- oval_image=CloneImage(canvas_image,canvas_image->columns,canvas_image->rows,
- MagickTrue,exception);
+ oval_image=CloneImage(canvas_image,canvas_image->columns,
+ canvas_image->rows,MagickTrue,exception);
if (oval_image == (Image *) NULL)
{
canvas_image=DestroyImage(canvas_image);
(UpdatePixelTrait | BlendPixelTrait));
SetPixelChannelMapComponent(image,AlphaPixelChannel,AlphaPixelChannel);
SetPixelChannelMapTraits(image,AlphaPixelChannel,UpdatePixelTrait);
+ if (image->colorspace == GRAYColorspace)
+ {
+ image->number_channels=2;
+ SetPixelChannelMapComponent(image,GreenPixelChannel,RedPixelChannel);
+ SetPixelChannelMapComponent(image,BluePixelChannel,RedPixelChannel);
+ }
if (image->colorspace == CMYKColorspace)
{
image->number_channels++;
SetPixelChannelMapComponent(image,IndexPixelChannel,IndexPixelChannel);
SetPixelChannelMapTraits(image,IndexPixelChannel,CopyPixelTrait);
}
+ image->number_channels+=image->number_meta_channels;
}
image->matte=MagickTrue;
}
if (LocaleCompare(value,"GRAYSCALE") == 0)
- quantum_type=GrayQuantum;
+ {
+ image->colorspace=GRAYColorspace;
+ quantum_type=GrayQuantum;
+ }
if (LocaleCompare(value,"GRAYSCALE_ALPHA") == 0)
{
- quantum_type=GrayAlphaQuantum;
+ image->colorspace=GRAYColorspace;
image->matte=MagickTrue;
+ quantum_type=GrayAlphaQuantum;
}
if (LocaleCompare(value,"RGB_ALPHA") == 0)
{
/*
Convert PBM image to pixel packets.
*/
+ image->colorspace=GRAYColorspace;
for (y=0; y < (ssize_t) image->rows; y++)
{
register ssize_t
/*
Convert PGM image to pixel packets.
*/
+ image->colorspace=GRAYColorspace;
scale=(Quantum *) NULL;
if (max_value != (1U*QuantumRange))
{
*restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
/*
Convert PBM raw image to pixel packets.
*/
+ image->colorspace=GRAYColorspace;
quantum_type=GrayQuantum;
if (image->storage_class == PseudoClass)
quantum_type=IndexQuantum;
/*
Convert PGM raw image to pixel packets.
*/
+ image->colorspace=GRAYColorspace;
range=GetQuantumRange(image->depth);
quantum_type=GrayQuantum;
extent=(image->depth <= 8 ? 1 : 2)*image->columns;