On Thursday 25 October 2007 04:05, Sergey Plis wrote:
> Hi,
>
> What it takes to implement a method in canvas class that would allow
> drawing from memory. Suppose I have a 2D array of RGB (or RGBA)
> values. I want to display this array on canvas object (I align their
> dimensions). Do I use mask method of display class? Do I have to go
> down to using X11 functions or I can get along with what's already
> implemented?

The create-pixmap word is your friend. It takes

( data size w h bits dpy -- pixmap w h )

You probably want to make a derived class of icon-pixmap which takes a 
memory array instead a file name to initialize, since canvas can easily 
draw an icon-pixmap object.

I'll try to implement this for you, as it seems to be fairly trivial, 
and indeed useful.

If you like to, you can also achieve this with the 3D turtle graphics 
object, since this has a create-mipmap3 and create-mipmap4 method which 
takes a RGB (3) or RGBA (4) array in memory and makes a texture from 
it. Then you can use that texture to draw a rectangle with it.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/

Attachment: pgp1yIeuzKQnG.pgp
Description: PGP signature

Reply via email to