A Tuning Dial

A round dial with an offcenter depression for turning/tuning. Either press B1 on the depression, move it in circles. Or press B1 anywhere on the dial and "flip" it left or right by leaving the dial and then releasing B1. The dial will keep turning and lose momentum over time. Moving the mouse pointer towards the dial center will increase dampening. On either upper or lower limit the dial will rebound.

With the tcl Shape extension installed this dial can be used as a free floating shaped widget.

# file dial.tcl

source dial_utils.tcl
source elabel.tcl
source dial_bindings.conf

interp alias {} run {} if 1


package require BLT
namespace import ::blt::*
proc setmm {var val min max} {
        if { $val < $min } {
                uplevel set $var $min
                return -1
        } elseif { $val > $max } {
                uplevel set $var $max
                return +1
        }
        uplevel set $var $val
        return 0
}
proc setmmf {var val min max} {
        if { $val < $min } {
                set val $min ]
        } elseif { $var > $max } {
                set val $max ]
        }
        return [ uplevel fixval $var $val ]
}

proc turndial {tok val} {
        if {$tok == $::dial(flag)} {
                if {[ setmm ::phi [ format %4.2f [ expr $::phi + $val ] ] $::min $::max ]} {
                        puts end?$val
                        if {abs($val) > $::rebound } {
                                set val [ expr $val * -0.5 ]
                                puts rebound:$val
                        } else {
                                set ::dial(flag) -2
                                puts [email protected]
                                return
                        }
                }
                if { abs($val) < 0.005 } {
                        set ::dial(flag) -2
                        puts stop
                        return
                }
                set val [ expr $val * $::decay ]
                after 100 turndial [ incr ::dial(flag) ] $val
                update idletasks
        }  else {
                puts OFF
        }
}
proc xy2pol {x y} {
        set hyp [ expr { sqrt(pow($x,2) + pow($y,2))}]
        if { $y > 0 } {
                set phi [ expr { +acos($x/$hyp) }]
        } else {
                set phi [ expr { -acos($x/$hyp) }]
        }
        return [ list $phi $hyp ]
}
proc pol2xy {phi hyp} {
        set x [ expr cos($phi) + $hyp ]
        set y [ expr sin($phi) + $hyp ]
        return [ list $x $y]
}

canvas .c -width 120 -height 120 -takefocus 1 ;# -relief groove -bd 2

pack .c

set ::color [ .c cget -bg ]
set ::clighter [ brightness $color 1.5 ]
set ::cdarker [ brightness $color 0.5 ]
puts "$color $clighter $cdarker"
# .c create line 60 60 60 60 -width 180 -capstyle round -fill black -tag knob
.c create line 57 57 57 57 -width 101 -capstyle round -fill $clighter
.c create line 63 63 63 63 -width 101 -capstyle round -fill $cdarker
# .c create line 60 60 60 60 -width 100 -capstyle round -fill black
.c create line 60 60 60 60 -width 100 -capstyle round -fill $color -tag dial
# .c create line 60 60 60 60 -width 80 -capstyle round -fill $color

.c bind dial <Enter> {
                puts decay:on
                set ::decay 0.90
}
.c bind dial <Leave> {
                puts decay:off
                set ::decay 1.00
}
.c bind dial <ButtonPress-1> {
                set ::dial(flag) 0
                set ::dial(x1) [ expr %x - 60 ]
                set ::dial(y1) [ expr %y - 60 ]
}
bind .c <3> {
                set ::dial(flag) 0
}
.c bind dial <ButtonRelease-1> {
                set ::dial(flag) 0
                set ::dial(x2) [ expr %x - 60 ]
                set ::dial(y2) [ expr %y - 60 ]
                set phi1 [ lindex [ xy2pol $::dial(x1) $::dial(y1) ] 0 ]
                set phi2 [ lindex [ xy2pol $::dial(x2) $::dial(y2) ] 0 ]
                set incr [ expr {($phi2 - $phi1)}]
                while {$incr > (sin(1) * 2) } {
                        set incr [ expr {$incr -(sin(1) * 4)}]
                }
                while {$incr < -(sin(1) * 2) } {
                        set incr [ expr {$incr +(sin(1) * 4)}]
                }
                set incr [ expr $incr / 4 ]
                puts delta:$incr
                if { abs($incr) > 0.02 } {
                        turndial [ incr ::dial(flag) ] $incr
                }
}
set ::min -0.0
set ::max +20e6
set ::decay 0.98
set ::rebound 0.25
set phi 0.0
set X [ expr 60 + ( 35 * sin($phi) ) ]
set Y [ expr 60 + ( 35 * cos($phi) ) ]
set x [ expr $X -2 ]
set y [ expr $Y -2 ]
.c create line $x $y $x $y \
        -width  20 -capstyle round -fill $::cdarker   -tag {pos pos_dark}
