example: remove the MicroPython examples

See #4347
This commit is contained in:
Gabor Kiss-Vamosi
2023-12-21 10:02:40 +01:00
parent 32c6bc5bd7
commit 469c2cfcef
160 changed files with 0 additions and 18897 deletions

View File

@@ -1,87 +0,0 @@
_CANVAS_WIDTH = 200
_CANVAS_HEIGHT = 150
LV_IMAGE_ZOOM_NONE = 256
rect_dsc = lv.draw_rect_dsc_t()
rect_dsc.init()
rect_dsc.radius = 10
rect_dsc.bg_opa = lv.OPA.COVER
rect_dsc.bg_grad.dir = lv.GRAD_DIR.HOR
rect_dsc.bg_grad.stops = [
lv.gradient_stop_t({'color': lv.palette_main(lv.PALETTE.RED)}),
lv.gradient_stop_t({'color': lv.palette_main(lv.PALETTE.BLUE), 'frac':0xff})
]
rect_dsc.border_width = 2
rect_dsc.border_opa = lv.OPA._90
rect_dsc.border_color = lv.color_white()
rect_dsc.shadow_width = 5
rect_dsc.shadow_offset_x = 5
rect_dsc.shadow_offset_y = 5
label_dsc = lv.draw_label_dsc_t()
label_dsc.init()
label_dsc.color = lv.palette_main(lv.PALETTE.ORANGE)
label_dsc.text = "Some text on text canvas"
cbuf = bytearray(_CANVAS_WIDTH * _CANVAS_HEIGHT * 4)
# cbuf2 = bytearray(_CANVAS_WIDTH * _CANVAS_HEIGHT * 4)
canvas = lv.canvas(lv.screen_active())
canvas.set_buffer(cbuf, _CANVAS_WIDTH, _CANVAS_HEIGHT, lv.COLOR_FORMAT.NATIVE)
canvas.center()
canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER)
layer = lv.layer_t()
canvas.init_layer(layer);
coords_rect = lv.area_t()
coords_rect.x1 = 70
coords_rect.y1 = 60
coords_rect.x2 = 100
coords_rect.y2 = 70
lv.draw_rect(layer, rect_dsc, coords_rect)
coords_text = lv.area_t()
coords_text.x1 = 40
coords_text.y1 = 80
coords_text.x2 = 100
coords_text.y2 = 120
lv.draw_label(layer, label_dsc, coords_text)
canvas.finish_layer(layer)
# Test the rotation. It requires another buffer where the original image is stored.
# So copy the current image to buffer and rotate it to the canvas
image = lv.image_dsc_t()
image.data = cbuf[:]
image.header.cf = lv.COLOR_FORMAT.NATIVE
image.header.w = _CANVAS_WIDTH
image.header.h = _CANVAS_HEIGHT
canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER)
image_dsc = lv.draw_image_dsc_t()
image_dsc.init();
image_dsc.rotation = 120;
image_dsc.src = image;
image_dsc.pivot.x = _CANVAS_WIDTH // 2;
image_dsc.pivot.y = _CANVAS_HEIGHT // 2;
coords_image = lv.area_t()
coords_image.x1 = 0
coords_image.y1 = 0
coords_image.x2 = _CANVAS_WIDTH - 1
coords_image.y2 = _CANVAS_HEIGHT - 1
lv.draw_image(layer, image_dsc, coords_image)

View File

@@ -1 +0,0 @@
pass

View File

