From: cristy Date: Mon, 5 Sep 2011 23:16:13 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~7077 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=05c0c9ada50c0973e9449f1f1c3ea3717d248eb5;p=imagemagick --- diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 7160e26ff..ad6144ddb 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -487,7 +487,7 @@ void Magick::Image::blur( const double radius_, const double sigma_ ) ExceptionInfo exceptionInfo; GetExceptionInfo( &exceptionInfo ); MagickCore::Image* newImage = - BlurImage( image(), radius_, sigma_, &exceptionInfo); + BlurImage( image(), radius_, sigma_, image()->bias, &exceptionInfo); replaceImage( newImage ); throwException( exceptionInfo ); (void) DestroyExceptionInfo( &exceptionInfo ); @@ -500,7 +500,7 @@ void Magick::Image::blurChannel( const ChannelType channel_, GetExceptionInfo( &exceptionInfo ); ChannelType channel_mask = SetPixelChannelMask( image(), channel_ ); MagickCore::Image* newImage = - BlurImage( image(), radius_, sigma_, &exceptionInfo); + BlurImage( image(), radius_, sigma_, image()->bias, &exceptionInfo); (void) SetPixelChannelMap( image(), channel_mask ); replaceImage( newImage ); throwException( exceptionInfo ); @@ -557,7 +557,7 @@ void Magick::Image::charcoal( const double radius_, const double sigma_ ) ExceptionInfo exceptionInfo; GetExceptionInfo( &exceptionInfo ); MagickCore::Image* newImage = - CharcoalImage( image(), radius_, sigma_, &exceptionInfo ); + CharcoalImage( image(), radius_, sigma_, image()->bias, &exceptionInfo ); replaceImage( newImage ); throwException( exceptionInfo ); (void) DestroyExceptionInfo( &exceptionInfo ); @@ -1213,7 +1213,7 @@ void Magick::Image::gaussianBlur ( const double width_, const double sigma_ ) ExceptionInfo exceptionInfo; GetExceptionInfo( &exceptionInfo ); MagickCore::Image* newImage = - GaussianBlurImage( image(), width_, sigma_, &exceptionInfo ); + GaussianBlurImage( image(), width_, sigma_, image()->bias, &exceptionInfo ); replaceImage( newImage ); throwException( exceptionInfo ); (void) DestroyExceptionInfo( &exceptionInfo ); @@ -1227,7 +1227,7 @@ void Magick::Image::gaussianBlurChannel ( const ChannelType channel_, GetExceptionInfo( &exceptionInfo ); ChannelType channel_mask = SetPixelChannelMask( image(), channel_ ); MagickCore::Image* newImage = - GaussianBlurImage( image(), width_, sigma_, &exceptionInfo ); + GaussianBlurImage( image(), width_, sigma_, image()->bias, &exceptionInfo ); (void) SetPixelChannelMap( image(), channel_mask ); replaceImage( newImage ); throwException( exceptionInfo ); @@ -1940,6 +1940,7 @@ void Magick::Image::sharpen ( const double radius_, const double sigma_ ) SharpenImage( image(), radius_, sigma_, + image()->bias, &exceptionInfo ); replaceImage( newImage ); throwException( exceptionInfo ); @@ -1956,6 +1957,7 @@ void Magick::Image::sharpenChannel ( const ChannelType channel_, SharpenImage( image(), radius_, sigma_, + image()->bias, &exceptionInfo ); (void) SetPixelChannelMap( image(), channel_mask ); replaceImage( newImage ); diff --git a/MagickCore/display.c b/MagickCore/display.c index 3a3365aed..c7a6d6ca3 100644 --- a/MagickCore/display.c +++ b/MagickCore/display.c @@ -8216,7 +8216,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, XCheckRefreshWindows(display,windows); flags=ParseGeometry(radius,&geometry_info); sharp_image=SharpenImage(*image,geometry_info.rho,geometry_info.sigma, - exception); + geometry_info.xi,exception); if (sharp_image != (Image *) NULL) { *image=DestroyImage(*image); @@ -8252,7 +8252,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, XCheckRefreshWindows(display,windows); flags=ParseGeometry(radius,&geometry_info); blur_image=BlurImage(*image,geometry_info.rho,geometry_info.sigma, - exception); + geometry_info.xi,exception); if (blur_image != (Image *) NULL) { *image=DestroyImage(*image); @@ -8745,7 +8745,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; charcoal_image=CharcoalImage(*image,geometry_info.rho,geometry_info.sigma, - exception); + geometry_info.xi,exception); if (charcoal_image != (Image *) NULL) { *image=DestroyImage(*image); diff --git a/MagickCore/effect.c b/MagickCore/effect.c index 8ac984b3b..9b7f00804 100644 --- a/MagickCore/effect.c +++ b/MagickCore/effect.c @@ -233,7 +233,7 @@ MagickExport Image *AdaptiveBlurImage(const Image *image, return((Image *) NULL); } (void) AdaptiveLevelImage(edge_image,"20%,95%",exception); - gaussian_image=GaussianBlurImage(edge_image,radius,sigma,exception); + gaussian_image=GaussianBlurImage(edge_image,radius,sigma,bias,exception); if (gaussian_image != (Image *) NULL) { edge_image=DestroyImage(edge_image); @@ -555,7 +555,7 @@ MagickExport Image *AdaptiveSharpenImage(const Image *image,const double radius, return((Image *) NULL); } (void) AdaptiveLevelImage(edge_image,"20%,95%",exception); - gaussian_image=GaussianBlurImage(edge_image,radius,sigma,exception); + gaussian_image=GaussianBlurImage(edge_image,radius,sigma,bias,exception); if (gaussian_image != (Image *) NULL) { edge_image=DestroyImage(edge_image); @@ -799,7 +799,7 @@ MagickExport Image *AdaptiveSharpenImage(const Image *image,const double radius, % The format of the BlurImage method is: % % Image *BlurImage(const Image *image,const double radius, -% const double sigma,ExceptionInfo *exception) +% const double sigma,const double bias,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -810,6 +810,8 @@ MagickExport Image *AdaptiveSharpenImage(const Image *image,const double radius, % % o sigma: the standard deviation of the Gaussian, in pixels. % +% o bias: the bias. +% % o exception: return any errors or warnings in this structure. % */ @@ -850,7 +852,7 @@ static double *GetBlurKernel(const size_t width,const double sigma) } MagickExport Image *BlurImage(const Image *image,const double radius, - const double sigma,ExceptionInfo *exception) + const double sigma,const double bias,ExceptionInfo *exception) { #define BlurImageTag "Blur/Image" @@ -870,9 +872,6 @@ MagickExport Image *BlurImage(const Image *image,const double radius, MagickOffsetType progress; - PixelInfo - bias; - register ssize_t i; @@ -880,6 +879,7 @@ MagickExport Image *BlurImage(const Image *image,const double radius, width; ssize_t + center, x, y; @@ -938,8 +938,7 @@ MagickExport Image *BlurImage(const Image *image,const double radius, */ status=MagickTrue; progress=0; - GetPixelInfo(image,&bias); - SetPixelInfoBias(image,&bias); + center=(ssize_t) GetPixelChannels(image)*(width/2L); image_view=AcquireCacheView(image); blur_view=AcquireCacheView(blur_image); #if defined(MAGICKCORE_OPENMP_SUPPORT) @@ -967,101 +966,77 @@ MagickExport Image *BlurImage(const Image *image,const double radius, status=MagickFalse; continue; } - for (x=0; x < (ssize_t) blur_image->columns; x++) + for (x=0; x < (ssize_t) image->columns; x++) { - PixelInfo - pixel; + register ssize_t + i; - register const double - *restrict k; + for (i=0; i < (ssize_t) GetPixelChannels(image); i++) + { + MagickRealType + alpha, + gamma, + pixel; - register const Quantum - *restrict kernel_pixels; + PixelChannel + channel; - register ssize_t - i; + PixelTrait + blur_traits, + traits; - pixel=bias; - k=kernel; - kernel_pixels=p; - if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) == 0) || - (image->matte == MagickFalse)) - { - for (i=0; i < (ssize_t) width; i++) - { - pixel.red+=(*k)*GetPixelRed(image,kernel_pixels); - pixel.green+=(*k)*GetPixelGreen(image,kernel_pixels); - pixel.blue+=(*k)*GetPixelBlue(image,kernel_pixels); - if (image->colorspace == CMYKColorspace) - pixel.black+=(*k)*GetPixelBlack(image,kernel_pixels); - k++; - kernel_pixels+=GetPixelChannels(image); - } - if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) - SetPixelRed(blur_image,ClampToQuantum(pixel.red),q); - if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) - SetPixelGreen(blur_image,ClampToQuantum(pixel.green),q); - if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) - SetPixelBlue(blur_image,ClampToQuantum(pixel.blue),q); - if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && - (blur_image->colorspace == CMYKColorspace)) - SetPixelBlack(blur_image,ClampToQuantum(pixel.black),q); - if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) - { - k=kernel; - kernel_pixels=p; - for (i=0; i < (ssize_t) width; i++) - { - pixel.alpha+=(*k)*GetPixelAlpha(image,kernel_pixels); - k++; - kernel_pixels+=GetPixelChannels(image); - } - SetPixelAlpha(blur_image,ClampToQuantum(pixel.alpha),q); - } - } - else - { - MagickRealType - alpha, - gamma; + register const double + *restrict k; - gamma=0.0; - for (i=0; i < (ssize_t) width; i++) + register const Quantum + *restrict pixels; + + register ssize_t + u; + + traits=GetPixelChannelMapTraits(image,(PixelChannel) i); + channel=GetPixelChannelMapChannel(image,(PixelChannel) i); + blur_traits=GetPixelChannelMapTraits(blur_image,channel); + if ((traits == UndefinedPixelTrait) || + (blur_traits == UndefinedPixelTrait)) + continue; + if ((blur_traits & CopyPixelTrait) != 0) { - alpha=(MagickRealType) (QuantumScale* - GetPixelAlpha(image,kernel_pixels)); - pixel.red+=(*k)*alpha*GetPixelRed(image,kernel_pixels); - pixel.green+=(*k)*alpha*GetPixelGreen(image,kernel_pixels); - pixel.blue+=(*k)*alpha*GetPixelBlue(image,kernel_pixels); - if (image->colorspace == CMYKColorspace) - pixel.black+=(*k)*alpha*GetPixelBlack(image,kernel_pixels); - gamma+=(*k)*alpha; - k++; - kernel_pixels+=GetPixelChannels(image); + q[channel]=p[center+i]; + continue; } - gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma); - if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) - SetPixelRed(blur_image,ClampToQuantum(gamma*pixel.red),q); - if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) - SetPixelGreen(blur_image,ClampToQuantum(gamma*pixel.green),q); - if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) - SetPixelBlue(blur_image,ClampToQuantum(gamma*pixel.blue),q); - if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && - (blur_image->colorspace == CMYKColorspace)) - SetPixelBlack(blur_image,ClampToQuantum(gamma*pixel.black),q); - if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) + k=kernel; + pixels=p; + pixel=0.0; + if ((blur_traits & BlendPixelTrait) == 0) + { + /* + No alpha blending. + */ + for (u=0; u < (ssize_t) width; u++) { - k=kernel; - kernel_pixels=p; - for (i=0; i < (ssize_t) width; i++) - { - pixel.alpha+=(*k)*GetPixelAlpha(image,kernel_pixels); - k++; - kernel_pixels+=GetPixelChannels(image); - } - SetPixelAlpha(blur_image,ClampToQuantum(pixel.alpha),q); + pixel+=(*k)*pixels[i]; + k++; + pixels+=GetPixelChannels(image); } + q[channel]=ClampToQuantum(pixel); + continue; + } + /* + Alpha blending. + */ + gamma=0.0; + for (u=0; u < (ssize_t) width; u++) + { + alpha=(MagickRealType) (QuantumScale*GetPixelAlpha(image,pixels)); + pixel+=(*k)*alpha*pixels[i]; + gamma+=(*k)*alpha; + k++; + pixels+=GetPixelChannels(image); } + gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma); + q[channel]=ClampToQuantum(gamma*pixel); + } p+=GetPixelChannels(image); q+=GetPixelChannels(blur_image); } @@ -1112,102 +1087,78 @@ MagickExport Image *BlurImage(const Image *image,const double radius, status=MagickFalse; continue; } - for (y=0; y < (ssize_t) blur_image->rows; y++) + for (y=0; y < (ssize_t) image->rows; y++) { - PixelInfo - pixel; + register ssize_t + i; - register const double - *restrict k; + for (i=0; i < (ssize_t) GetPixelChannels(image); i++) + { + MagickRealType + alpha, + gamma, + pixel; - register const Quantum - *restrict kernel_pixels; + PixelChannel + channel; - register ssize_t - i; + PixelTrait + blur_traits, + traits; - pixel=bias; - k=kernel; - kernel_pixels=p; - if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) == 0) || - (blur_image->matte == MagickFalse)) - { - for (i=0; i < (ssize_t) width; i++) - { - pixel.red+=(*k)*GetPixelRed(blur_image,kernel_pixels); - pixel.green+=(*k)*GetPixelGreen(blur_image,kernel_pixels); - pixel.blue+=(*k)*GetPixelBlue(blur_image,kernel_pixels); - if (blur_image->colorspace == CMYKColorspace) - pixel.black+=(*k)*GetPixelBlack(blur_image,kernel_pixels); - k++; - kernel_pixels+=GetPixelChannels(blur_image); - } - if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) - SetPixelRed(blur_image,ClampToQuantum(pixel.red),q); - if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) - SetPixelGreen(blur_image,ClampToQuantum(pixel.green),q); - if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) - SetPixelBlue(blur_image,ClampToQuantum(pixel.blue),q); - if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && - (blur_image->colorspace == CMYKColorspace)) - SetPixelBlack(blur_image,ClampToQuantum(pixel.black),q); - if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) - { - k=kernel; - kernel_pixels=p; - for (i=0; i < (ssize_t) width; i++) - { - pixel.alpha+=(*k)*GetPixelAlpha(blur_image,kernel_pixels); - k++; - kernel_pixels+=GetPixelChannels(blur_image); - } - SetPixelAlpha(blur_image,ClampToQuantum(pixel.alpha),q); - } - } - else - { - MagickRealType - alpha, - gamma; + register const double + *restrict k; - gamma=0.0; - for (i=0; i < (ssize_t) width; i++) + register const Quantum + *restrict pixels; + + register ssize_t + u; + + traits=GetPixelChannelMapTraits(image,(PixelChannel) i); + channel=GetPixelChannelMapChannel(image,(PixelChannel) i); + blur_traits=GetPixelChannelMapTraits(blur_image,channel); + if ((traits == UndefinedPixelTrait) || + (blur_traits == UndefinedPixelTrait)) + continue; + if ((blur_traits & CopyPixelTrait) != 0) { - alpha=(MagickRealType) (QuantumScale* - GetPixelAlpha(blur_image,kernel_pixels)); - pixel.red+=(*k)*alpha*GetPixelRed(blur_image,kernel_pixels); - pixel.green+=(*k)*alpha*GetPixelGreen(blur_image,kernel_pixels); - pixel.blue+=(*k)*alpha*GetPixelBlue(blur_image,kernel_pixels); - if (blur_image->colorspace == CMYKColorspace) - pixel.black+=(*k)*alpha*GetPixelBlack(blur_image,kernel_pixels); - gamma+=(*k)*alpha; - k++; - kernel_pixels+=GetPixelChannels(blur_image); + q[channel]=p[center+i]; + continue; } - gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma); - if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) - SetPixelRed(blur_image,ClampToQuantum(gamma*pixel.red),q); - if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) - SetPixelGreen(blur_image,ClampToQuantum(gamma*pixel.green),q); - if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) - SetPixelBlue(blur_image,ClampToQuantum(gamma*pixel.blue),q); - if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && - (blur_image->colorspace == CMYKColorspace)) - SetPixelBlack(blur_image,ClampToQuantum(gamma*pixel.black),q); - if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) + k=kernel; + pixels=p; + pixel=0.0; + if ((blur_traits & BlendPixelTrait) == 0) + { + /* + No alpha blending. + */ + for (u=0; u < (ssize_t) width; u++) { - k=kernel; - kernel_pixels=p; - for (i=0; i < (ssize_t) width; i++) - { - pixel.alpha+=(*k)*GetPixelAlpha(blur_image,kernel_pixels); - k++; - kernel_pixels+=GetPixelChannels(blur_image); - } - SetPixelAlpha(blur_image,ClampToQuantum(pixel.alpha),q); + pixel+=(*k)*pixels[i]; + k++; + pixels+=GetPixelChannels(image); } + q[channel]=ClampToQuantum(pixel); + continue; + } + /* + Alpha blending. + */ + gamma=0.0; + for (u=0; u < (ssize_t) width; u++) + { + alpha=(MagickRealType) (QuantumScale*GetPixelAlpha(image,pixels)); + pixel+=(*k)*alpha*pixels[i]; + gamma+=(*k)*alpha; + k++; + pixels+=GetPixelChannels(image); } - p+=GetPixelChannels(blur_image); + gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma); + q[channel]=ClampToQuantum(gamma*pixel); + } + p+=GetPixelChannels(image); q+=GetPixelChannels(blur_image); } if (SyncCacheViewAuthenticPixels(blur_view,exception) == MagickFalse) @@ -1989,7 +1940,7 @@ MagickExport Image *EmbossImage(const Image *image,const double radius, % The format of the GaussianBlurImage method is: % % Image *GaussianBlurImage(const Image *image,onst double radius, -% const double sigma,ExceptionInfo *exception) +% const double sigma,const double bias,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -2000,11 +1951,13 @@ MagickExport Image *EmbossImage(const Image *image,const double radius, % % o sigma: the standard deviation of the Gaussian, in pixels. % +% o bias: the bias. +% % o exception: return any errors or warnings in this structure. % */ MagickExport Image *GaussianBlurImage(const Image *image,const double radius, - const double sigma,ExceptionInfo *exception) + const double sigma,const double bias,ExceptionInfo *exception) { Image *blur_image; @@ -2036,6 +1989,7 @@ MagickExport Image *GaussianBlurImage(const Image *image,const double radius, (void) ResetMagickMemory(kernel_info,0,sizeof(*kernel_info)); kernel_info->width=width; kernel_info->height=width; + kernel_info->bias=bias; kernel_info->signature=MagickSignature; kernel_info->values=(double *) AcquireAlignedMemory(kernel_info->width, kernel_info->width*sizeof(*kernel_info->values)); @@ -2055,7 +2009,6 @@ MagickExport Image *GaussianBlurImage(const Image *image,const double radius, i++; } } - kernel_info->bias=image->bias; blur_image=ConvolveImage(image,kernel_info,exception); kernel_info=DestroyKernelInfo(kernel_info); return(blur_image); @@ -2645,14 +2598,15 @@ MagickExport Image *PreviewImage(const Image *image,const PreviewType preview, } case SharpenPreview: { - preview_image=SharpenImage(thumbnail,radius,sigma,exception); + preview_image=SharpenImage(thumbnail,radius,sigma,image->bias, + exception); (void) FormatLocaleString(label,MaxTextExtent,"sharpen %gx%g", radius,sigma); break; } case BlurPreview: { - preview_image=BlurImage(thumbnail,radius,sigma,exception); + preview_image=BlurImage(thumbnail,radius,sigma,image->bias,exception); (void) FormatLocaleString(label,MaxTextExtent,"blur %gx%g",radius, sigma); break; @@ -2761,7 +2715,7 @@ MagickExport Image *PreviewImage(const Image *image,const PreviewType preview, case CharcoalDrawingPreview: { preview_image=CharcoalImage(thumbnail,(double) radius,(double) sigma, - exception); + image->bias,exception); (void) FormatLocaleString(label,MaxTextExtent,"charcoal %gx%g", radius,sigma); break; @@ -3736,7 +3690,7 @@ MagickExport Image *ShadeImage(const Image *image,const MagickBooleanType gray, % The format of the SharpenImage method is: % % Image *SharpenImage(const Image *image,const double radius, -% const double sigma,ExceptionInfo *exception) +% const double sigma,const double bias,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -3747,11 +3701,13 @@ MagickExport Image *ShadeImage(const Image *image,const MagickBooleanType gray, % % o sigma: the standard deviation of the Laplacian, in pixels. % +% o bias: bias. +% % o exception: return any errors or warnings in this structure. % */ MagickExport Image *SharpenImage(const Image *image,const double radius, - const double sigma,ExceptionInfo *exception) + const double sigma,const double bias,ExceptionInfo *exception) { double normalize; @@ -3786,6 +3742,7 @@ MagickExport Image *SharpenImage(const Image *image,const double radius, (void) ResetMagickMemory(kernel_info,0,sizeof(*kernel_info)); kernel_info->width=width; kernel_info->height=width; + kernel_info->bias=bias; kernel_info->signature=MagickSignature; kernel_info->values=(double *) AcquireAlignedMemory(kernel_info->width, kernel_info->width*sizeof(*kernel_info->values)); @@ -3808,7 +3765,6 @@ MagickExport Image *SharpenImage(const Image *image,const double radius, } } kernel_info->values[i/2]=(double) ((-2.0)*normalize); - kernel_info->bias=image->bias; sharp_image=ConvolveImage(image,kernel_info,exception); kernel_info=DestroyKernelInfo(kernel_info); return(sharp_image); @@ -4867,7 +4823,7 @@ MagickExport Image *UnsharpMaskImage(const Image *image, if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); - unsharp_image=BlurImage(image,radius,sigma,exception); + unsharp_image=BlurImage(image,radius,sigma,image->bias,exception); if (unsharp_image == (Image *) NULL) return((Image *) NULL); quantum_threshold=(MagickRealType) QuantumRange*threshold; @@ -4923,55 +4879,45 @@ MagickExport Image *UnsharpMaskImage(const Image *image, pixel.green=GetPixelGreen(image,p)- (MagickRealType) GetPixelGreen(image,q); if (fabs(2.0*pixel.green) < quantum_threshold) - pixel.green=(MagickRealType) - GetPixelGreen(image,p); + pixel.green=(MagickRealType) GetPixelGreen(image,p); else - pixel.green=(MagickRealType) - GetPixelGreen(image,p)+ + pixel.green=(MagickRealType) GetPixelGreen(image,p)+ (pixel.green*amount); SetPixelGreen(unsharp_image, ClampToQuantum(pixel.green),q); } if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) { - pixel.blue=GetPixelBlue(image,p)- - (MagickRealType) GetPixelBlue(image,q); + pixel.blue=GetPixelBlue(image,p)-(MagickRealType) + GetPixelBlue(image,q); if (fabs(2.0*pixel.blue) < quantum_threshold) - pixel.blue=(MagickRealType) - GetPixelBlue(image,p); + pixel.blue=(MagickRealType) GetPixelBlue(image,p); else - pixel.blue=(MagickRealType) - GetPixelBlue(image,p)+(pixel.blue*amount); - SetPixelBlue(unsharp_image, - ClampToQuantum(pixel.blue),q); + pixel.blue=(MagickRealType) GetPixelBlue(image,p)+ + (pixel.blue*amount); + SetPixelBlue(unsharp_image,ClampToQuantum(pixel.blue),q); } if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && (image->colorspace == CMYKColorspace)) { - pixel.black=GetPixelBlack(image,p)- - (MagickRealType) GetPixelBlack(image,q); + pixel.black=GetPixelBlack(image,p)-(MagickRealType) + GetPixelBlack(image,q); if (fabs(2.0*pixel.black) < quantum_threshold) - pixel.black=(MagickRealType) - GetPixelBlack(image,p); + pixel.black=(MagickRealType) GetPixelBlack(image,p); else - pixel.black=(MagickRealType) - GetPixelBlack(image,p)+(pixel.black* - amount); - SetPixelBlack(unsharp_image, - ClampToQuantum(pixel.black),q); + pixel.black=(MagickRealType) GetPixelBlack(image,p)+ + (pixel.black*amount); + SetPixelBlack(unsharp_image,ClampToQuantum(pixel.black),q); } if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) { - pixel.alpha=GetPixelAlpha(image,p)- - (MagickRealType) GetPixelAlpha(image,q); + pixel.alpha=GetPixelAlpha(image,p)-(MagickRealType) + GetPixelAlpha(image,q); if (fabs(2.0*pixel.alpha) < quantum_threshold) - pixel.alpha=(MagickRealType) - GetPixelAlpha(image,p); + pixel.alpha=(MagickRealType) GetPixelAlpha(image,p); else - pixel.alpha=GetPixelAlpha(image,p)+ - (pixel.alpha*amount); - SetPixelAlpha(unsharp_image, - ClampToQuantum(pixel.alpha),q); + pixel.alpha=GetPixelAlpha(image,p)+(pixel.alpha*amount); + SetPixelAlpha(unsharp_image,ClampToQuantum(pixel.alpha),q); } p+=GetPixelChannels(image); q+=GetPixelChannels(unsharp_image); diff --git a/MagickCore/effect.h b/MagickCore/effect.h index 1804af5dc..cf30eb59a 100644 --- a/MagickCore/effect.h +++ b/MagickCore/effect.h @@ -76,12 +76,14 @@ extern MagickExport Image ExceptionInfo *), *AdaptiveSharpenImage(const Image *,const double,const double,const double, ExceptionInfo *), - *BlurImage(const Image *,const double,const double,ExceptionInfo *), + *BlurImage(const Image *,const double,const double,const double, + ExceptionInfo *), *ConvolveImage(const Image *,const KernelInfo *,ExceptionInfo *), *DespeckleImage(const Image *,ExceptionInfo *), *EdgeImage(const Image *,const double,const double,ExceptionInfo *), *EmbossImage(const Image *,const double,const double,ExceptionInfo *), - *GaussianBlurImage(const Image *,const double,const double,ExceptionInfo *), + *GaussianBlurImage(const Image *,const double,const double,const double, + ExceptionInfo *), *MotionBlurImage(const Image *,const double,const double,const double, ExceptionInfo *), *PreviewImage(const Image *,const PreviewType,ExceptionInfo *), @@ -90,7 +92,8 @@ extern MagickExport Image ExceptionInfo *), *ShadeImage(const Image *,const MagickBooleanType,const double,const double, ExceptionInfo *), - *SharpenImage(const Image *,const double,const double,ExceptionInfo *), + *SharpenImage(const Image *,const double,const double,const double, + ExceptionInfo *), *SpreadImage(const Image *,const double,ExceptionInfo *), *StatisticImage(const Image *,const StatisticType,const size_t,const size_t, ExceptionInfo *), diff --git a/MagickCore/fx.c b/MagickCore/fx.c index 34f65a31d..ff00a39a7 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -610,7 +610,7 @@ MagickExport Image *BlueShiftImage(const Image *image,const double factor, % The format of the CharcoalImage method is: % % Image *CharcoalImage(const Image *image,const double radius, -% const double sigma,ExceptionInfo *exception) +% const double sigma,const double bias,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -620,11 +620,13 @@ MagickExport Image *BlueShiftImage(const Image *image,const double factor, % % o sigma: the standard deviation of the Gaussian, in pixels. % +% o bias: the bias. +% % o exception: return any errors or warnings in this structure. % */ MagickExport Image *CharcoalImage(const Image *image,const double radius, - const double sigma,ExceptionInfo *exception) + const double sigma,const double bias,ExceptionInfo *exception) { Image *charcoal_image, @@ -645,7 +647,7 @@ MagickExport Image *CharcoalImage(const Image *image,const double radius, clone_image=DestroyImage(clone_image); if (edge_image == (Image *) NULL) return((Image *) NULL); - charcoal_image=BlurImage(edge_image,radius,sigma,exception); + charcoal_image=BlurImage(edge_image,radius,sigma,bias,exception); edge_image=DestroyImage(edge_image); if (charcoal_image == (Image *) NULL) return((Image *) NULL); @@ -4226,7 +4228,7 @@ MagickExport Image *ShadowImage(const Image *image,const double opacity, } border_view=DestroyCacheView(border_view); channel_mask=SetPixelChannelMask(border_image,AlphaChannel); - shadow_image=BlurImage(border_image,0.0,sigma,exception); + shadow_image=BlurImage(border_image,0.0,sigma,image->bias,exception); (void) SetPixelChannelMap(border_image,channel_mask); border_image=DestroyImage(border_image); if (shadow_image == (Image *) NULL) @@ -5212,7 +5214,8 @@ MagickExport Image *TintImage(const Image *image,const char *opacity, % 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: % @@ -5275,7 +5278,7 @@ MagickExport Image *VignetteImage(const Image *image,const double radius, draw_info->primitive=AcquireString(ellipse); (void) DrawImage(oval_image,draw_info,exception); draw_info=DestroyDrawInfo(draw_info); - blur_image=BlurImage(oval_image,radius,sigma,exception); + blur_image=BlurImage(oval_image,radius,sigma,image->bias,exception); oval_image=DestroyImage(oval_image); if (blur_image == (Image *) NULL) { diff --git a/MagickCore/fx.h b/MagickCore/fx.h index bf99249f5..86e6ce265 100644 --- a/MagickCore/fx.h +++ b/MagickCore/fx.h @@ -39,7 +39,8 @@ typedef enum extern MagickExport Image *AddNoiseImage(const Image *,const NoiseType,ExceptionInfo *), *BlueShiftImage(const Image *,const double,ExceptionInfo *), - *CharcoalImage(const Image *,const double,const double,ExceptionInfo *), + *CharcoalImage(const Image *,const double,const double,const double, + ExceptionInfo *), *ColorizeImage(const Image *,const char *,const PixelPacket,ExceptionInfo *), *ColorMatrixImage(const Image *,const KernelInfo *kernel,ExceptionInfo *), *FxImage(const Image *,const char *,ExceptionInfo *), diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 2b155be91..bcbf026b6 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -889,7 +889,7 @@ WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand, % The format of the MagickBlurImage method is: % % MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius, -% const double sigma) +% const double sigmaconst double bias) % % A description of each parameter follows: % @@ -900,9 +900,11 @@ WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand, % % o sigma: the standard deviation of the , in pixels. % +% o bias: the bias. +% */ WandExport MagickBooleanType MagickBlurImage(MagickWand *wand, - const double radius,const double sigma) + const double radius,const double sigma,const double bias) { Image *blur_image; @@ -913,7 +915,7 @@ WandExport MagickBooleanType MagickBlurImage(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - blur_image=BlurImage(wand->images,radius,sigma,wand->exception); + blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception); if (blur_image == (Image *) NULL) return(MagickFalse); ReplaceImageInList(&wand->images,blur_image); @@ -1042,7 +1044,7 @@ WandExport MagickBooleanType MagickBrightnessContrastImage( % The format of the MagickCharcoalImage method is: % % MagickBooleanType MagickCharcoalImage(MagickWand *wand, -% const double radius,const double sigma) +% const double radius,const double sigma,const double bias) % % A description of each parameter follows: % @@ -1053,9 +1055,11 @@ WandExport MagickBooleanType MagickBrightnessContrastImage( % % o sigma: the standard deviation of the Gaussian, in pixels. % +% o bias: the bias. +% */ WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand, - const double radius,const double sigma) + const double radius,const double sigma,const double bias) { Image *charcoal_image; @@ -1066,7 +1070,7 @@ WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception); + charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception); if (charcoal_image == (Image *) NULL) return(MagickFalse); ReplaceImageInList(&wand->images,charcoal_image); @@ -3337,7 +3341,7 @@ WandExport MagickBooleanType MagickGammaImage(MagickWand *wand, % The format of the MagickGaussianBlurImage method is: % % MagickBooleanType MagickGaussianBlurImage(MagickWand *wand, -% const double radius,const double sigma) +% const double radius,const double sigma,const double bias) % % A description of each parameter follows: % @@ -3348,9 +3352,11 @@ WandExport MagickBooleanType MagickGammaImage(MagickWand *wand, % % o sigma: the standard deviation of the Gaussian, in pixels. % +% o bias: the bias. +% */ WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand, - const double radius,const double sigma) + const double radius,const double sigma,const double bias) { Image *blur_image; @@ -3361,7 +3367,7 @@ WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception); + blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception); if (blur_image == (Image *) NULL) return(MagickFalse); ReplaceImageInList(&wand->images,blur_image); @@ -10223,7 +10229,7 @@ WandExport MagickBooleanType MagickShadowImage(MagickWand *wand, % The format of the MagickSharpenImage method is: % % MagickBooleanType MagickSharpenImage(MagickWand *wand, -% const double radius,const double sigma) +% const double radius,const double sigma,const double bias) % % A description of each parameter follows: % @@ -10234,9 +10240,11 @@ WandExport MagickBooleanType MagickShadowImage(MagickWand *wand, % % o sigma: the standard deviation of the Gaussian, in pixels. % +% o bias: the bias. +% */ WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand, - const double radius,const double sigma) + const double radius,const double sigma,const double bias) { Image *sharp_image; @@ -10247,7 +10255,7 @@ WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception); + sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception); if (sharp_image == (Image *) NULL) return(MagickFalse); ReplaceImageInList(&wand->images,sharp_image); diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h index 5895ec6c5..95ae5f51b 100644 --- a/MagickWand/magick-image.h +++ b/MagickWand/magick-image.h @@ -87,10 +87,10 @@ extern WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *), MagickBlackThresholdImage(MagickWand *,const PixelWand *), MagickBlueShiftImage(MagickWand *,const double), - MagickBlurImage(MagickWand *,const double,const double), + MagickBlurImage(MagickWand *,const double,const double,const double), MagickBorderImage(MagickWand *,const PixelWand *,const size_t,const size_t), MagickBrightnessContrastImage(MagickWand *,const double,const double), - MagickCharcoalImage(MagickWand *,const double,const double), + MagickCharcoalImage(MagickWand *,const double,const double,const double), MagickChopImage(MagickWand *,const size_t,const size_t,const ssize_t, const ssize_t), MagickClampImage(MagickWand *), @@ -139,7 +139,7 @@ extern WandExport MagickBooleanType MagickFunctionImage(MagickWand *,const MagickFunction,const size_t, const double *), MagickGammaImage(MagickWand *,const double), - MagickGaussianBlurImage(MagickWand *,const double,const double), + MagickGaussianBlurImage(MagickWand *,const double,const double,const double), MagickGetImageAlphaChannel(MagickWand *), MagickGetImageBackgroundColor(MagickWand *,PixelWand *), MagickGetImageBluePrimary(MagickWand *,double *,double *), @@ -271,7 +271,7 @@ extern WandExport MagickBooleanType const double), MagickShadowImage(MagickWand *,const double,const double,const ssize_t, const ssize_t), - MagickSharpenImage(MagickWand *,const double,const double), + MagickSharpenImage(MagickWand *,const double,const double,const double), MagickShaveImage(MagickWand *,const size_t,const size_t), MagickShearImage(MagickWand *,const PixelWand *,const double,const double), MagickSigmoidalContrastImage(MagickWand *,const MagickBooleanType, diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 547a93b8c..8961400b3 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -706,6 +706,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; + if ((flags & XiValue) == 0) + geometry_info.xi=0.0; mogrify_image=AdaptiveBlurImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,exception); break; @@ -730,6 +732,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; + if ((flags & XiValue) == 0) + geometry_info.xi=0.0; mogrify_image=AdaptiveSharpenImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,exception); break; @@ -900,8 +904,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; + if ((flags & XiValue) == 0) + geometry_info.xi=0.0; mogrify_image=BlurImage(*image,geometry_info.rho, - geometry_info.sigma,exception); + geometry_info.sigma,geometry_info.xi,exception); break; } if (LocaleCompare("border",option+1) == 0) @@ -920,8 +926,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, { if (*option == '+') { - (void) QueryColorDatabase(MogrifyBorderColor,&draw_info->border_color, - exception); + (void) QueryColorDatabase(MogrifyBorderColor, + &draw_info->border_color,exception); break; } (void) QueryColorDatabase(argv[i+1],&draw_info->border_color, @@ -999,8 +1005,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; + if ((flags & XiValue) == 0) + geometry_info.xi=1.0; mogrify_image=CharcoalImage(*image,geometry_info.rho, - geometry_info.sigma,exception); + geometry_info.sigma,geometry_info.xi,exception); break; } if (LocaleCompare("chop",option+1) == 0) @@ -1702,8 +1710,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; + if ((flags & XiValue) == 0) + geometry_info.xi=0.0; mogrify_image=GaussianBlurImage(*image,geometry_info.rho, - geometry_info.sigma,exception); + geometry_info.sigma,geometry_info.xi,exception); break; } if (LocaleCompare("geometry",option+1) == 0) @@ -2662,8 +2672,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; + if ((flags & XiValue) == 0) + geometry_info.xi=0.0; mogrify_image=SharpenImage(*image,geometry_info.rho, - geometry_info.sigma,exception); + geometry_info.sigma,geometry_info.xi,exception); break; } if (LocaleCompare("shave",option+1) == 0) @@ -3216,7 +3228,7 @@ static MagickBooleanType MogrifyUsage(void) "-brightness-contrast geometry", " improve brightness / contrast of the image", "-cdl filename color correct with a color decision list", - "-charcoal radius simulate a charcoal drawing", + "-charcoal geometry simulate a charcoal drawing", "-chop geometry remove pixels from the image interior", "-clamp restrict pixel range from 0 to the quantum depth", "-clip clip along the first path from the 8BIM profile", diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index 89df01d85..21d552339 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -214,7 +214,8 @@ static struct {"bordercolor", StringReference}, {"color", StringReference}, {"compose", MagickComposeOptions} } }, { "Blur", { {"geometry", StringReference}, {"radius", RealReference}, - {"sigma", RealReference}, {"channel", MagickChannelOptions} } }, + {"sigma", RealReference}, {"bias", RealReference}, + {"channel", MagickChannelOptions} } }, { "Chop", { {"geometry", StringReference}, {"width", IntegerReference}, {"height", IntegerReference}, {"x", IntegerReference}, {"y", IntegerReference} } }, @@ -255,7 +256,8 @@ static struct { "Shade", { {"geometry", StringReference}, {"azimuth", RealReference}, {"elevation", RealReference}, {"gray", MagickBooleanOptions} } }, { "Sharpen", { {"geometry", StringReference}, {"radius", RealReference}, - {"sigma", RealReference}, {"channel", MagickChannelOptions} } }, + {"sigma", RealReference}, {"bias", RealReference}, + {"channel", MagickChannelOptions} } }, { "Shear", { {"geometry", StringReference}, {"x", RealReference}, {"y", RealReference}, { "fill", StringReference}, {"color", StringReference} } }, @@ -367,7 +369,7 @@ static struct { "Threshold", { {"threshold", StringReference}, {"channel", MagickChannelOptions} } }, { "Charcoal", { {"geometry", StringReference}, {"radius", RealReference}, - {"sigma", RealReference} } }, + {"sigma", RealReference}, {"biabias", RealReference} } }, { "Trim", { {"fuzz", StringReference} } }, { "Wave", { {"geometry", StringReference}, {"amplitude", RealReference}, {"wavelength", RealReference}, @@ -380,7 +382,7 @@ static struct { "Deconstruct", }, { "GaussianBlur", { {"geometry", StringReference}, {"radius", RealReference}, {"sigma", RealReference}, - {"channel", MagickChannelOptions} } }, + {"bias", RealReference}, {"channel", MagickChannelOptions} } }, { "Convolve", { {"coefficients", ArrayReference}, {"channel", MagickChannelOptions}, {"bias", StringReference}, {"kernel", StringReference} } }, @@ -7552,10 +7554,12 @@ Mogrify(ref,...) if (attribute_flag[2] != 0) geometry_info.sigma=argument_list[2].real_reference; if (attribute_flag[3] != 0) - channel=(ChannelType) argument_list[3].integer_reference; + geometry_info.xi=argument_list[3].real_reference; + if (attribute_flag[4] != 0) + channel=(ChannelType) argument_list[4].integer_reference; channel_mask=SetPixelChannelMask(image,channel); image=BlurImage(image,geometry_info.rho,geometry_info.sigma, - exception); + geometry_info.xi,exception); if (image != (Image *) NULL) (void) SetPixelChannelMask(image,channel_mask); break; @@ -7842,10 +7846,12 @@ Mogrify(ref,...) if (attribute_flag[2] != 0) geometry_info.sigma=argument_list[2].real_reference; if (attribute_flag[3] != 0) - channel=(ChannelType) argument_list[3].integer_reference; + geometry_info.xi=argument_list[3].real_reference; + if (attribute_flag[4] != 0) + channel=(ChannelType) argument_list[4].integer_reference; channel_mask=SetPixelChannelMask(image,channel); image=SharpenImage(image,geometry_info.rho,geometry_info.sigma, - exception); + geometry_info.xi,exception); if (image != (Image *) NULL) (void) SetPixelChannelMask(image,channel_mask); break; @@ -9028,8 +9034,10 @@ Mogrify(ref,...) geometry_info.rho=argument_list[1].real_reference; if (attribute_flag[2] != 0) geometry_info.sigma=argument_list[2].real_reference; + if (attribute_flag[3] != 0) + geometry_info.xi=argument_list[3].real_reference; image=CharcoalImage(image,geometry_info.rho,geometry_info.sigma, - exception); + geometry_info.xi,exception); break; } case 59: /* Trim */ @@ -9118,10 +9126,12 @@ Mogrify(ref,...) if (attribute_flag[2] != 0) geometry_info.sigma=argument_list[2].real_reference; if (attribute_flag[3] != 0) - channel=(ChannelType) argument_list[3].integer_reference; + geometry_info.xi=argument_list[3].real_reference; + if (attribute_flag[4] != 0) + channel=(ChannelType) argument_list[4].integer_reference; channel_mask=SetPixelChannelMask(image,channel); image=GaussianBlurImage(image,geometry_info.rho,geometry_info.sigma, - exception); + geometry_info.xi,exception); if (image != (Image *) NULL) (void) SetPixelChannelMask(image,channel_mask); break; diff --git a/coders/jpeg.c b/coders/jpeg.c index e5a6d8469..59cd5bacf 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -670,10 +670,14 @@ static boolean ReadProfile(j_decompress_ptr jpeg_info) previous_profile=GetImageProfile(image,name); if (previous_profile != (const StringInfo *) NULL) { + ssize_t + length; + + length=GetStringInfoLength(profile); SetStringInfoLength(profile,GetStringInfoLength(profile)+ GetStringInfoLength(previous_profile)); (void) memcpy(GetStringInfoDatum(profile),GetStringInfoDatum(profile)+ - GetStringInfoLength(previous_profile),GetStringInfoLength(profile)); + GetStringInfoLength(previous_profile),length); (void) memcpy(GetStringInfoDatum(profile), GetStringInfoDatum(previous_profile), GetStringInfoLength(previous_profile)); diff --git a/coders/msl.c b/coders/msl.c index 06d6be97e..605b7b074 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -1239,7 +1239,8 @@ static void MSLStartElement(void *context,const xmlChar *tag, } channel_mask=SetPixelChannelMask(msl_info->image[n],channel); blur_image=BlurImage(msl_info->image[n],geometry_info.rho, - geometry_info.sigma,&msl_info->image[n]->exception); + geometry_info.sigma,geometry_info.xi, + &msl_info->image[n]->exception); (void) SetPixelChannelMap(msl_info->image[n],channel_mask); if (blur_image == (Image *) NULL) break; @@ -1437,7 +1438,8 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare((const char *) tag, "charcoal") == 0) { - double radius = 0.0, + double bias = 0.0, + radius = 0.0, sigma = 1.0; if (msl_info->image[n] == (Image *) NULL) @@ -1458,6 +1460,17 @@ static void MSLStartElement(void *context,const xmlChar *tag, msl_info->attributes[n],(const char *) attributes[i],&exception)); switch (*keyword) { + case 'B': + case 'b': + { + if (LocaleCompare(keyword, "bias") == 0) + { + bias = InterpretLocaleValue(value,(char **) NULL); + break; + } + ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); + break; + } case 'R': case 'r': { @@ -1496,7 +1509,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, Image *newImage; - newImage=CharcoalImage(msl_info->image[n],radius,sigma, + newImage=CharcoalImage(msl_info->image[n],radius,sigma,bias, &msl_info->image[n]->exception); if (newImage == (Image *) NULL) break; @@ -6342,7 +6355,8 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare((const char *) tag,"sharpen") == 0) { - double radius = 0.0, + double bias = 0.0, + radius = 0.0, sigma = 1.0; if (msl_info->image[n] == (Image *) NULL) @@ -6363,6 +6377,17 @@ static void MSLStartElement(void *context,const xmlChar *tag, msl_info->attributes[n],(const char *) attributes[i],&exception)); switch (*keyword) { + case 'B': + case 'b': + { + if (LocaleCompare(keyword, "bias") == 0) + { + bias = InterpretLocaleValue(value,(char **) NULL); + break; + } + ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); + break; + } case 'R': case 'r': { @@ -6401,7 +6426,8 @@ static void MSLStartElement(void *context,const xmlChar *tag, Image *newImage; - newImage=SharpenImage(msl_info->image[n],radius,sigma,&msl_info->image[n]->exception); + newImage=SharpenImage(msl_info->image[n],radius,sigma,bias, + &msl_info->image[n]->exception); if (newImage == (Image *) NULL) break; msl_info->image[n]=DestroyImage(msl_info->image[n]);