OUTPUT BUFFER:
#!/usr/local/ActiveTcl/bin/wish package require Img set Wdt 600 set Hgt 300 set img1 [image create photo] $img1 blank set img2 [image create photo] $img2 blank set d 30 set f 80 set ok 1 while { $ok } { set d [expr {$d+100}] set f [expr {$d+50}] if {$f >= $Wdt} { set f [expr {$Wdt-1}] set ok 0 } lappend Lim [list $d $f] } set ColStock [list red green blue yellow magenta cyan black grey] proc faitimg1 {img1} { global ColStock global Wdt Hgt Lim for {set y 0} {$y < $Hgt} {incr y} { set h $y set b [expr {$y+1}] set c 0 foreach e $Lim { foreach {d f} $e {} set col [lindex $ColStock $c] $img1 put $col -to $d $h $f $b incr c } } return } proc faitimg2 {img2} { global ColStock global Wdt Hgt Lim for {set y 0} {$y < $Hgt} {incr y} { set Data "" set c 0 set xi 0 foreach e $Lim { foreach {d f} $e {} set col [lindex $ColStock $c] set rep [expr {$d-$xi}] append Data [string repeat " white" $rep] set rep [expr {$f-$d}] append Data [string repeat " $col" $rep] set xi $f incr c } set rep [expr {$Wdt-$f}] append Data " white" lappend LData [string trim $Data] } $img2 put $LData return } puts "[time {faitimg1 $img1} ]" puts "[time {faitimg2 $img2} ]" exit