[racket] images from tcp

From: Danny Yoo (dyoo at hashcollision.org)
Date: Tue Apr 16 02:56:05 EDT 2013

On Tue, Apr 16, 2013 at 12:32 AM, deepak verma
<deepakverma14021994 at gmail.com> wrote:
> how will i extract the image from tcp-connect ?
>
> actually i was talking about  objects of image-snip class

[Aside: Please use your email client's "Reply to All" feature.]


Ok, good, that's much more specific.

Have you read the documentation on image snips?

    http://docs.racket-lang.org/gui/image-snip_.html

An image snip has a get-bitmap method that returns a bitmap% instance:

    http://docs.racket-lang.org/gui/image-snip_.html#%28meth._%28%28%28lib._racket%2Fsnip..rkt%29._image-snip~25%29._get-bitmap%29%29

after which the results of the previous email apply: use a bitmap's
save-file method to serialize to an output port.


To restore a bitmap from the input port, use the second version of the
bitmap%'s constructor (the second one out of the three):

    http://docs.racket-lang.org/draw/bitmap_.html#(constructor._((lib._racket/draw..rkt)._bitmap~25))

The second version of the bitmap% constructor consumes an input port.

Posted on the users mailing list.