public void SkiaSharp()
 {
     //fail "Could not load file or assembly 'SkiaSharp.Views.Forms, Version=...."
     var skiaSharpCanvas = new SkiaSharp.Views.Forms.SKCanvasView();
    // skiaSharpCanvas.PaintSurface += SkiaSharpCanvas_PaintSurface; 
     Assert.AreNotEqual(null, skiaSharpCanvas);
 }
Пример #2
0
 private void SetupSurface()
 {
     if (ForceSoftwareRenderer)
     {
         if (SKCanvasView == null)
         {
             SKCanvasView = new SkiaSharp.Views.Forms.SKCanvasView();
             SKCanvasView.PaintSurface += SKCanvasView_PaintSurface;
         }
         if (SKGLView != null)
         {
             SKGLView = null;
         }
         Content = SKCanvasView;
     }
     else
     {
         if (SKGLView == null)
         {
             SKGLView = new SkiaSharp.Views.Forms.SKGLView();
             SKGLView.PaintSurface += SKGLView_PaintSurface;
         }
         if (SKCanvasView != null)
         {
             SKCanvasView = null;
         }
         Content = SKGLView;
     }
 }
Пример #3
0
 public static void Add(SkiaSharp.Views.Forms.SKCanvasView element)
 {
     bag.Add(element);
     if (timer == null)
     {
         var autoEvent = new AutoResetEvent(false);
         timer = new Timer(timerElapsed, autoEvent, new TimeSpan(0, 0, 0, 0, 20), new TimeSpan(0, 0, 0, 0, 20));
     }
 }
Пример #4
0
        public AvatarCustomizer()
        {
            this.SizeChanged += AvatarCustomizer_SizeChanged;


            SkiaSharp.Views.Forms.SKCanvasView cb = new SkiaSharp.Views.Forms.SKCanvasView();
            cb.VerticalOptions   = LayoutOptions.FillAndExpand;
            cb.HorizontalOptions = LayoutOptions.FillAndExpand;
            cb.PaintSurface     += Cb_PaintSurface;
            TapGestureRecognizer tgr = new TapGestureRecognizer();

            tgr.Tapped += Tgr_Tapped;
            cb.GestureRecognizers.Add(tgr);
            _displays["avatar"] = cb;

            TapGestureRecognizer thair = new TapGestureRecognizer();

            thair.Tapped += Thair_Tapped;
            foreach (PlayerAvatar.AvatarElement ae in editables)
            {
                SkiaSharp.Views.Forms.SKCanvasView hair = new LinkedCanvasView <PlayerAvatar.AvatarElement>(ae);
                hair.VerticalOptions   = LayoutOptions.FillAndExpand;
                hair.HorizontalOptions = LayoutOptions.FillAndExpand;
                hair.PaintSurface     += Hair_PaintSurface;

                hair.GestureRecognizers.Add(thair);
                _displays[ae.ToString()] = hair;
            }

            for (int i = 0; i < 4; ++i)
            {
                optionGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                optionGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }
        }
Пример #5
0
        public CodeButtonClickPage()
        {
            this.Disappearing += CodeButtonClickPage_Disappearing;

            SkiaSharp.Views.Forms.SKCanvasView bv = new SkiaSharp.Views.Forms.SKCanvasView();
            bv.VerticalOptions   = LayoutOptions.FillAndExpand;
            bv.HorizontalOptions = LayoutOptions.FillAndExpand;
            //bv.
            bv.PaintSurface += new FlOval()
            {
                backgroundColor = new SKPaint()
                {
                    Color = new SKColor(125, 0, 0)
                }
            }.AutoPaint;
            TapGestureRecognizer ttr = new TapGestureRecognizer();

            ttr.Tapped += Tgr_Tapped1;
            bv.GestureRecognizers.Add(ttr);
            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(5, GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            int         foodIdx = 0;
            List <Food> foods   = Food.Discover(12);

            for (int row = 1; row <= 3; ++row)
            {
                for (int col = 0; col <= 3; col += 2)
                {
                    if (foodIdx >= 0 && foodIdx < foods.Count)
                    {
                        ToggleableImage ib = new ToggleableImage()
                        {
                            Value = foods[foodIdx]
                        };
                        ib.VerticalOptions   = LayoutOptions.FillAndExpand;
                        ib.HorizontalOptions = LayoutOptions.FillAndExpand;
                        TapGestureRecognizer tgr = new TapGestureRecognizer();
                        tgr.Tapped += ib.Tgr_Tapped;
                        ib.GestureRecognizers.Add(tgr);

                        grid.Children.Add(ib, col, row);
                        Grid.SetColumnSpan(ib, 2);

                        foodIdx++;
                    }
                    if (foodIdx >= foods.Count)
                    {
                        foodIdx = -1;
                    }
                }
            }
            SkiaSharp.Views.Forms.SKCanvasView cb = new SkiaSharp.Views.Forms.SKCanvasView();
            cb.VerticalOptions   = LayoutOptions.FillAndExpand;
            cb.HorizontalOptions = LayoutOptions.FillAndExpand;
            cb.PaintSurface     += Cb_PaintSurface;
            grid.Children.Add(cb, 0, 0);
            grid.Children.Add(bv, 1, 4);

            Grid.SetColumnSpan(cb, 4);
            Grid.SetColumnSpan(bv, 2);

            Content = grid;
        }