kopia lustrzana https://github.com/EmbroidePy/pyembroidery
Fix python2 pecgraphics scale bug
rodzic
abaca51112
commit
c2bdf4a76d
|
@ -94,8 +94,8 @@ def draw_scaled(extends, points, graphic, stride, buffer=5):
|
||||||
if diagram_height == 0:
|
if diagram_height == 0:
|
||||||
diagram_height = 1
|
diagram_height = 1
|
||||||
|
|
||||||
scale_x = (graphic_width - buffer) / diagram_width
|
scale_x = (graphic_width - buffer) / float(diagram_width)
|
||||||
scale_y = (graphic_height - buffer) / diagram_height
|
scale_y = (graphic_height - buffer) / float(diagram_height)
|
||||||
|
|
||||||
scale = min(scale_x, scale_y)
|
scale = min(scale_x, scale_y)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ def read_u01_stitches(f, out):
|
||||||
if (ctrl & 0x40) != 0:
|
if (ctrl & 0x40) != 0:
|
||||||
dy = -dy
|
dy = -dy
|
||||||
command = ctrl & 0b11111
|
command = ctrl & 0b11111
|
||||||
# print(str(count), " ", str("{0:b}").format(ctrl), " 0x%0.2X " % ctrl, str(command), " " + str(dx), " ", str(dy))
|
|
||||||
if command == 0x0:
|
if command == 0x0:
|
||||||
# Stitch
|
# Stitch
|
||||||
out.stitch(dx, dy)
|
out.stitch(dx, dy)
|
||||||
|
@ -51,20 +50,28 @@ def read_u01_stitches(f, out):
|
||||||
continue
|
continue
|
||||||
if command == 0x06:
|
if command == 0x06:
|
||||||
# T1 Top Thread Trimming, TTrim.
|
# T1 Top Thread Trimming, TTrim.
|
||||||
out.trim(dx, dy)
|
out.trim()
|
||||||
|
if dx != 0 or dy != 0:
|
||||||
|
out.move(dx, dy)
|
||||||
continue
|
continue
|
||||||
if command == 0x07:
|
if command == 0x07:
|
||||||
# T2 Bobbin Threading
|
# T2 Bobbin Threading
|
||||||
out.trim(dx, dy)
|
out.trim()
|
||||||
|
if dx != 0 or dy != 0:
|
||||||
|
out.move(dx, dy)
|
||||||
continue
|
continue
|
||||||
if command == 0x08: # ww, stop file had proper A8 rather than E8 and displacement
|
if command == 0x08: # ww, stop file had proper A8 rather than E8 and displacement
|
||||||
# C00 Stop
|
# C00 Stop
|
||||||
out.stop(dx, dy)
|
out.stop()
|
||||||
|
if dx != 0 or dy != 0:
|
||||||
|
out.move(dx, dy)
|
||||||
continue
|
continue
|
||||||
if 0x09 <= command <= 0x17:
|
if 0x09 <= command <= 0x17:
|
||||||
# C01 - C14
|
# C01 - C14
|
||||||
if count > 1:
|
if count > 1:
|
||||||
out.color_change(dx, dy)
|
out.color_change()
|
||||||
|
if dx != 0 or dy != 0:
|
||||||
|
out.move(dx, dy)
|
||||||
continue
|
continue
|
||||||
if command == 0x18:
|
if command == 0x18:
|
||||||
break
|
break
|
||||||
|
|
|
@ -87,7 +87,7 @@ def vp3_read_colorblock(f, read_object, center_x, center_y):
|
||||||
y = signed16(stitch_bytes[i], stitch_bytes[i + 1])
|
y = signed16(stitch_bytes[i], stitch_bytes[i + 1])
|
||||||
i += 2
|
i += 2
|
||||||
if abs(x) > 255 or abs(y) > 255:
|
if abs(x) > 255 or abs(y) > 255:
|
||||||
read_object.trim(0, 0)
|
read_object.trim()
|
||||||
read_object.move(x, y)
|
read_object.move(x, y)
|
||||||
else:
|
else:
|
||||||
read_object.stitch(x, y)
|
read_object.stitch(x, y)
|
||||||
|
@ -98,8 +98,8 @@ def vp3_read_colorblock(f, read_object, center_x, center_y):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
read_object.stitch(x, y)
|
read_object.stitch(x, y)
|
||||||
read_object.trim(0, 0)
|
read_object.trim()
|
||||||
read_object.color_change(0, 0)
|
read_object.color_change()
|
||||||
|
|
||||||
|
|
||||||
def vp3_read_thread(f):
|
def vp3_read_thread(f):
|
||||||
|
|
Ładowanie…
Reference in New Issue