contrib/inkscape_tools: remove old_style constructor and whitespace error
[nit.git] / contrib / inkscape_tools / src / svg_to_png_and_nit.nit
index 1a2d7b3..f718255 100644 (file)
@@ -38,7 +38,6 @@ class ImageSetSrc
        super Template
 
        var name: String
-       init(name: String) do self.name = name
 
        var attributes = new Array[String]
        var load_exprs = new Array[String]
@@ -141,7 +140,7 @@ for drawing in drawings do
        # Inkscape doesn't give us this information
        var page_width = -1
        var page_height = -1
-       var svg_file = new IFStream.open(drawing)
+       var svg_file = new FileReader.open(drawing)
        while not svg_file.eof do
                var line = svg_file.read_line
 
@@ -164,7 +163,7 @@ for drawing in drawings do
 
        # Query Inkscape
        var prog = "inkscape"
-       var proc = new IProcess.from_a(prog, ["--without-gui", "--query-all", drawing])
+       var proc = new ProcessReader.from_a(prog, ["--without-gui", "--query-all", drawing])
 
        var min_x = 1000000
        var min_y = 1000000
@@ -177,14 +176,14 @@ for drawing in drawings do
        while not proc.eof do
                var line = proc.read_line
                var words = line.split(",")
-               
+
                if words.length == 5 then
                        var id = words[0]
 
                        var x = words[1].to_f.floor.to_i
                        var y = words[2].to_f.floor.to_i
-                       var w = words[3].to_f.ceil.to_i
-                       var h = words[4].to_f.ceil.to_i
+                       var w = words[3].to_f.ceil.to_i+1
+                       var h = words[4].to_f.ceil.to_i+1
 
                        if id.has_prefix("0") then
                                var nit_name = id.substring_from(1)
@@ -240,7 +239,7 @@ for drawing in drawings do
        end
 
        # Output source file
-       var src_file = new OFStream.open("{src_path}/{drawing_name}.nit")
+       var src_file = new FileWriter.open("{src_path}/{drawing_name}.nit")
        nit_src.write_to(src_file)
        src_file.close