Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix vp3 trims #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyembroidery/Vp3Reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def read(f, out, settings=None):
skip_vp3_string(f) # "Produced by Software Ltd"
count_colors = read_int_16be(f)
for i in range(0, count_colors):
if i != 0:
out.color_change()
vp3_read_colorblock(f, out, center_x, center_y)


Expand Down Expand Up @@ -94,8 +96,7 @@ def vp3_read_colorblock(f, read_object, center_x, center_y):
elif y == 0x02:
pass # ends long stitch mode.
elif y == 0x03:
read_object.end(0, 0)
return
read_object.trim()
else:
read_object.stitch(x, y)
read_object.trim()
Expand Down
3 changes: 2 additions & 1 deletion pyembroidery/Vp3Writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,12 @@ def write_stitches_block(f, stitches, first_pos_x, first_pos_y):
y = stitch[1]
flags = stitch[2]
if flags == END:
f.write(b'\x80\x03')
f.write(b'\x80\x03') # trim at end of file
break
elif flags == COLOR_CHANGE:
continue
elif flags == TRIM:
f.write(b'\x80\x03')
continue
elif flags == SEQUIN_MODE:
continue
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pyembroidery",
version="1.2.39",
version="1.2.40",
author="Tatarize",
author_email="[email protected]",
description="Embroidery IO library",
Expand Down