Inheritance: SKObject
Ejemplo n.º 1
0
 private void GameBoardView_Draw(GameBoardView gameBoard, SkiaSharp.SKSurface args)
 {
     using (var paint = new SKPaint()
     {
         IsAntialias = true, Color = SKColors.Red, StrokeWidth = 2, Style = SKPaintStyle.Stroke
     })
     {
         args.Canvas.DrawCircle(
             100,
             100,
             48,
             paint);
     }
 }
Ejemplo n.º 2
0
        private void canvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e)
        {
            SkiaSharp.SKSurface surface = e.Surface;
            SKCanvas            canvas  = surface.Canvas;

            canvas.Clear(SKColors.LightGoldenrodYellow);
            var      width    = e.Info.Width;
            var      height   = e.Info.Height;
            DateTime dateTime = DateTime.Now;

            canvas.Translate(width / 2, height / 2);
            canvas.Scale(width / 300f);
            canvas.DrawCircle(0, 0, 100, blueFillPaint);

            for (int angle = 0; angle < 360; angle += 6)
            {
                canvas.DrawCircle(0, -90, angle % 30 == 0 ? 4 : 2, whitefillpaint);
                canvas.RotateDegrees(6);
            }

            canvas.Save();
            canvas.RotateDegrees(30 * dateTime.Hour + dateTime.Minute / 2f);
            whiteStrokePaint.StrokeWidth = 12;
            canvas.DrawLine(0, 0, 0, -50, whiteStrokePaint);
            canvas.Restore();


            canvas.RotateDegrees(6 * dateTime.Minute + dateTime.Second / 10f);
            whiteStrokePaint.StrokeWidth = 8;
            canvas.DrawLine(0, 0, 0, -70, whiteStrokePaint);
            canvas.Restore();

            canvas.Save();
            float seconds = dateTime.Second + dateTime.Millisecond / 1000f;

            canvas.RotateDegrees(6 * seconds);
            whiteStrokePaint.StrokeWidth = 2;
            canvas.DrawLine(0, 10, 0, -90, whiteStrokePaint);
            canvas.Restore();
        }
Ejemplo n.º 3
0
 public BitmapDrawingContext(SKSurface surface) : base(surface.Canvas)
 {
     _surface = surface;
 }
Ejemplo n.º 4
0
        protected override void OnDraw(SKSurface surface, SKImageInfo info)
        {
            base.OnDraw(surface, info);

            if (!_viewportInitialized)
                InitializeViewport();
            if (!_viewportInitialized)
                return;

            _renderer.Render(surface.Canvas, _map.Viewport, _map.Layers, _map.BackColor);
        }
Ejemplo n.º 5
0
        // DrawSurface

        public void DrawSurface(SKSurface surface, SKPoint p, SKPaint paint = null)
        {
            DrawSurface(surface, p.X, p.Y, paint);
        }