set x [ expr $X +2 ]
set y [ expr $Y +2 ]
.c create line $x $y $x $y \
        -width  20 -capstyle round -fill $::clighter  -tag {pos pos_light}
set x [ expr $X -0 ]
set y [ expr $Y -0 ]
.c create line $x $y $x $y \
        -width  19 -capstyle round -fill $::color     -tag {pos pos_bottom}
.c bind pos <1> { puts "B1 %x %y" ; set ::dial(flag) -2 }
.c bind pos <B1-Motion> {dialmotion %W %x %y}

elabel .c.el -validate %f -textvariable ::phi -width 5 -align center -fg [ brightness $color 0.3 ]
.c create window 60 60 -window .c.el -anchor center
bind .c.el.l <Key-Right>  { set ::phi [ expr $::phi + 0.1 ] }
bind .c.el.l <Key-Left> { set ::phi [ expr $::phi - 0.1 ] }
bind .c.el.l <Key-Up>    { set ::phi [ expr $::phi + 0.5 ] }
bind .c.el.l <Key-Down>  { set ::phi [ expr $::phi - 0.5 ] }

proc dialmotion {W x y} {
        set pi [ expr {asin(1) * 2 }]
        puts $pi
        set rx  [ expr { $x  -  60}]
        set ry  [ expr { $y  -  60}]
        set hyp [ expr { sqrt(pow($rx,2) + pow($ry,2))}]

        set cnt [ expr {round( $::phi / (2 * $pi ))}]
        set remain [ expr {$::phi - ($cnt * 2 * $pi)}]
        set phi 0
        if { $ry > 0 } {
                set phi [ expr { +acos($rx/$hyp) }]
                puts pos
        } else {
                set phi [ expr { -acos($rx/$hyp) }]
                puts neg
        }
        if { ($remain * $phi ) < -(($pi*$pi)/4) } {
                puts crossover
                puts diff:[ format "% 6.4f % 6.4f" $remain $phi ]
                if { $phi  < 0.0 } {
                        puts forw
                        incr cnt
                } elseif { $phi  > 0.0 } {
                        puts rev
                        incr cnt -1
                }
        }
        set ::phi [ format %4.2f [ expr ( $cnt * (2 * $pi ) ) + $phi ] ]
}
proc turn {_a e op } {
        if {"$e" == "" } {
                upvar $_a a
                set phi $a
        } else {
                upvar $_a a
                set phi $a($e)
        }
        set X [ expr 60 + ( 35 * cos($phi) ) ]
        set Y [ expr 60 + ( 35 * sin($phi) ) ]
        set x [ expr $X -2 ]
        set y [ expr $Y -2 ]
        .c coords pos_dark $x $y $x $y
        set x [ expr $X +2 ]
        set y [ expr $Y +2 ]
        .c coords pos_light $x $y $x $y
        set x [ expr $X -0 ]
        set y [ expr $Y -0 ]
        .c coords pos_bottom $x $y $x $y
}
set phi 0.0
turn phi "" w
# trace variable ::phi w+ turn
trace variable ::phi w turn

toplevel .s
scale .s.c -from 0.0 -to 20e5 -orient horizontal -resolution 0.01 -variable ::phi
pack .s.c -expand 1 -fill x
# file: dial_utils.tcl

