From: Cristy Date: Sun, 31 Mar 2019 23:52:07 +0000 (-0400) Subject: Corrected stroke-opacity setting X-Git-Tag: 7.0.8-36~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a928224dbc72b702066e82923f5689cf10e0f8f;p=imagemagick Corrected stroke-opacity setting --- diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index 6106246b9..53fe2543a 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -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); diff --git a/MagickCore/draw.c b/MagickCore/draw.c index e8cf327a1..5a7a29b12 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -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) diff --git a/MagickCore/segment.c b/MagickCore/segment.c index 516f4365b..8e6605344 100644 --- a/MagickCore/segment.c +++ b/MagickCore/segment.c @@ -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)