unison

Fork of Unison, a bi-directional file synchronization tool
git clone git://git.laack.co/unison.git
Log | Files | Refs | README | LICENSE

svg_to_data.ml (466B)


      1 
      2 (*
      3    Create a bitmap from a svg file, containing raw data suitable to be
      4    loaded using GdkPixbuf.from_data.
      5 
      6    Usage:
      7     lablgtk2 svg_data.ml U.svg > /tmp/U.data
      8 *)
      9 
     10 let buf = Rsvg.render_from_file Sys.argv.(1)
     11 let _ =
     12 Format.printf "\"";
     13 let s = Gpointer.string_of_region (GdkPixbuf.get_pixels buf) in
     14 for i = 0 to 575 do
     15   Format.printf "%s" (String.escaped (String.sub s (i * 16) 16));
     16   if i = 575 then Format.printf "\"@." else Format.printf "\\@. "
     17 done