Exemple #1
0
 public SkiaSolidBrush(ArgbColor color)
 {
     _skPaint = new SKPaint()
     {
         ColorF = color.ToSKColor(),
         Style  = SKPaintStyle.Fill
     };
 }
Exemple #2
0
 public SkiaHatchBrush(ArgbColor color, float angle, float distance = 5, float widh = 2f)
 {
     _skPaint = new SKPaint()
     {
         PathEffect  = SKPathEffect.Create2DLine(widh, Multiply(SKMatrix.CreateRotationDegrees(angle), SKMatrix.CreateScale(1.007f, distance))),
         Color       = color.ToSKColor(),
         IsAntialias = true,
     };
 }
Exemple #3
0
        public SkiaPen(ArgbColor color, float width)
        {
            _skPaint = new SKPaint()
            {
                Color       = color.ToSKColor(),
                Style       = SKPaintStyle.Stroke,
                StrokeWidth = Math.Max(0.8f, width),
                StrokeJoin  = SKStrokeJoin.Round
            };

            this.DashStyle = LineDashStyle.Solid;
            this.StartCap  = this.EndCap = LineCap.Round;
        }
        public SkiaLinearGradientBrush(CanvasRectangleF rect, ArgbColor col1, ArgbColor col2, float angle)
        {
            var center = rect.Center;

            angle = angle * (float)(Math.PI / 180.0);

            var angleRect = new SKRect(center.X - rect.Width * (float)Math.Cos(angle),
                                       center.Y - rect.Width * (float)Math.Sin(angle),
                                       center.X + rect.Width * (float)Math.Cos(angle),
                                       center.Y + rect.Width * (float)Math.Sin(angle));

            _skPaint = new SKPaint()
            {
                Shader = SKShader.CreateLinearGradient(
                    new SKPoint(angleRect.Left, angleRect.Top),
                    new SKPoint(angleRect.Right, angleRect.Bottom),
                    new SKColor[] { col1.ToSKColor(), col2.ToSKColor() },
                    new float[] { 0, 1 },
                    SKShaderTileMode.Clamp)
            };
        }