Skip to content

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

@JacobChrist

Description

@JacobChrist

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

Metadata

Metadata

Assignees

Labels

LuabugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions