On Mon, Dec 27, 2010 at 7:13 AM, Stephen Bloch <sbl...@adelphi.edu> wrote: > I'm trying to port the picturing-programs teachpack to still work with 5.1. > (BTW, approximately how long do I have to do that before 5.1 is released?)
We have not started the release process yet, but the release is sometime in Jan. Generally releases are every 3 months. Ryan should know the precise dates. > Right now it crashes because the API for make-bitmap has changed -- for the > better, I think, but I still need to fix things. Which make-bitmap would that be? Are you talking about the internal, private constructor? > I've got a "map-image" function that creates a [bitmap] image the same width > and height as an existing image by mapping a color->color function on its > pixels, and a "build-image" function that creates a [bitmap] image of a > specified width and height by mapping a specified function on the coordinates > of its pixels. I also wrote (but didn't really document) a > "map-masked-image" and "build-masked-image" which do the same, but the mapped > function is also allowed to return #f, in which case the specified pixel is > made transparent (i.e. alpha=0). I can tweak those to work with the new > make-bitmap, but the process got me wondering... > > It would be nice if I could allow students to generate alphas other than 1 > and 0. It seems to me the cleanest way to do this is with an alpha-color > struct (which existed in htdp/image, but seems to be gone from 2htdp/image). > I can do that myself, putting in glue code between it and 2htdp/image to > convert back and forth among various color-like-things (color, alpha-color, > string, symbol, color%, and #f for transparency), but 2htdp/image is already > doing a lot of that, and it feels really inefficient to re-do it. > > What would you think of ALL "color" structs actually having an alpha > component, with the constructor allowing alpha to default to 1? I think you should be operating at the racket/draw bitmap level, not the 2htdp/image bitmap level. That is, use the render-image function to get a bitmap, and then make a loop that calls their function and fills in a bytes and then turn that bytes back into a bitmap. This will save creating a bunch of intermediate data and is a simpler function overall. Robby _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users