fill-opacity bug fix
"Yi Zhang" <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.core |
|---|---|
| Message-ID | <003d01c405e7$7ffe6820$020111ac@qf712dlh4tevyr> |
Hi,
I had problem with applying fill-opacity and stroke-opacity at the same
time. When I set fill-opacity to 0.0, and stroke-opacity to 1.0, the
object's (e.g. rectangle) outline will not be drawn. Someone on the
ImageMagick mailing list had a similar experience:
http://studio.imagemagick.org/pipermail/magick-users/2003-November/011301.ht
ml
Eventually, I fixed my problem with the following patch (the first patch
chunk is in DrawGetFillOpacity(), the second chunk is in
DrawSetFillOpacity()):
***************************************************
--- magick/draw.c 3 Mar 2004 03:11:33 -0000 1.6
+++ magick/draw.c 9 Mar 2004 14:07:18 -0000
@@ -1546,7 +1546,7 @@
assert(context != (DrawContext)NULL);
assert(context->signature == MagickSignature);
- return ((double)CurrentContext->opacity/MaxRGB);
+ return (1.0-(((double)CurrentContext->fill.opacity)/MaxRGB));
}
/*
@@ -1585,9 +1585,9 @@
opacity = (Quantum)((double) MaxRGB*(1.0-(fill_opacity <= 1.0 ?
fill_opacity : 1.0 ))+0.5);
- if (context->filter_off || (CurrentContext->opacity != opacity))
+ if (context->filter_off || (CurrentContext->fill.opacity != opacity))
{
- CurrentContext->opacity = opacity;
+ CurrentContext->fill.opacity = (Quantum) ceil(opacity);
MvgPrintf(context, "fill-opacity %.4g\n", fill_opacity);
}
}
**************************************************
Do you think this is the good and correct way to fix the problem?
Thank you,
Yi
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click