Skip to content

Commit 5cb7ffe

Browse files
authored
Merge pull request #70 from EmbroidePy/tatarize-vp3-trims
Corrections for trims for the VP3Reader/Writer
2 parents 529262d + 8be565e commit 5cb7ffe

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pyembroidery/Vp3Reader.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def read(f, out, settings=None):
5555
count_colors = read_int_16be(f)
5656
for i in range(0, count_colors):
5757
vp3_read_colorblock(f, out, center_x, center_y)
58+
if (i + 1) < count_colors: # Don't add the color change on the final read.
59+
out.color_change()
5860

5961

6062
def vp3_read_colorblock(f, out, center_x, center_y):
@@ -96,10 +98,7 @@ def vp3_read_colorblock(f, out, center_x, center_y):
9698
elif y == 0x02:
9799
pass # ends long stitch mode.
98100
elif y == 0x03:
99-
out.end(0, 0)
100-
return
101-
out.trim()
102-
out.color_change()
101+
out.trim()
103102

104103

105104
def vp3_read_thread(f):

pyembroidery/Vp3Writer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,12 @@ def write_stitches_block(f, stitches, first_pos_x, first_pos_y):
225225
y = stitch[1]
226226
flags = stitch[2] & COMMAND_MASK
227227
if flags == END:
228-
f.write(b'\x80\x03')
228+
f.write(b'\x80\x03') # Write a trim at end of file.
229229
break
230230
elif flags == COLOR_CHANGE:
231231
continue
232232
elif flags == TRIM:
233+
f.write(b'\x80\x03')
233234
continue
234235
elif flags == SEQUIN_MODE:
235236
continue

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="pyembroidery",
8-
version="1.4.2",
8+
version="1.4.3",
99
author="Tatarize",
1010
author_email="[email protected]",
1111
description="Embroidery IO library",

0 commit comments

Comments
 (0)