Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JacobChrist opened this issue Apr 4, 2023 · 2 comments
Open

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

JacobChrist opened this issue Apr 4, 2023 · 2 comments
Assignees
Labels
bug Something isn't working Lua

Comments

@JacobChrist
Copy link
Member

JacobChrist commented Apr 4, 2023

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

@JacobChrist JacobChrist added bug Something isn't working Lua labels Apr 4, 2023
@microlan
Copy link
Contributor

microlan commented Apr 4, 2023

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Lua
Projects
None yet
Development

No branches or pull requests

2 participants