[plt-scheme] Problems with draw-bitmap (?)

From: Katsmall the Wise (kela_bit at netvision.net.il)
Date: Mon Mar 3 16:42:42 EST 2003

I was told to use double-buffering so that animations won't flicker, so 
here's what I did:

I turned

(define/override (on-paint)
  (debug "on-paint: clearing screen\n")
  (send (get-dc) clear)
  (set! the-log (draw-on-dc (get-dc) the-log))
  (void))

Into

(define bmp (make-object bitmap% 10 10 #f))
(define bmp-dc (instantiate bitmap-dc% ()))
(send bmp-dc set-bitmap bmp)
(define/override (on-paint)
  (debug "on-paint: clearing screen\n")
  (send bmp-dc clear)
  (set! the-log (draw-on-dc bmp-dc the-log))
  (send (get-dc) draw-bitmap bmp 0 0)
  (void))

The first one worked, the second one doesn't.
the-log is a variable that says what to draw, draw-on-dc gets a dc, 
draws the-log into it, and returns the-log (sometimes changed - in case 
of an exception (bad log))

What is wrong with the change?

Katsmall the Wise
kela_bit at netvision.net.il



Posted on the users mailing list.