Morphic pixel writing
Ned Konz
ned at bike-nomad.com
Wed Jul 2 14:05:04 UTC 2003
On Tuesday 01 July 2003 10:46 pm, Joel Shellman wrote:
> How would one draw an image in Squeak pixel by pixel
> (programmatically)? I saw that generally you would subclass Morph
> or MorphForm or something like that and then override the #drawOn
> method, but I couldn't find anything in Canvas that would allow me
> to write a specific pixel. It only had lines, rectangles, fills and
> such.
Well, a pixel is only a rectangle of extent 1, right?
You can also use a bitBlt operation to a Form, then paint/stencil that
form to the canvas in your drawOn:.
If you're doing a lot of pixels, consider keeping around your own
poker and color map (if they're going to be the same color,
especially)..
poker := BitBlt current bitPokerToForm: myForm.
pixelValue := self pixelValueFor: aColor.
then for many pixels...
poker pixelAt: aPoint put: pixelValue.
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|