コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SkiaSharpDrawingContext"/> class.
 /// </summary>
 /// <param name="motionCanvas">The motion canvas.</param>
 /// <param name="info">The information.</param>
 /// <param name="surface">The surface.</param>
 /// <param name="canvas">The canvas.</param>
 public SkiaSharpDrawingContext(MotionCanvas <SkiaSharpDrawingContext> motionCanvas, SKImageInfo info, SKSurface surface, SKCanvas canvas)
 {
     MotionCanvas = motionCanvas;
     Info         = info;
     Surface      = surface;
     Canvas       = canvas;
 }
コード例 #2
0
 public CustomDrawOp(
     MotionCanvas avaloniaControl, MotionCanvas <SkiaSharpDrawingContext> motionCanvas, Rect bounds, SKColor backColor)
 {
     _avaloniaControl = avaloniaControl;
     _motionCanvas    = motionCanvas;
     _backColor       = backColor;
     Bounds           = bounds;
 }
コード例 #3
0
 public Chart(MotionCanvas <TDrawingContext> canvas, Action <LiveChartsSettings> defaultPlatformConfig)
 {
     this.canvas               = canvas;
     updateThrottler           = new ActionThrottler(TimeSpan.FromSeconds(300));
     updateThrottler.Unlocked += UpdateThrottlerUnlocked;
     easingFunction            = EasingFunctions.QuadraticOut;
     if (!LiveCharts.IsConfigured)
     {
         LiveCharts.Configure(defaultPlatformConfig);
     }
 }
コード例 #4
0
    /// <summary>
    /// Initializes a new instance of the <see cref="SkiaSharpDrawingContext"/> class.
    /// </summary>
    /// <param name="motionCanvas">The motion canvas.</param>
    /// <param name="info">The information.</param>
    /// <param name="surface">The surface.</param>
    /// <param name="canvas">The canvas.</param>
    /// <param name="lockOnDraw">Locks the canvas while drawing it (workaround for avalonia).</param>
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
    public SkiaSharpDrawingContext(
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
        MotionCanvas <SkiaSharpDrawingContext> motionCanvas,
        SKImageInfo info,
        SKSurface surface,
        SKCanvas canvas,
        bool lockOnDraw = false) : base(lockOnDraw)
    {
        MotionCanvas = motionCanvas;
        Info         = info;
        Surface      = surface;
        Canvas       = canvas;
    }
コード例 #5
0
    public static void Generate(MotionCanvas <SkiaSharpDrawingContext> canvas)
    {
        var r = new Random();
        var p = new SolidColorPaint(SKColors.Blue, 3)
        {
            IsFill = true
        };

        canvas.AddDrawableTask(p);

        for (var i = 0; i < 1000; i++)
        {
            var circle = new CircleGeometry {
                X = r.Next(15, 285), Y = r.Next(15, 285), Width = 5, Height = 5
            };

            _ = circle
                .TransitionateProperties(
                nameof(circle.X), nameof(circle.Y))
                .WithAnimation(animation =>
                               animation
                               .WithDuration(TimeSpan.FromSeconds(1))
                               .WithEasingFunction(EasingFunctions.ElasticOut))
                .CompleteCurrentTransitions();

            //circle.SetPropertiesTransitions(
            //    new Animation(EasingFunctions.ElasticOut, TimeSpan.FromSeconds(1)),
            //    nameof(circle.X), nameof(circle.Y));
            //circle.CompleteAllTransitions();

            p.AddGeometryToPaintTask(canvas, circle);

            circle.X = r.Next(15, 285);
            circle.Y = r.Next(15, 285);
        }

        canvas.Invalidate();
    }
コード例 #6
0
        public CartesianChart(
            ICartesianChartView <TDrawingContext> view,
            Action <LiveChartsSettings> defaultPlatformConfig,
            MotionCanvas <TDrawingContext> canvas)
            : base(canvas, defaultPlatformConfig)
        {
            chartView = view;

            view.PointStates.Chart = this;
            foreach (var item in view.PointStates.GetStates())
            {
                if (item.Fill != null)
                {
                    item.Fill.ZIndex += 1000000;
                    canvas.AddDrawableTask(item.Fill);
                }
                if (item.Stroke != null)
                {
                    item.Stroke.ZIndex += 1000000;
                    canvas.AddDrawableTask(item.Stroke);
                }
            }
        }