@@ -1,44 +0,0 @@
CANVAS_WIDTH = 50
CANVAS_HEIGHT = 50
LV_COLOR_SIZE = 32
#
# Draw a rectangle to the canvas
#
# Create a buffer for the canvas
cbuf = bytearray((LV_COLOR_SIZE // 8) * CANVAS_WIDTH * CANVAS_HEIGHT)
# Create a canvas and initialize its palette*/
canvas = lv.canvas(lv.screen_active())
canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.COLOR_FORMAT.NATIVE)
canvas.fill_bg(lv.color_hex3(0xccc), lv.OPA.COVER)
canvas.center()
dsc = lv.draw_rect_dsc_t()
dsc.init()
dsc.bg_color = lv.palette_main(lv.PALETTE.RED)
dsc.border_color = lv.palette_main(lv.PALETTE.BLUE)
dsc.border_width = 3
dsc.outline_color = lv.palette_main(lv.PALETTE.GREEN)
dsc.outline_width = 2
dsc.outline_pad = 2
dsc.outline_opa = lv.OPA._50
dsc.radius = 5
dsc.border_width = 3
coords = lv.area_t()
coords.x1 = 10
coords.y1 = 10
coords.x2 = 30
coords.y2 = 20
layer = lv.layer_t()
canvas.init_layer(layer);
lv.draw_rect(layer, dsc, coords)
canvas.finish_layer(layer)

View File

@@ -1,68 +0,0 @@
import fs_driver
CANVAS_WIDTH = 50
CANVAS_HEIGHT = 50
LV_COLOR_SIZE = 32
#
# Draw a text to the canvas
#
# Create a buffer for the canvas
cbuf = bytearray((LV_COLOR_SIZE // 8) * CANVAS_WIDTH * CANVAS_HEIGHT)
# Create a canvas and initialize its palette
canvas = lv.canvas(lv.screen_active())
canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.COLOR_FORMAT.NATIVE)
canvas.fill_bg(lv.color_hex3(0xccc), lv.OPA.COVER)
canvas.center()
dsc = lv.draw_label_dsc_t()
dsc.init()
dsc.color = lv.palette_main(lv.PALETTE.RED)
# get the directory in which the script is running
try:
script_path = __file__[:__file__.rfind('/')] if __file__.find('/') >= 0 else '.'
except NameError:
print("Could not find script path")
script_path = ''
if script_path != '':
try:
dsc.font = lv.font_montserrat_18
except:
# needed for dynamic font loading
fs_drv = lv.fs_drv_t()
fs_driver.fs_register(fs_drv, 'S')
print("Loading font montserrat_18")
font_montserrat_18 = lv.font_t()
lv.binfont_load(font_montserrat_18, "S:" + script_path + "/../../assets/font/montserrat-18.fnt")
if not font_montserrat_18:
print("Font loading failed")
else:
dsc.font = font_montserrat_18
dsc.decor = lv.TEXT_DECOR.UNDERLINE
dsc.text = "Hello"
layer = lv.layer_t()
canvas.init_layer(layer);
coords = lv.area_t()
coords.x1 = 10
coords.y1 = 10
coords.x2 = 40
coords.y2 = 30
lv.draw_label(layer, dsc, coords)
canvas.finish_layer(layer)

View File

@@ -1,35 +0,0 @@
CANVAS_WIDTH = 50
CANVAS_HEIGHT = 50
LV_COLOR_SIZE = 32
#
# Draw an arc to the canvas
#
# Create a buffer for the canvas
cbuf = bytearray((LV_COLOR_SIZE // 8) * CANVAS_WIDTH * CANVAS_HEIGHT)
# Create a canvas and initialize its palette
canvas = lv.canvas(lv.screen_active())
canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.COLOR_FORMAT.NATIVE)
canvas.fill_bg(lv.color_hex3(0xccc), lv.OPA.COVER)
canvas.center()
dsc = lv.draw_arc_dsc_t()
dsc.init()
dsc.color = lv.palette_main(lv.PALETTE.RED)
dsc.width = 5
dsc.center.x = 25
dsc.center.y = 25
dsc.width = 15
dsc.start_angle = 0
dsc.end_angle = 220
layer = lv.layer_t()
canvas.init_layer(layer);
lv.draw_arc(layer, dsc)
canvas.finish_layer(layer)

View File

@@ -1,50 +0,0 @@
CANVAS_WIDTH = 50
CANVAS_HEIGHT = 50
LV_COLOR_SIZE = 32
# Create an image from the png file
try:
with open('../../assets/img_star.png','rb') as f:
png_data = f.read()
except:
print("Could not find star.png")
sys.exit()
image_star_argb = lv.image_dsc_t({
'data_size': len(png_data),
'data': png_data
})
#
# Draw an image to the canvas
#
# Create a buffer for the canvas
cbuf = bytearray((LV_COLOR_SIZE // 8) * CANVAS_WIDTH * CANVAS_HEIGHT)
# Create a canvas and initialize its palette
canvas = lv.canvas(lv.screen_active())
canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.COLOR_FORMAT.NATIVE)
canvas.fill_bg(lv.color_hex3(0xccc), lv.OPA.COVER)
canvas.center()
dsc = lv.draw_image_dsc_t()
dsc.init()
dsc.src = image_star_argb
coords = lv.area_t()
coords.x1 = 5
coords.y1 = 5
coords.x2 = 5 + 29
coords.y2 = 5 + 28
layer = lv.layer_t()
canvas.init_layer(layer);
lv.draw_image(layer, dsc, coords)
canvas.finish_layer(layer)

View File

@@ -1,38 +0,0 @@
CANVAS_WIDTH = 50
CANVAS_HEIGHT = 50
LV_COLOR_SIZE = 32
#
# Draw a line to the canvas
#
# Create a buffer for the canvas
cbuf = bytearray((LV_COLOR_SIZE // 8) * CANVAS_WIDTH * CANVAS_HEIGHT)
# Create a canvas and initialize its palette
canvas = lv.canvas(lv.screen_active())
canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.COLOR_FORMAT.NATIVE)
canvas.fill_bg(lv.color_hex3(0xccc), lv.OPA.COVER)
canvas.center()
dsc = lv.draw_line_dsc_t()
dsc.init()
dsc.color = lv.palette_main(lv.PALETTE.RED)
dsc.width = 4
dsc.round_end = 1
dsc.round_start = 1
dsc.p1.x = 15;
dsc.p1.y = 15;
dsc.p2.x = 35;
dsc.p2.y = 10;
layer = lv.layer_t()
canvas.init_layer(layer);
lv.draw_line(layer, dsc)
canvas.finish_layer(layer)