[cairo-commit] [cairo-www] src/pythoncairopil.mdwn

Carl Worth cworth at freedesktop.org
Mon Aug 18 13:04:33 PDT 2008


 src/pythoncairopil.mdwn |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit ded7dd856fa2dded95904ffede8153010c446760
Author: Carl Worth <cworth at freedesktop.org>
Date:   Mon Aug 18 13:04:32 2008 -0700

    web commit by BehdadEsfahbod

diff --git a/src/pythoncairopil.mdwn b/src/pythoncairopil.mdwn
index 39c0cb9..eece2bf 100644
--- a/src/pythoncairopil.mdwn
+++ b/src/pythoncairopil.mdwn
@@ -2,6 +2,8 @@
 
 Please note that the code below was to only blur an cairo image surface and thus ignores conversion from BGRA to RGBA to BGRA that is needed in other situations. Theoretically just replace RGBA with BGRA in frombuffer and tostring.
 
+    import cairo, Image, array
+
     im = cairo.ImageSurface.create_from_png("img11.png")
             
     im1 = Image.frombuffer("RGBA",( im.get_width(),im.get_height() ),im.get_data(),"raw","RGBA",0,1)
@@ -12,8 +14,8 @@ Please note that the code below was to only blur an cairo image surface and thus
             
     #imgd = im1.tostring("raw","RGBA",0,1)
     imgd = im1.tostring()
-    a = array('B',imgd)
+    a = array.array('B',imgd)
             
     stride = self.width * 4
     surface = cairo.ImageSurface.create_for_data (a, cairo.FORMAT_ARGB32,
-                                                  self.width, self.height, stride) 
\ No newline at end of file
+                                                  self.width, self.height, stride) 


More information about the cairo-commit mailing list