 : cairo_close_path ( cairo_t -- )
     "void" "cairo" "cairo_close_path" [ "cairo_t*" ] alien-invoke ;
 
+! Surface manipulation
+
+: cairo_surface_create_similar ( cairo_surface_t cairo_content_t width height -- cairo_surface_t )
+    "cairo_surface_t*" "cairo" "cairo_surface_create_similar" [ "cairo_surface_t*" "uint" "int" "int" ] alien-invoke ;
+
+: cairo_surface_reference ( cairo_surface_t -- cairo_surface_t )
+    "cairo_surface_t*" "cairo" "cairo_surface_reference" [ "cairo_surface_t*" ] alien-invoke ;
+
+: cairo_surface_finish ( cairo_surface_t -- )
+    "void" "cairo" "cairo_surface_finish" [ "cairo_surface_t*" ] alien-invoke ;
+
+: cairo_surface_destroy ( cairo_surface_t -- )
+    "void" "cairo" "cairo_surface_destroy" [ "cairo_surface_t*" ] alien-invoke ;
+
+: cairo_surface_get_reference_count ( cairo_surface_t -- count )
+    "uint" "cairo" "cairo_surface_get_reference_count" [ "cairo_surface_t*" ] alien-invoke ;
+
+: cairo_surface_status ( cairo_surface_t -- cairo_status_t )
+    "uint" "cairo" "cairo_surface_status" [ "cairo_surface_t*" ] alien-invoke ;
+
+: cairo_surface_flush ( cairo_surface_t -- )
+    "void" "cairo" "cairo_surface_flush" [ "cairo_surface_t*" ] alien-invoke ;
+
 ! painting functions
 : cairo_paint ( cairo_t -- )
     "void" "cairo" "cairo_paint" [ "cairo_t*" ] alien-invoke ;

: cairo_clip_preserve ( cairo_t -- )
    "void" "cairo" "cairo_clip_preserve" [ "cairo_t*" ] alien-invoke ;

: cairo_set_source ( cairo_t cairo_pattern_t -- )
    "void" "cairo" "cairo_set_source" [ "cairo_t*" "void*" ] alien-invoke ;

: cairo_pattern_create_linear ( x0 y0 x1 y1 -- cairo_pattern_t )
    "void*" "cairo" "cairo_pattern_create_linear" [ "double" "double" "double" "double" ] alien-invoke ;

: cairo_set_font_size ( cairo_t scale -- )
    "void" "cairo" "cairo_set_font_size" [ "cairo_t*" "double" ] alien-invoke ;

: cairo_set_font_matrix ( cairo_t cairo_matrix_t -- )
  	"void" "cairo" "cairo_set_font_matrix" [ "cairo_t*" "cairo_matrix_t*" ] alien-invoke ;

: cairo_get_font_matrix ( cairo_t cairo_matrix_t -- )
  	"void" "cairo" "cairo_get_font_matrix" [ "cairo_t*" "cairo_matrix_t*" ] alien-invoke ;



! Cairo pdf

: cairo_pdf_surface_create ( filename width height -- surface )
  "void*" "cairo" "cairo_pdf_surface_create" [ "char*" "double" "double" ] alien-invoke ;

! Missing:

! cairo_public cairo_surface_t *
! cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func,
!                                      void              *closure,
!                                      double             width_in_points,
!                                      double             height_in_points);

: cairo_pdf_surface_set_size ( surface width height -- )
  "void" "cairo" "cairo_pdf_surface_set_size" [ "void*" "double" "double" ] alien-invoke ;
