Is it possible to make a copy of Gdk.image object using lablgtk2 for Ocaml? I tried to find 'copy' or 'clone' methods but failed.
A:
Here is my clumsy workaround:
let copy_image image =
let w, h = Image.width image, Image.height image in
let copy = Image.create ~kind: `FASTEST ~visual: (Image.get_visual image)
~width: w
~height: h in
for x = 0 to w-1 do
for y = 0 to h-1 do
Image.put_pixel copy ~x:x ~y:y (Image.get_pixel image ~x:x ~y:y)
done
done;
copy
Alfa07
2009-08-21 21:01:52
although pixbuf variant is also clumsy :(
Alfa07
2009-08-21 21:05:30