Negotiating BSX:

@RQV



 The BSX format defines a vector graphic format with some limitations. One chunk can only have up to 32 polygons. One polygon can have up to 32 edges.

Besides that, there are only 16 predefined colors available. Which are: black, blue, forestgreen, skyblue, indianred, hotpink, brown, lightgrey, dimgrey, deepskyblue, green, cyan, tomato, magenta, yellow and white.

Numbers are encoded as hexadecimal, two-digit values without prefix. E.g. 127 as 7F and 10 as 0A. They only use uppercase letters.

Drawings are encoded as follows:

   1. polygon count
   2. first polygon
         1. edge count
         2. color
         3. first edge (x,y)
         4. second
         5. .. and so on ..
   3. second polygon
         1. edge count
         2. color
         3. edges
   4. .. and so on ..

Therefore 020300000000FFFF00030F00FFFFFFFF00 stands for:

   1.

      02
      2 polygons
   2.

      03
      first polygon has 3 edges (triangle) 00
      its color is black 0000
      first edge, left upper corner 00FF
      second, left lower corner FF00
      third, right upper corner
   3.

      03
      second polygon has 3 edges (also a triangle) 0F
      colored with white 00FF
      first edge, left lower corner FFFF
      second edge, right lower corner FF00
      last edge, right upper corner

You might have noticed that edges are encoded bye 2 digits for x-position and 2 digits for y-position. So coordinates range from 0 to 255. Normaly the graphic gets scaled to a ratio at 1:2, meaning the graphic gets displayed on a 512px times 256px canvas.
