Skip to content

Commit 48bcfe0

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/issues/229
1 parent 27b8b33 commit 48bcfe0

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2016-07-13 7.0.2-5 Cristy <quetzlzacatenango@image...>
2+
* Fix MVG stroke-opacity (reference
3+
https://github.com/ImageMagick/ImageMagick/issues/229).
4+
15
2016-07-11 7.0.2-4 Cristy <quetzlzacatenango@image...>
26
* Release ImageMagick version 7.0.2-4, GIT revision 18591:50debe5:20160710.
37

MagickCore/draw.c

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info,
341341
clone_info->bounds=draw_info->bounds;
342342
clone_info->clip_units=draw_info->clip_units;
343343
clone_info->render=draw_info->render;
344-
clone_info->alpha=draw_info->alpha;
344+
clone_info->fill_alpha=draw_info->fill_alpha;
345+
clone_info->stroke_alpha=draw_info->stroke_alpha;
345346
clone_info->element_reference=draw_info->element_reference;
346347
clone_info->debug=IsEventLogging();
347348
exception=DestroyExceptionInfo(exception);
@@ -2032,8 +2033,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
20322033
{
20332034
status&=QueryColorCompliance(token,AllCompliance,
20342035
&graphic_context[n]->fill,exception);
2035-
if (graphic_context[n]->alpha != OpaqueAlpha)
2036-
graphic_context[n]->fill.alpha=graphic_context[n]->alpha;
2036+
if (graphic_context[n]->fill_alpha != OpaqueAlpha)
2037+
graphic_context[n]->fill.alpha=graphic_context[n]->fill_alpha;
20372038
if (status == MagickFalse)
20382039
{
20392040
ImageInfo
@@ -2054,7 +2055,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
20542055
{
20552056
GetNextToken(q,&q,extent,token);
20562057
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
2057-
graphic_context[n]->fill.alpha=(double) QuantumRange*(1.0-factor*
2058+
graphic_context[n]->fill_alpha=(double) QuantumRange*(1.0-factor*
20582059
StringToDouble(token,&next_token));
20592060
if (token == next_token)
20602061
status=MagickFalse;
@@ -2235,8 +2236,11 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
22352236
{
22362237
GetNextToken(q,&q,extent,token);
22372238
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
2238-
graphic_context[n]->alpha=ClampToQuantum(QuantumRange*(1.0-(
2239-
QuantumScale*graphic_context[n]->alpha*(1.0-factor*
2239+
graphic_context[n]->fill_alpha=ClampToQuantum(QuantumRange*(1.0-(
2240+
QuantumScale*graphic_context[n]->fill_alpha*(1.0-factor*
2241+
StringToDouble(token,&next_token)))));
2242+
graphic_context[n]->stroke_alpha=ClampToQuantum(QuantumRange*(1.0-(
2243+
QuantumScale*graphic_context[n]->stroke_alpha*(1.0-factor*
22402244
StringToDouble(token,&next_token)))));
22412245
if (token == next_token)
22422246
status=MagickFalse;
@@ -2592,8 +2596,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
25922596
{
25932597
status&=QueryColorCompliance(token,AllCompliance,
25942598
&graphic_context[n]->stroke,exception);
2595-
if (graphic_context[n]->alpha != OpaqueAlpha)
2596-
graphic_context[n]->stroke.alpha=graphic_context[n]->alpha;
2599+
if (graphic_context[n]->stroke_alpha != OpaqueAlpha)
2600+
graphic_context[n]->stroke.alpha=
2601+
graphic_context[n]->stroke_alpha;
25972602
if (status == MagickFalse)
25982603
{
25992604
ImageInfo
@@ -2716,7 +2721,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
27162721
{
27172722
GetNextToken(q,&q,extent,token);
27182723
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
2719-
graphic_context[n]->stroke.alpha=(double) QuantumRange*(1.0-factor*
2724+
graphic_context[n]->stroke_alpha=(double) QuantumRange*(1.0-factor*
27202725
StringToDouble(token,&next_token));
27212726
if (token == next_token)
27222727
status=MagickFalse;
@@ -2842,12 +2847,10 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
28422847
}
28432848
if (status == MagickFalse)
28442849
break;
2845-
if ((fabs(affine.sx-1.0) >= DrawEpsilon) ||
2846-
(fabs(affine.rx) >= DrawEpsilon) ||
2847-
(fabs(affine.ry) >= DrawEpsilon) ||
2850+
if ((fabs(affine.sx-1.0) >= DrawEpsilon) ||
2851+
(fabs(affine.rx) >= DrawEpsilon) || (fabs(affine.ry) >= DrawEpsilon) ||
28482852
(fabs(affine.sy-1.0) >= DrawEpsilon) ||
2849-
(fabs(affine.tx) >= DrawEpsilon) ||
2850-
(fabs(affine.ty) >= DrawEpsilon))
2853+
(fabs(affine.tx) >= DrawEpsilon) || (fabs(affine.ty) >= DrawEpsilon))
28512854
{
28522855
graphic_context[n]->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
28532856
graphic_context[n]->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
@@ -4855,7 +4858,7 @@ static MagickBooleanType DrawStrokePolygon(Image *image,
48554858
break;
48564859
stroke_polygon=(PrimitiveInfo *) RelinquishMagickMemory(stroke_polygon);
48574860
q=p+p->coordinates-1;
4858-
closed_path=(fabs(q->point.x-p->point.x) < DrawEpsilon) &&
4861+
closed_path=(fabs(q->point.x-p->point.x) < DrawEpsilon) &&
48594862
(fabs(q->point.y-p->point.y) < DrawEpsilon) ? MagickTrue : MagickFalse;
48604863
if ((draw_info->linecap == RoundCap) && (closed_path == MagickFalse))
48614864
{
@@ -4954,8 +4957,9 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info)
49544957
(void) QueryColorCompliance("#0000",AllCompliance,&draw_info->stroke,
49554958
exception);
49564959
draw_info->stroke_width=1.0;
4957-
draw_info->alpha=OpaqueAlpha;
49584960
draw_info->fill_rule=EvenOddRule;
4961+
draw_info->fill_alpha=OpaqueAlpha;
4962+
draw_info->stroke_alpha=OpaqueAlpha;
49594963
draw_info->linecap=ButtCap;
49604964
draw_info->linejoin=MiterJoin;
49614965
draw_info->miterlimit=10;
@@ -5137,7 +5141,7 @@ static void TraceArcPath(PrimitiveInfo *primitive_info,const PointInfo start,
51375141
size_t
51385142
arc_segments;
51395143

5140-
if ((fabs(start.x-end.x) < DrawEpsilon) &&
5144+
if ((fabs(start.x-end.x) < DrawEpsilon) &&
51415145
(fabs(start.y-end.y) < DrawEpsilon))
51425146
{
51435147
TracePoint(primitive_info,end);
@@ -6103,22 +6107,22 @@ static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *draw_info,
61036107
slope.q=0.0;
61046108
inverse_slope.q=0.0;
61056109
if (fabs(dx.q) < DrawEpsilon)
6106-
{
6107-
if (dx.q >= 0.0)
6110+
{
6111+
if (dx.q >= 0.0)
61086112
slope.q=dy.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon;
61096113
else
61106114
slope.q=dy.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon;
61116115
}
6112-
else
6116+
else
61136117
if (fabs(dy.q) < DrawEpsilon)
6114-
{
6118+
{
61156119
if (dy.q >= 0.0)
61166120
inverse_slope.q=dx.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon;
61176121
else
61186122
inverse_slope.q=dx.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon;
61196123
}
61206124
else
6121-
{
6125+
{
61226126
slope.q=dy.q/dx.q;
61236127
inverse_slope.q=(-1.0/slope.q);
61246128
}

MagickCore/draw.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization
33
dedicated to making software imaging solutions freely available.
4-
4+
55
You may not use this file except in compliance with the License.
66
obtain a copy of the License at
7-
7+
88
http://www.imagemagick.org/script/license.php
9-
9+
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -320,6 +320,10 @@ typedef struct _DrawInfo
320320

321321
size_t
322322
signature;
323+
324+
double
325+
fill_alpha,
326+
stroke_alpha;
323327
} DrawInfo;
324328

325329

0 commit comments

Comments
 (0)