arch(driver): new driver architecture with new color format support
This commit is contained in:
@@ -25,7 +25,7 @@ cbuf= bytearray(LV_CANVAS_BUF_SIZE_INDEXED_1BIT(CANVAS_WIDTH, CANVAS_HEIGHT))
|
||||
|
||||
# Create a canvas and initialize its palette
|
||||
canvas = lv.canvas(lv.scr_act())
|
||||
canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.img.CF.INDEXED_1BIT)
|
||||
canvas.set_buffer(cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, lv.COLOR_FORMAT.I1)
|
||||
canvas.set_palette(0, LV_COLOR_CHROMA_KEY)
|
||||
canvas.set_palette(1, lv.palette_main(lv.PALETTE.RED))
|
||||
|
||||
@@ -33,8 +33,8 @@ canvas.set_palette(1, lv.palette_main(lv.PALETTE.RED))
|
||||
c0 = lv.color_t()
|
||||
c1 = lv.color_t()
|
||||
|
||||
c0.full = 0
|
||||
c1.full = 1
|
||||
c0.set_int(0)
|
||||
c1.set_int(1)
|
||||
|
||||
# Red background (There is no dedicated alpha channel in indexed images so LV_OPA_COVER is ignored)
|
||||
canvas.fill_bg(c1, lv.OPA.COVER)
|
||||
@@ -42,4 +42,4 @@ canvas.fill_bg(c1, lv.OPA.COVER)
|
||||
# Create hole on the canvas
|
||||
for y in range(10,30):
|
||||
for x in range(5,20):
|
||||
canvas.set_px(x, y, c0)
|
||||
canvas.set_px(x, y, c0, lv.OPA.COVER)
|
||||
|
||||
Reference in New Issue
Block a user