[cairo-commit] pycairo/examples hering.py, 1.7, 1.8 spiral.py, 1.5, 1.6

Steve Chaplin commit at pdx.freedesktop.org
Fri Jan 20 03:15:23 PST 2006


Committed by: stevech1097

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

Modified Files:
	hering.py spiral.py 
Log Message:
'SC'

Index: hering.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/hering.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- hering.py	7 May 2005 04:28:06 -0000	1.7
+++ hering.py	20 Jan 2006 11:15:21 -0000	1.8
@@ -2,7 +2,8 @@
 """cairo/cairo-demo/png/hering.c translated into Python
 """
 
-from math import pi
+import math
+
 import cairo
 
 WIDTH  = 300
@@ -10,7 +11,7 @@
 
 def draw_hering (ctx, width, height):
     LINES= 32
-    MAX_THETA = .80 * pi * 2
+    MAX_THETA = .80 * math.pi * 2
     THETA_INC = 2.0 * MAX_THETA / (LINES-1)
 
     ctx.set_source_rgb (0, 0, 0)
@@ -20,12 +21,12 @@
 
     ctx.translate (width / 2, height / 2)
     ctx.rotate (MAX_THETA)
-	
+
     for i in range (LINES):
         ctx.move_to (-2 * width, 0)
         ctx.line_to (2 * width, 0)
         ctx.stroke()
-	    
+
         ctx.rotate (- THETA_INC)
 
     ctx.restore()
@@ -45,9 +46,9 @@
 surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
 ctx = cairo.Context(surface)
 
-ctx.rectangle (0, 0, WIDTH, HEIGHT)
 ctx.set_source_rgb (1, 1, 1)
-ctx.fill()
+ctx.set_operator (cairo.OPERATOR_SOURCE)
+ctx.paint()
 
 draw_hering (ctx, WIDTH, HEIGHT)
 

Index: spiral.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/spiral.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- spiral.py	7 May 2005 04:28:06 -0000	1.5
+++ spiral.py	20 Jan 2006 11:15:21 -0000	1.6
@@ -27,9 +27,9 @@
 surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
 ctx = cairo.Context(surface)
 
-ctx.rectangle (0, 0, WIDTH, HEIGHT)
 ctx.set_source_rgb (1, 1, 1)
-ctx.fill()
+ctx.set_operator (cairo.OPERATOR_SOURCE)
+ctx.paint()
 
 draw_spiral (ctx, WIDTH, HEIGHT)
 



More information about the cairo-commit mailing list