[cairo-commit]
pycairo/examples/svg svg2png.py, 1.3, 1.4 svgview.py, 1.5, 1.6
Steve Chaplin
commit at pdx.freedesktop.org
Fri May 20 01:57:46 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/examples/svg
In directory gabe:/tmp/cvs-serv17784/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.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- svg2png.py 14 May 2005 01:15:06 -0000 1.3
+++ svg2png.py 20 May 2005 08:57:44 -0000 1.4
@@ -22,10 +22,10 @@
svg = cairo.svg.Context()
svg.parse (filename)
- width, height = svg.size
+ width, height = svg.get_size()
surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, width, height)
ctx = cairo.Context(surface)
svg.render (ctx)
- surface.write_to_png(file_out)
+ 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.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- svgview.py 14 May 2005 01:15:06 -0000 1.5
+++ svgview.py 20 May 2005 08:57:44 -0000 1.6
@@ -35,8 +35,9 @@
retval = []
for action in actions:
- if len (action) >= 6: # action[5] is the callcack function as a string
- action = action[0:5] + (getattr (instance, action[5]),) + action[6:]
+ if len (action) >= 6: # action[5] is the callcack function as a string
+ action = action[0:5] + (getattr (instance, action[5]),) + \
+ action[6:]
retval += [action]
return retval
@@ -105,14 +106,14 @@
width, height = da.allocation.width, da.allocation.height
pixmap = gtk.gdk.Pixmap (da.window, width, height)
- ctx = cairo.gtk.create_cairo_context(pixmap)
+ ctx = cairo.gtk.gdk_cairo_create (pixmap)
# draw to pixmap
ctx.rectangle(0,0,width,height)
ctx.set_source_rgb(*self.rgb_bg)
ctx.fill()
- svg_width, svg_height = self.svg.size
+ svg_width, svg_height = self.svg.get_size()
matrix = cairo.Matrix (xx=width/svg_width, yy=height/svg_height)
ctx.set_matrix (matrix)
self.svg.render (ctx)
@@ -143,8 +144,9 @@
if self.af is None:
self.create_da()
- width, height = self.svg.size
- self.af.set(xalign=0.5, yalign=0.5, ratio=width/height, obey_child=False)
+ width, height = self.svg.get_size()
+ self.af.set (xalign=0.5, yalign=0.5,
+ ratio=width/height, obey_child=False)
self.da.queue_draw()
@@ -164,7 +166,8 @@
gtk.STOCK_OPEN, gtk.RESPONSE_OK),
backend = '',
path = None):
- super (MyFileChooserDialog, self).__init__ (title, parent, action, buttons, backend)
+ super (MyFileChooserDialog, self).__init__ (title, parent, action,
+ buttons, backend)
if path: self.path = path
else: self.path = os.getcwd() + os.sep
More information about the cairo-commit
mailing list