PES CSewSeg section - frno7/libpes GitHub Wiki
The first CSewSeg segment block's header is the data of the CEmbOne block. If the PES header declares the number of csewseg_segment_block to be 1, then this block contains only the csewseg_segment_block. If zero then this block would be omitted. But, if greater than one, then additional headers and csewseg_segment_blocks are appended within this block.
Type |
Bytes |
Value |
Description |
u16 |
2 |
7 |
Length of following string |
char |
7 |
"CSewSeg" |
CSewSeg identification |
csewseg_segment_block |
|
|
CSewSeg segment block |
header |
|
|
CSewSeg header (optional) |
segment_block |
|
|
CSewSeg segment block (optional) |
... |
|
|
Additional header / segment-block sequences (optional) |
CSewSeg segment block
CSewSeg stitch list subsection
The CSewSeg stitch list subsection is divided into stitch blocks. The last block does not end with the continuation code 0x8003
and so is 2 bytes shorter than the others. Some files seem to limit the number of stitches to a maximum of 1000 per block, is this required?
Type |
Bytes |
Value |
Description |
u16 |
2 |
0 | 1 | ? |
Stitch type where 0 means a normal stitch and 1 means a jump stitch |
u16 |
2 |
|
Thread index for block + 1 |
u16 |
2 |
N |
Number of following coordinates |
csewseg_coordinates |
4 × N |
|
CSewSeg coordinate subsection |
u16 |
2 |
0x8003 | ? |
Continuation code where 0x8003 means list continues with another following block, with the last block not having this field at all |
CSewSeg coordinate subsection
Type |
Bytes |
Value |
Description |
s16 |
2 |
|
Stitch x coordinate |
s16 |
2 |
|
Stitch y coordinate |
CSewSeg color list subsection
Type |
Bytes |
Value |
Description |
u16 |
2 |
N |
Number of following colors |
csewseg_color |
4 × N |
|
CSewSeg color subsection |
CSewSeg color subsection
Type |
Bytes |
Value |
Description |
u16 |
2 |
|
Block index where change of thread takes effect, starting from zero |
u16 |
2 |
|
In PES versions 1 through 4 this is a PEC thread palette index and in versions 5 and 6 this is a thread index defined in the PES header section |
Header
The header for the first block is contained within the CEmbOne section. However, if the PES Header specified that there would be more than one CSewSeg object these headers will be appended along with additional stitchgroups.
Type |
Bytes |
Value |
Description |
u16 |
2 |
7 |
Length of following string |
char |
7 |
"CEmbOne" |
CEmbOne identification |
section |
40 |
|
Block Geometry, Extents and Affine Transformation |
u16 |
2 |
1 (typical) |
Unknown |
s16 |
2 |
|
CSewSeg x coordinate translation? |
s16 |
2 |
|
CSewSeg y coordinate translation? |
s16 |
2 |
|
CSewSeg width |
s16 |
2 |
|
CSewSeg height |
u8 |
8 |
0 (typical) |
Unknown |
u16 |
2 |
|
CSewSeg block count |