Ejemplo n.º 1
0
        private void DrawBorder(RenderContext context)
        {
            var gradient = new GradientBuilder().AddCssGradient("linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%)").Build().First();

            gradient.InstantiateShader(_control);
            gradient.Measure(context.RenderRect.Width, context.RenderRect.Height);

            using var paint = new SKPaint
                  {
                      StrokeWidth = 10,
                      Style       = SKPaintStyle.Stroke,
                      Color       = SKColors.Yellow,
                      Shader      = gradient.Shader.Create(context)
                  };

            context.Canvas.DrawRect(context.RenderRect, paint);
        }