[cairo-commit]
pycairo/examples/svg svg2png.py, 1.1, 1.2 svgview.py, 1.3, 1.4
Steve Chaplin
commit at pdx.freedesktop.org
Fri Apr 29 02:11:18 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/examples/svg
In directory gabe:/tmp/cvs-serv22168/examples/svg
Modified Files:
svg2png.py svgview.py
Log Message:
SC
Index: svg2png.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/svg/svg2png.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- svg2png.py 2 Mar 2005 13:12:56 -0000 1.1
+++ svg2png.py 29 Apr 2005 09:11:16 -0000 1.2
@@ -24,13 +24,9 @@
svg.parse (filename)
width, height = svg.size
- try:
- fileObject = file(file_out, 'wb')
- except IOError, exc:
- raise SystemExit("%s: %s" % (exc.filename, exc.strerror))
-
ctx = cairo.Context()
- ctx.set_target_png (fileObject, cairo.FORMAT_ARGB32, width, height)
+ surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, width, height)
+ ctx.set_target_surface (surface)
svg.render (ctx)
- ctx.show_page()
+ surface.write_to_png(file_out)
print 'saved', file_out
Index: svgview.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/svg/svgview.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- svgview.py 20 Mar 2005 04:46:09 -0000 1.3
+++ svgview.py 29 Apr 2005 09:11:16 -0000 1.4
@@ -112,18 +112,16 @@
# draw to pixmap
ctx.rectangle(0,0,width,height)
- ctx.set_rgb_color(*self.rgb_bg)
+ ctx.set_source_rgb(*self.rgb_bg)
ctx.fill()
svg_width, svg_height = self.svg.size
- matrix = cairo.Matrix (a=width/svg_width,
- d=height/svg_height)
+ matrix = cairo.Matrix (xx=width/svg_width, yy=height/svg_height)
ctx.set_matrix (matrix)
self.svg.render (ctx)
# draw pixmap to gdk.window
- da.window.draw_drawable(gtk.gdk.GC(da.window),
- pixmap, 0,0, 0,0, -1,-1)
+ da.window.draw_drawable(gtk.gdk.GC(da.window), pixmap, 0,0, 0,0, -1,-1)
def cb_open (self, action, data=None):
More information about the cairo-commit
mailing list