earthlcd / ezLCD-5x

Public Repository for ezLCD-5035-RT release files system, firmware and issue reporting
https://earthlcd.com/products/ezlcd-5x?_pos=1&_sid=0927d2260&_ss=r
0 stars 1 forks source link

The ez.SetAlpha() command doesn't work as expected. #74

Open JacobChrist opened 1 year ago

JacobChrist commented 1 year ago

Describe the bug The ez.SetAlpha() command doesn't work as expected.

A clear and concise description of what the bug is.

*To Reproduce The following code


function printLine(font_height, line, str) -- Show a title sequence for the program
    local x1, y1, x2, y2, bg
    -- Display Size -> 320x240 

    -- Erase Old Weight
    x1 = 0
    y1 = font_height * line
    x2 = 320
    y2 = font_height * line + font_height

    bg = (8 * line)

    -- ez.BoxFill(x1,y1, x2,y2, ez.RGB(bg,bg,bg)) -- X, Y, Width, Height, Color
    ez.BoxFill(x1,y1, x2,y2, ez.RGB(0x17, 0x28, 0x15)) -- X, Y, Width, Height, Color

    -- Display Line
    -- ez.SetColor(ez.RGB(0,0,255))
    ez.SetColor(ez.RGB(0xee, 0xf2, 0xe8))
    ez.SetFtFont(fn, font_height * 0.70) -- Font Number, Height, Width
    ez.SetXY(x1, y1)
    print(str)
    -- ez.Wait_ms(200)
end

    ez.SerialOpen("DebugPortReceiveFunction", 0)
    ez.Cls(ez.RGB(0,0,0))

    ez.SetAlpha(255)
    ez.SetXY(44,55)
    result = ez.PutPictFile(2, 3, "/Scale/circle-alpha.bmp")
    ez.SerialTx("result=".. tostring(result) .. "\r\n", 80, debug_port) -- doesn't work
    printLine(font_height, 6, "/Scale/circle-alpha.bmp")
    ez.Wait_ms(2000)

    ez.SetAlpha(128)
    ez.SetXY(11,12)
    result = ez.PutPictFile(2, 3, "/Scale/pulltest-bg.bmp")
    ez.SerialTx("result=".. tostring(result) .. "\r\n", 80, debug_port) -- doesn't work
    printLine(font_height, 6, "/Scale/pulltest-bg.bmp")
    ez.Wait_ms(2000)

    ez.SetAlpha(64)
    ez.SetXY(66,77)
    result = ez.PutPictFile(2, 3, "/Scale/circle-alpha.bmp")
    ez.SerialTx("result=".. tostring(result) .. "\r\n", 80, debug_port) -- doesn't work
    printLine(font_height, 6, "/Scale/circle-alpha.bmp")
    ez.SetAlpha(255)
    ez.Wait_ms(2000)

    ez.SetAlpha(32)
    ez.SetXY(44,55)
    result = ez.PutPictFile(2, 3, "/Scale/pulltest-bg1.bmp")
    ez.SerialTx("result=".. tostring(result) .. "\r\n", 80, debug_port) -- doesn't work
    printLine(font_height, 6, "/Scale/pulltest-bg1.bmp")
    ez.Wait_ms(2000)

Produces images like this where you can't really see the image behind it: image image image

Expected behavior Alpha should show background image behind it.

Attached images used with this code: Scale.zip

microlan commented 1 year ago

NOTE: Review the original (FAVR32-based) ezLCD-10x documentation to see how the SetAlpha command was designed to work originally. (the 5x code is a combination of the FAVR32 code and the ezLCD-405 code; SetAlpha came from FAVR32). I have not verified if the current behavior matches the original spec or not. See attached

JacobChrist commented 1 year ago

Cool, when I get back to looking at this I'll check out the original documentation. Just capturing issues at the moment.