How to make a copy of an existing image instance

View: New views
1 Messages — Rating Filter:   Alert me  

How to make a copy of an existing image instance

by Stevenson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe someone know the answer. How to make an exact copy of a previously instanced FXImage object?
I need that because image manipulation like crop or scale methods affect the current object. I have tried to use clone or dup method to create an exact copy of image but when I tried to use cloned object I recieve :

c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.14-mswin32/lib/fox16/aliases.rb:1118:in `getWidth': This FXDrawable * already released (RuntimeError)

Here is some code:
dataBuffer = File.open("someFile.jpg","rb").read
img = FXJPGImage.new(getApp(), dataBuffer, IMAGE_OWNED|IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)
clonedImage = img.clone
puts clonedImage.width

I need some idea to make multiple copies of a current image. Thanks