[Pharo-users] Display MozCanvas on screen?

Tudor Girba tudor at tudorgirba.com
Tue Feb 26 02:35:04 EST 2019


Hi,

Look for the examples that are shipped with GT/Brick/Bloc/Sparta.

The simplest  way you play with the canvas is through the inspector.

For example, paste this code in a Playground:

canvas := BlSpartaMozCanvasBuilder extent: 600 at 400.
canvas fill
	paint: Color white;
	path: canvas bounds;
	draw.
path := canvas path
	moveTo: 150 at 50;
	lineTo: 250 at 250;
	curveVia: 150 at 300 to: 50 at 250;
	close;
	finish.
canvas stroke
	paint: Color red;
	path: path;
	strokeOptions: (canvas strokeOptions
		width: 5);
	draw.
canvas

Then inspect the result (Cmd+g), and choose the Preview view from the inspector.

Here is how it looks like in the new GT Playground:



Cheers,
Doru


> On Feb 25, 2019, at 11:09 PM, David Richards <david.i.richards.iii at gmail.com> wrote:
> 
> 
> 	| canvas |
> 	
> 	. canvas := BlSpartaMozCanvasBuilder extent: 600 at 400
> 
> How do I display this MosCanvas on screen?
> 
> Does anyone know where I can get documentation on how to do graphics in Pharo? The comments in the code are not understandable to a beginner.

--
www.feenk.com

"We cannot reach the flow of things unless we let go."





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190226/f46488a4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2019-02-26 at 8.12.57 AM.png
Type: image/png
Size: 199394 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190226/f46488a4/attachment-0001.png>


More information about the Pharo-users mailing list