proc brightness {color relbright} {
    set len [ string length $color ]
    set w [ expr ( $len - 1 ) / 3 ]
    scan $color "#%${w}x%${w}x%${w}x" r g b
    set min 0
    set max [ expr ( 1<<($w * 4 ) ) -1 ]
    puts max:$max
    set cmax $r
    puts foreach
    foreach col "$g $b" {
        set cmax [ expr $cmax > $col ? $cmax : $col ]
    }
    puts foreachdone
    set cmax [expr {$cmax * 1.0}]
    set maxbright [expr {$max / $cmax}]
    puts maxbright:$maxbright
    set relbright [ expr {$relbright <= $maxbright ? $relbright : $maxbright }]
    foreach col "r g b" {
        set $col [ expr round($relbright * \$$col) ]
        puts col:$col
    }
    return [ format "#%${w}x%${w}x%${w}x" $r $g $b ]
}


# file: dial_bindings.conf

# what: abstract bindings 

# or provide a proc lvarpop:
package require Tclx


proc aevent args {
        set aevent [ lvarpop args ]
        lappend ::aevent(aevents) $aevent
        set ::aevent(aevents) [ lsort -unique $::aevent(aevents) ]
        foreach arg $args {
                event add $aevent $arg
                lappend ::aevent($aevent) $arg
        }
}

aevent <<Edit>>         <Shift-Button-1> <Key-F3>
aevent <<Reset>>        <Shift-Key-Escape>
aevent <<Abort>>        <Key-Escape> <Button-3>
aevent <<Submit>>       <Return>
# file: elabel.tcl
# an editable label with some twists

package require BLT

namespace eval ::editablelabel {
    variable defaults {
        fargs       {}
        largs       {-takefocus 1 -bd 2}
        eargs       {-takefocus 0 -bg white -relief sunken -bd 2}
        validate    valfloat
        chainargs   {}
    }
    variable enum {}

    proc elabel {w args} {
        variable defaults
        foreach {arg val} $defaults {
            # puts "set $arg $val"
            set $arg $val
        }
        # puts "elabel:$w $args"
        foreach {arg val} $args {
            switch -- [ string trimleft $arg - ] \
              validate {
                    switch -glob -- $val\
                        *%*  {
                        set validate [ list valfmt $val]
                        # puts validate:$validate
                    } bool {
                        set validate {valbool}
                    } default {
                        set validate $val
                    }
            } -bd - -relief {
                    lappend fargs $arg $val
            } align - justify - anchor {
                switch -- $val \
                   e - right {  lappend largs -anchor  e
                                lappend eargs -justify right
                }  w - left  {  lappend largs -anchor  w
                                lappend eargs -justify left
                }
            } textvariable {
                lappend largs $arg $val
            } default {
                lappend chainargs $arg $val
            }
        }
        # puts chainargs:$chainargs
        set largs [ concat $largs $chainargs ]
        set eargs [ concat $eargs $chainargs ]
        set targs {-fill both}

        set l $w.l
        set e $w.e
        # puts $fargs
        # puts $largs
        # puts $eargs
        run [ concat frame $w $fargs ]
        run [ concat entry $e $eargs ]
        run [ concat table $w $e 0,0 $targs ]
        run [ concat label $l $largs ]
        run [ concat table $w $l 0,0 $targs ]
        $e configure -font [ $l cget -font ]

        bind $l <FocusIn>  [ list %W configure -state active]
        bind $l <FocusOut> [ list %W configure -state normal]
        bind $l <<Edit>>   [ list ::editablelabel::edit   %W ]
        set validate [ string map {% %%} $validate ]
        bind $e <<Submit>> [ concat ::editablelabel::submit %W $validate ]
        bind $e <<Reset>>  [ list ::editablelabel::reset  %W ]
        bind $e <<Abort>>  [ list ::editablelabel::abort  %W ]

        lappend enum $w
        return $w
    }
    proc edit win  {
        set ewin [ string replace $win end end e]
        set lwin [ string replace $win end end l]
        set cont [ set [ $lwin cget -textvariable ] ]
        $lwin configure -state disabled -takefocus 0
        set [ $ewin cget -textvariable ] $cont
        $ewin configure -state normal -takefocus 1
        $ewin delete 0 100
        $ewin insert 0 $cont
        raise $ewin
        focus $ewin
    }
    proc submit {win args} {
        set ewin [ string replace $win end end e]
        set lwin [ string replace $win end end l]
        lappend args [$ewin get]
        if {[catch $args nice ]} {
            $ewin insert end $nice
            # puts $win.submiterr:$args,$nice
            after 1000 [namespace current]::edit $win
        } else {
            set var [ $lwin cget -textvariable ]
            catch {set $var $nice} cerr
            unedit $win
        }
    }
    proc reset win {
        edit $win
    }
    proc abort win {
        unedit $win
    }
    proc unedit win {
        set ewin [ string replace $win end end e]
        set lwin [ string replace $win end end l]
        $ewin configure -state disabled -takefocus 0
        $lwin configure -state normal -takefocus 1
        raise $lwin
        focus $lwin
    }
    proc valfloat arg {
        set fmt %f
        if {[scan $arg $fmt num] != 1} {
            return -code error  " != $fmt"
        }
        return [ format %4.2f $num ]
    }
    proc valfloat arg {
        set fmt %4.2f
        return [ valfmt $fmt $arg ]
    }
    proc valfmt {fmt args} {
        set arg [ lindex $args 0 ]
        set scan [ string index $fmt 0][string index $fmt end]
        if {[scan $arg $scan val] != 1} {
            return -code error  " != $fmt"
        }
        return [ format $fmt $val ]


    }
}
# puts alias:[
 interp alias {} elabel {} ::editablelabel::elabel
