File: durformat.md

package info (click to toggle)
durdraw 0.29.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,284 kB
  • sloc: python: 10,234; xml: 330; sh: 6; makefile: 2
file content (186 lines) | stat: -rw-r--r-- 6,330 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
Durdraw File Format version 7 (draft) - May 2023

Durdraw is an ANSI art editor that handles animation, Unicode and 256 color. This document describes its primary file format, "dur."

Durdraw files store color text art (both animated and static) in a file format with the ".dur" file extension. This is a JSON file that has been gzipped. It contains an object named "DurMovie" with a set of key/values specifying metadata and "movie" data. Movie data includes the color format (16 and 256 for now), character encoding, canvas size, frame rate, etc. Metadata includes the artwork name and artist name, which can be used to generate "sauce" records.

"DurMovie" contains an array called "frames." Each element of "frames" is a Frame object, which contains a frame number, a delay amount (in seconds), a "contents" array, and a "colorMap" array.

The "contents" array contains strings, each one of which represents a line of ASCII or Utf-8 text in a frame of art. This can be thought of as a flat ASCII (or Unicode) art file which has been separated into lines, with each line stored as a string in the array.

Similarly, colorMap contains an array of lines, wich each line containing a list of foreground and background color pairs. For example, the pair [1,0] represents blue text with a black background.

Each element of the colorMap should coordinate with a corresponding line and column in the contents. For example, colorMap[2][3] should describe the foreground and background color for the character at contents[2][3], which is the character at Line 2, Column 3 of the given frame.

Here is the full list of JSON keys stored in a DurMovie object, and their purpose:

```
"formatVersion" - The DurDraw file format version
"colorFormat" - The color format of the movie. 16, 256, RGB, mIRC, etc.
"preferredFont" - The preferred font to use (optional)
"encoding" - Text encoding format. Options include "utf-8" and "cp437"
"name" - The name of the movie or artwork
"artist" - The artist name
"framerate" - The playback speed, specified as Frames Per Second
"columns" - The number of columns in the canvas (formerly sizeX)
"lines" - The number of lines in the canvas (formerly sizeY)
"extra" - This can be used to store any JSON object that the user wants to include with their art, perhaps to be used in a custom way. It is not used for anything by Durdraw. (optional)

"frames" - An array of frame objects
"delay" - the amount of time to stay on a frame, in seconds
"contents" - An array of lines containing the ASCII or Unicode artwork
"colorMap" - An array of arrays containing the foreground and background colors for a given line and column in the canvas
```

Here is an example Durdraw file, containing an animation with 3 lines, 10 columns and 6 frames:

```
{
  "DurMovie": {
    "formatVersion": 7,
    "colorFormat": "256",
    "preferredFont": "fixed",
    "encoding": "utf-8",
    "name": "",
    "artist": "",
    "framerate": 6.0,
    "sizeX": 10,
    "sizeY": 3,
    "extra": null,
    "frames": [
      {
        "frameNumber": 1,
        "delay": 0,
        "contents": [
          "O         ",
          "          ",
          "          "
        ],
        "colorMap": [
          [[12, 8],[1, 0],[1, 0]],
          [[1, 0],[7, 8],[1, 0]],
          [[7, 8],[7, 8],[1, 0]],
          [[7, 8],[7, 8],[1, 0]],
          [[7, 8],[7, 8],[7, 8]],
          [[7, 8],[7, 8],[7, 8]],
          [[7, 8],[7, 8],[7, 8]],
          [[7, 8],[1, 0],[1, 0]],
          [[7, 8],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]
          ]
        ]
      },
      {
        "frameNumber": 2,
        "delay": 0,
        "contents": [
          "          ",
          " O        ",
          "          "
        ],
        "colorMap": [
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[12, 8],[1, 0]],
          [[1, 0],[7, 8],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]
          ]
        ]
      },
      {
        "frameNumber": 3,
        "delay": 0,
        "contents": [
          "          ",
          "          ",
          "  O       "
        ],
        "colorMap": [
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[7, 8],[1, 0]],
          [[1, 0],[7, 8],[12, 8]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]
          ]
        ]
      },
      {
        "frameNumber": 4,
        "delay": 0,
        "contents": [
          "          ",
          "          ",
          "  o       "
        ],
        "colorMap": [
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[7, 8],[1, 0]],
          [[1, 0],[7, 8],[12, 8]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]
          ]
        ]
      },
      {
        "frameNumber": 5,
        "delay": 0,
        "contents": [
          "          ",
          "   O      ",
          "          "
        ],
        "colorMap": [
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[7, 8],[1, 0]],
          [[1, 0],[7, 8],[7, 8]],
          [[1, 0],[12, 8],[12, 8]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]
          ]
        ]
      },
      {
        "frameNumber": 6,
        "delay": 0,
        "contents": [
          "     O    ",
          "          ",
          "          "
        ],
        "colorMap": [
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[7, 8],[1, 0]],
          [[1, 0],[7, 8],[7, 8]],
          [[1, 0],[1, 0],[7, 8]],
          [[1, 0],[12, 8],[1, 0]],
          [[12, 8],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]],
          [[1, 0],[1, 0],[1, 0]
          ]
        ]
      }
    ]
  }
}
```