acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_png_1.py (902B)
1 #!/opt/bin/lv_micropython -i 2 import lvgl as lv 3 import display_driver 4 from imagetools import get_png_info, open_png 5 from img_wink_png import img_wink_png_map 6 # Register PNG image decoder 7 decoder = lv.img.decoder_create() 8 decoder.info_cb = get_png_info 9 decoder.open_cb = open_png 10 11 img_wink_png = lv.img_dsc_t( 12 { 13 "header": {"always_zero": 0, "w": 50, "h": 50, "cf": lv.img.CF.RAW_ALPHA}, 14 "data_size": 5158, 15 "data": img_wink_png_map, 16 } 17 ) 18 img1 = lv.img(lv.scr_act()) 19 img1.set_src(img_wink_png) 20 img1.align(lv.ALIGN.RIGHT_MID, -250, 0) 21 22 # Create an image from the png file 23 try: 24 with open('wink.png','rb') as f: 25 png_data = f.read() 26 except: 27 print("Could not find wink.png") 28 sys.exit() 29 30 wink_argb = lv.img_dsc_t({ 31 'data_size': len(png_data), 32 'data': png_data 33 }) 34 35 img2 = lv.img(lv.scr_act()) 36 img2.set_src(wink_argb) 37 img2.align(lv.ALIGN.RIGHT_MID, -150, 0)