Double Buffering

A very primitive example of bitmap/image double buffering in tcl. With this model: More sprites & more updates == more cpu used.


 source bmpdata.dat

 proc do_frame {} {
    # Generate a random frame full of sprites.
    set sprites {}
    for {set i 0} {$i < 100} {incr i} {
       set dest_x [expr {int (rand()*620)}]
       set dest_x2 [expr {int ($dest_x + 28)}]
       set dest_y [expr {int (rand()*420)}]
       set dest_y2 [expr {int ($dest_y + 35)}]
       set sprite [expr {int (rand()* 2) == 0 ? $::sprite_1:$::sprite_2}]
       lappend sprites [list $sprite $dest_x $dest_y $dest_x2 $dest_y2]
    }

    # "blit" the sprites to the buffer.   
    foreach sprite_info $sprites {
       foreach {spr dest_x dest_y dest_x2 dest_y2} $sprite_info {}
       $::double_buffer copy $spr -to $dest_x $dest_y $dest_x2 $dest_y2
    }
 }

 proc do_update {} {
    # Clear the display area with the background image.
    # Use 'blank' if you do not have one. i.e. $::double_buffer blank
    $::double_buffer copy $::base_image -zoom 2 3
   
    # Get the frame update.
    do_frame
   
    # Push out the new frame.
    .l1 configure -image $::double_buffer
   
    # This controls our frame rate.
    after 35 {do_update}
 }

 # Load the background and the sprite images.
 set ::sprite_1 [image create photo -data $box_data]
 set ::sprite_2 [image create photo -data $hitchcock_data]
 set ::base_image [image create photo -height 640 -width 480 -data $map_data]
 set ::double_buffer [image create photo -height 640 -width 480]
 $::double_buffer copy $::base_image -zoom 2 3

 #Get the first frame full...
 do_frame

 label .l1 -height 680 -width 500 -image $double_buffer
 pack .l1

 # Start up the frame 'animator'
 after 35 {do_update}

Bitmap data file bmpdata.dat:

set box_data {R0lGODlhHAAjAPcAAAAAAAsLAQsLDAgHBBMNABQSAhsUABwaARUVDBQUExoa
Gg4PDyQbASgZATIdBSkmBDYpATc2BycnGTc2FS4wDx0dIigoJzY2Kjc4Ni8v
LR4hFEc3AVY5AEUvBE89ITxCJUdGCFlGAVhYCldXFUpKFGZJAGpVAXhYAHBO
BXloAHt3BWdnFnd3F2lpDUNDO0lIJ3FyJV1jGTw8Q0hIR1dX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iioLUYmsqSCcAdeRevKCiwjHDds75gKSK
hORhdmZOkm7heMeMquqms/Sislxssn7HjZyEPsDhI5AH+FKkJoZvoqQopvRq
MqRwImpsMYnEfNYOAUDjfMJnNUIFuYCByTbSN66QJspJpSzpJN3OAJ+sJV/F
AauyhbYmQtYrgn7FWNCPJ9UMAWTBPZqlzJzKFWURMsLLPeRRFjFwbZ5gXdKl
FeahrvChrqYhHjCBNqQjOVhl3ghEYSSgiBxif2TwVBzkOc6KIDIkObol0SzC
VAICADs=}

slebetman 28 April 2009: This is a VERY BAD implementation of drawing sprites onto a background. Image copying is very very slow (probably done with memcpy). Use the canvas instead. The following is an improved re-implementation in canvas which achives a much higher framerate using far fewer CPU time while managing to be flicker-free without resorting to double buffering:

  proc do_frame {} {
    set sprites {}
    for {set i 0} {$i < 100} {incr i} {
      set dest_x [expr {int (rand()*620)}]
      set dest_y [expr {int (rand()*420)}]
      set sprite [expr {int (rand()* 2) == 0 ? $::sprite_1:$::sprite_2}]
      lappend sprites [list $sprite $dest_x $dest_y]
    }

    .c delete sprites

    foreach sprite_info $sprites {
      foreach {spr dest_x dest_y} $sprite_info {}
      .c create image $dest_x $dest_y -image $spr -tags sprites
    }
  }

  proc do_update {} {
    # Get the frame update.
    do_frame

    # This controls our frame rate.
    after 35 {do_update}
  }

  # Load the background and the sprite images.
  set ::sprite_1 [image create photo -data $box_data]
  set ::sprite_2 [image create photo -data $hitchcock_data]
  set ::base_image [image create photo -height 640 -width 480 -data $map_data]
  set ::map_image [image create photo -height 640 -width 480]
  $::map_image copy $::base_image -zoom 2 3

  pack [canvas .c -height 680 -width 500]
  .c create image 0 0 -image $map_image -anchor nw

  #Get the first frame full...
  do_frame

  # Start up the frame 'animator'
  after 35 {do_update}

