I'm always looking for interesting gadgets, and in the latest ALDI flyer I noticed this little thingy:
You can draw on paper with a real pen, and in the meantime all your
writing gets digitized and stored internally on the pad.
The serial number states MD 85276, which on second though I should have googled. As I found out later, there is a tool top2svg available on freshmeat that is written in perl and performs the same task as what I'm about to explain here.
I bought it today and it is quite nice, but it stores it data in a different format than I expected. Gerwin's drawing pad stores the strokes you draw in DHW format, while mine seems to use a WALTOP format. I couldn't find any specs, but the format is fairly easy to reverse engineer.
A single dot produces the following file:
0000000 4157 544c 504f 0001 0000 0020 ffff 2af8
0000010 203a 0200 0000 0000 0000 0000 0000 0000
0000020 f707 7502 fd1e f707 7502 fe1e f807 7502
0000030 fe1e f907 7502 fe1e f707 7402 fd1e f907
0000040 7402 fd1e f907 7402 fe1e f907 7402 fd1e
0000050 f907 7402 fe1e f907 7302 fe1e f907 7302
0000060 ff1e f907 7302 fe1e f907 7302 ff1e f907
0000070 7302 fe1e f907 7202 fe1e f907 7102 fe1e
0000080 f907 7002 fe1e f907 6e02 fe1e fa07 6d02
0000090 fe1e fa07 6c02 fe1e f907 6c02 fe1e f907
00000a0 6d02 fd1e f907 6a02 fe1e f900 6a02 fe1e
After some fiddling the file structure turns out to be:
and then a repeated sequence of 6-byte packets containing:
I've written a little python utility to convert these TOP files to SVG (also available in svn://jorik/code/sandbox/memopad):
import sys
if len(sys.argv) != 2:
print "usage: %s <input.top>"
sys.exit(1)
fn = sys.argv[1]
f = file(fn,"rb")
f.read(32) # skip header
print """<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">
"""
print '<path d="'
#<path d="M250 150 L150 350 L350 350 L100 100.50"
#style="fill:none;stroke:red;stroke-width:2" />
drawing = False
while True:
packet = f.read(6)
if len(packet) < 6:
break
xcoord = ord(packet[4])*256+ord(packet[3])
ycoord = ord(packet[2])*256+ord(packet[1])
if packet[0]==chr(0):
# pen up
drawing = False
code = "L"
else:
# pen down
if drawing:
code = "L"
else:
code = "M"
drawing = True
ycoord = 12000-ycoord
print code,xcoord/10.0,ycoord/10.0, #, (ord(packet[5])+128)%256-128
print '" style="fill:none;stroke:black;stroke-width:1" />'
print "</svg>"
f.close()
The result: