Changeset - 6862f0b57b7a
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 years ago 2005-06-05 07:29:48
drewp@bigasterisk.com
shaded curve experiment
1 file changed with 13 insertions and 2 deletions:
0 comments (0 inline, 0 general)
light9/curve.py
Show inline comments
 
@@ -4,12 +4,13 @@ from bisect import bisect_left,bisect,bi
 
import Tkinter as tk
 
from dispatch import dispatcher
 

	
 
import run_local
 
from light9 import Submaster, dmxclient, networking
 
from light9.TLUtility import make_attributes_from_args
 
from light9.dmxchanedit import gradient
 

	
 
class Curve:
 
    """curve does not know its name. see Curveset"""
 
    points = None # x-sorted list of (x,y)
 
    def __init__(self):
 
        self.points = [(0,0),(10,0)]
 
@@ -110,15 +111,25 @@ class Curveview(tk.Canvas):
 
                             
 
        visible_points = cp[visleftidx:visrightidx+1]
 
        visible_idxs = range(visleftidx,visrightidx+1)
 
        
 
        self.delete('curve')
 

	
 
        for x in range(0,self.winfo_width(),3):
 
            wx = self.world_from_screen(x,0)[0]
 
            mag = self.curve.eval(wx)
 
            self.create_line(x,0, x,70,
 
                             fill=gradient(mag,
 
                                           low=(20,10,50),
 
                                           high=(255,187,255)),
 
                             width=3, tags='curve')
 

	
 

	
 
        self._draw_markers(visible_x)
 
        
 
        self._draw_line(visible_idxs,visible_points)
 
        self._draw_line(visible_points)
 
        
 
        self.dots = {} # idx : canvas rectangle
 

	
 
        if len(visible_points)<50:
 
            self._draw_handle_points(visible_idxs,visible_points)
 

	
 
@@ -143,13 +154,13 @@ class Curveview(tk.Canvas):
 
        self.create_line(x,self.winfo_height(),x,self.winfo_height()-20,
 
                         tags=('curve',))
 
        self.create_text(x,self.winfo_height()-20,text=label,anchor='s',
 
                         tags=('curve',))
 

	
 

	
 
    def _draw_line(self,visible_idxs,visible_points):
 
    def _draw_line(self,visible_points):
 
        linepts=[]
 
        step=1
 
        linewidth=2
 
        if len(visible_points)>800:
 
            step = int(len(visible_points)/800)
 
            linewidth=1
0 comments (0 inline, 0 general)