[cairo-commit] cairo-ocaml/test basket.ml,1.1.1.1,1.2

Olivier Andrieu commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005


Committed by: oandrieu

Update of /cvs/cairo/cairo-ocaml/test
In directory pdx:/tmp/cvs-serv5006/test

Modified Files:
	basket.ml 
Log Message:
wrap cairo_current_path and cairo_current_path_flat

Index: basket.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/test/basket.ml,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/basket.ml	18 Nov 2003 19:02:26 -0000	1.1.1.1
--- b/basket.ml	22 Feb 2004 22:41:26 -0000	1.2
***************
*** 3,7 ****
    Cairo.init
  
! let draw c =
    Cairo.move_to c 10. 10. ;
    Cairo.line_to c 510. 10. ;
--- 3,24 ----
    Cairo.init
  
! let print_path_elem = function
!   | `MOVE_TO { Cairo.x = x ; Cairo.y = y } ->
!       Format.printf "@ move_to (%f, %f)" x y
!   | `LINE_TO { Cairo.x = x ; Cairo.y = y } ->
!       Format.printf "@ line_to (%f, %f)" x y
!   | `CURVE_TO ({ Cairo.x = x1 ; Cairo.y = y1 },
! 	       { Cairo.x = x2 ; Cairo.y = y2 },
! 	       { Cairo.x = x3 ; Cairo.y = y3 }) ->
!       Format.printf "@ curve_to (%f, %f, %f, %f, %f, %f)" x1 y1 x2 y2 x3 y3
!   | `CLOSE ->
!       Format.printf "@ close\n"
! let print_path c =
!   Format.printf "@[<v 2>current_path:" ;
!   let nb = Cairo.fold_current_path c
!       (fun nb el -> print_path_elem el ; nb+1) 0 in
!   Format.printf "@]%d elements at ." nb
! 
! let draw ?(print=false) c =
    Cairo.move_to c 10. 10. ;
    Cairo.line_to c 510. 10. ;
***************
*** 9,15 ****
    Cairo.close_path c ;
    
!   Cairo.save c ;
!   Cairo.set_rgb_color c 0.8 0.1 0.1 ;
!   Cairo.fill c ;
    Cairo.restore c ;
  
--- 26,34 ----
    Cairo.close_path c ;
    
!   if print then print_path c ;
!   
!   Cairo.save c ; begin
!     Cairo.set_rgb_color c 0.8 0.1 0.1 ;
!     Cairo.fill c end ;
    Cairo.restore c ;
  
***************
*** 18,21 ****
--- 37,42 ----
    Cairo.stroke c
  
+ 
+ 
  let width = 520.
  let height = 170.
***************
*** 34,40 ****
      close_out oc ;
      Cairo.set_target_ps c file x_inches y_inches x_ppi y_ppi ;
!     draw c ;
      Cairo.show_page c ;
!     Cairo.finalise_target_ps c ;
      Cairo_channel.close file
    end ;
--- 55,61 ----
      close_out oc ;
      Cairo.set_target_ps c file x_inches y_inches x_ppi y_ppi ;
!     draw ~print:true c ;
      Cairo.show_page c ;
!     Cairo.finalise_target c ;
      Cairo_channel.close file
    end ;





More information about the cairo-commit mailing list