[cairo-commit] pycairo/test cairo_image_surface_create_for_data.py,
1.4, NONE for_data1.py, NONE, 1.1 for_data2.py, NONE,
1.1 for_data3.py, NONE, 1.1 Makefile.am, 1.1, 1.2
Steve Chaplin
commit at pdx.freedesktop.org
Thu Sep 22 09:12:37 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/test
In directory gabe:/tmp/cvs-serv27142/test
Modified Files:
Makefile.am
Added Files:
for_data1.py for_data2.py for_data3.py
Removed Files:
cairo_image_surface_create_for_data.py
Log Message:
'SC'
--- cairo_image_surface_create_for_data.py DELETED ---
--- NEW FILE: for_data1.py ---
#!/usr/bin/env python
import array
import math
import cairo
width, height = 30*16, 30*9
data = array.array('c', 'a' * width * height * 4)
stride = width * 4
surface = cairo.ImageSurface.create_for_data (data, cairo.FORMAT_ARGB32,
width, height, stride);
del data # to test that create_for_data() references 'data'
ctx = cairo.Context (surface)
ctx.scale (width, height)
pat = cairo.LinearGradient (0.0, 0.0, 0.0, 1.0)
pat.add_color_stop_rgba (1, 0, 0, 0, 1)
pat.add_color_stop_rgba (0, 1, 1, 1, 1)
ctx.rectangle (0,0,1,1)
ctx.set_source (pat)
ctx.fill ()
pat = cairo.RadialGradient (0.45, 0.4, 0.1,
0.4, 0.4, 0.5)
pat.add_color_stop_rgba (0, 1, 1, 1, 1)
pat.add_color_stop_rgba (1, 0, 0, 0, 1)
ctx.set_source (pat)
ctx.arc (0.5, 0.5, 0.3, 0, 2 * math.pi)
ctx.fill ()
surface.write_to_png ('for_data1.png')
--- NEW FILE: for_data2.py ---
#!/usr/bin/env python
"""
use ImageSurface.create_for_data() to access Numeric, using the buffer
protocol
"""
import math
import cairo
import Numeric
width, height = 30*16, 30*9
data = Numeric.zeros ((width,height,4), Numeric.UInt8)
stride = width * 4
surface = cairo.ImageSurface.create_for_data (data, cairo.FORMAT_ARGB32,
width, height, stride);
del data # to test that create_for_data() references 'data'
ctx = cairo.Context (surface)
ctx.scale (width, height)
pat = cairo.LinearGradient (0.0, 0.0, 0.0, 1.0)
pat.add_color_stop_rgba (1, 0, 0, 0, 1)
pat.add_color_stop_rgba (0, 1, 1, 1, 1)
ctx.rectangle (0,0,1,1)
ctx.set_source (pat)
ctx.fill ()
pat = cairo.RadialGradient (0.45, 0.4, 0.1,
0.4, 0.4, 0.5)
pat.add_color_stop_rgba (0, 1, 1, 1, 1)
pat.add_color_stop_rgba (1, 0, 0, 0, 1)
ctx.set_source (pat)
ctx.arc (0.5, 0.5, 0.3, 0, 2 * math.pi)
ctx.fill ()
surface.write_to_png ('for_data2.png')
--- NEW FILE: for_data3.py ---
#!/usr/bin/env python
"""
use ImageSurface.create_for_data() to access numarray, using the buffer
protocol
"""
import math
import cairo
import numarray
width, height = 30*16, 30*9
data = numarray.zeros ((width,height,4), numarray.UInt8)
stride = width * 4
surface = cairo.ImageSurface.create_for_data (data, cairo.FORMAT_ARGB32,
width, height, stride);
del data # to test that create_for_data() references 'data'
ctx = cairo.Context (surface)
ctx.scale (width, height)
pat = cairo.LinearGradient (0.0, 0.0, 0.0, 1.0)
pat.add_color_stop_rgba (1, 0, 0, 0, 1)
pat.add_color_stop_rgba (0, 1, 1, 1, 1)
ctx.rectangle (0,0,1,1)
ctx.set_source (pat)
ctx.fill ()
pat = cairo.RadialGradient (0.45, 0.4, 0.1,
0.4, 0.4, 0.5)
pat.add_color_stop_rgba (0, 1, 1, 1, 1)
pat.add_color_stop_rgba (1, 0, 0, 0, 1)
ctx.set_source (pat)
ctx.arc (0.5, 0.5, 0.3, 0, 2 * math.pi)
ctx.fill ()
surface.write_to_png ('for_data3.png')
Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/pycairo/test/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am 24 Jul 2005 14:21:09 -0000 1.1
+++ Makefile.am 22 Sep 2005 16:12:35 -0000 1.2
@@ -1,5 +1,7 @@
EXTRA_DIST = \
cairo_image_surface_create_for_array.py \
- cairo_image_surface_create_for_data.py \
+ for_data1.py \
+ for_data2.py \
+ for_data3.py \
test.py \
test.test
More information about the cairo-commit
mailing list