Fix python2 pecgraphics scale bug

pull/10/head
tatarize 2018-08-22 00:23:00 -07:00 zatwierdzone przez GitHub
rodzic abaca51112
commit c2bdf4a76d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 17 dodań i 10 usunięć

Wyświetl plik

@ -94,8 +94,8 @@ def draw_scaled(extends, points, graphic, stride, buffer=5):
if diagram_height == 0:
diagram_height = 1
scale_x = (graphic_width - buffer) / diagram_width
scale_y = (graphic_height - buffer) / diagram_height
scale_x = (graphic_width - buffer) / float(diagram_width)
scale_y = (graphic_height - buffer) / float(diagram_height)
scale = min(scale_x, scale_y)

Wyświetl plik

@ -16,7 +16,6 @@ def read_u01_stitches(f, out):
if (ctrl & 0x40) != 0:
dy = -dy
command = ctrl & 0b11111
# print(str(count), " ", str("{0:b}").format(ctrl), " 0x%0.2X " % ctrl, str(command), " " + str(dx), " ", str(dy))
if command == 0x0:
# Stitch
out.stitch(dx, dy)
@ -51,20 +50,28 @@ def read_u01_stitches(f, out):
continue
if command == 0x06:
# T1 Top Thread Trimming, TTrim.
out.trim(dx, dy)
out.trim()
if dx != 0 or dy != 0:
out.move(dx, dy)
continue
if command == 0x07:
# T2 Bobbin Threading
out.trim(dx, dy)
out.trim()
if dx != 0 or dy != 0:
out.move(dx, dy)
continue
if command == 0x08: # ww, stop file had proper A8 rather than E8 and displacement
# C00 Stop
out.stop(dx, dy)
out.stop()
if dx != 0 or dy != 0:
out.move(dx, dy)
continue
if 0x09 <= command <= 0x17:
# C01 - C14
if count > 1:
out.color_change(dx, dy)
out.color_change()
if dx != 0 or dy != 0:
out.move(dx, dy)
continue
if command == 0x18:
break

Wyświetl plik

@ -87,7 +87,7 @@ def vp3_read_colorblock(f, read_object, center_x, center_y):
y = signed16(stitch_bytes[i], stitch_bytes[i + 1])
i += 2
if abs(x) > 255 or abs(y) > 255:
read_object.trim(0, 0)
read_object.trim()
read_object.move(x, y)
else:
read_object.stitch(x, y)
@ -98,8 +98,8 @@ def vp3_read_colorblock(f, read_object, center_x, center_y):
return
else:
read_object.stitch(x, y)
read_object.trim(0, 0)
read_object.color_change(0, 0)
read_object.trim()
read_object.color_change()
def vp3_read_thread(f):