[fxruby-users] FXImage problems
Jeroen van der Zijp
jeroen at fox-toolkit.org
Wed Nov 3 09:36:52 EST 2004
On Wednesday 03 November 2004 09:37 am, Fredrik Jagenheim wrote:
> I don't understand how to combine ImageMagick and FXImage...
> The problem is that I don't get how I should tell the FXImage about my pixels...
> The docs says I should either provide a FXMemoryBuffer or a String.
> I've tried with all types of strings I think. Both binary (from pack)
> and seperated with spaces, commas, etc, but all I get is either a grey
> mass, or black with various colored pixels...
> FXMemoryBuffer can't be created it seems. FXMemoryBuffer.new just blows up?!??
> I guess I could save the image generated from ImageMagick and then use
> the 'standard' FXJpgImage class, but I rather not...
You could create an FXImage with the right dimensions, and then
set its pixel data:
After which FXImage assumes ownership of the pixel array [which must have
been allocated with FXMALLOC()]. If the pixel array is not to be owned
by FXImage, then, of course, you can just omit the IMAGE_OWNED flag.
The pixel array, incidentally, is just a rectangular array of colors.
Each color is RGBA, in that order, from low to high memory. The FXRGB
macros are adjusted based on the machine's byte order so if you use
these macros then the memory layout of your colors will be automatically
Hope this helps,
More information about the fxruby-users