# ]

return

set ::test hallo
set ::blub 1234
elabel .test -textvariable ::test               -align e
elabel .blub -textvariable ::blub -validate %d  -align e
pack .test .blub
label .la -textvariable ::test
label .lb -textvariable ::blub
pack .la .lb

bind . <Key-A> { puts [focus] }
file: dial_shape.tcl
#!/bin/sh

# This little demo (in the splendid tradition of xteddy and xbomb :^)
# is due to John LoVerso <[email protected]> and I have adapted it
# a little in order to increase its effectiveness.

# Now we make cunning use of the backslash/shell trick \
[ -x `dirname $0`/../shapewish ] && exec `dirname $0`/../shapewish $0 ${1+"[email protected]"} || exec wish $0 ${1+"[email protected]"} || { echo "`basename $0`: couldn't start wish" >&2 ; exit 1; }

package require Shape


. config -bg tan  -width 120 -height 120
# wm overrideredirect . 1
wm title . "noframe"
wm withdraw .
update idle
shape set . -bound bitmap @[file join . dial.xbm]
wm deiconify .
bind . <2> {
    regexp {\+(-?[0-9]+)\+(-?[0-9]+)} [winfo geometry .] dummy x y
    set x [expr $x-%X]
    set y [expr $y-%Y]
}
bind . <B2-Motion> {
    wm geometry . +[expr %X+$x]+[expr %Y+$y]
}

source dial.tcl
#file: dial.xbm
#define dial_width 120
#define dial_height 120
static char dial_bits[] = {
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xfc,0xff,0xff,0xff,0x01,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xe0,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0x03,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,0x00,0x00,
 0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,0x00,0x00,
 0x00,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,
 0x00,0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,0x00,0x00,
 0x00,0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0x00,
 0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,0x00,0x00,
 0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
 0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x00,0x00,
 0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,0x00,
 0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,0x00,
 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,
 0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,0x00,
 0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,
 0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,0x00,
 0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,0x00,
 0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
 0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x00,
 0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,
 0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,
 0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,
 0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,
 0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,
 0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,
 0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,
 0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,
 0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,
 0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
 0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,
 0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
 0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
 0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
 0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,
 0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,
 0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,
 0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,
 0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,
 0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,
 0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,
 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,
 0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,
 0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,
 0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,
 0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,
 0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,
 0x00,0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x00,
 0x00,0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
 0x00,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,0x00,
 0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x00,0x00,
 0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,
 0x00,0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,0x00,
 0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,
 0x00,0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,0x00,
 0x00,0x00,0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,0x00,
 0x00,0x00,0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x00,0x00,
 0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0xff,0xff,0xff,0x03,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x7f,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
 };