[prev in list] [next in list] [prev in thread] [next in thread]
List: cairo
Subject: Re: [cairo] Strange behaviour on arc drawing with big line width
From: Maurizio Berti <maurizio.berti () gmail ! com>
Date: 2014-09-25 0:04:26
Message-ID: CAPn+-XRaX7GC6dn9JrsL17hmoomT+7vaYNZT6a0zADjhcM-_kg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Thank you all for your efforts, I hope I will able to try it as soon as
possible, even if unfortunally on my system I can't afford to use cairo
from git.
To answer to Tobias, I could draw lines and fill the arc, but that's not
what I'd need, since I have to be able to use arcs with line width smaller
than the radius, so I should create two arcs and then fill, but that would
require me 3 further commands from a python script that has to be as light
and fast as possible while drawing (I need 50-60fps refresh rate and try to
keep cpu usage low).
Thank you again,
Maurizio
2014-09-23 0:10 GMT+02:00 Bryce Harrington <bryce@osg.samsung.com>:
> Chris posted a patch to the bug tracker for this issue:
>
> https://bugs.freedesktop.org/show_bug.cgi?id=84115
>
> Bryce
>
> On Sun, Sep 21, 2014 at 01:34:23PM +0200, Tobias Hoffmann wrote:
> > Hi,
> >
> > I tried a few things, and expected the correct result to be this:
> > cr.arc(200, 200, 200, 0*(math.pi/180), -60*(math.pi/180))
> > cr.line_to(200,200)
> > cr.close_path()
> > cr.fill()
> >
> > but actually PostScript (ghostscript's interpretation of it) will
> > not draw a horizontal line at the beginning, either:
> > $ gs
> > GS> 200 setlinewidth
> > GS> 200 500 100 0 60 arcn stroke
> >
> > (Note: I've used arcn instead of arc and 60 instead of -60 because
> > the postscript coordinate system has its Y-axis going upwards,
> > unlike pygtk.)
> >
> > Also, when using LINE_CAP_SQUARE (and a smaller line-width), I can
> > see that cairo and ghostscript disagrees on the tangent-direction at
> > the endpoints of the arc...
> >
> > What cairo seems to do, is use different tangent directions for the
> > inner and the outer part of the stroked arc, but (AFAICS) *only at
> > the beginning* of the arc -- the end of it is always unaffected!
> > That seems strange to me.
> > But I'm not sure, which tangent is actually the 'correct' one.
> >
> > If you want a perfect horizontal line, you should not stroke the
> > arc, but fill it (see my first code snippet).
> >
> > Maybe someone with better knowledge of how cairo actually draws
> > (tesselates?) these arcs wants to explain the current behavior?
> >
> > Tobias
> >
> >
> >
> > On 20/09/14 02:04, Maurizio Berti wrote:
> > >Hello,
> > >I'm writing a cairo python script, which loads graphics and
> > >animations from a custom file to create "fancy" (and unuseful)
> > >graphics like those seen in videogames and scifi movies.
> > >I have a problem with arcs, though: I need to be able to draw them
> > >interactively, with user given coords, start/end and line width.
> > >When I try to draw arcs with a certain line width I have a strange
> > >behaviour: the beginning of the line is not straight as it should
> > >be, you can see an example of it here:
> > >http://jidesk.net/sypy/strangearc2.jpg
> > >
> > >Here is the code I used for this test:
> > >https://bpaste.net/show/e1f3b8d1f842
> > >
> > >I'm using cairo 1.12.16 from the official Gentoo portage (the
> > >problem still remains with the latest -r3 version in the portage),
> > >with pycairo 1.10.0-r4, also latest stable from the portage.
> > >
> > >CC'ing to bryce@osg.samsung.com <mailto:bryce@osg.samsung.com> who
> > >confirmed the issue on #cairo using cairo
> > >1.13.0~20140204-0ubuntu1, but was not present using cairo
> > >1.12.16-0ubuntu1.1~bryce~precise6, with little different results:
> > >http://jidesk.net/sypy/strangearc-bryce.png
> > >
> > >To draw single and simple "filled" arcs I could use lines and
> > >curves, but that would affect the performances of my script (and
> > >would require a lot of complex calculations), so I'm here to ask
> > >if someone can confirm that this is a bug indeed.
> > >
> > >Thanks,
> > >Maurizio
> > >
> > >--
> > >Č difficile avere una convinzione precisa quando si parla delle
> > >ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi
> > >http://www.jidesk.net
> > >
> > >
> >
>
--
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
[Attachment #5 (text/html)]
<div dir="ltr">Thank you all for your efforts, I hope I will able to try it as soon \
as possible, even if unfortunally on my system I can't afford to use cairo from \
git.<div>To answer to Tobias, I could draw lines and fill the arc, but that's not \
what I'd need, since I have to be able to use arcs with line width smaller than \
the radius, so I should create two arcs and then fill, but that would require me 3 \
further commands from a python script that has to be as light and fast as possible \
while drawing (I need 50-60fps refresh rate and try to keep cpu usage \
low).</div><div><br></div><div>Thank you again,</div><div>Maurizio</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">2014-09-23 0:10 GMT+02:00 Bryce \
Harrington <span dir="ltr"><<a href="mailto:bryce@osg.samsung.com" \
target="_blank">bryce@osg.samsung.com</a>></span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Chris posted a patch to the bug tracker for this issue:<br> \
<br> <a href="https://bugs.freedesktop.org/show_bug.cgi?id=84115" \
target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=84115</a><br> <br>
Bryce<br>
<div><div class="h5"><br>
On Sun, Sep 21, 2014 at 01:34:23PM +0200, Tobias Hoffmann wrote:<br>
> Hi,<br>
><br>
> I tried a few things, and expected the correct result to be this:<br>
> cr.arc(200, 200, 200, 0*(math.pi/180), -60*(math.pi/180))<br>
> cr.line_to(200,200)<br>
> cr.close_path()<br>
> cr.fill()<br>
><br>
> but actually PostScript (ghostscript's interpretation of it) will<br>
> not draw a horizontal line at the beginning, either:<br>
> $ gs<br>
> GS> 200 setlinewidth<br>
> GS> 200 500 100 0 60 arcn stroke<br>
><br>
> (Note: I've used arcn instead of arc and 60 instead of -60 because<br>
> the postscript coordinate system has its Y-axis going upwards,<br>
> unlike pygtk.)<br>
><br>
> Also, when using LINE_CAP_SQUARE (and a smaller line-width), I can<br>
> see that cairo and ghostscript disagrees on the tangent-direction at<br>
> the endpoints of the arc...<br>
><br>
> What cairo seems to do, is use different tangent directions for the<br>
> inner and the outer part of the stroked arc, but (AFAICS) *only at<br>
> the beginning* of the arc -- the end of it is always unaffected!<br>
> That seems strange to me.<br>
> But I'm not sure, which tangent is actually the 'correct' one.<br>
><br>
> If you want a perfect horizontal line, you should not stroke the<br>
> arc, but fill it (see my first code snippet).<br>
><br>
> Maybe someone with better knowledge of how cairo actually draws<br>
> (tesselates?) these arcs wants to explain the current behavior?<br>
><br>
> Tobias<br>
><br>
><br>
><br>
> On 20/09/14 02:04, Maurizio Berti wrote:<br>
> >Hello,<br>
> >I'm writing a cairo python script, which loads graphics and<br>
> >animations from a custom file to create "fancy" (and unuseful)<br>
> >graphics like those seen in videogames and scifi movies.<br>
> >I have a problem with arcs, though: I need to be able to draw them<br>
> >interactively, with user given coords, start/end and line width.<br>
> >When I try to draw arcs with a certain line width I have a strange<br>
> >behaviour: the beginning of the line is not straight as it should<br>
> >be, you can see an example of it here:<br>
> ><a href="http://jidesk.net/sypy/strangearc2.jpg" \
target="_blank">http://jidesk.net/sypy/strangearc2.jpg</a><br> > ><br>
> >Here is the code I used for this test:<br>
> ><a href="https://bpaste.net/show/e1f3b8d1f842" \
target="_blank">https://bpaste.net/show/e1f3b8d1f842</a><br> > ><br>
> >I'm using cairo 1.12.16 from the official Gentoo portage (the<br>
> >problem still remains with the latest -r3 version in the portage),<br>
> >with pycairo 1.10.0-r4, also latest stable from the portage.<br>
> ><br>
</div></div>> >CC'ing to <a \
href="mailto:bryce@osg.samsung.com">bryce@osg.samsung.com</a> <mailto:<a \
href="mailto:bryce@osg.samsung.com">bryce@osg.samsung.com</a>> who<br> <div \
class="HOEnZb"><div class="h5">> >confirmed the issue on #cairo using cairo<br> \
> >1.13.0~20140204-0ubuntu1, but was not present using cairo<br> > \
>1.12.16-0ubuntu1.1~bryce~precise6, with little different results:<br> > ><a \
href="http://jidesk.net/sypy/strangearc-bryce.png" \
target="_blank">http://jidesk.net/sypy/strangearc-bryce.png</a><br> > ><br>
> >To draw single and simple "filled" arcs I could use lines and<br>
> >curves, but that would affect the performances of my script (and<br>
> >would require a lot of complex calculations), so I'm here to ask<br>
> >if someone can confirm that this is a bug indeed.<br>
> ><br>
> >Thanks,<br>
> >Maurizio<br>
> ><br>
> >--<br>
> >Č difficile avere una convinzione precisa quando si parla delle<br>
> >ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br>
> ><a href="http://www.jidesk.net" \
target="_blank">http://www.jidesk.net</a><br> > ><br>
> ><br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>È difficile \
avere una convinzione precisa quando si parla delle ragioni del cuore. - \
"Sostiene Pereira", Antonio Tabucchi<br><a \
href="http://www.jidesk.net">http://www.jidesk.net</a> </div>
--
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic