[plt-scheme] converting htdp/images to/from color-lists and transparency
Use image->alpha-color-list.
Robby
On Monday, February 8, 2010, Stephen Bloch <sbloch at adelphi.edu> wrote:
> I was just testing my picturing-programs teachpack against 4.2.4, and noticed that when I rotate an image (using my rotate-cw function, which is defined on old-style images using color-lists) the transparency changes. Specifically, consider the following animation:
>
> ; place-on-pink : image -> image
> (check-expect (place-on-pink calendar)
> (place-image calendar 100 40 (rectangle 150 200 "solid" "pink")))
> (check-expect (place-on-pink (triangle 30 "solid" "blue"))
> (place-image (triangle 30 "solid" "blue") 100 40 (nw:rectangle 150 200 "solid" "pink")))
> (define (place-on-pink pic)
> (place-image pic 100 40 (nw:rectangle 150 200 "solid" "pink")))
>
> (big-bang calendar
> (on-draw place-on-pink)
> (on-tick rotate-cw 1/2))
>
> The calendar picture initially shows up on a white rectangle against the pink background, but after the first tick event, all the white in the image becomes the background pink. The same happens when the tick handler is reflect-horiz, but not when it's the identity function. So I hypothesize that it's a side effect of doing an image->color-list and color-list->image. Is there an easy explanation, or even better, an easy fix?
>
>
> Stephen Bloch
> sbloch at adelphi.edu
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>