On 29.04.2010, at 15:58, Lawson English wrote:
Bert Freudenberg wrote:
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.
drawOn: aCanvas super drawOn: aCanvas. aCanvas form colorAt: "self topLeft +"(30@30) put: Color black.
Does NOT draw the dot at the upper left corner of the squeak window, but when I drag the morph around, the dot is offset as I would expect. When I release the mouse, the dot disappears.
However:
drawOn: aCanvas super drawOn: aCanvas. aCanvas form colorAt: self topLeft +(30@30) put: Color black.
Draws the dot where I expected though it doesn't draw it during the mouse down.
Please read again what I wrote: "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."
Also, why would the From>>colorAt:put: be slower than the Canvas drawing methods which are a good bit more indirect?
I did not compare it to canvas. Please, try to assume I meant it just as written ;)
- Bert -