[Pharo-dev] How to draw an ellipse with Athens?

Alexandre Bergel alexandre.bergel at me.com
Mon Nov 18 08:00:12 EST 2013


Ah yes, I am having a look at it...

Alexandre


On Nov 17, 2013, at 8:49 PM, milton mamani <akevalion at gmail.com> wrote:

> Hi Alex!
> 
> I made a simple code in sunburst:
> 
> .=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
> | node view|
> view := ROView new.
> node := ROElement on:'Hello world'.
> node + ROLabel.
> 
> node addShape: ((ROArc startAngle: 0 endAngle: 360) fillColor: Color lightGray); @RODraggable.
> view add: node.
> node translateBy: 100 @ 100.
> view open.
> .=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
> 
> <image.png>
> 
> Cheers,
> Milton
> 
> 2013/11/17 Alexandre Bergel <alexandre.bergel at me.com>
> Hi!
> 
> In Roassal, I have the following to draw an ellipse:
> 
> -=-=-=-=-=-=-=-=-=-=
> fillOval: aRectangle color: aColor borderWidth: aBorderWidth borderColor: aBorderColor
> 
> 	|p rect stroke |
> 	
> 	rect := self virtualToRealRectangle: aRectangle.
> 
> 	nativeCanvas pathTransform restoreAfter: [
> 		p:= nativeCanvas createPath: [:path | 
> 				|halfPi |
> 				halfPi := Float pi /2.
> 				path 
> 					absolute;
> 					moveTo: rect topCenter;
> 					cwArcTo: rect rightCenter angle: halfPi;
> 					cwArcTo: rect bottomCenter angle: halfPi;
> 					cwArcTo: rect leftCenter angle: halfPi;
> 					cwArcTo: rect topCenter angle: halfPi].
> 		nativeCanvas setShape: p.
> 		nativeCanvas setPaint: aColor.
> 		nativeCanvas draw.
> 		stroke := nativeCanvas setStrokePaint: aBorderColor.
> 		stroke width: aBorderWidth.
> 		nativeCanvas draw
> 		]
> -=-=-=-=-=-=-=-=-=-=
> I feel this is not quite right.
> 
> It produces something like:
> <Screen Shot 2013-11-17 at 12.46.15 PM.png>
> 
> With the following Roassal script:
> 
> -=-=-=-=-=-=-=-=-=-=
> | view el |
> view := ROView new.
> el := ROElement on: 'hello world'.
> el + ROLabel + ROEllipse.
> el @ RODraggable.
> view add: el.
> view open
> -=-=-=-=-=-=-=-=-=-=
> 
> 
> It is has if the halfPi variable does not have the right value. 
> I have found example on the web (e.g., https://developer.gnome.org/gtkmm-tutorial/3.2/sec-cairo-drawing-arcs.html.en)
> However I was not able to map them in Athens.
> 
> Help appreciated. This is a bug in Roassal that has been there for too long :-)
> 
> Cheers,
> Alexandre
> 
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> 
> 
> 
> 

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.







More information about the Pharo-dev mailing list