Jump to content

Projects/Liberty/File Formats/Viking Pfaff

From KDE Community Wiki
Revision as of 21:56, 15 August 2012 by Purple-bobby (talk | contribs) (Hoop-header: clarify canvas tag)

Viking/Husqvarna Pfaff/Singer 3 VP3

The VP3 file format appears to be series of nested sections. Most sections contain tagged records.

In the style of Backus–Naur Form,

File = File-header Extent

Extent = Extent-header {Hoop}

Hoop = Hoop-header Canvas Threads

Threads = Threads-header {Thread}

Thread = Thread-header Colours Thread-text Thread-detail Stitches Thread-end

Colours = {Colour-detail}

Stitches = Stitches-header {Stitch}

Stitch = Escaped-command | Displacement

File-header

Offset Length Type Description
0 6 ASCIIZ Signature = "%vsn%"
6 N1 N-WStr Producer 16 bit big-endian length in bytes followed by 16 bit characters
6+N1

Extent-header

Offset Length Type Description
0 3 Tag Extent-tag 00 02 00 three bytes
3 4 Length Extent-len remaining bytes in file
3 N2 N-WStr Settings human readable debugging notes
7+N2 4 MicroM Extent-top top edge of stitching in um
11+N2 4 MicroM Extent-right
15+N2 4 MicroM Extent-bottom
19+N2 4 MicroM Extent-left
23+N2 4 Count Total-stitch-count
27+N2 2 Count Total-thread-count
29+N2 1 Byte unknown = 12
30+N2 2 Count unknown = 1 may be hoop-count

Hoop-header

Offset Length Type Description
0 3 Tag Hoop-tag = 00 03 00
3 4 Length Hoop-len
7 4 MicroM Centre-X
11 4 MicroM Centre-Y
15 3 Tag Canvas-tag = 00 00 00 (or unknown)
18 4 MicroM Hoop-left
22 4 MicroM Hoop-right
26 4 MicroM Hoop-bottom
30 4 MicroM Hoop-top
34 4 MicroM Hoop-width
38 4 MicroM Hoop-height
42 N3 N-WStr Settings-2 second copy of Settings
42+N3 1 Byte unknown = 100
43+N3 1 Byte unknown = 100
44+N3 4 int unknown = 4096
48+N3 4 int unknown = 0
52+N3 4 int unknown = 0
56+N3 4 int unknown = 4096

Threads-header

Offset Length Type Description
0 6 Bytes Threads-sig = 120 120 80 80 1 0
6 N4 N-WStr Producer-2 copy of producer text
6+N4 2 Count Thread-count

Thread

Offset Length Type Description
0 3 Tag Thread-tag = 00 05 00
3 4 Length Thread-len bytes to next thread
7 4 MicroM Start-X
11 4 MicroM Start-Y
15 1 Count Colours-per-thread
16 1 Byte unknown = 0
17 N5 Table Colours
17+N5 1 Code Thread-type-tension
18+N5 1 Byte Thread-weight
19+N5 N6 Record Thread-text human readable thread description
19+N5+N6 4 MicroM unknown-X
23+N5+N6 4 MicroM unknown-Y
27+N5+N6 N7 Record Stitches
27+N5+N6+N7 1 Byte unknown = 0

Colour-detail

Offset Length Type Description
0 3 RRGGBB Colour-RGB
3 1 Byte unknown = 0 or 10
4 1 Byte unknown = 0
5 1 Byte unknown = 0, 20, or 10

Thread-text

Offset Length Type Description
0 N6a N-Str Thread-code 16 bit length followed by ASCII characters part-number
0+N6a N6b N-Str Thread-name human readable name of thread
0+N6a+N6b N6c N-Str Thread-manu maker, material and weight

Stitches-header

Offset Length Type Description
0 3 Tag Stitches-tag = 00 01 00
3 4 Length Stitches-len
7 1 Byte Scale-X = 10
8 1 Byte Scale-Y = -10
9 1 Byte unknown = 0

Escaped-command

Offset Length Type Description
0 1 Byte Escape = -128 or 0x80
1 1 Byte Command-code
Command-code Description
0 Deleted or null stitch
1 Move followed by 16 bit displacement-X and 16 bit displacement-Y
2 End-move
3 Deleted or null stitch

Displacement

Offset Length Type Description
0 1 Byte Displacement-X -127 to 127 in 0.1 mm
1 1 Byte Displacement-Y -127 to 127 in -0.1 mm


Other References

The VP3 File Format external page contains an overview of this format.