]> granicus.if.org Git - imagemagick/commitdiff
Restore draw clip path behavior
authorCristy <urban-warrior@imagemagick.org>
Sun, 29 Apr 2018 19:27:26 +0000 (15:27 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sun, 29 Apr 2018 19:27:26 +0000 (15:27 -0400)
MagickCore/color.h
MagickCore/draw.c
MagickCore/draw.h
coders/svg.c
configure

index 8b1934ed6f8e9a235a10381b9e014d560924bdea..1a3915bafeeb66b15549d1a8c84e7260196efef4 100644 (file)
@@ -33,6 +33,7 @@ typedef enum
   SVGCompliance = 0x0001,
   X11Compliance = 0x0002,
   XPMCompliance = 0x0004,
+  MVGCompliance = 0x0008,
   AllCompliance = 0x7fffffff
 } ComplianceType;
 
index 77842412d59aedd13451e769682556b153bbde60..a64507a5a2230ebc09c320bcca96c5ead10245e0 100644 (file)
@@ -267,6 +267,7 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info,
     (void) CloneString(&clone_info->primitive,draw_info->primitive);
   if (draw_info->geometry != (char *) NULL)
     (void) CloneString(&clone_info->geometry,draw_info->geometry);
+  clone_info->compliance=draw_info->compliance;
   clone_info->viewbox=draw_info->viewbox;
   clone_info->affine=draw_info->affine;
   clone_info->gravity=draw_info->gravity;
@@ -2130,6 +2131,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                 graphic_context[n]->clipping_mask=DrawClippingMask(image,
                   graphic_context[n],clip_path,exception);
                 clip_path=DestroyString(clip_path);
+                if (draw_info->compliance != SVGCompliance)
+                  status=SetImageMask(image,WritePixelMask,
+                    graphic_context[n]->clipping_mask,exception);
               }
             break;
           }
@@ -2182,6 +2186,12 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
             primitive_type=ColorPrimitive;
             break;
           }
+        if (LocaleCompare("compliance",keyword) == 0)
+          {
+            GetNextToken(q,&q,extent,token);
+            graphic_context[n]->compliance=(ComplianceType) ParseCommandOption(
+              MagickComplianceOptions,MagickFalse,token);
+          }
         status=MagickFalse;
         break;
       }
@@ -4665,7 +4675,10 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
       ((IsPixelInfoGray(&draw_info->fill) == MagickFalse) ||
        (IsPixelInfoGray(&draw_info->stroke) == MagickFalse)))
     (void) SetImageColorspace(image,sRGBColorspace,exception);
-  status=SetImageMask(image,WritePixelMask,draw_info->clipping_mask,exception);
+  status=MagickTrue;
+  if (draw_info->compliance == SVGCompliance)
+    status=SetImageMask(image,WritePixelMask,draw_info->clipping_mask,
+      exception);
   x=(ssize_t) ceil(primitive_info->point.x-0.5);
   y=(ssize_t) ceil(primitive_info->point.y-0.5);
   image_view=AcquireAuthenticCacheView(image,exception);
@@ -5103,7 +5116,8 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
     }
   }
   image_view=DestroyCacheView(image_view);
-  status&=SetImageMask(image,WritePixelMask,(Image *) NULL,exception);
+  if (draw_info->compliance == SVGCompliance)
+    status&=SetImageMask(image,WritePixelMask,(Image *) NULL,exception);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(DrawEvent,GetMagickModule(),"  end draw-primitive");
   return(status != 0 ? MagickTrue : MagickFalse);
index 0bd9209e995d65927416ee1eb0c59a802118908e..09707a6e9a5d3ced48899a54da13921b40bd3c85 100644 (file)
@@ -22,6 +22,7 @@
 #include "MagickCore/image.h"
 #include "MagickCore/pixel.h"
 #include "MagickCore/type.h"
+#include "MagickCore/color.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
@@ -330,6 +331,9 @@ typedef struct _DrawInfo
 
   Image
     *clipping_mask;
+
+  ComplianceType
+    compliance;
 } DrawInfo;
 
 typedef struct _PrimitiveInfo
index 4ac2bf199fd118185112a04b50c2b3edbdcbc7ef..6e624cd028eefb4b0175431adafd1d7f21de2455 100644 (file)
@@ -1144,6 +1144,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
       if (LocaleCompare((const char *) name,"svg") == 0)
         {
           PushGraphicContext(id);
+          (void) FormatLocaleFile(svg_info->file,"compliance \"SVG\"\n");
           (void) FormatLocaleFile(svg_info->file,"fill \"black\"\n");
           (void) FormatLocaleFile(svg_info->file,"fill-opacity 1\n");
           (void) FormatLocaleFile(svg_info->file,"stroke \"none\"\n");
index 906640aea4de27429362eb8a051e687d3f2c7025..d83bc5d7ad5f6634ec46bfefc8d979b1fc2169b7 100755 (executable)
--- a/configure
+++ b/configure
@@ -4554,7 +4554,7 @@ MAGICK_PATCHLEVEL_VERSION=29
 
 MAGICK_VERSION=7.0.7-29
 
-MAGICK_GIT_REVISION=14195:eb005622e:20180427
+MAGICK_GIT_REVISION=14218:84d1b11ea:20180429
 
 
 # Substitute library versioning