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.
Asked
Active
Viewed 335 times
2 Answers
0
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
- 3,314
- 3
- 26
- 39
-
although pixbuf variant is also clumsy :( – Alfa07 Aug 21 '09 at 21:05