add utilities to turn bitmap to code

This commit is contained in:
Brad Grantham 2018-06-06 12:15:58 -07:00
parent e47cb00e40
commit b925142da1
2 changed files with 41 additions and 0 deletions

12
bitmap_to_basic.py Normal file
View File

@ -0,0 +1,12 @@
import sys
print "5 HGR : HCOLOR=3"
num = 10
row = 0
for line in sys.stdin:
for b in xrange(0, 40):
if line[b * 2] == '*':
print "%d HPLOT %d, %d" % (num, b, row)
num += 10
row += 1

29
bitmap_to_c.py Normal file
View File

@ -0,0 +1,29 @@
import sys
maxwidth = 0
print "unsigned char bitmap[] = {"
for line in sys.stdin:
bit = 0
width = 0
for b in xrange(0, 40):
if line[b * 2] == '*':
print "255,",
else:
print "0,",
width += 1
bit += 1
if False and bit == 7:
print "255,",
width += 1
bit = 0
maxwidth = max(width, maxwidth)
print "// %d, %d" % ( width, bit)
print "};"
print "// width = %d" % maxwidth