Hi Lorenzo,
Are you familiar with browsing existing code in Squeak already? If not, I advise you have a look at the Squeak by Example book: https://hal.inria.fr/inria-00441576/file/SBE.pdf It also contains a chapter on drawing your own morphs.
Otherwise you probably want to have a look at the classes Canvas and Form. A Form contains pixels and a Canvas can be used to draw things like points, lines, and other images to a graphical medium. A FormCanvas (a subclass of Canvas) can be used to draw on a Form. To display a Form in the world you can use an ImageMorph.
The following creates a 32-Bit Form of 200x200 pixels, draws two lines on it and attaches the image to the mouse cursor (hand).
form := Form extent: 200@200 depth: 32. canvas := FormCanvas on: form. canvas line: 0@0 to: 200@200 color: Color red. canvas line: 200@0 to: 0@200 color: Color blue. morph := ImageMorph new. morph image: form. morph openInHand.
You can then draw further stuff with the canvas and the morph will be updated accordingly.
Does this help you?
Best regards, Jakob
2017-06-23 22:43 GMT+02:00 Lorenzo Berendsen lorenzoberendsen@hotmail.com:
Hi All,
I am trying to draw a simples 2D Line in months.
I can’t understand what to do.
Could someone help me with this?
I have C, Pascal, VBA background, but none of these knowledge is helping me…
Regards,
Lorenzo.
is there a way to draw lines over top of all the open windows? like a line from inside of one window to inside of another window? like arrows from a help window to graphical elements in some other windows?
On Sat, Jun 24, 2017 at 06:00 Jakob Reschke jakob.reschke@student.hpi.de wrote:
Hi Lorenzo,
Are you familiar with browsing existing code in Squeak already? If not, I advise you have a look at the Squeak by Example book: https://hal.inria.fr/inria-00441576/file/SBE.pdf It also contains a chapter on drawing your own morphs.
Otherwise you probably want to have a look at the classes Canvas and Form. A Form contains pixels and a Canvas can be used to draw things like points, lines, and other images to a graphical medium. A FormCanvas (a subclass of Canvas) can be used to draw on a Form. To display a Form in the world you can use an ImageMorph.
The following creates a 32-Bit Form of 200x200 pixels, draws two lines on it and attaches the image to the mouse cursor (hand).
form := Form extent: 200@200 depth: 32. canvas := FormCanvas on: form. canvas line: 0@0 to: 200@200 color: Color red. canvas line: 200@0 to: 0@200 color: Color blue. morph := ImageMorph new. morph image: form. morph openInHand.
You can then draw further stuff with the canvas and the morph will be updated accordingly.
Does this help you?
Best regards, Jakob
2017-06-23 22:43 GMT+02:00 Lorenzo Berendsen <lorenzoberendsen@hotmail.com
: Hi All,
I am trying to draw a simples 2D Line in months.
I can’t understand what to do.
Could someone help me with this?
I have C, Pascal, VBA background, but none of these knowledge is helping
me…
Regards,
Lorenzo.
squeak-dev@lists.squeakfoundation.org