Created
May 31, 2024 11:59
-
-
Save Staars/6a5f496d9375b37a144c2b87ef410ff2 to your computer and use it in GitHub Desktop.
cam snippet Berry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lv.start() | |
# set background color to blue | |
scr = lv.scr_act() | |
scr.set_style_bg_color(lv.color(lv.COLOR_BLUE), lv.PART_MAIN | lv.STATE_DEFAULT) | |
# create a lv_img object and set it to Tasmota logo | |
logo = lv.img(scr) | |
logo.set_tasmota_logo() | |
logo.center() | |
i = img() | |
f = open("j.jpg","r") | |
i.from_jpg(f.readbytes()) | |
f.close() | |
i.convert_to(i.RGB565) | |
def lv_img_dsc(image) | |
var i = image.info() | |
var dsc = bytes(24) | |
dsc..0x19 # magic | |
dsc..0x12 # cf RGB565 | |
dsc.add(0,2) # flags | |
dsc.add(i["width"],2) # width | |
dsc.add(i["height"],2) # height | |
dsc.add(i["width"] * 2,2) # stride | |
dsc.add(0,2) # reserved | |
dsc.add(i["size"],4) # size | |
dsc.add(i["buf_addr"],4) # data | |
dsc.add(0,4) # reserved | |
print(dsc) | |
return dsc | |
end | |
db = lv_img_dsc(i) | |
logo.set_src(db) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment