]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/matitaMathView.ml
more on screenshot
[helm.git] / helm / software / matita / matitaMathView.ml
index 492aece49cf3b3a322fdad5065ef7909f45ab615..ad0a66294db314ff2ac47be9c59e45b2ee9df6ea 100644 (file)
@@ -1576,23 +1576,29 @@ let mathViewer () =
     method show_uri_list ?(reuse=false) ~entry l =
       (self#get_browser reuse)#load entry
 
-    method screenshot status sequent metasenv subst filename =
+    method screenshot status sequent metasenv subst (filename as ofn) =
        let mathml = 
          ApplyTransformation.nmml_of_cic_sequent status metasenv subst sequent
        in
        let w = GWindow.window ~title:"screenshot" () in
+       let width = 600 in
+       let height = 2000 in
        let m = GMathView.math_view 
-          ~font_size:!current_font_size ~width:500 ~height:400 
+          ~font_size:!current_font_size ~width ~height
           ~packing:w#add
           ~show:true ()
        in
        w#show ();
        m#load_root ~root:mathml#get_documentElement;
        let pixmap = m#get_buffer in
-       let pixbuf = GdkPixbuf.create ~width:500 ~height:400 () in
+       let pixbuf = GdkPixbuf.create ~width ~height () in
        GdkPixbuf.get_from_drawable ~dest:pixbuf pixmap;
-       let filename = filename ^ ".png" in
+       let filename = filename ^ "-raw.png" in
        GdkPixbuf.save ~filename ~typ:"png" pixbuf;
+       ignore(Sys.command (Printf.sprintf 
+         "convert -trim -border 3 -bordercolor white %s %s" 
+         (Filename.quote filename) 
+         (Filename.quote (ofn ^ ".png")))); 
        w#destroy ();
   end