/[gzz]/gzz/test/tools/gfx.py
ViewVC logotype

Diff of /gzz/test/tools/gfx.py

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

revision 1.5 by tjl, Sun Oct 20 09:33:17 2002 UTC revision 1.6 by tjl, Tue Oct 29 14:09:32 2002 UTC
# Line 1  Line 1 
1    from jarray import array, zeros
2    
3  import gzz  import gzz
4  print "Init test.gfx"  print "Init test.gfx"
5  print dir(gzz)  print dir(gzz)
# Line 44  def checkNotAvgColor(x, y, w, h, color, Line 46  def checkNotAvgColor(x, y, w, h, color,
46      raise msg      raise msg
47    
48    
49    def checkTrans(vs, cs, srclist, dstlist, delta=0, alsoGL = 1):
50        """Check that a transformation works a certain way.
51        """
52        src = array(srclist, 'f')
53        dst = zeros(len(src), 'f')
54        vs.coords.transformPoints3(cs, src, dst)
55        for i in range(0, len(src)):
56            failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, dst[i], dstlist[i]]))
57        if alsoGL:
58            for i in range(0, len(src), 3):
59                vs.map.clear()
60                vs.map.put(SolidBgVob(Color.red))
61                d = TestSpotVob(src[i], src[i+1], src[i+2])
62                vs.map.put(d, cs)
63                render(vs)
64                checkNotAvgColor(
65                    int(dstlist[i])-1, int(dstlist[i+1])-1,
66                    3, 3, (255, 0, 0), delta=50)
67    
68    def checkInterp(vs1, vs2, i, fract, cs, srclist, dstlist, delta=0):
69        src = array(srclist, 'f')
70        dst = zeros(len(src), 'f')
71        failUnless(vs1.coords.transformPoints3_interp(i, vs2.coords,
72                        fract, 0, cs, src, dst))
73        for i in range(0, len(src)):
74            failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, dst[i], dstlist[i]]))
75    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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