]> granicus.if.org Git - imagemagick/commitdiff
Added clip/clipPath to Magick++.
authordirk <dirk@git.imagemagick.org>
Sat, 5 Oct 2013 09:45:45 +0000 (09:45 +0000)
committerdirk <dirk@git.imagemagick.org>
Sat, 5 Oct 2013 09:45:45 +0000 (09:45 +0000)
Magick++/lib/Image.cpp
Magick++/lib/Magick++/Image.h

index d32706532656bf0e5e5de68da7de60d574193dcb..98965a13aaa3ae6a569f48374dc1c8e7b4f76ff1 100644 (file)
@@ -822,6 +822,28 @@ void Magick::Image::clampChannel ( const ChannelType channel_ )
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
+void Magick::Image::clip ( void )
+{
+  modifyImage();
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  ClipImage( image(), &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
+void Magick::Image::clipPath ( const std::string pathname_,
+                               const bool inside_ )
+{
+  modifyImage();
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  ClipImagePath( image(), pathname_.c_str(), (MagickBooleanType) inside_,
+    &exceptionInfo);
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
 void Magick::Image::clut ( const Image &clutImage_,
                            const PixelInterpolateMethod method )
 {
index 5291c1f937c2b7b70776b801eef3471dd958b3f8..096bb510274c1ce48e3dbb1e47ca6f60a93efc17 100644 (file)
@@ -275,6 +275,12 @@ namespace Magick
     void            clamp ( void );
     void            clampChannel ( const ChannelType channel_ );
 
+    // Sets the image clip mask based on any clipping path information
+    // if it exists.
+    void            clip ( void );
+    void            clipPath ( const std::string pathname_,
+                               const bool inside_ );
+
     // Apply a color lookup table (CLUT) to the image.
     void            clut ( const Image &clutImage_,
                            const PixelInterpolateMethod method );