This patch is against trunk, but it'd be nice to get it into the next 6.9.1 release.
Code: Select all
Index: Magick++/lib/Image.cpp
===================================================================
--- Magick++/lib/Image.cpp (revision 18267)
+++ Magick++/lib/Image.cpp (working copy)
@@ -2847,6 +2847,25 @@
extent(geometry);
}
+void Magick::Image::filter(const std::string &kernel_)
+{
+ KernelInfo
+ *kernel;
+
+ MagickCore::Image
+ *newImage;
+
+ kernel=AcquireKernelInfo(kernel_.c_str());
+ if (kernel == (KernelInfo *)NULL)
+ throwExceptionExplicit(OptionError,"Unable to parse kernel.");
+
+ GetPPException;
+ newImage=FilterImage(constImage(),kernel,exceptionInfo);
+ replaceImage(newImage);
+ kernel=DestroyKernelInfo(kernel);
+ ThrowImageException;
+}
+
void Magick::Image::flip(void)
{
MagickCore::Image
Index: Magick++/lib/Magick++/Image.h
===================================================================
--- Magick++/lib/Magick++/Image.h (revision 18267)
+++ Magick++/lib/Magick++/Image.h (working copy)
@@ -861,6 +861,11 @@
const GravityType gravity_);
void extent(const Geometry &geometry_,const GravityType gravity_);
+ // Filter image. Applies a user-specified filter to the image.
+ // kernel_ is a string containing a list of doubles separated by
+ // commas representing the filter kernel.
+ void filter(const std::string &kernel_);
+
// Flip image (reflect each scanline in the vertical direction)
void flip(void);