Esempio n. 1
0
        public override SKShader CreateShader(SKPaint paint, SKImageInfo info)
        {
            var(startPoint, endPoint) = GetGradientPoints(info.Width, info.Height, Angle);

            var orderedStops = Stops.OrderBy(x => x.Offset).ToArray();
            var colors       = orderedStops.Select(x => x.Color.ToSKColor()).ToArray();
            var colorPos     = orderedStops.Select(x => x.Offset).ToArray();
            var tileMode     = SKShaderTileMode.Clamp;

            return(SKShader.CreateLinearGradient(startPoint, endPoint, colors, colorPos, tileMode));
        }