[cairo-commit] cairo-ocaml/test basket.ml,1.6,1.7

Olivier Andrieu commit at pdx.freedesktop.org
Thu Feb 9 07:57:13 PST 2006


Committed by: oandrieu

Update of /cvs/cairo/cairo-ocaml/test
In directory gabe:/tmp/cvs-serv30596/test

Modified Files:
	basket.ml 
Log Message:
* src/cairo_svg.mli, src/cairo_svg.mli, src/ml_cairo_svg.c: support
  for the SVG backend.
* test/basket.ml: test SVG output.


Index: basket.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/test/basket.ml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- basket.ml	26 May 2005 23:56:10 -0000	1.6
+++ basket.ml	9 Feb 2006 15:57:11 -0000	1.7
@@ -56,29 +56,36 @@
 let x_inches = 8.
 let y_inches = 3.
 
+
+let file_backend ?(verbose=false) ~backend_name ~filename surface_create =
+  prerr_endline backend_name ;
+  do_file_out filename
+    (fun oc ->
+      let width_in_points  = x_inches *. 72. in
+      let height_in_points = y_inches *. 72. in
+      let s = surface_create oc ~width_in_points ~height_in_points in
+      let c = Cairo.create s in
+      draw ~print:verbose c ;
+      Cairo.show_page c ;
+      Cairo.surface_finish s)
+
 let main () =
 
-  begin
-    prerr_endline "PS" ;
-    do_file_out "basket.ps"
-      (fun oc ->
-	let s = Cairo_ps.surface_create_for_channel oc (x_inches *. 72.) (y_inches *. 72.) in
-	let c = Cairo.create s in
-	draw ~print:true c ;
-	Cairo.show_page c ;
-	Cairo.surface_finish s)
-  end ;
+  file_backend
+    ~verbose:true
+    ~backend_name:"PS"
+    ~filename:"basket.ps"
+    Cairo_ps.surface_create_for_channel ;
 
-  begin
-    prerr_endline "PDF" ;
-    do_file_out "basket.pdf"
-      (fun oc ->
-	let s = Cairo_pdf.surface_create_for_channel oc (x_inches *. 72.) (y_inches *. 72.) in
-	let c = Cairo.create s in
-	draw c ;
-	Cairo.show_page c ;
-	Cairo.surface_finish s)
-  end ;
+  file_backend
+    ~backend_name:"PDF"
+    ~filename:"basket.pdf"
+    Cairo_pdf.surface_create_for_channel ;
+
+  file_backend
+    ~backend_name:"SVG"
+    ~filename:"basket.svg"
+    Cairo_svg.surface_create_for_channel ;
 
   begin
     prerr_endline "Bigarray, PPM and PNG (ARGB32) " ;



More information about the cairo-commit mailing list