# HG changeset patch # User viric@llimona # Date 1161512595 -7200 # Node ID c36976fd28f31130ddf622aed48d68e5c00a1dd1 # Parent 2b12eedda29542892510110bdac251b366284e29 More changes. diff -r 2b12eedda295 -r c36976fd28f3 gamma.tk --- a/gamma.tk Mon Oct 16 00:49:43 2006 +0200 +++ b/gamma.tk Sun Oct 22 12:23:15 2006 +0200 @@ -1,16 +1,74 @@ #!/bin/wish +set wheight 400 +set wwidth 800 +set wwidthsingle [expr $wwidth / 3 ] +set gradient 5 + +# Aquest -2 és perque els butons, per alguna raó, són 2 pixels més alts i +# amples. +set wheightsingle [expr $wheight / $gradient - 2] + +proc stepvalue { min max step } { + global gradient + return [expr $min + ( ( $max - $min ) * $step / ($gradient - 1) )] +} + +proc color { r g b } { + return [format "#%04x%04x%04x" $r $g $b] +} + +# Build the labels + +# Left frame .leftcol -label .leftcol.c -height 100 -width 50 -bg #12f -bitmap @gray50.xbm +label .leftcol.c -height $wheight -width $wwidthsingle -bg #12f \ + -bitmap @gray50.xbm -borderwidth 0 pack .leftcol.c + +# Center frame .centercol -button .centercol.b -height 100 -width 50 -bg #f21 -fg #f21 -bitmap gray50 -pack .centercol.b +for {set i 0} {$i < $gradient} {incr i} { + set r [stepvalue 0 65535 $i] + set g $r + set b $r + button .centercol.b$i -height $wheightsingle -width $wwidthsingle \ + -bg [color $r $g $b] -bitmap gray50 -borderwidth 0 \ + -highlightthickness 0 -command "selection $i" + pack .centercol.b$i -side top +} + +# Right frame .rightcol -label .rightcol.c -height 100 -width 50 -bg #5f6 -bitmap @gray50.xbm +label .rightcol.c -height $wheight -width $wwidthsingle -bg #f12 \ + -bitmap @gray50.xbm -borderwidth 0 pack .rightcol.c pack .leftcol -side left pack .centercol -side left pack .rightcol -side left + +# Global variables + +# Loop functions + +# Returns { min_r max_r min_g max_g min_b max_b } +set min_r 0 +set max_r 65535 +set min_g 0 +set max_g 0 +set min_b 0 +set max_b 0 + +proc getnext { } { +} + +proc prepare_colors { } { + global min_r max_r min_g max_g min_b max_b +} + +proc selection { i } { + puts $i +} +