[plt-scheme] duplicate of a bitmap
What is the simplest way to make a duplicate of a bitmap?
Currently I do something like this (which seems overly complicated):
(let* ((_bitmap-dc (new bitmap-dc% (bitmap _bitmap)))
(_width (send _bitmap get-width))
(_height (send _bitmap get-height))
(_pixels (make-bytes (* 4 _width _height)))
(_copy (make-object bitmap% _width _height #f)))
(send _bitmap-dc get-argb-pixels 0 0 _width _height _pixels
#f)
(send _bitmap-dc set-bitmap _copy)
(send _bitmap-dc set-argb-pixels 0 0 _width _height _pixels
#f)
(send _bitmap-dc set-bitmap #f) ; 'release' the bitmap
_copy)
- dr