public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            (Vector2 Min, Vector2 Max) = RectTransform.Rect;
            //SKRect rect = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRect(new SKRect(Min.X, Min.Y, Max.X, Max.Y));
            //canvas.DrawRect(rect, dragPaint);
            float   radius = ((CircleArea)StartRegion).Radius;
            SKPoint pos    = ((CircleArea)StartRegion).Position.ToSKPoint();

            canvas.DrawCircle(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(pos), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRadius(radius), paint);
            if (Pressed)
            {
                float Direction = (float)(Math.Atan2(Delta.Y, Delta.X) * 180 / Math.PI);
                float factor    = 0;
                float Distance  = Delta.Length();
                if (Direction < 0)
                {
                    factor = (Direction + 360) / 360;
                }
                else
                {
                    factor = (Direction) / 360;
                }
                SKColor baseColor = new SKColor(255, (byte)(255 * factor), 0);
                dragPaint.Color = baseColor;
                canvas.DrawCircle(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(((CircleArea)StartRegion).Position.ToSKPoint()), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRadius(Distance), dragPaint);
            }
        }
        public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            (Vector2 Min, Vector2 Max) = RectTransform.Rect;
            float   radius = ((CircleArea)StartRegion).Radius;
            SKPoint pos    = ((CircleArea)StartRegion).Position.ToSKPoint();

            canvas.DrawCircle(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(pos), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRadius(radius), IdlePaint);
            canvas.DrawCircle(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(pos), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRadius(MaxLength), MaxLengthAreaPaint);
            if (Pressed)
            {
                var endPos = (((CircleArea)StartRegion).Position + Delta).ToSKPoint();
                canvas.DrawLine(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(pos), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(endPos), LinePaint);


                var           pointer      = OnSketchPointer;
                SKPoint       pointerPoint = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(new SKPoint(pointer.Point.X, pointer.Point.Y));
                StringBuilder sb           = new StringBuilder();
                sb.AppendLine("POINTER INFO:");

                foreach (var area in AreaList.ToArray())
                {
                    if (area.Status == AreaStatus.Pressed)
                    {
                        sb.Append(area.AreaIdentifier + ", ");
                    }
                }

                canvas.DrawText(sb.ToString(), pointerPoint, _BoardFontPaint);
            }
        }
 protected override void Start()
 {
     if (SkiaManager == null)
     {
         SkiaManager = SketchEngine.FindObjectByType <SkiaManager>();
     }
     SkiaManager.InvalidCanvas();
 }
 protected override void OnDeltaChanged()
 {
     base.OnDeltaChanged();
     if (SkiaManager == null)
     {
         SkiaManager = SketchEngine.FindObjectByType <SkiaManager>();
     }
     SkiaManager.InvalidCanvas();
 }
 protected override void OnJoystickUp()
 {
     //throw new NotImplementedException();
     if (SkiaManager == null)
     {
         SkiaManager = SketchEngine.FindObjectByType <SkiaManager>();
     }
     SkiaManager.InvalidCanvas();
 }
示例#6
0
        public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            //System.Diagnostics.Debug.WriteLine("PaintSurface");
            SKPaint paint = new SKPaint()
            {
                Color = SKColors.Red
            };

            canvas.DrawCircle(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(Position), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRadius(50), paint);
        }
        public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            var sketchInputManager = SketchEngine.FindObjectByType <SketchInputManager>();

            foreach (var pointer in sketchInputManager.SketchPointers)
            {
                //Vector2 pos = Vector2.Transform(pointer.Point, skiaManager.SketchSpaceToCanvasSpaceMatrix);
                SKPoint pos = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(new SKPoint(pointer.Point.X, pointer.Point.Y));
                canvas.DrawText(pointer.ToString(), pos, _BoardFontPaint);
            }
        }
        public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            float   radius     = ((CircleArea)StartRegion).Radius;
            SKPoint pos        = ((CircleArea)StartRegion).Position.ToSKPoint();
            var     shapePaint = Pressed ? PressedShapePaint : ReleasedShapePaint;
            var     wordPaint  = Pressed ? PressedStringPaint : ReleasedStringPaint;

            wordPaint.TextSize = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRadius(((CircleArea)StartRegion).Radius);
            canvas.DrawCircle(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(pos), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRadius(radius), shapePaint);
            canvas.DrawText(ButtonString, skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(((CircleArea)StartRegion).Position.ToSKPoint()), wordPaint);
        }
        public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            var rectTransformSKRectInCanvas = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRect(RectTransform.Rect.ToSKRect());

            if (Pressed)
            {
                canvas.DrawRect(rectTransformSKRectInCanvas, PressedPaint);
            }
            else
            {
                canvas.DrawRect(rectTransformSKRectInCanvas, ReleasedPaint);
            }
        }
