Implement proper alpha-blending of SVG icons (#7011)

* Implement proper alpha-blending of SVG icons

Also, instead of doing that every time, cache a pre-composited version
that matches the screen's BB type.
This is faster, and also has the advantage of making icon highlights
behave.

Jot down a few notes about corner-cases or future improvements, e.g.,
dimming icons on non-white backgrounds, and nightmode with color icons.
This commit is contained in:
NiLuJe
2020-12-19 22:34:16 +01:00
committed by GitHub
parent a5b133dadc
commit f4e2878a3c
2 changed files with 69 additions and 10 deletions

View File

@@ -35,7 +35,7 @@ local IconWidget = ImageWidget:extend{
-- be overriden by callers.
width = Screen:scaleBySize(DGENERIC_ICON_SIZE), -- our icons are square
height = Screen:scaleBySize(DGENERIC_ICON_SIZE),
alpha = true, -- our icons have a transparent background
alpha = false, --- @note: our icons have a transparent background, but we flatten them at caching time, and this flag is only checked at blitting time.
is_icon = true, -- avoid dithering in ImageWidget:paintTo()
}