gFinger 손끝으로 만드는 세상

SkiaSharp +1

 

Table Of Contens

1. SkShader Class Example

2. Reference

 

1. SkShader Class Example

 
        public void FillSpotGradient(SKCanvas canvas, float width, float height)
        {
            float selectedSize = Math.Min(width, height);


                // create the shader
                var colors = new SKColor[]
                {
                    new SKColor(0, 255, 255),
                    new SKColor(255, 0, 255),
                    new SKColor(255, 255, 0),
                    new SKColor(0, 255, 255)
                };
                var shader = SKShader.CreateSweepGradient
                (
                    new SKPoint(width / 3, height / 3),
                    colors,
                    null
                );

                // use the shader
                var paint = new SKPaint
                {
                    Shader = shader
                };
                canvas.DrawPaint(paint); 
        }

 

2. Reference


https://docs.microsoft.com/en-us/dotnet/api/skiasharp.skshader?view=skiasharp-1.68.1

 

SKShader Class (SkiaSharp)

Shaders specify the source color(s) for what is being drawn in the .

docs.microsoft.com