Index: tables.lisp
===================================================================
--- tables.lisp	(revision 19)
+++ tables.lisp	(working copy)
@@ -112,5 +112,5 @@
 (defun lookup-enum (enum table)
   (let ((cairo-enum (car (rassoc enum table))))
     (unless cairo-enum
-      (error "Could not find ~a in ~a." cairo-enum table))
+      (error "Could not find ~a in ~a." enum table))
     cairo-enum))
Index: surface.lisp
===================================================================
--- surface.lisp	(revision 19)
+++ surface.lisp	(working copy)
@@ -113,6 +113,25 @@
 			       width height)
    width height t))
 
+(defun get-bytes-per-pixel (format)
+  (case format
+    (format-argb32 4)
+    (format-rgb24 3)
+    (format-a8 1)
+    (otherwise (error (format nil "unknown format: ~a" format))))) ;todo: how does format-a1 fit in here?
+
+(defun image-surface-get-data (surface)
+  (with-surface (surface pointer)
+    (let* ((width (image-surface-get-width surface))
+           (height (image-surface-get-height surface))
+           (bytes-per-pixel (get-bytes-per-pixel (image-surface-get-format surface)))
+           (buffer (make-array (* width height bytes-per-pixel) :element-type '(unsigned-byte 8) :fill-pointer 0))
+           (data (cairo_image_surface_get_data pointer)))
+      (loop for i from 0 below (* width height bytes-per-pixel) do
+         (vector-push-extend (cffi:mem-ref data :uint8 i) buffer))
+      buffer)))
+
+
 (defun image-surface-get-format (surface)
   (with-surface (surface pointer)
     (lookup-cairo-enum (cairo_image_surface_get_format pointer) table-format)))
Index: package.lisp
===================================================================
--- package.lisp	(revision 19)
+++ package.lisp	(working copy)
@@ -14,6 +14,7 @@
    destroy create-ps-surface create-pdf-surface create-svg-surface
    create-image-surface image-surface-get-format
    image-surface-get-width image-surface-get-height
+   image-surface-get-data
    image-surface-create-from-png surface-write-to-png
     
    ;; context
