[fxruby-users] FXImage + RMagick problems

Pawel Szymczykowski makenai at gmail.com
Wed Oct 19 19:08:29 EDT 2005

> From this, you can surmise that it is indeed possible to change the pixmap
> kept in the X11 Server later on:- just call render() again. Of course,
> IMAGE_KEEP is needed to ensure that the client-side pixel data is still
> around as well.

Hi Jeroen,

Thanks for the response! It looks like I was confusing the issue a bit in my
original testing by switching from an FXImageView to an FXCanvas which I
don't really understand that well especially when drawing contexts come into
place. When I went back to the FXImageView, just calling .create on the
image before returning it seemed to fix my problem, however I'm not sure
what I'm doing (reassigning @imageview.image = [a new image object] every
second) is the most efficient way. I tried manipulating the pixel buffer
directly as you suggest - would I have to do it with setpixel? I guess I
can't access the .data attribute writer directly.

Is there a better way I can update an imported image periodically? I'm
working on a sort of primitive motion detector for a video stream with
visual feedback - Ideally I'd like to be able to get something like 5 to 15
frames per second, but the way I'm doing it right now might be a bit too
slow for that.

I'm assuming you're talking about FXMemoryStream? Anyway, FXStream is useful
> as it allows e.g. FXBMPImage to extract a BMP-type image from a sequence
> of
> bytes. This uses the bmpimage->loadPixels() API. More typically this is
> used in conjunction with FXFileStream (in C++):

Actually, I guess I was thinking about FXMemoryBuffer as referenced in the
docs for the pixel buffer of FXImage:

data [R] Pixel data

But I turned out to be confusing it with the array of FXColor pixels values
passed to FXImage.new. Basically I've been very confused about the way the
whole thing works

Hope this helps,

It has indeed - I wasn't clear on what FXImage.create was actually doing
before, so I overlooked my larger overall problem with the Canvas object.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20051019/46ad6e80/attachment.htm

More information about the fxruby-users mailing list