I want to write a small knitting program for my wife. In it, I will also read * .stp files (Stitch pattern). These are small files containing a graphic created by the program DesignaKnit and many of which are files on the Internet. (Examples z. B. to http://www.stricknetz.net/muster/dateien/). To read it I need of course the format. Since I found it nowhere I tried to decipher. I have found much, but not get ahead now and hope to help.
Here what I found out:
Byte 0-2: D7C
Byte 3-4: width
Byte 5-6: Height
Byte 7-8: width
Byte 9-10: Height
Byte 11-12: number of pattern repeats Horizontal
Byte 13-14: Number of vertical pattern repeats
Byte 44: 'Knitting technique:
'0 = different - see the pattern ????
'1 = marquetry
'2 = 2-color jacquard
'3 = 3-color jacquard
'4 = 4-color jacquard
'12 = Handstrick
'14 = Structure pattern right side
'15 = Textured pattern left
Byte 177-209: Font name - padded with 0 (209 = End 0)
248-249 = height (number of rows)
250-251 = size image data in bytes
252 - (252 + image data size) = image data - (somehow RLE - compressed)
Then: 2 bytes = height (number of rows or number ???)
then 2 bytes Size of data
then ending bytes
then unknown data
then pallet (48 colors - if color is not used to zero)
Color 1 = 25 bytes
Byte 0: number?
Byte 1: message numbers
Byte 3: Number
Byte 6-8: RGB color
Byte 9: Length Color Name
Byte 10-24: color name with a final 0 (at length 15 without 0)
But I'm stuck with the RLE encoding of data. They are somehow specially coded. The figures (for number the same color, but also for the number in the range) switch repeatedly. z. B.
00h 05h 21h 00h 22h 02h 29h 0Ch
Color 1 | 2 Color | Color 1 | 2 Color | Color 1 | 2 Color | Color 1 | Colour 2 | etc.
Thus, the position changes in the pallet continuously (or to re-calculate - for example color 1 in the example. 00h, 21h, 22h, 29h ...)
But the number of same-colored pixels in the RLE-encoded bytes changes constantly. So 2 is the same color pixels once B3h, then B9H, then again B9H, then B4h etc. In tests I found out that it is connected with any bytes from position 35h (decimal 53). But I do not come on. I tried to look in a program that they can read files with IDA (SilverKnit Utility (www.silverknit.nl/download/) -. But since I speak no assembler I not get Perhaps someone can help me the riddle of STP to solve files (if at all possible) ??????????????????
Alfred