[Newbies] How to draw a single pixel with permanence?

Bert Freudenberg bert at freudenbergs.de
Thu Apr 29 13:44:40 UTC 2010


On 29.04.2010, at 15:31, Lawson English wrote:
> 
> My  point is, how do I "paint it" into a form

colorAt:put: is okay for that (though slow).

> and then display it?

See the Canvas protocol "drawing-images".

> my question concerns getting what I've poked into the form to stay on the screen after I've released the mouse.

Whenever #drawOn: is called, you need to draw it again.

> Obviously I'm not caching the results as I thought I was.

No, your just not drawing where you think you are. Again: you should not draw into the Canvas's form directly. Use the canvas protocol.  

What's happening is that when you drag the morph in the hand, the canvas has a different transform than when it is resting in the world. Drawing directly into the canvas's form will ignore this transform. So it works sometimes but not always.

- Bert -




More information about the Beginners mailing list