diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1993-01-27 11:42:21 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1993-01-27 11:42:21 (GMT) |
commit | 772eca639cc32d55bafbc1156917f6cbd297fe2c (patch) | |
tree | 863651983e2b184e41d60cf6c690343e36408876 /Demo/sgi/video/Vplay.py | |
parent | 41292a81a81dc565293c8d49c61064e986015cbc (diff) | |
download | cpython-772eca639cc32d55bafbc1156917f6cbd297fe2c.zip cpython-772eca639cc32d55bafbc1156917f6cbd297fe2c.tar.gz cpython-772eca639cc32d55bafbc1156917f6cbd297fe2c.tar.bz2 |
Added options to make window bigger than video (for recording to tape)
Diffstat (limited to 'Demo/sgi/video/Vplay.py')
-rwxr-xr-x | Demo/sgi/video/Vplay.py | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/Demo/sgi/video/Vplay.py b/Demo/sgi/video/Vplay.py index 4f85eef..15592d3 100755 --- a/Demo/sgi/video/Vplay.py +++ b/Demo/sgi/video/Vplay.py @@ -20,6 +20,9 @@ def help(): print '-t : use a 2nd thread for read-ahead' print '-x left : window offset from left of screen' print '-y top : window offset from top of screen' + print '-w width : window width' + print '-h height : window height' + print '-b color : background color (white,black or (r,g,b))' print 'file ... : file(s) to play; default film.video' print print 'User interface:' @@ -52,17 +55,20 @@ regen = None speed = 1.0 threading = 0 xoff = yoff = None +xwsiz = ywsiz = None +bgcolor = None # Main program -- mostly command line parsing def main(): global debug, looping, magnify, mindelta, nowait, quiet, regen, speed - global threading, xoff, yoff + global threading, xoff, yoff, xwsiz, ywsiz, bgcolor # Parse command line try: - opts, args = getopt.getopt(sys.argv[1:], 'M:dlm:nqr:s:tx:y:') + opts, args = getopt.getopt(sys.argv[1:], \ + 'M:dlm:nqr:s:tx:y:w:h:b:') except getopt.error, msg: sys.stdout = sys.stderr print 'Error:', msg, '\n' @@ -96,6 +102,20 @@ def main(): print '-t ignored' if opt == '-x': xoff = string.atoi(arg) if opt == '-y': yoff = string.atoi(arg) + if opt == '-w': xwsiz = string.atoi(arg) + if opt == '-h': ywsiz = string.atoi(arg) + if opt == '-b': + if arg == 'black': + bgcolor = (0,0,0) + elif arg == 'white': + bgcolor = (255,255,255) + else: + try: + bgcolor = eval(arg) + xxr, xxg, xxb = bgcolor + except: + print '-b needs (r,g,b) tuple' + sys.exit(2) except string.atoi_error: sys.stdout = sys.stderr print 'Option', opt, 'requires integer argument' @@ -141,6 +161,13 @@ def process(filename): gl.foreground() width, height = int(vin.width * magnify), int(vin.height * magnify) + xborder = yborder = 0 + if xwsiz: + vin.xorigin = (xwsiz - width)/2 + width = xwsiz + if ywsiz: + vin.yorigin = (ywsiz - height)/2 + height = ywsiz if xoff <> None and yoff <> None: scrheight = gl.getgdesc(GL.GD_YPMAX) gl.prefposition(xoff, xoff+width-1, \ @@ -154,6 +181,10 @@ def process(filename): if quiet: vin.quiet = 1 vin.initcolormap() + if bgcolor: + r, g, b = bgcolor + vin.clearto(r,g,b) + gl.qdevice(ESCKEY) gl.qdevice(WINSHUT) gl.qdevice(WINQUIT) @@ -169,7 +200,11 @@ def process(filename): while not stop: dev, val = gl.qread() if dev == REDRAW: - vin.clear() + if bgcolor: + r,g,b = bgcolor + vin.clearto(r,g,b) + else: + vin.clear() if dev == LEFTMOUSE and val == 1: break # Continue outer loop if dev == ESCKEY and val == 1 or \ |