[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/lava bgfilegen.py
From: |
Asko Soukka |
Subject: |
[Gzz-commits] libvob/lava bgfilegen.py |
Date: |
Tue, 06 May 2003 08:55:48 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Asko Soukka <address@hidden> 03/05/06 08:55:48
Modified files:
lava : bgfilegen.py
Log message:
zoom may work, couldn't test yet
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/lava/bgfilegen.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
Patches:
Index: libvob/lava/bgfilegen.py
diff -u libvob/lava/bgfilegen.py:1.13 libvob/lava/bgfilegen.py:1.14
--- libvob/lava/bgfilegen.py:1.13 Sun May 4 09:11:01 2003
+++ libvob/lava/bgfilegen.py Tue May 6 08:55:48 2003
@@ -81,7 +81,7 @@
files = [f for f in files if extensions.count(f.split('.')[-1]) > 0]
return files
-def genBgFileFromSeed(w, vs, seed, jpeg=0):
+def genBgFileFromSeed(w, vs, seed, jpeg=0, scale=1):
"""
Generates a background texture into filename constructed
from the seed. Seed is some 64bit integer value.
@@ -89,6 +89,10 @@
Returns the filename with absolute path of the generated file.
"""
+ scalePostfix = ''
+ if scale != 1: scalePostfix = '-%sx' % (scale)
+
+ w.setLocation(0,0,384*scale,384*scale)
size = vs.getSize()
# for Java to accept Python Long
@@ -98,24 +102,26 @@
pap = ThePaperMill().getPaper(lseed, passmask=passmask, vecs=[[.5,0],[0,
.5]])
pq = GLRen.createPaperQuad(pap, -0.5, -0.5, 0.5, 0.5, 0)
- cs = vs.coords.affine(0, 1, 0, 0, 768, 0, 0, 768)
+ cs = vs.coords.affine(0, 1, 0, 0, 768*scale, 0, 0, 768*scale)
vs.matcher.add(cs, "tex")
vs.put(SolidBackdropVob(java.awt.Color(0,0,0)))
vs.map.put(pq, cs, 0)
w.renderStill(vs, 0)
if (jpeg):
- print 'Saving background texture into %s-paper.gen.jpg.' % (str(seed))
- saveanim.saveframe('bgfile.tmp', w, 0, 0, 384, 384)
+ print 'Saving background texture into %s%s-paper.gen.jpg.' %
(str(seed), scalePostfix)
+ saveanim.saveframe('bgfile.tmp', w, 0, 0, 384*scale, 384*scale)
os.system("convert -quality 95 %s %s" \
- % ('bgfile.tmp', basedir+str(seed)+'-paper.gen.jpg'))
+ % ('bgfile.tmp', basedir+str(seed)+'%s-paper.gen.jpg' %
(scalePostfix)))
os.system("rm bgfile.tmp")
- return os.path.abspath(basedir+str(seed)+'-paper.gen.jpg')
+ w.setLocation(0,0,384,384)
+ return os.path.abspath(basedir+str(seed)+'%s-paper.gen.jpg' %
(scalePostfix))
else:
- print 'Saving background texture into %s-paper.gen.png.' % (str(seed))
- saveanim.saveframe(basedir+str(seed)+'-paper.gen.png',
- w, 0, 0, 384, 384)
- return os.path.abspath(basedir+str(seed)+'-paper.gen.png')
+ print 'Saving background texture into %s%s-paper.gen.png.' %
(str(seed), scalePostfix)
+ saveanim.saveframe(basedir+str(seed)+'%s-paper.gen.png' %
(scalePostfix),
+ w, 0, 0, 384*scale, 384*scale)
+ w.setLocation(0,0,384,384)
+ return os.path.abspath(basedir+str(seed)+'%s-paper.gen.png' %
(scalePostfix))
class Main(Runnable):
def run(self):
@@ -123,7 +129,6 @@
from vob.paper.papermill import ThePaperMill
w = gfxapi.createWindow()
- w.setLocation(0,0,384,384)
vs = w.createVobScene()
print "Working directory:", basedir
@@ -142,15 +147,22 @@
if len(requests) > 0:
sleep = 0
for seed in requests:
- filepath = genBgFileFromSeed(w,
- vs,
- long(seed.split('.')[0]),
- jpeg)
+ if seed.find('-') != -1:
+ id = seed.split('.')[0]
+ scale = id.split('-')[1].split('x')[0]
+ filepath = genBgFileFromSeed(w,
+ vs,
+
long(id.split('-')[0]),
+ jpeg, int(scale))
+ else:
+ filepath = genBgFileFromSeed(w,
+ vs,
+
long(seed.split('.')[0]),
+ jpeg)
if notify:
os.system(notify + ' ' + filepath \
+ ' ' + seed.split('.')[0])
os.system('rm '+basedir+seed)
-
else:
if not sleep:
print time.strftime('%y/%m/%d %H:%M:%S'), \
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/04
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/04
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/04
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/04
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/04
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/04
- [Gzz-commits] libvob/lava bgfilegen.py,
Asko Soukka <=
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/06
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/06
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/07
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/07
- [Gzz-commits] libvob/lava bgfilegen.py, Asko Soukka, 2003/05/07