|
| 1 | +notice = """ |
| 2 | + Hello World Rainbow Dot Font Demo |
| 3 | + ----------------------------------- |
| 4 | +| Copyright 2022 by Joel C. Alcarez | |
| 5 | +| [joelalcarez1975@gmail.com] | |
| 6 | +|-----------------------------------| |
| 7 | +| We make absolutely no warranty | |
| 8 | +| of any kind, expressed or implied | |
| 9 | +|-----------------------------------| |
| 10 | +| This graphics library outputs | |
| 11 | +| to a bitmap file. | |
| 12 | + ----------------------------------- |
| 13 | +""" |
| 14 | + |
| 15 | +from Python_BMP.BITMAPlib import( |
| 16 | + newBMP, |
| 17 | + plotstringasdots as f, |
| 18 | + getcolorname2RGBdict, |
| 19 | + font8x8thin, |
| 20 | + getfuncmetastr as meta, |
| 21 | + saveBMP |
| 22 | + ) |
| 23 | + |
| 24 | +import subprocess as proc |
| 25 | +from os import path |
| 26 | + |
| 27 | + |
| 28 | +def main(): |
| 29 | + print(f'{notice}\n{meta(f)}') |
| 30 | + imgedt = 'mspaint' # replace with another editor if Unix |
| 31 | + rootdir = path.dirname(__file__) # get path of this script |
| 32 | + mx, my = 550, 70 # bitmap size |
| 33 | + bmp = newBMP(mx, my, 24) # RGB bitmap |
| 34 | + c = getcolorname2RGBdict() |
| 35 | + f(bmp, 20, 10, # position the text |
| 36 | + 'TetraPlex', # random text |
| 37 | + 7, # uint font size multiplier |
| 38 | + 1, # uint space between pixels |
| 39 | + 0, # uint default space between char |
| 40 | + (c['brightred'], |
| 41 | + c['brightorange'], |
| 42 | + c['brightyellow'], |
| 43 | + c['brightgreen'], |
| 44 | + c['cyan'], |
| 45 | + c['brightblue'], |
| 46 | + c['brightmagenta']), |
| 47 | + font8x8thin) |
| 48 | + file = f'HelloWorldRainbow{f.__name__}.bmp' #file name |
| 49 | + saveBMP(file, bmp) |
| 50 | + print('Saved to %s in %s\nAll done close %s to finish' % \ |
| 51 | + (file, rootdir, imgedt)) # tell user we are done |
| 52 | + ret = proc.call([imgedt, file]) |
| 53 | + |
| 54 | +if __name__=="__main__": |
| 55 | + main() |
0 commit comments