diff --git a/README.md b/README.md index e7fe9fc..3b35b01 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Converts .svg files generated by Aseprite to TempleOS GR format, preserving pale # Notes -Tested w/ Aseprite v1.2.33-x64 +Tested w/ Aseprite v1.3.17-x64 # Usage diff --git a/svg2GR b/svg2GR index d251dba..23b7e27 100755 --- a/svg2GR +++ b/svg2GR @@ -26,20 +26,25 @@ def main(): height = int(get_attr(svg_rows[1], "height")) width_internal = (width + 7) & (-8); - x = 0 - y = 0 - color = 0 buffer = bytearray([255]) * (height * width_internal) i = 2 while i < len(svg_rows) - 1: x = int(get_attr(svg_rows[i], "x")) y = int(get_attr(svg_rows[i], "y")) + rw = int(get_attr(svg_rows[i], "width")) + rh = int(get_attr(svg_rows[i], "height")) if "opacity" in svg_rows[i]: color = 255 else: color = color_lookup[get_attr(svg_rows[i], "fill")] - buffer[(y * width_internal) + x] = color + iy = y; + while iy < y + rh: + ix = x + while ix < x + rw: + buffer[(iy * width_internal) + ix] = color + ix += 1 + iy += 1 i += 1 f = open(svg_file.replace(".svg",".GR"), "wb")