[cairo-commit]
pycairo/examples/cairo_snippets snippets_svg.py, NONE, 1.1
Steve Chaplin
commit at pdx.freedesktop.org
Tue Dec 13 20:47:04 PST 2005
- Previous message: [cairo-commit] pycairo/cairo cairomodule.c, 1.49, 1.50 pycairo.h,
1.42, 1.43 pycairo-private.h, 1.33, 1.34 pycairo-surface.c,
1.60, 1.61
- Next message: [cairo-commit] pycairo/examples Makefile.am,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: stevech1097
Update of /cvs/cairo/pycairo/examples/cairo_snippets
In directory gabe:/tmp/cvs-serv11259/examples/cairo_snippets
Added Files:
snippets_svg.py
Log Message:
'SC'
--- NEW FILE: snippets_svg.py ---
#!/usr/bin/env python
from __future__ import division
from math import pi as M_PI # used by many snippets
import sys
import cairo
if not cairo.HAS_SVG_SURFACE:
raise SystemExit ('cairo was not compiled with SVG support')
from snippets import snip_list, snippet_normalize, snippet_set_bg_svg
width_in_inches, height_in_inches = 2, 2
width_in_points, height_in_points = width_in_inches * 72, height_in_inches * 72
width, height = width_in_points, height_in_points # used by snippet_normalize()
def do_snippet (snippet):
if verbose_mode:
print 'processing %s' % snippet,
filename = 'snippets/%s.svg' % snippet
surface = cairo.SVGSurface (filename, width_in_points, height_in_points)
cr = cairo.Context (surface)
cr.save()
try:
execfile ('snippets/%s.py' % snippet, globals(), locals())
except:
exc_type, exc_value = sys.exc_info()[:2]
print >> sys.stderr, exc_type, exc_value
else:
cr.restore()
cr.show_page()
if verbose_mode:
print
if __name__ == '__main__':
verbose_mode = True
if len(sys.argv) > 1 and sys.argv[1] == '-s':
verbose_mode = False
del sys.argv[1]
if len(sys.argv) > 1: # do specified snippets
snippet_list = sys.argv[1:]
else: # do all snippets
snippet_list = snip_list
for s in snippet_list:
do_snippet (s)
- Previous message: [cairo-commit] pycairo/cairo cairomodule.c, 1.49, 1.50 pycairo.h,
1.42, 1.43 pycairo-private.h, 1.33, 1.34 pycairo-surface.c,
1.60, 1.61
- Next message: [cairo-commit] pycairo/examples Makefile.am,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list