[plt-scheme] pickling a bitmap%
A couple of questions...
Given an image-snip% bound to _image-snip
(define _bitmap (send _image-snip get-bitmap))
; now try to 'release' the bitmap from the image-snip, so it can be
used by bitmap-dc
(send _image-snip set-bitmap (make-object bitmap% 1 1 #f) #f)
; but it doesn't work, and the next line gives an error
(define _bitmap-dc (new bitmap-dc% (bitmap _bitmap)))
(define _width (send _bitmap get-width))
(define _height (send _bitmap get-height))
; i don't know how to create a "mutable byte string", is the next line
correct?
(define _pixels (make-bytes (* 4 _width _height))) ; ???
(send _bitmap-dc get-argb-pixels 0 0 _width _height _pixels #f)
This all seems like spooky voodoo to me, very far removed conceptually
from what I'm trying to do. I'm tempted to just go with the temporary
disk file method, even if it is much slower. I'm checking to see if
there is a memory-based virtual disk utility available for Mac OS so I
can at least avoid having to do an actual physical disk write for the
temporary file. I wonder if there is a standard unix utility for
creating memory-based virtual volumes.
- dr
On Jun 1, 2006, at 2:58 PM, Matthew Flatt wrote:
> At Thu, 01 Jun 2006 14:11:53 -0400, David Richards wrote:
>> How do I access the raw byte data in a bitmap?
>
> Use the `get-argb-pixels' method of dc<%>.
>
> Matthew
>