Blitting image with alpha channel doesn't seem blend alpha
wezm opened this issue · 1 comments
wezm commented
Loading a transparent PNG then blitting it seems to always have a light background instead of blending it with what's already there.
E.g. with this image:
animation { width = 1000, height = 400, length = 1, framerate = 60 }
gitLogo = image.load("Git-Logo-2Color.png")
nearlyblack = solid(hex("#202020"))
function render()
clear(nearlyblack)
blit(gitLogo, 0, 0)
end
wezm commented
The issue might be that Cairo's ARGB32 format expects pre-multiplied alpha. However, I'm not sure this is accounted in the image loading function as PNG requires non-pre-multiplied alpha:
Lines 158 to 168 in 6289a27