P
Pawel Szymczykowski
------=_Part_145_16722959.1129705722483
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi,
I'm trying to combine FXRuby with RMagick. I've searched the mail archives
(I had to index them myself! Is there an easy to use official search page
somewhere?) and apparently it's been done before, but I can't seem to get i=
t
to work.
Basically I'm processing my image and then doing an export_pixels and tryin=
g
to convert it to the FXImage format. It works the first time, but when I tr=
y
to do it again it crashes on my saying 'invalid image' in Linux, or
something useless about abnormal termination in Windows.
This is the piece of code that seems to be giving me the specific trouble:
pixels =3D []
@current_image.export_pixels(0, 0, @current_image.columns,
@current_image.rows,
"RGBA").each_slice(4) { |rgba| pixels << FXRGBA( *rgba ) }
an_image =3D FXImage.new(app, pixels, IMAGE_OWNED|IMAGE_KEEP,
@current_image.columns, @current_image.rows )
That works the first time - I get a nice picture as expected when drawn to
the canvas. The next time it happens via a timeout, I get the crash.
Actually, it's more like it works fine if I do it before calling
app.create(or maybe run?), but not afterwards.
I've also tried the following as mentioned in one of the messages in the
archives, but it complains that it's looking for an Array (buffer is
FXMemoryBuffer class of course):
buffer =3D FXMemoryBuffer.new( pixels )
an_image =3D FXImage.new(app, buffer, IMAGE_OWNED|IMAGE_KEEP,
@current_image.columns, @current_image.rows )
I've tried several different combinations of the flags, and putting
an_image.create in various places. The former didn't help at all, but in th=
e
latter I just got a black image.
Am I doing something idiotic somewhere? I'm kind of new to ruby and GUI
development in general being more of web app guy. I can post a runnable
version of the code up somewhere if the problem isn't completely obvious an=
d
of course if someone is feeling charitable enough to take a look at it.
Thanks for your help!
-Pawel
------=_Part_145_16722959.1129705722483--
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi,
I'm trying to combine FXRuby with RMagick. I've searched the mail archives
(I had to index them myself! Is there an easy to use official search page
somewhere?) and apparently it's been done before, but I can't seem to get i=
t
to work.
Basically I'm processing my image and then doing an export_pixels and tryin=
g
to convert it to the FXImage format. It works the first time, but when I tr=
y
to do it again it crashes on my saying 'invalid image' in Linux, or
something useless about abnormal termination in Windows.
This is the piece of code that seems to be giving me the specific trouble:
pixels =3D []
@current_image.export_pixels(0, 0, @current_image.columns,
@current_image.rows,
"RGBA").each_slice(4) { |rgba| pixels << FXRGBA( *rgba ) }
an_image =3D FXImage.new(app, pixels, IMAGE_OWNED|IMAGE_KEEP,
@current_image.columns, @current_image.rows )
That works the first time - I get a nice picture as expected when drawn to
the canvas. The next time it happens via a timeout, I get the crash.
Actually, it's more like it works fine if I do it before calling
app.create(or maybe run?), but not afterwards.
I've also tried the following as mentioned in one of the messages in the
archives, but it complains that it's looking for an Array (buffer is
FXMemoryBuffer class of course):
buffer =3D FXMemoryBuffer.new( pixels )
an_image =3D FXImage.new(app, buffer, IMAGE_OWNED|IMAGE_KEEP,
@current_image.columns, @current_image.rows )
I've tried several different combinations of the flags, and putting
an_image.create in various places. The former didn't help at all, but in th=
e
latter I just got a black image.
Am I doing something idiotic somewhere? I'm kind of new to ruby and GUI
development in general being more of web app guy. I can post a runnable
version of the code up somewhere if the problem isn't completely obvious an=
d
of course if someone is feeling charitable enough to take a look at it.
Thanks for your help!
-Pawel
------=_Part_145_16722959.1129705722483--