[plt-scheme] playing with image internals
FWIW, this is exactly as intended. You mutated the thing that was
being drawn. So of course it changed.
Robby
On Tue, Apr 20, 2010 at 11:27 AM, Stephen Bloch <sbloch at adelphi.edu> wrote:
> Start with
>
> (require mrlib/image-core)
> (require 2htdp/private/image-more)
> (require 2htdp/private/img-err)
> (require scheme/gui)
>
> (define tri (triangle 30 "solid" "orange"))
> (define w (image-width tri))
> (define h (image-height tri))
> (define bm (make-object bitmap% w h))
> (define bmdc (make-object bitmap-dc% bm))
>
> Now, in Interactions, type
> (render-image (rectangle w h "solid" "purple") bmdc 0 0)
> (to-img bm)
> and it shows a purple rectangle, as I would expect.
>
> Next, in Interactions, type
> (render-image tri bmdc 0 0)
> (to-img bm)
> and not only does it show an orange triangle on a purple background, but the PREVIOUS output in the Interactions pane (which was a purple rectangle) retroactively becomes an orange triangle on a purple background. to-image mutates [the record of] the past!
>
> It's not really a bug, as this is all internal stuff that one wouldn't normally be using in Interactions, but it's weird and amusing.
>
>
>
> Stephen Bloch
> sbloch at adelphi.edu
>
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>