I have a TSkLabel
that is my title on my form, but I would like to draw a colorful gradient line underneath it.
I want just a simple line that goes from one color to a different color. Perhaps multiple colors. Like a rainbow gradient divider line underneath my title.
How can this be achieved with Skia?
Using a TSKPaintBox.OnDraw you need to use the TSkShader.MakeGradientLinear method. It takes these Parameters
To make the AColors array:
and in the TSkPaintbox.OnDraw event:
Produces this:
for multicolor gradients:
Mind you, this is just hard coded to produce a horizontal line. It would be better to create a method to draw the line so you could use the start and end points of the line to set the gradient.