1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:17:36 +00:00

LibWeb: Implement linear-gradient() transition hints

These allow you to specify the point were the gradient transitions
from one color to the next (without a transition hint the transition
occurs at the point 50% of the way between the two colors).

There is a little bit of guesswork in this implementation as the
specification left out how hints work with the color stop fixup,
though it appears that they are treated the same as color stops.
This commit is contained in:
MacDue 2022-08-11 18:37:29 +01:00 committed by Andreas Kling
parent 4f83b70c7f
commit b205cf967d
2 changed files with 55 additions and 20 deletions

View file

@ -17,6 +17,7 @@ namespace Web::Painting {
struct ColorStop {
Gfx::Color color;
float position = 0;
Optional<float> transition_hint = {};
};
using ColorStopList = Vector<ColorStop, 4>;