I think a bit of explanation is warranted as to why this implementation manage to smoothly update the canvas without us needing to do anything special (i.e. no double buffering). When you draw anything in Tk (canvas elements or plain widgets) what you draw is not immediately displayed on the screen. Instead Tk waits for the event loop before drawing stuff. This means that Tk is already implicitly double buffered (the stuff on the screen is not modified while drawing takes place).

JSB Very nice example. I did mine with a label to disconnect the process from the canvas widget, just to show some simple double buffer code.

ZB Of course, the example of sort: "how not to do it" is also very valuable; it shows, what one has to avoid. There is even a special cathegory for such examples here: Don't do that.

I was trying to suggest the simplest way out - I meant just using usual "canvas offerings", yes: "itemconfigure" and "move" (still using the same example):

  proc do_frame {} {
    set sprites {}  
    for {set i 0} {$i < 100} {incr i} {
      set dest_x [expr {int (rand()*620)}]
      set dest_y [expr {int (rand()*420)}]
      set sprite [expr {int (rand()* 2) == 0 ? $::sprite_1 : $::sprite_2}]
      lappend sprites [list $sprite $dest_x $dest_y]
    }

    set i -1
    set ::shapes [list]
    foreach sprite_info $sprites {
      foreach {spr dest_x dest_y} $sprite_info {}
      incr i
      .c create image $dest_x $dest_y -image $spr -tags sprite$i
      lappend ::shapes sprite$i
    }
  }  

  proc next_frame {} {
    foreach sprite $::shapes {
      set dest_x [expr {int (rand()*620)}]
      set dest_y [expr {int (rand()*420)}]
      set spriteImage [expr {int (rand()* 2) == 0 ? $::sprite_1 : $::sprite_2}]
      .c itemconfigure $sprite -image $spriteImage
      .c moveto $sprite $dest_x $dest_y
    }
  }  
     
  proc do_update {} {
    # Get the frame update.
    next_frame

    # This controls our frame rate.
    after 35 {do_update}
  }

 # Load the background and the sprite images.
  set ::sprite_1 [image create photo -data $box_data]
  set ::sprite_2 [image create photo -data $hitchcock_data]
  set ::base_image [image create photo -height 640 -width 480 -data $map_data]
  set ::map_image [image create photo -height 640 -width 480]
  $::map_image copy $::base_image -zoom 2 3

  pack [canvas .c -height 680 -width 500]
  .c create image 0 0 -image $map_image -anchor nw

  #Get the first frame full...
  do_frame

  # Start up the frame 'animator'
  after 35 {do_update}

...but, unfortunately, my suggestions to use obvious, "native" canvas commands, lost in confrontation with "double buffering". Nothing like advanced technology! :)

Not sure, which one is faster (didn't make any measurement) - slebetman's or mine - "optically" looks about the same, and both have similar CPU utilization.

slebetman: Where did you get that "moveto" subcommand in your canvas from? Is it a Tk8.6 thing? I did a delete-all-and-redraw because that was what the original code seem to be doing.

ZB Yes, I'm testing 8.6b1. So there's no "moveto" in 8.5.7? I'm a bit surprised - but it's possible.

slebetman: I'm using 8.5.3 and there's no "moveto" subcommand. But for this specific example, I think [.c coords $coords $dest_x $dest_y] is equivalent.

DKF: I can confirm that “moveto” is an 8.6 addition; I can also remember checking that code in. ;-)

Did you know that Tk canvases (along with virtually all other Tk widgets) are double-buffered internally anyway?

ZB As for me: I didn't. Just being aware, that copying graphics data using "pure TCL" won't be particularly fast, I've been voting for using "canvas buffering" (swapping images via "itemconfigure") rather - not realizing, that it's double buffering. :D