On Friday 26 October 2007 08:24, Sergey M Plis wrote: > I've added the following class to minos.fb (and recompiled) > > icon-pixmap class memory-pixmap > how: : assign ( data w h bits -- ) > > >r 2dup * r@ * -rot r> screen xrc dpy @ > > create-pixmap h ! w ! image ! ; > class; > > Now I run xbigforth and do the following: > > also minos > 100 100 4 * * allocate throw value data > data 100 100 4 memory-pixmap new Bus Error ! new > > Any ideas why that might be the case ?
create-pixmap wasn't well factored out, and actually took some more parameters. I've now refactored create-pixmap to take only ( data w h -- image w h ) and used that for memory-pixmap. Take care: The data is taken in RGB format (3 bytes per pixel), but the memory conversion is done in-place, so you need to allocate 4*w*h. data isn't disposed in create-pixmap any longer, so you can reuse that buffer for next time. This is still not very well factored out, and doesn't take RGBA pixmaps, for which I also have support (see read-png). -- Bernd Paysan "If you want it done right, you have to do it yourself" http://www.jwdt.com/~paysan/
pgpXwBBgN03tO.pgp
Description: PGP signature
