Diverses millores: New, gnuplots, ...
authorviric@llimona
Mon, 23 Oct 2006 00:35:20 +0200
changeset 3 2bdd3f8b7864
parent 2 9aa865195c24
child 4 f8ce867298a9
Diverses millores: New, gnuplots, ...
gamma.tk
graph.plot
--- a/gamma.tk	Sun Oct 22 22:56:16 2006 +0200
+++ b/gamma.tk	Mon Oct 23 00:35:20 2006 +0200
@@ -1,4 +1,4 @@
-#!/bin/wish
+#!/usr/bin/wish
 
 set wheight 400
 set wwidth 800
@@ -58,6 +58,7 @@
 set mFile [menu .mb.mFile]
 .mb add cascade -label File -menu .mb.mFile
 
+$mFile add command -label New -command new_points
 $mFile add command -label Load -command load_file
 $mFile add command -label Save -command save_file
 $mFile add separator
@@ -225,16 +226,18 @@
 		return
 	}
 	set fd [open $file w]
-	puts "# plot for gnuplot"
-	puts "# plot 'data' index 0 title 'vermell', 'data' index 1 title 'verd', 'data' index 2 title 'blau'"
+	puts $fd "# plot for gnuplot"
+	puts $fd "# plot 'data' index 0 title 'vermell', 'data' index 1 title 'verd', 'data' index 2 title 'blau'"
 
 	foreach t { rpoints gpoints bpoints } {
+		puts $fd "# $t"
 		foreach i [set $t] {
 			puts -nonewline $fd [join $i " "]
 			puts $fd ""
 		}
 		if { $t != "bpoints"} {
 			puts $fd ""
+			puts $fd ""
 		}
 	}
 
@@ -267,7 +270,7 @@
 				}
 			}
 		} else {
-			if { [string index $line] != "#" } {
+			if { [string index $line 0] != "#" } {
 				lappend ${type}points [split $line " "]
 			}
 		}
@@ -283,5 +286,16 @@
 	prepare_colors_newpoint
 }
 
+proc new_points { } {
+        global rpoints gpoints bpoints
+
+        set rpoints {{0 0.} {65535 1.}}
+        set gpoints {{0 0.} {65535 1.}}
+        set bpoints {{0 0.} {65535 1.}}
+
+        prepare_colors_newpoint
+}
+
+
 # Prepare the colors for the user, for the first time!
 prepare_colors_newpoint
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graph.plot	Mon Oct 23 00:35:20 2006 +0200
@@ -0,0 +1,9 @@
+#!/usr/bin/gnuplot
+
+
+plot 'sobretaula.gamma' index 0 title 'vermell' with linespoints, \
+	'sobretaula.gamma' index 1 title 'verd' with linespoints, \
+	'sobretaula.gamma' index 2 title 'blau' with linespoints, \
+	(x / 65535)**2.2 title "sRGB" with lines
+
+pause -1