[plt-scheme] 2htdp/image Images in Slideshow

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Fri May 28 16:21:38 EDT 2010

This image->pict function doesn't seem to work with place-image when embedded in a slide. When I use it in the interactions pane, it does produce the expected pict, but when it renders the slide below, all I get is an empty scene....


#lang slideshow

(require (prefix-in im: 2htdp/image))
(require mrlib/image-core)

(define (image->pict img)
 (dc (λ (dc dx dy) (render-image img dc dx dy))
     (im:image-width img)
     (im:image-height img)))

(slide
 (image->pict (im:place-image
               (im:circle 10 "solid" "red") 50 50     
               (im:empty-scene 100 100))))






On May 25, 2010, at 4:59 PM, Robby Findler wrote:

> You can do this:
> 
> #lang scheme
> (require slideshow slideshow/code)
> 
> (require (prefix-in im: 2htdp/image)
>         mrlib/image-core)
> 
> (define (image->pict img)
>  (dc (λ (dc dx dy) (render-image img dc dx dy))
>      (im:image-width img)
>      (im:image-height img)))
> 
> (slide
> (hbl-append (code (rectangle 15 25 "solid" "blue"))
>             (t "=>")
>             (image->pict (im:rectangle 15 25 "solid" "blue"))))
> 
> I see that render-image isn't documented, tho. Apologies for that.
> 
> Robby
> 
> On Tue, May 25, 2010 at 2:45 PM, Nadeem Abdul Hamid <nadeem at acm.org> wrote:
>> 
>> How can one embed images generated using 2htdp/image into a slideshow? Is there an easy tweak to make something like this work:
>> 
>> (require (prefix-in im: 2htdp/image))
>> (slide
>>  (hbl-append (code (rectangle 15 25 "solid" "blue")) (t "=>")  (im:rectangle 15 25 "solid" "blue"))
>>  )
>> 
>> --- nadeem
>> 
>> 
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>> 



Posted on the users mailing list.