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_style_6.py (1029B)
1 from imagetools import get_png_info, open_png 2 # Register PNG image decoder 3 decoder = lv.img.decoder_create() 4 decoder.info_cb = get_png_info 5 decoder.open_cb = open_png 6 7 # Create an image from the png file 8 try: 9 with open('../assets/img_cogwheel_argb.png', 'rb') as f: 10 png_data = f.read() 11 except: 12 print("Could not find img_cogwheel_argb.png") 13 sys.exit() 14 15 img_cogwheel_argb = lv.img_dsc_t({ 16 'data_size': len(png_data), 17 'data': png_data 18 }) 19 20 # 21 # Using the Image style properties 22 # 23 style = lv.style_t() 24 style.init() 25 26 # Set a background color and a radius 27 style.set_radius(5) 28 style.set_bg_opa(lv.OPA.COVER) 29 style.set_bg_color(lv.palette_lighten(lv.PALETTE.GREY, 3)) 30 style.set_border_width(2) 31 style.set_border_color(lv.palette_main(lv.PALETTE.BLUE)) 32 33 style.set_img_recolor(lv.palette_main(lv.PALETTE.BLUE)) 34 style.set_img_recolor_opa(lv.OPA._50) 35 # style.set_transform_angle(300) 36 37 # Create an object with the new style 38 obj = lv.img(lv.scr_act()) 39 obj.add_style(style, 0) 40 41 obj.set_src(img_cogwheel_argb) 42 43 obj.center()