Re: [Fxruby-users] Copying an Image with FXMemoryStream?
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <jl...@cf...> - 2004-01-02 21:03:08
|
Carsten Eckelmann wrote: > I just can't figure out how this FXMemoryStream works. I just want to > (deep) copy an image in memory: <snip> > What am I doing wrong? Based on the error message, there's probably a bug with the wrapping of FXMemoryStream, and I will need to take a look. In the meantime, if it's acceptable to use a temporary file you can just save the image out to disk and re-load it for the copy, i.e. # Save orig_img to a file on disk (tmpfile.jpg) FXFileStream.open("tmpfile.jpg", FXStreamSave) do |stream| fxsaveJPG(stream, orig_img.data.to_s, 0, orig_img.width, orig_img.height, orig_img.quality) end # Reload it and make a new FXJPGImage dest_img = nil File.open("tmpfile.jpg", "rb") do |file| dest_img = FXJPGImage.new(app, file.read, IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP) end Hope this helps, Lyle |