コード例 #7
0
 /// <summary>
 /// Sets the geometries.
 /// </summary>
 /// <param name="canvas">The canvas.</param>
 /// <param name="geometries">The geometries.</param>
 public void SetGeometries(MotionCanvas <TDrawingContext> canvas, HashSet <IDrawable <TDrawingContext> > geometries)
 {
 }
コード例 #8
0
 /// <summary>
 /// Removes all geometry from paint task.
 /// </summary>
 /// <param name="canvas">The canvas.</param>
 public void ClearGeometriesFromPaintTask(MotionCanvas <TDrawingContext> canvas)
 {
 }
コード例 #9
0
 /// <summary>
 /// Removes the geometry from pain task.
 /// </summary>
 /// <param name="canvas">The canvas.</param>
 /// <param name="geometry">The geometry.</param>
 public void RemoveGeometryFromPainTask(MotionCanvas <TDrawingContext> canvas, IDrawable <TDrawingContext> geometry)
 {
 }
コード例 #10
0
 /// <summary>
 /// Gets the geometries.
 /// </summary>
 /// <param name="canvas">The canvas.</param>
 /// <returns></returns>
 public IEnumerable <IDrawable <TDrawingContext> > GetGeometries(MotionCanvas <TDrawingContext> canvas)
 {
     return(Enumerable.Empty <IDrawable <TDrawingContext> >());
 }
コード例 #11
0
 /// <summary>
 /// Adds the geometry to paint task.
 /// </summary>
 /// <param name="canvas">The canvas.</param>
 /// <param name="geometry">The geometry.</param>
 public void AddGeometryToPaintTask(MotionCanvas <TDrawingContext> canvas, IDrawable <TDrawingContext> geometry)
 {
 }
コード例 #12
0
 /// <inheritdoc cref="IPaintTask{TDrawingContext}.GetClipRectangle(MotionCanvas{TDrawingContext})" />
 public RectangleF GetClipRectangle(MotionCanvas <TDrawingContext> canvas)
 {
     return(RectangleF.Empty);
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AvaloniaDrawingContext"/> class.
 /// </summary>
 /// <param name="motionCanvas">The motion canvas.</param>
 /// <param name="info">The information.</param>
 /// <param name="surface">The surface.</param>
 /// <param name="canvas">The canvas.</param>
 public AvaloniaDrawingContext(MotionCanvas <SkiaSharpDrawingContext> motionCanvas, SKImageInfo info, SKSurface surface, SKCanvas canvas)
     : base(motionCanvas, info, surface, canvas, true)
 {
 }
コード例 #14
0
 /// <summary>
 /// Sets the geometries.
 /// </summary>
 /// <param name="canvas">The canvas.</param>
 /// <param name="geometries">The geometries.</param>
 public void SetGeometries(MotionCanvas <TDrawingContext> canvas, HashSet <IDrawable <TDrawingContext> > geometries)
 {
     throw new System.NotImplementedException();
 }
コード例 #15
0
 /// <inheritdoc cref="IPaint{TDrawingContext}.GetClipRectangle(MotionCanvas{TDrawingContext})" />
 public LvcRectangle GetClipRectangle(MotionCanvas <TDrawingContext> canvas)
 {
     return(LvcRectangle.Empty);
 }
コード例 #16
0
 /// <inheritdoc cref="IPaint{TDrawingContext}.SetClipRectangle(MotionCanvas{TDrawingContext}, LvcRectangle)" />
 public void SetClipRectangle(MotionCanvas <TDrawingContext> canvas, LvcRectangle value)
 {
 }
コード例 #17
0
 /// <inheritdoc cref="IPaint{TDrawingContext}.ReleaseCanvas(MotionCanvas{TDrawingContext})" />
 public void ReleaseCanvas(MotionCanvas <TDrawingContext> canvas)
 {
 }