[fxruby-users] FXImage problems

Fredrik Jagenheim jagenheim at gmail.com
Wed Nov 3 12:03:33 EST 2004


On Wed, 3 Nov 2004 09:36:52 -0500, Jeroen van der Zijp
<jeroen at fox-toolkit.org> wrote:
> On Wednesday 03 November 2004 09:37 am, Fredrik Jagenheim wrote:
> 
> 
> > I don't understand how to combine ImageMagick and FXImage...
> >
>
> You could create an FXImage with the right dimensions, and then
> set its pixel data:
> 
>         image=new FXImage(app,pixels,IMAGE_OWNED|IMAGE_KEEP,width,height);

I'm using fxruby, so it looks like this for me:

# This should create a either very dark magenta or very bright
magenta, depending on internal bitcolors:
buf = []
100.times {
  100.times {
     buf << 255
     buf << 0
     buf << 255
   }
}

transformed_buf = buf.join(" ")     # Doesn't work
# transformed_buf = buf.pack("i")   # Doesn't work either

image = FXImage.new(getApp(), transformed_buf, 0, 100, 100)

imageView = FXImageView.new(self, nil, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
imageView.image = image


All I get is a small, scrollable window in very dark grey.

> The pixel array, incidentally, is just a rectangular array of colors.

Documentation for FXRuby says it should be FXMemoryBuffer or String. :(

FXMemoryBuffer doesn't work though:
fx_image_test.rb:20:in `new': allocator undefined for
Fox::FXMemoryBuffer (NoMethodError)

And I can't figure out how to transform my Array to a proper String...

> Hope this helps,

Sadly not, I'm using the Ruby interface...

But that's not your fault. :)

I don't know how/why my message ended up on the foxgui-users mailing
list, though...

//F


More information about the fxruby-users mailing list