/[libvob]/libvob/vob/demo/lava/gamma.py
ViewVC logotype

Diff of /libvob/vob/demo/lava/gamma.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by tjl, Mon Sep 22 08:49:01 2003 UTC revision 1.2 by tjl, Tue Sep 23 10:38:32 2003 UTC
# Line 36  class Scene: Line 36  class Scene:
36      def __init__(self):      def __init__(self):
37          self.key = KeyPresses(          self.key = KeyPresses(
38              self,              self,
39              SlideLin("gamma", 2.2, .05, "exponent", "Down", "Up"),              SlideLin("gamma", 2.4, .05, "exponent", "Down", "Up"),
40                SlideLin("offset", .055, .005, "offset", "Left", "Right"),
41              )              )
42    
43          code = """          code = """
# Line 70  class Scene: Line 71  class Scene:
71          self.stripe2 = getDList(code)          self.stripe2 = getDList(code)
72    
73          code = """          code = """
74            LineWidth 1.0
75            Begin LINES
76            """
77            for i in range(0,N):
78                if i % 3 != 1:
79                    code += """
80                    Vertex .6666 %s
81                    Vertex 1 %s
82                    """ % (i, i)
83                    
84            code += """
85            End
86            """
87            self.stripe3 = getDList(code)
88    
89            code = """
90          Begin QUAD_STRIP          Begin QUAD_STRIP
91          Vertex .3333 0          Vertex .3333 0
92          Vertex .6666 0          Vertex .6666 0
# Line 81  class Scene: Line 98  class Scene:
98    
99      def scene(self, vs):      def scene(self, vs):
100          vob.color.spaces.gamma = self.gamma          vob.color.spaces.gamma = self.gamma
101            vob.color.spaces.offset = self.offset
102                    
103          vs.put( background( (0, 0, 0) ) )          vs.put( background( (0, 0, 0) ) )
104                    
# Line 88  class Scene: Line 106  class Scene:
106          i = 0          i = 0
107          for cs in css:          for cs in css:
108              col = [(1,1,1),(0,1,0),(1,0,0),(0,0,1)][i&3]              col = [(1,1,1),(0,1,0),(1,0,0),(0,0,1)][i&3]
109              f = (1 - (i / 4) * .2)**3              f = .5 * (1 - (i / 4) * .2)**3
110              i += 1              i += 1
111              col = [c * f for c in col]              col = [c * f for c in col]
112              col1 = [c * 1.5 for c in col]              col1 = [c * 2 for c in col]
113              col2 = [c * .5 for c in col]              col2 = [c * 3 for c in col]
114              vs.put(color(col))              col3 = [c * 3 / 2 for c in col]
115              vs.map.put(self.stripe, cs)  
116              if (col1[0] <= 1.0001 and              if (col1[0] <= 1.0001 and
117                  col1[1] <= 1.0001 and                  col1[1] <= 1.0001 and
118                  col1[2] <= 1.0001):                  col1[2] <= 1.0001):
119                  vs.put(color(col1))                  vs.put(color(col1))
120                    vs.map.put(self.stripe, cs)
121    
122                if (col2[0] <= 1.0001 and
123                    col2[1] <= 1.0001 and
124                    col2[2] <= 1.0001):
125                    vs.put(color(col2))
126                  vs.map.put(self.stripe2, cs)                  vs.map.put(self.stripe2, cs)
127              vs.put(color(col2))              elif (col3[0] <= 1.0001 and
128                      col3[1] <= 1.0001 and
129                      col3[2] <= 1.0001):
130                    vs.put(color(col3))
131                    vs.map.put(self.stripe3, cs)
132    
133                vs.put(color(col))
134              vs.map.put(self.block, cs)              vs.map.put(self.block, cs)
135    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26