[squeak-dev] ENC: How to draw a 2D line
squeaklist at gmail.com
Mon Jun 26 19:28:30 UTC 2017
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 at student.hpi.de>
> 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:
> 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 at 200 depth: 32.
> canvas := FormCanvas on: form.
> canvas line: 0 at 0 to: 200 at 200 color: Color red.
> canvas line: 200 at 0 to: 0 at 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,
> 2017-06-23 22:43 GMT+02:00 Lorenzo Berendsen <lorenzoberendsen at 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
> > Regards,
> > Lorenzo.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev