[svg-developers] Problem with overlappying lines

2006-05-18 Thread dancooperstock
I'm working in Firefox 1.5. If I have the following SVG code:




then the overlapping part (from y value 100 down to 140) looks darker
than the non-overlapping part (from 140 down to 170). I've tried
messing with opacity settings (like setting it to 1) but that makes no
difference.

Any bright ideas on how to avoid this, other than by not having
overlapping lines? (Not doing that would be tricky in my actual use
case, because I'm drawing edges of a tree-structured graph created by
another package, and those edges overlap. I'd have to do a whole bunch
of analysis to eliminate the overlaps.)

Thanks.
---
Dan Cooperstock, Senior Software Developer, Quest Software
260 King St. E., Toronto ON Canada  M5A 4L5
[EMAIL PROTECTED]416-933-5165

With Quest Software, you get more ... more performance, more
productivity, more value from your IT investments.

Visit www.quest.com to learn more.








 Yahoo! Groups Sponsor ~--> 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/1U_rlB/TM
~-> 

-
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [svg-developers] Problem with overlappying lines

2006-05-18 Thread Cameron McCormack
Hi Dan.

dancooperstock:
> I'm working in Firefox 1.5. If I have the following SVG code:
> 
> 
> 
> 
> then the overlapping part (from y value 100 down to 140) looks darker
> than the non-overlapping part (from 140 down to 170). I've tried
> messing with opacity settings (like setting it to 1) but that makes no
> difference.

The issue is with anti-aliasing and the way the coordinate system works
in SVG.  If one user unit in your SVG maps to one pixel as rendered by
Firefox, and if anti-aliasing is used when drawing, then drawing
horizontal or vertical lines with integer coordinate values with a
stroke-width of 1 will result in the line straddling pixels.  This is
because the integer coordinate values lie between the pixels in this
case, and a stroke-width of 1 will cause half of the stroke line to
drawn on one pixel, and the other half on the adjacent pixel--each with
0.5 opacity.  When the two coincident lines are drawn, their semi-opaque
pixels add together.

You could do two things to avoid this:

  * force your lines to be rendered exactly on pixels by subtracting 0.5
from your coordinates, e.g.:

  


  

  * set shape-rendering="crispEdges" to force anti-aliasing to be turned
off for these lines:

  


  

-- 
 Cameron McCormack  ICQ: 26955922
 cam (at) mcc.id.au MSN: cam (at) mcc.id.au
 http://mcc.id.au/  JBR: heycam (at) jabber.org


 Yahoo! Groups Sponsor ~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/1U_rlB/TM
~-> 

-
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/