gio/internal/f32color/rgba.go -rw-r--r-- 4.5 KiB
internal/f32color: delete unused NRGBAToRGBA_PostAlpha

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget/material: add hover to Button

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
internal/f32color: revert incorrect NRGBA to linear color change

Egon Elbre convinced me commit 01d5e722917 was incorrect, because
in the NRGBA colorspace the alpha value is linear, not gamma adjusted.

Updates gio#192

Signed-off-by: Elias Naur <mail@eliasnaur.com>
internal/f32color: correct pre-multipled color conversion

Tweak a test color to avoid an off-by-1 rounding error after changing
the conversion formula.

Fixes gio#192

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget: use correct color in Icon

iconvg seems to expect a linear premultiplied color.

Fixes gio#132

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
widget/material: better disabled color calculation

Use desaturation in combination with alpha multiplication.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
all: use color.NRGBA in public API

color.RGBA has two problems with regards to using it.

First the color values need to be premultiplied, whereas most APIs
have non-premultiplied values. This is mainly to preserve color components
with low alpha values.

Second there are two ways to premultiply with sRGB. One is to premultiply
after sRGB conversion, the other is before. This makes using the API more

Using color.NRGBA in sRGB makes it align with CSS.e

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
internal/f32color: add colorspace-correct function for alpha scaling

Package material's ad-hoc mulAlpha didn't take the sRGB color-space
into account, which meant that alpha-scaled colors were subtly wrong.
Introduce f32color.MulAlpha and convert all uses to it.

Thanks to René Post for finding and debugging the issue.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
internal/f32color: use explicit type to avoid allocation

f32color.RGBAFromSRGB is used extensively in package gpu, avoid an
interface type to save allocations.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
add f32color.RGBA

Signed-off-by: Egon Elbre <egonelbre@gmail.com>