El 11-04-2014, a las 20:56, Igor Stasenko <siguc...@gmail.com> escribió:




On 12 April 2014 01:37, Juraj Kubelka <juraj.kube...@gmail.com> wrote:
Thank you Igor,

I suspect there is no better solution. But anyway I am surprised, every simple drawing application manages ellipses. 

 
Athens is not an application, it is framework.
And why you think that every framework supports drawing ellipses as a basic command/primitive..for instance? I know of at least one, which doesn't - try drawing it with OpenGL.
;)

There is an example where it looks as I expect. The strike has the same width along the entire length. 
It is Cairo. So I think it is possible. I have tried to write equivalent code for ellipse in Smalltalk, but I have not succeeded. 

Image from the page:

My image:
Thanks for any help,
Juraj


 
Thank you anyway. 
Juraj

El 11-04-2014, a las 17:35, Igor Stasenko <siguc...@gmail.com> escribió:

yes, you using stroke for 2nd ellipse,
but stroke width is also subject of scaling, that's why it has different width, because
of non-uniform scaling (x/y).
instead you can first, draw a filled ellipse (blue) and then draw green one over it. 


On 11 April 2014 21:33, Juraj Kubelka <juraj.kube...@gmail.com> wrote:
Hi Igor, hi all!

I am not sure how to properly draw ellipse. Right now I draw a path like this:

The path is created that way:
-=-=-=-=-
computePath
path := self athensCanvas
createPath: [ :builder | 
builder
absolute;
moveTo: 0 @ 0.5;
ccwArcTo: 0.5 @ 0.0 angle: 90 degreesToRadians;
ccwArcTo: 0.0 @ -0.5 angle: 90 degreesToRadians;
ccwArcTo: -0.5 @ 0.0 angle: 90 degreesToRadians;
ccwArcTo: 0 @ 0.5 angle: 90 degreesToRadians ]
-=-=-=-=-

And draw it like this:
-=-=-=-=-
drawOn: athensCanvas
athensCanvas pathTransform
restoreAfter: [ 
athensCanvas pathTransform
scaleBy: rectangle extent asFloatPoint
athensCanvas 
setPaint: color;
drawShape: self path.
  (athensCanvas setStrokePaint: strokePaint) 
width: (self strokeWidth / self scale) asFloat. 
athensCanvas drawShape: self path ]
-=-=-=-=-

But with a different shapes, the border does not have same width all around the ellipse. See the image:

<Captura de pantalla 2014-04-11 a la(s) 16.29.13.png>

Is there better way to draw it?
Thank you,
Jura



-- 
Best regards,
Igor Stasenko.




-- 
Best regards,
Igor Stasenko.

Reply via email to