Embroidermodder / libembroidery

Library for reading/writing/manipulating machine and design embroidery files
https://www.libembroidery.org
zlib License
47 stars 14 forks source link

Update formats.c #194

Closed fabricocouto closed 2 years ago

fabricocouto commented 2 years ago

for all the tests and readings of the binary of this file the closest to a stop chance color would be like this, at least in files generated by wilcom

if ((bcode & 0xE1) ==225)
robin-swift commented 2 years ago

I'm confused: your quoted line doesn't match the patch.

if ((bcode & 0xE1) ==225)

0xE1 means the byte 0b11100001 and 225 means the byte 0b11100001, so this is saying bcode is any byte 0b111xxxx1 where x is a wildcard for 1 bit of either value.

In your patch, if ((bcode & 0xE1) != 0) meaning 0byyyxxxxy where at least one y is non-zero and x is any.

Can you show me a stop in context? Like the hex corresponding to the stop in a simple file exported to .bro format?

fabricocouto commented 2 years ago

image image gm goncalves.zip

if ((code & 0xE1) == 225) { flags = StitchType.fSTOP; colorcont++; }

fabricocouto commented 2 years ago

image

fabricocouto commented 2 years ago

So I came to the conclusion that wilcom uses 0xE1 when embird uses 2 It's a bit confusing, but it's working. I believe wilcom does not use 2 for color change

if ((code & 0xE1) == 225 || code == 2) {flags = StitchType.fSTOP;colorcont++;} image