]> granicus.if.org Git - imagemagick/commitdiff
Corrected stroke-opacity setting
authorCristy <mikayla-grace@urban-warrior.org>
Sun, 31 Mar 2019 23:52:07 +0000 (19:52 -0400)
committerCristy <mikayla-grace@urban-warrior.org>
Sun, 31 Mar 2019 23:52:07 +0000 (19:52 -0400)
MagickCore/annotate.c
MagickCore/draw.c
MagickCore/segment.c

index 6106246b96ab805eb483cfe23512abff24e79e6f..53fe2543afbbfd6fbc55e1204d4e95020ea80318 100644 (file)
@@ -1711,8 +1711,7 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info,
             if (transparent_fill == MagickFalse)
               {
                 GetPixelInfo(image,&fill_color);
-                GetFillColor(draw_info,x_offset,y_offset,&fill_color,
-                  exception);
+                GetFillColor(draw_info,x_offset,y_offset,&fill_color,exception);
                 fill_opacity=fill_opacity*fill_color.alpha;
                 CompositePixelOver(image,&fill_color,fill_opacity,q,
                   GetPixelAlpha(image,q),q);
index e8cf327a1afa6eada5e02fa9cfcf20fed535d57f..5a7a29b126ea8fb996d1a43ff2738a87b90e9c1c 100644 (file)
@@ -2901,7 +2901,7 @@ static MagickBooleanType RenderMVGContent(Image *image,
               graphic_context[n]->fill.alpha=graphic_context[n]->fill_alpha;
             else
               graphic_context[n]->fill.alpha=(MagickRealType)
-                ClampToQuantum(QuantumRange*opacity);
+                ClampToQuantum(QuantumRange*(1.0-opacity));
             break;
           }
         if (LocaleCompare("fill-rule",keyword) == 0)
@@ -3695,7 +3695,7 @@ static MagickBooleanType RenderMVGContent(Image *image,
               graphic_context[n]->stroke.alpha=graphic_context[n]->stroke_alpha;
             else
               graphic_context[n]->stroke.alpha=(MagickRealType)
-                ClampToQuantum(QuantumRange*opacity);
+                ClampToQuantum(QuantumRange*(1.0-opacity));
             break;
           }
         if (LocaleCompare("stroke-width",keyword) == 0)
index 516f4365b2cbea36801be2a09d4ebb6ae9afa01e..8e6605344c5b832150311ab04409929bad460948 100644 (file)
@@ -251,6 +251,21 @@ static MagickBooleanType Classify(Image *image,short **extrema,
   ExceptionInfo *exception)
 {
 #define SegmentImageTag  "Segment/Image"
+#define ThrowClassifyException(severity,tag,label) \
+{\
+  for (cluster=head; cluster != (Cluster *) NULL; cluster=next_cluster) \
+  { \
+    next_cluster=cluster->next; \
+    cluster=(Cluster *) RelinquishMagickMemory(cluster); \
+  } \
+  if (squares != (double *) NULL) \
+    { \
+      squares-=255; \
+      free_squares=squares; \
+      free_squares=(double *) RelinquishMagickMemory(free_squares); \
+    } \
+  ThrowBinaryException(severity,tag,label); \
+}
 
   CacheView
     *image_view;
@@ -293,6 +308,7 @@ static MagickBooleanType Classify(Image *image,short **extrema,
   */
   cluster=(Cluster *) NULL;
   head=(Cluster *) NULL;
+  squares=(double *) NULL;
   (void) memset(&red,0,sizeof(red));
   (void) memset(&green,0,sizeof(green));
   (void) memset(&blue,0,sizeof(blue));
@@ -319,7 +335,7 @@ static MagickBooleanType Classify(Image *image,short **extrema,
             head=cluster;
           }
         if (cluster == (Cluster *) NULL)
-          ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+          ThrowClassifyException(ResourceLimitError,"MemoryAllocationFailed",
             image->filename);
         /*
           Initialize a new class.
@@ -339,7 +355,7 @@ static MagickBooleanType Classify(Image *image,short **extrema,
       */
       cluster=(Cluster *) AcquireMagickMemory(sizeof(*cluster));
       if (cluster == (Cluster *) NULL)
-        ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+        ThrowClassifyException(ResourceLimitError,"MemoryAllocationFailed",
           image->filename);
       /*
         Initialize a new class.
@@ -502,13 +518,13 @@ static MagickBooleanType Classify(Image *image,short **extrema,
       (void) FormatLocaleFile(stdout,"\n");
     }
   if (number_clusters > 256)
-    ThrowBinaryException(ImageError,"TooManyClusters",image->filename);
+    ThrowClassifyException(ImageError,"TooManyClusters",image->filename);
   /*
     Speed up distance calculations.
   */
   squares=(double *) AcquireQuantumMemory(513UL,sizeof(*squares));
   if (squares == (double *) NULL)
-    ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+    ThrowClassifyException(ResourceLimitError,"MemoryAllocationFailed",
       image->filename);
   squares+=255;
   for (i=(-255); i <= 255; i++)
@@ -517,7 +533,7 @@ static MagickBooleanType Classify(Image *image,short **extrema,
     Allocate image colormap.
   */
   if (AcquireImageColormap(image,number_clusters,exception) == MagickFalse)
-    ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+    ThrowClassifyException(ResourceLimitError,"MemoryAllocationFailed",
       image->filename);
   i=0;
   for (cluster=head; cluster != (Cluster *) NULL; cluster=cluster->next)