[plt-scheme] 2htdp/image questions

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Apr 22 10:54:02 EDT 2010

> ;; I used a 1200x900 cut-n-paste of a digicam photo via MS Paint
> (define HI-RES {text "Insert large bitmap here" 20 "black"})

Yes, a 1200 x 900 photo will impose a heavy burden on the universe  
drawing as implemented. We have played with tricks to do the rendering  
right and we are okay with say 800 by 800, but barely. If in addition  
your tick handler demands a lot of work, we're out of luck.

Matthew and I have discussed an alternative semantics (what a tick  
means isn't all that obvious) and I intend to implement it over the  
summer. I doubt, however, that the result will cope with your images.  
Even if, I can imagine that someone with a 30in monitor (I just got  
one) will use an even larger image as background.

To accommodate this world properly, I have considered a slightly  
different API where the result of a render function can be the  
addition to an existing background. I may implement this in addition  
to the above changes.

;; ---

All in all, Universe is a relatively simplistic functional library for  
teaching and is intended for simple, small animations. If you are  
using this in a teaching context, please try to use modest images and  
backgrounds (400 x 400, 600 x 800 should be okay). I think students  
can still have fun with these modest sizes. We just had a game design  
contest for our freshman semester (trailer) and kids wrote fantastic,  
multi level games -- and they were well-designed.

Thanks -- Matthias

On Apr 22, 2010, at 10:39 AM, <engineer at alum.mit.edu> wrote:

> Attached is an example that shows some poor performance.
> The animation has four ways to render the background:
> 1. Use a blank rectangle
> 2. Use place-image to create a complex image which is recreated from  
> scratch
> each time render is called
> 3. Create an image like in #2 but store it as a constant before the
> animation starts.  Render then references this constant as the  
> background
> scene for the animation each time.
> 4. Use a constant hi-res photo as the background.
> I found that #1 and #4 run okay, but #2 and #3 show choppy animation  
> of the
> foreground.
> I pulled my hi-res photo out of the code to make the file more  
> attachment
> friendly.
> Thanks,
> Paul
> Paul R. Ojanen
> Math/Physics/Computer Science Instructor
> Technology Director
> The Academy at King
> 5825 Old Jonesboro Rd
> Bristol, TN 37620
>> -----Original Message-----
>> From: plt-scheme-bounces at list.cs.brown.edu [mailto:plt-scheme-
>> bounces at list.cs.brown.edu] On Behalf Of Robby Findler
>> Sent: Thursday, April 22, 2010 8:28 AM
>> To: Noel Welsh
>> Cc: plt-scheme at list.cs.brown.edu
>> Subject: Re: [plt-scheme] 2htdp/image questions
>>> On Wed, Apr 21, 2010 at 3:33 AM, Stephen Bloch <sbloch at adelphi.edu>
>> wrote:
>>>> But why do I (or my students) have to go through a feature-request
>> process
>>>> to get additional operations, rather than having an easy way to  
>>>> write
>> them
>>>> ourselves?
>> One possible answer: you don't. Make a copy of the 2htdp/image and go
>> wild. Put it on planet if you think I'm so unresponsive that I won't
>> even accept patches.
>> One possible other answer: asking for an easy way to add features to
>> library is in fact a feature. :)
>> That said, I do plan to do more with 2htdp/image. I just don't expect
>> I'll have time for a few months. I welcome your experimentation in
>> that time; lots of the work is figuring out exactly what to do, often
>> that's easier than doing it, once the "what" is settled.
>> As for a recent comment here, I don't think that we want to add a
>> "rasterize" or "make this be a bitmap" operation to 2htdp/image since
>> that brings in a performance model to teach to the students, at least
>> without exploring other alternatives. I have not had a chance to look
>> into the specific performance problem that was mentioned here  
>> earlier,
>> but but I would hope that there is a better solution than making the
>> students do extra work.
>> Speaking of which, if someone has a badly performing program, please
>> do share it so I can investigate more effectively.
>> Thanks,
>> Robby
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> <animation  
> slowdown.ss>_________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.