/[gzz]/gzz/gfx/demo/fontfilter2.py
ViewVC logotype

Diff of /gzz/gfx/demo/fontfilter2.py

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

revision 1.2 by tjl, Tue Mar 4 09:12:04 2003 UTC revision 1.3 by tjl, Tue Mar 4 09:29:31 2003 UTC
# Line 45  PageSpanPaper.setupOnlyPass = parseCombi Line 45  PageSpanPaper.setupOnlyPass = parseCombi
45    
46      SPARE0 = (1-TEX0)      SPARE0 = (1-TEX0)
47    
48      color = COL0      color = COL0 * SPARE0
49      alpha = SPARE0.blue      alpha = SPARE0.blue
50  """)  """)
51    
# Line 61  def paperOnce(vs, into, layout, scale): Line 61  def paperOnce(vs, into, layout, scale):
61    
62  def textPaperScene(vs, layout, layoutBg, scale):  def textPaperScene(vs, layout, layoutBg, scale):
63            
64        if currentScene.bg:
65            paperOnce(vs, 0, layoutBg, scale)
66    
67      if currentScene.halo:      if currentScene.halo:
         if currentScene.bg:  
             paperOnce(vs, 0, layoutBg, scale)  
68          sz = 10          sz = 10
69          for x in range(-sz,sz+1):          for x in range(-sz,sz+1):
70              for y in range(-sz,sz+1):              for y in range(-sz,sz+1):
71                  if x==0 and y==0: continue                  if x==0 and y==0: continue
72                  into = vs.translateCS(0, str((x,y)), 2*x, 2*y)                  into = vs.translateCS(0, str((x,y)), x, y)
73    
74                    dist = math.hypot(x, y)
75                    if dist > sz: continue
76    
77                    # f = .15*(1 - dist / sz)
78                    f = .02
79    
                 f = 1 / (1 + (math.hypot(x, y))**1.5)  
80                  vs.put(getDListNocoords("""                  vs.put(getDListNocoords("""
81                      Enable BLEND                      Enable BLEND
82                      Disable DEPTH_TEST                      Disable DEPTH_TEST
83                      Disable ALPHA_TEST                      Disable ALPHA_TEST
84                      BlendFunc SRC_ALPHA ONE                      BlendFunc ONE ONE_MINUS_SRC_COLOR
85                        TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
86                      Color %(f)s %(f)s %(f)s                      Color %(f)s %(f)s %(f)s
87                  """ % locals()))                  """ % locals()))
88                  paperOnce(vs, into, layout, scale)                  paperOnce(vs, into, layout, scale)
89    
90          vs.put(getDListNocoords("""      vs.put(getDListNocoords("""
91              Enable BLEND          Enable BLEND
92              Disable DEPTH_TEST          Disable DEPTH_TEST
93              BlendFunc SRC_ALPHA ONE          BlendFunc ONE ONE
94              BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA          BlendFunc ONE ONE_MINUS_SRC_ALPHA
95              Color 0 0 0          TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
96          """ % locals()))          Color 0 0 0
97          paperOnce(vs, 0, layout, scale)      """ % locals()))
98      else:      paperOnce(vs, 0, layout, scale)
         if currentScene.bg:  
             paperOnce(vs, 0, layoutBg, scale)  
         else:  
             vs.put(getDListNocoords("""  
                 Enable BLEND  
                 Disable DEPTH_TEST  
                 BlendFunc SRC_ALPHA ONE  
                 BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA  
                 Color 0 0 0  
             """ % locals()))  
             paperOnce(vs, 0, layout, scale)  
99    
100  class OptMill(gzz.gfx.gl.PaperMill):  class OptMill(gzz.gfx.gl.PaperMill):
101      def __init__(self, mill):      def __init__(self, mill):
# Line 118  class Scene: Line 113  class Scene:
113          self.pageSpanCellView.useBg = 0          self.pageSpanCellView.useBg = 0
114          self.pageSpanCellViewBg = gzz.view.PageSpanCellView()          self.pageSpanCellViewBg = gzz.view.PageSpanCellView()
115          self.pageSpanCellViewBg.useBg = 1          self.pageSpanCellViewBg.useBg = 1
116            self.pageSpanCellViewBg.useText = 0
117          self.key = KeyPresses(self,          self.key = KeyPresses(self,
118              SlideLog("scale", 2, "scale", "<",">"),              SlideLog("scale", 2, "scale", "<",">"),
119              SlideLin("seed", -3900, 300, "paperseed", "P", "p"),              SlideLin("seed", -3900, 300, "paperseed", "P", "p"),

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

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