[plt-scheme] Yet another question. And this time: animations

From: Robert Bruce Findler (robby at cs.uchicago.edu)
Date: Mon Mar 3 08:40:31 EST 2003

That appears to be a bug. You can work around it like this:

(define bmp (make-object bitmap% 10 10 #f))
(define bmp-dc (instantiate bitmap-dc% ()))
(send bmp-dc set-bitmap bmp)

You may want to consider making a smaller bitmap and only making it big
when the window resizes.

Robby

At Mon, 03 Mar 2003 14:34:21 +0200, Katsmall the Wise wrote:
> The error is "instantiate: unused initialization arguments: (bitmap 
> #<struct:bitmap%>) for instantiated class: bitmap-dc%"
> Sorry for the double mail...
> 
> I wrote:
> 
> > I actually used on-paint, not refresh, but I had to clear the canvas 
> > before redrawing - otherwise it would leave a trail behind...
> > What's wrong with calling on-paint from other threads though? That's 
> > what I did...
> > Anyway, I have a new problem with double buffering:
> > (define bmp (make-object bitmap% 10000 10000 #f))
> > (define bmp-dc (instantiate bitmap-dc% () (bitmap bmp)))
> > --> Unused instantiation variable error (or something like that, don't 
> > remember ran it from a computer at the uni this morning...)
> > Why is that?
> >
> > Katsmall the Wise
> > kela_bit at netvision.net.il
> >
> > Matthew Flatt wrote:
> >
> >> I think another problem is that `refresh' clears the canvas before it
> >> calls `on-paint'. I'll will add a flag in the near future to disable
> >> the clear.
> >>
> >> Meanwhile, you can call `on-paint' directly if you're running in the
> >> handler thread.
> >>
> >> Matthew
> >>
> >> At Sun, 2 Mar 2003 16:36:59 -0600, Robert Bruce Findler wrote:
> >>  
> >>
> >>> You can use offscreen bitmaps. Put the next frame of the animation into
> >>> a bitmap and then just draw that into the canvas.
> >>>
> >>> Robby
> >>>
> >>> At Mon, 03 Mar 2003 00:08:51 +0200, Katsmall the Wise wrote:
> >>>   
> >>>
> >>>>  For list-related administrative tasks:
> >>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >>>>
> >>>> Hello again,
> >>>>
> >>>> Now that I have normal drawings settled, what about some 
> >>>> animations? Are they possible?
> >>>> I tried making moving parts via boxes which are set every 0.1 secs 
> >>>> and then refresh the canvas, yet (quite logically) the screen 
> >>>> blinks like that...
> >>>> Is there a built-in way to make animations?
> >>>>
> >>>> Katsmall the Wise
> >>>> kela_bit at netvision.net.il
> >>>>
> 
> 
> 



Posted on the users mailing list.