示例#10
0
        public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            var     sketchInfo = SketchEngine.FindObjectByType <SketchInfo>();
            SKPoint leftDown   = new SKPoint(0, 0);
            SKPoint leftUp     = new SKPoint(0, sketchInfo.Sketch.Height);
            SKPoint rightUp    = new SKPoint(sketchInfo.Sketch.Width, sketchInfo.Sketch.Height);
            SKPoint rightDown  = new SKPoint(sketchInfo.Sketch.Width, 0);

            canvas.DrawLine(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(leftDown), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(leftUp), _BorderPaint);
            canvas.DrawLine(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(leftUp), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(rightUp), _BorderPaint);
            canvas.DrawLine(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(rightUp), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(rightDown), _BorderPaint);
            canvas.DrawLine(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(rightDown), skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(leftDown), _BorderPaint);
        }
 public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
 {
     foreach (var skiaObject in SketchEngine.SketchObjectList)
     {
         if (skiaObject is IRectTransformable)
         {
             var rect = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapRect((skiaObject as IRectTransformable).RectTransform.Rect.ToSKRect());
             canvas.DrawRect(rect, FramePaint);
             canvas.DrawPoint(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint((skiaObject as IRectTransformable).RectTransform.Rect.Min.ToSKPoint()), MinPointPaint);
             canvas.DrawPoint(skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint((skiaObject as IRectTransformable).RectTransform.Rect.Max.ToSKPoint()), MaxPointPaint);
         }
     }
 }
示例#12
0
        public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
        {
            if (Pressed)
            {
                SKPoint p1   = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint(_StartPos.ToSKPoint());
                SKPoint p2   = skiaManager.SketchSpaceToCanvasSpaceMatrix.MapPoint((_StartPos + Delta).ToSKPoint());
                SKPoint pMin = new SKPoint();
                SKPoint pMax = new SKPoint();
                if (p1.X <= p2.X && p1.Y <= p2.Y)
                {
                    pMin = p1;
                    pMax = p2;
                }
                else if (p1.X >= p2.X && p1.Y >= p2.Y)
                {
                    pMin = p2;
                    pMax = p1;
                }
                else
                {
                    SKPoint p3 = new SKPoint(p1.X, p2.Y);
                    SKPoint p4 = new SKPoint(p2.X, p1.Y);
                    if (p3.X <= p4.X && p3.Y <= p4.Y)
                    {
                        pMin = p3;
                        pMax = p4;
                    }
                    else
                    {
                        pMin = p4;
                        pMax = p3;
                    }
                }

                SKRect rect = new SKRect(pMin.X, pMin.Y, pMax.X, pMax.Y);
                canvas.DrawRect(rect, _SelectorPaint);
            }
        }
 protected override void Start()
 {
     base.Start();
     SkiaManager = SketchEngine.FindObjectByType <SkiaManager>();
 }
示例#14
0
 public OnDrawEventArgs(SkiaManager skiaManager, SKCanvas canvas)
 {
     SkiaManager = skiaManager;
     SKCanvas    = canvas;
 }
示例#15
0
 public void PaintSurface(SkiaManager skiaManager, SKCanvas canvas)
 {
     OnDraw?.Invoke(this, new OnDrawEventArgs(skiaManager, canvas));
 }