[cairo-commit] pycairo/examples/gtk cairo-demo.py, 1.3, 1.4 cairo-knockout.py, 1.4, 1.5 hangman.py, 1.4, 1.5 lsystem.py, 1.3, 1.4 png_view.py, 1.5, 1.6 text.py, 1.4, 1.5

Steve Chaplin commit at pdx.freedesktop.org
Sun May 8 17:52:49 PDT 2005


Committed by: stevech1097

Update of /cvs/cairo/pycairo/examples/gtk
In directory gabe:/tmp/cvs-serv27558/examples/gtk

Modified Files:
	cairo-demo.py cairo-knockout.py hangman.py lsystem.py 
	png_view.py text.py 
Log Message:
SC

Index: cairo-demo.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/cairo-demo.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-demo.py	15 Apr 2005 03:25:37 -0000	1.3
+++ cairo-demo.py	9 May 2005 00:52:47 -0000	1.4
@@ -85,8 +85,7 @@
 
     drawable.clear()
 
-    ctx = cairo.Context()
-    cairo.gtk.set_target_drawable(ctx, drawable)
+    ctx = cairo.gtk.create_cairo_context(drawable)
     ctx.set_source_rgb(0, 0, 0)
 
     ctx.set_line_width(SIZE / 4)

Index: cairo-knockout.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/cairo-knockout.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo-knockout.py	2 May 2005 02:25:51 -0000	1.4
+++ cairo-knockout.py	9 May 2005 00:52:47 -0000	1.5
@@ -91,9 +91,8 @@
     xc = width / 2.
     yc = height / 2.
 
-    ctx = cairo.Context()
-    cairo.gtk.set_target_drawable(ctx, drawable)
-    surface = ctx.target_surface
+    ctx = cairo.gtk.create_cairo_context(drawable)
+    surface = ctx.target
 
     overlay = surface.create_similar(cairo.FORMAT_ARGB32, width,height)
     punch   = surface.create_similar(cairo.FORMAT_A8,     width,height)
@@ -119,7 +118,9 @@
     ctx.restore()
 
     ctx.set_operator(cairo.OPERATOR_OUT_REVERSE)
-    ctx.show_surface(punch, width, height)
+    ctx.set_source_surface (punch, 0, 0)
+    ctx.paint()
+    #ctx.show_surface(punch, width, height)
 
     ctx.save()
 
@@ -130,11 +131,15 @@
     ctx.restore()
 
     ctx.set_operator(cairo.OPERATOR_ADD)
-    ctx.show_surface(circles, width, height)
+    ctx.set_source_surface (circles, 0, 0)
+    ctx.paint()
+    #ctx.show_surface(circles, width, height)
 
     ctx.restore()
 
-    ctx.show_surface(overlay, width, height)
+    ctx.set_source_surface (overlay, 0, 0)
+    ctx.paint()
+    #ctx.show_surface(overlay, width, height)
     
 def main():
     win = gtk.Window()

Index: hangman.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/hangman.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- hangman.py	15 Apr 2005 03:25:37 -0000	1.4
+++ hangman.py	9 May 2005 00:52:47 -0000	1.5
@@ -66,11 +66,8 @@
 
     pixmap = gtk.gdk.Pixmap (widget.window, width, height)
     
-    ctx = cairo.Context()
-    surface = cairo.gtk.surface_create_for_pixmap_with_visual(
-        pixmap, widget.window.get_visual())
-    ctx.set_target_surface (surface)
-
+    ctx = cairo.gtk.create_cairo_context(pixmap)
+    
     # set the background
     ctx.set_source_rgb(0.7,0.7,0.7)
     ctx.rectangle(0,0,width, height)

Index: lsystem.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/lsystem.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- lsystem.py	15 Apr 2005 03:25:37 -0000	1.3
+++ lsystem.py	9 May 2005 00:52:47 -0000	1.4
@@ -29,8 +29,8 @@
 
         drawable.clear()
 
-        ctx = cairo.Context()
-        cairo.gtk.set_target_drawable(ctx, drawable)
+        ctx = cairo.gtk.create_cairo_context(drawable)        
+        
         ctx.set_source_rgb(0, 0, 0)
 
         ctx.set_line_width(self.SIZE / 4)

Index: png_view.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/png_view.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- png_view.py	5 May 2005 01:35:13 -0000	1.5
+++ png_view.py	9 May 2005 00:52:47 -0000	1.6
@@ -11,11 +11,7 @@
 def expose_event(widget, event, surface):
     widget.window.clear()
     
-    ctx = cairo.Context()
-    tsurface = cairo.gtk.surface_create_for_window_with_visual(
-        widget.window, widget.window.get_visual())
-    ctx.set_target_surface (tsurface)
-
+    ctx = cairo.gtk.create_cairo_context(widget.window)
     ctx.set_source_surface(surface, 0,0)
     ctx.paint()
 

Index: text.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/gtk/text.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- text.py	15 Apr 2005 03:25:37 -0000	1.4
+++ text.py	9 May 2005 00:52:47 -0000	1.5
@@ -7,8 +7,8 @@
 def expose_event(widget, event):
     widget.window.clear()
     
-    ctx = cairo.Context()
-    cairo.gtk.set_target_drawable(ctx, widget.window)
+    ctx = cairo.gtk.create_cairo_context(widget.window)
+    
     ctx.set_line_width(6)
     ctx.set_tolerance(.1)
 




More information about the cairo-commit mailing list