gamma.tk
author viric@llimona
Sun, 22 Oct 2006 12:23:15 +0200
changeset 1 c36976fd28f3
parent 0 2b12eedda295
child 2 9aa865195c24
permissions -rw-r--r--
More changes.
#!/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 $wheight -width $wwidthsingle -bg #12f \
	-bitmap @gray50.xbm -borderwidth 0
pack .leftcol.c

# Center
frame .centercol
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 $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
}