-
Notifications
You must be signed in to change notification settings - Fork 10
PEC section
The first part of the PEC section is 512 bytes.
Type | Bytes | Value | Description |
---|---|---|---|
char |
19 | Label string prefixed with "LA:" and padded with space (0x20 ) |
|
char |
1 | '\r' |
carriage return character |
u8 |
11 |
0x20 (typical) |
Unknown |
u8 |
1 |
0x20 | 0xFF | ? |
Unknown |
u16 |
2 |
0x00FF (typical) |
Unknown |
u8 |
1 |
6 (typical) |
Thumbnail image width in bytes, with 8 bit pixels per byte, so 6 would mean 6×8 = 48 pixels per line |
u8 |
1 |
38 (typical) |
Thumbnail image height in pixels |
u8 |
12 |
0x00 | 0x20 | 0x64 | 0xFF | ? |
Unknown, usually 20 20 20 20 64 20 00 20 00 20 20 20 |
u8 |
1 | N | Number of colors minus one, 0xFF means 0 colors. |
u8 |
1 + N | Palette index | |
u8 |
462 - N |
0x20 (typical) |
Unknown |
Then follows the second part of the PEC section.
Type | Bytes | Value | Description |
---|---|---|---|
u16 |
2 |
0x0000 (typical) |
Unknown |
u16 |
2 | Offset to thumbnail image subsection relative to the PEC section offset plus 512 bytes | |
u16 |
2 |
0x3100 (typical) |
Unknown |
u16 |
2 |
0xF0FF (typical) |
Unknown |
s16 |
2 | Width | |
s16 |
2 | Height | |
u16 |
2 |
0x01E0 (typical) |
Unknown |
u16 |
2 |
0x01B0 (typical) |
Unknown |
4 | Unknown | ||
pec_stitch_list |
PEC stitch list subsection | ||
pec_thumbnail_images |
PEC thumbnail image subsection |
The PEC stitch list come in dx and dy relative coordinate pairs. Depending on the bit patterns used, 2, 3 or 4 bytes are used for the coordinate pairs as explained below. Note that if the first coordinates are (0, 0) the embroidery machine apparently ignores them. The first nonzero coordinate pair is relative to the minimum bound coordinates.
Type | Bytes | Value | Description |
---|---|---|---|
u8 |
1 | Stitch dx coordinate | |
u8 |
1 | Stitch dy coordinate |
Some combined dx and dy values have special meaning. After a stop stitch, an alternating byte of 2 and 1 is encoded, starting with 2. The end of the stitch list is coded with 0xFF
for dx but no value for dy. To encode a stop stitch, dx is 0xFE
.
If the most significant bit is cleared but dx or dy is greater than 0x3F
, then their value is subtracted by 0x80
to yield a negative value, respectively.
If the most significant bit is set in dx, the following is computed. If bit 6 is set the stitch is a trim stitch, or if bit 5 is set then the stitch is a jump stitch. The 4 least significant bits in dx are masked and multiplied by 256 and dy is added to dx to yield a 12 bit dx. If dx is greater than 0x7FF
then the value is subtracted by 0x1000
to yield a negative value. A following u8
byte is used for a new dy value.
If the most significant bit is set in dy, the following is computed. If bit 6 is set the stitch is a trim stitch, or if bit 5 is set then the stitch is a jump stitch. The 4 least significant bits in dy are masked and multiplied by 256 and the following u8
byte is added to dy to yield a 12 bit dy. If dy is greater than 0x7FF
then the value is subtracted by 0x1000
to yield a negative value.
There is always one main thumbnail image plus one for each color. The size of each thumbnail is the thumbnail width multiplied with the thumbnail height number of bytes (width and height are given in the PEC section). The pixels are oriented from the top left corner, with one pixel per bit starting with the most significant bit in the first byte.
PES format
- PES format overview
- PES section
- PEC section
- PEC thread palette
- Write PES
- Write PEC
- Unknowns