Added rotationalBlur to Magick++.
ThrowPPException;
}
+void Magick::Image::rotationalBlur(const double angle_)
+{
+ MagickCore::Image
+ *newImage;
+
+ GetPPException;
+ newImage=RotationalBlurImage(constImage(),angle_,&exceptionInfo);
+ replaceImage(newImage);
+ ThrowPPException;
+}
+
+void Magick::Image::rotationalBlurChannel(const ChannelType channel_,
+ const double angle_)
+{
+ MagickCore::Image
+ *newImage;
+
+ GetPPException;
+ SetPPChannelMask(channel_);
+ newImage=RotationalBlurImage(constImage(),angle_,&exceptionInfo);
+ RestorePPChannelMask;
+ replaceImage(newImage);
+ ThrowPPException;
+}
+
void Magick::Image::sample(const Geometry &geometry_)
{
MagickCore::Image
// Rotate image counter-clockwise by specified number of degrees.
void rotate(const double degrees_);
+ // Rotational blur image.
+ void rotationalBlur(const double angle_);
+ void rotationalBlurChannel(const ChannelType channel_,const double angle_);
+
// Resize image by using pixel sampling algorithm
void sample(const Geometry &geometry_);
using MagickCore::ResourceLimitWarning;
using MagickCore::RollImage;
using MagickCore::RotateImage;
+ using MagickCore::RotationalBlurImage;
using MagickCore::SampleImage;
using MagickCore::ScaleImage;
using MagickCore::SegmentImage;
STRINGIFY(
- __kernel void RadialBlur(const __global CLPixelType *im, __global CLPixelType *filtered_im,
- const float4 bias,
- const unsigned int channel, const unsigned int matte,
- const float2 blurCenter,
- __constant float *cos_theta, __constant float *sin_theta,
- const unsigned int cossin_theta_size)
+ __kernel void RotationalBlur(const __global CLPixelType *im, __global CLPixelType *filtered_im,
+ const float4 bias,
+ const unsigned int channel, const unsigned int matte,
+ const float2 blurCenter,
+ __constant float *cos_theta, __constant float *sin_theta,
+ const unsigned int cossin_theta_size)
{
const int x = get_global_id(0);
const int y = get_global_id(1);
}
-static Image* ComputeRadialBlurImage(const Image *inputImage, const ChannelType channel, const double angle, ExceptionInfo *exception)
+static Image* ComputeRotationalBlurImage(const Image *inputImage, const ChannelType channel, const double angle, ExceptionInfo *exception)
{
MagickBooleanType outputReady;
cl_context context;
cl_mem_flags mem_flags;
cl_mem inputImageBuffer, filteredImageBuffer, sinThetaBuffer, cosThetaBuffer;
- cl_kernel radialBlurKernel;
+ cl_kernel rotationalBlurKernel;
cl_command_queue queue;
const void *inputPixels;
sinThetaBuffer = NULL;
cosThetaBuffer = NULL;
queue = NULL;
- radialBlurKernel = NULL;
+ rotationalBlurKernel = NULL;
clEnv = GetDefaultOpenCLEnv();
}
/* get the OpenCL kernel */
- radialBlurKernel = AcquireOpenCLKernel(clEnv, MAGICK_OPENCL_ACCELERATE, "RadialBlur");
- if (radialBlurKernel == NULL)
+ rotationalBlurKernel = AcquireOpenCLKernel(clEnv, MAGICK_OPENCL_ACCELERATE, "RotationalBlur");
+ if (rotationalBlurKernel == NULL)
{
(void) OpenCLThrowMagickException(exception, GetMagickModule(), ResourceLimitWarning, "AcquireOpenCLKernel failed.", "'%s'", ".");
goto cleanup;
/* set the kernel arguments */
i = 0;
- clStatus=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(cl_mem),(void *)&inputImageBuffer);
- clStatus|=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(cl_mem),(void *)&filteredImageBuffer);
+ clStatus=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(cl_mem),(void *)&inputImageBuffer);
+ clStatus|=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(cl_mem),(void *)&filteredImageBuffer);
GetMagickPixelPacket(inputImage,&bias);
biasPixel.s[0] = bias.red;
biasPixel.s[1] = bias.green;
biasPixel.s[2] = bias.blue;
biasPixel.s[3] = bias.opacity;
- clStatus|=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(cl_float4), &biasPixel);
- clStatus|=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(ChannelType), &channel);
+ clStatus|=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(cl_float4), &biasPixel);
+ clStatus|=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(ChannelType), &channel);
matte = (inputImage->matte != MagickFalse)?1:0;
- clStatus|=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(unsigned int), &matte);
+ clStatus|=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(unsigned int), &matte);
- clStatus=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(cl_float2), &blurCenter);
+ clStatus=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(cl_float2), &blurCenter);
- clStatus|=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(cl_mem),(void *)&cosThetaBuffer);
- clStatus|=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(cl_mem),(void *)&sinThetaBuffer);
- clStatus|=clEnv->library->clSetKernelArg(radialBlurKernel,i++,sizeof(unsigned int), &cossin_theta_size);
+ clStatus|=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(cl_mem),(void *)&cosThetaBuffer);
+ clStatus|=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(cl_mem),(void *)&sinThetaBuffer);
+ clStatus|=clEnv->library->clSetKernelArg(rotationalBlurKernel,i++,sizeof(unsigned int), &cossin_theta_size);
if (clStatus != CL_SUCCESS)
{
(void) OpenCLThrowMagickException(exception, GetMagickModule(), ResourceLimitWarning, "clEnv->library->clSetKernelArg failed.", "'%s'", ".");
global_work_size[0] = inputImage->columns;
global_work_size[1] = inputImage->rows;
/* launch the kernel */
- clStatus = clEnv->library->clEnqueueNDRangeKernel(queue, radialBlurKernel, 2, NULL, global_work_size, NULL, 0, NULL, NULL);
+ clStatus = clEnv->library->clEnqueueNDRangeKernel(queue, rotationalBlurKernel, 2, NULL, global_work_size, NULL, 0, NULL, NULL);
if (clStatus != CL_SUCCESS)
{
(void) OpenCLThrowMagickException(exception, GetMagickModule(), ResourceLimitWarning, "clEnv->library->clEnqueueNDRangeKernel failed.", "'%s'", ".");
if (inputImageBuffer!=NULL) clEnv->library->clReleaseMemObject(inputImageBuffer);
if (sinThetaBuffer!=NULL) clEnv->library->clReleaseMemObject(sinThetaBuffer);
if (cosThetaBuffer!=NULL) clEnv->library->clReleaseMemObject(cosThetaBuffer);
- if (radialBlurKernel!=NULL) RelinquishOpenCLKernel(clEnv, radialBlurKernel);
+ if (rotationalBlurKernel!=NULL) RelinquishOpenCLKernel(clEnv, rotationalBlurKernel);
if (queue != NULL) RelinquishOpenCLCommandQueue(clEnv, queue);
if (outputReady == MagickFalse)
{
% %
% %
% %
-% R a d i a l B l u r I m a g e w i t h O p e n C L %
+% R o t a t i o n a l B l u r I m a g e w i t h O p e n C L %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% RadialBlurImage() applies a radial blur to the image.
+% RotationalBlurImage() applies a rotational blur to the image.
%
% Andrew Protano contributed this effect.
%
-% The format of the RadialBlurImage method is:
+% The format of the RotationalBlurImage method is:
%
-% Image *RadialBlurImage(const Image *image,const double angle,
+% Image *RotationalBlurImage(const Image *image,const double angle,
% ExceptionInfo *exception)
-% Image *RadialBlurImageChannel(const Image *image,const ChannelType channel,
+% Image *RotationalBlurImageChannel(const Image *image,const ChannelType channel,
% const double angle,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o channel: the channel type.
%
-% o angle: the angle of the radial blur.
+% o angle: the angle of the rotational blur.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport
-Image* AccelerateRadialBlurImage(const Image *image, const ChannelType channel, const double angle, ExceptionInfo *exception)
+Image* AccelerateRotationalBlurImage(const Image *image, const ChannelType channel, const double angle, ExceptionInfo *exception)
{
MagickBooleanType status;
Image* filteredImage;
if (status == MagickFalse)
return NULL;
- filteredImage = ComputeRadialBlurImage(image, channel, angle, exception);
+ filteredImage = ComputeRotationalBlurImage(image, channel, angle, exception);
return filteredImage;
}
return NULL;
}
-MagickExport Image *AccelerateRadialBlurImage(
+MagickExport Image *AccelerateRotationalBlurImage(
const Image *magick_unused(image),const ChannelType magick_unused(channel),
const double magick_unused(angle),ExceptionInfo *magick_unused(exception))
{
*AccelerateDespeckleImage(const Image *,ExceptionInfo *),
*AccelerateMotionBlurImage(const Image*, const ChannelType,
const double*,const size_t,const OffsetInfo*,ExceptionInfo*),
- *AccelerateRadialBlurImage(const Image *,const ChannelType,const double,
- ExceptionInfo *),
*AccelerateResizeImage(const Image *,const size_t,const size_t,
const ResizeFilter *,ExceptionInfo *),
+ *AccelerateRotationalBlurImage(const Image *,const ChannelType,const double,
+ ExceptionInfo *),
*AccelerateUnsharpMaskImage(const Image *,const ChannelType,const double,
const double,const double,const double,ExceptionInfo *);
% %
% %
% %
-% R a d i a l B l u r I m a g e %
+% R o t a t i o n a l B l u r I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% RadialBlurImage() applies a radial blur to the image.
+% RotationalBlurImage() applies a radial blur to the image.
%
% Andrew Protano contributed this effect.
%
-% The format of the RadialBlurImage method is:
+% The format of the RotationalBlurImage method is:
%
-% Image *RadialBlurImage(const Image *image,const double angle,
+% Image *RotationalBlurImage(const Image *image,const double angle,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *RadialBlurImage(const Image *image,const double angle,
+MagickExport Image *RotationalBlurImage(const Image *image,const double angle,
ExceptionInfo *exception)
{
CacheView
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_RadialBlurImage)
+ #pragma omp critical (MagickCore_RotationalBlurImage)
#endif
proceed=SetImageProgress(image,BlurImageTag,progress++,image->rows);
if (proceed == MagickFalse)
*MotionBlurImage(const Image *,const double,const double,const double,
ExceptionInfo *),
*PreviewImage(const Image *,const PreviewType,ExceptionInfo *),
- *RadialBlurImage(const Image *,const double,ExceptionInfo *),
+ *RotationalBlurImage(const Image *,const double,ExceptionInfo *),
*SelectiveBlurImage(const Image *,const double,const double,const double,
ExceptionInfo *),
*ShadeImage(const Image *,const MagickBooleanType,const double,const double,
#define QueueAuthenticPixelCacheNexus PrependMagickMethod(QueueAuthenticPixelCacheNexus)
#define QueueAuthenticPixels PrependMagickMethod(QueueAuthenticPixels)
#define QueueCacheViewAuthenticPixels PrependMagickMethod(QueueCacheViewAuthenticPixels)
-#define RadialBlurImage PrependMagickMethod(RadialBlurImage)
-#define RadialBlurImage PrependMagickMethod(RadialBlurImage)
#define RaiseImage PrependMagickMethod(RaiseImage)
#define RandomChannelThresholdImage PrependMagickMethod(RandomChannelThresholdImage)
#define RandomComponentGenesis PrependMagickMethod(RandomComponentGenesis)
#define sRGBTransformImage PrependMagickMethod(sRGBTransformImage)
#define RollImage PrependMagickMethod(RollImage)
#define RotateImage PrependMagickMethod(RotateImage)
+#define RotationalBlurImage PrependMagickMethod(RotationalBlurImage)
#define SampleImage PrependMagickMethod(SampleImage)
#define ScaleImage PrependMagickMethod(ScaleImage)
#define ScaleResampleFilter PrependMagickMethod(ScaleResampleFilter)
{ "-quantize", 1L, QuantizeInfoOptionFlag, MagickFalse },
{ "+quiet", 0L, GlobalOptionFlag | FireOptionFlag, MagickFalse },
{ "-quiet", 0L, GlobalOptionFlag | FireOptionFlag, MagickFalse },
- { "+radial-blur", 1L, DeprecateOptionFlag, MagickTrue },
- { "-radial-blur", 1L, SimpleOperatorFlag, MagickFalse },
+ { "-rotational-blur", 1L, SimpleOperatorFlag, MagickFalse },
{ "+raise", 1L, SimpleOperatorFlag, MagickFalse },
{ "-raise", 1L, SimpleOperatorFlag, MagickFalse },
{ "+random-threshold", 1L, DeprecateOptionFlag, MagickTrue },
"-posterize levels reduce the image to a limited number of color levels",
"-profile filename add, delete, or apply an image profile",
"-quantize colorspace reduce colors in this colorspace",
- "-radial-blur angle radial blur the image",
"-raise value lighten/darken image edges to create a 3-D effect",
"-random-threshold low,high",
" random threshold the image",
"-resize geometry resize the image",
"-roll geometry roll an image vertically or horizontally",
"-rotate degrees apply Paeth rotation to the image",
+ "-rotational-blur angle",
+ " rotational blur the image",
"-sample geometry scale image with pixel sampling",
"-scale geometry scale the image",
"-segment values segment an image",
}
case 'r':
{
- if (LocaleCompare("radial-blur",option+1) == 0)
+ if (LocaleCompare("rotational-blur",option+1) == 0)
{
i++;
if (i == (ssize_t) (argc-1))
% %
% %
% %
-% M a g i c k R a d i a l B l u r I m a g e %
+% M a g i c k R o t a t i o n a l B l u r I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% MagickRadialBlurImage() radial blurs an image.
+% MagickRotationalBlurImage() rotational blurs an image.
%
-% The format of the MagickRadialBlurImage method is:
+% The format of the MagickRotationalBlurImage method is:
%
-% MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
+% MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
% const double angle)
%
% A description of each parameter follows:
% o angle: the angle of the blur in degrees.
%
*/
-WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
+WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
const double angle)
{
Image
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- blur_image=RadialBlurImage(wand->images,angle,wand->exception);
+ blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
if (blur_image == (Image *) NULL)
return(MagickFalse);
ReplaceImageInList(&wand->images,blur_image);
const size_t,const DitherMethod,const MagickBooleanType),
MagickQuantizeImages(MagickWand *,const size_t,const ColorspaceType,
const size_t,const DitherMethod,const MagickBooleanType),
- MagickRadialBlurImage(MagickWand *,const double),
+ MagickRotationalBlurImage(MagickWand *,const double),
MagickRaiseImage(MagickWand *,const size_t,const size_t,const ssize_t,
const ssize_t,const MagickBooleanType),
MagickRandomThresholdImage(MagickWand *,const double,const double),
}
case 'r':
{
- if (LocaleCompare("radial-blur",option+1) == 0)
+ if (LocaleCompare("rotational-blur",option+1) == 0)
{
/*
- Radial blur image.
+ Rotational blur image.
*/
(void) SyncImageSettings(mogrify_info,*image,exception);
flags=ParseGeometry(argv[i+1],&geometry_info);
- mogrify_image=RadialBlurImage(*image,geometry_info.rho,exception);
+ mogrify_image=RotationalBlurImage(*image,geometry_info.rho,exception);
break;
}
if (LocaleCompare("raise",option+1) == 0)
"-posterize levels reduce the image to a limited number of color levels",
"-profile filename add, delete, or apply an image profile",
"-quantize colorspace reduce colors in this colorspace",
- "-radial-blur angle radial blur the image",
"-raise value lighten/darken image edges to create a 3-D effect",
"-random-threshold low,high",
" random threshold the image",
"-resize geometry resize the image",
"-roll geometry roll an image vertically or horizontally",
"-rotate degrees apply Paeth rotation to the image",
+ "-rotational-blur angle",
+ " rotational blur the image",
"-sample geometry scale image with pixel sampling",
"-scale geometry scale the image",
"-segment values segment an image",
}
case 'r':
{
- if (LocaleCompare("radial-blur",option+1) == 0)
+ if (LocaleCompare("rotational-blur",option+1) == 0)
{
i++;
if (i == (ssize_t) argc)
}
case 'r':
{
- if (LocaleCompare("radial-blur",option+1) == 0)
+ if (LocaleCompare("rotational-blur",option+1) == 0)
{
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & RhoValue) == 0)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- new_image=RadialBlurImage(_image,geometry_info.rho,_exception);
+ new_image=RotationalBlurImage(_image,geometry_info.rho,_exception);
break;
}
if (LocaleCompare("raise",option+1) == 0)