Exemplo n.º 1
0
 private void OutputImageCanvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasVirtualControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     if (InputImageStream != null)
     {
         args.TrackAsyncAction(LoadOutputVirtualBitmap().AsAsyncAction());
     }
 }
Exemplo n.º 2
0
 private void ImageVirtualControl_CreateResources(CanvasVirtualControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     if (imageStream != null)
     {
         args.TrackAsyncAction(LoadVirtualBitmap().AsAsyncAction());
     }
 }
Exemplo n.º 3
0
        private void Canvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            //创建径向渐变画笔的实例;中心将是透明的, 极端不透明的黑色
            canvasRadialGradientBrush = new CanvasRadialGradientBrush(sender, Colors.Transparent, Colors.Black);

            //加载要绘制的图像。
            args.TrackAsyncAction(Task.Run(async() => { image = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///wallhaven-766453.jpg")); }).AsAsyncAction());
        }
Exemplo n.º 4
0
 private void Canvas_CreateResources(CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     for (int i = 0; i < 6; i++)
     {
         Items.Add(new Uri($"ms-appx:///Assets/Images/loadinganim{i}.png"));
     }
     args.TrackAsyncAction(Canvas_CreateResourcesAsync(sender).AsAsyncAction());
 }
Exemplo n.º 5
0
        private void canvasControl_CreateResources(CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            CreateSizeDependentResources();

            if (ThumbnailGenerator.IsDrawingThumbnail)
            {
                args.TrackAsyncAction(LoadThumbnailResources(sender).AsAsyncAction());
            }
        }
Exemplo n.º 6
0
        private void GameCanvas_CreateResources(CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
            width  = GameCanvas.ActualWidth;
            height = GameCanvas.ActualHeight;

            shipWidth  = (int)(width / 2 - 150);
            shipHeight = (int)(height - 425);
        }
Exemplo n.º 7
0
        private void Canvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            // Create instance of radial gradient brush; the center will be transparent and the extremes opaque black.
            radialBrush = new CanvasRadialGradientBrush(sender, Colors.Transparent, Colors.Black);

            // Load image to draw.
            args.TrackAsyncAction(Task.Run(async() =>
            {
                image = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///SpotlightImage.png"));
            }).AsAsyncAction());
        }
Exemplo n.º 8
0
        private void Canvas1_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            if (mainCharacter == null)
            {
                mainCharacter = new GameCharacter(Canvas1);
            }

            //Grass
            shapes.Add(new Rect(0, Canvas1.ActualHeight - 75, Canvas1.ActualWidth, 75), Colors.Green);

            for (int i = 0; i < 5; i++)
            {
                shapes.Add(new Rect(100 + (i * 150), Canvas1.ActualHeight - (150 + i * 80), 140, 10), Colors.Brown);
            }

            shapes.Add(new Rect(1000, 300, 140, 10), Colors.Green);

            args.TrackAsyncAction(mainCharacter.CreateResources(sender).AsAsyncAction());
        }
Exemplo n.º 9
0
 /// <summary>
 /// Creates shared resources for Win2D rendering
 /// </summary>
 private void PersistentHolderCanvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(RenderService.CreateResourcesAsync(sender).AsAsyncAction());
 }
Exemplo n.º 10
0
 // Adapted from https://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_UI_Xaml_CanvasControl.htm
 private void GameCanvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     // Calls CreateResourcesAsync Task and ensures could will not execute until the task completes
     args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
 }
Exemplo n.º 11
0
 private void OnCreateResources(CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {   // Creates Resources once
     // Load Images
     args.TrackAsyncAction(LoadResourcesAsync(sender).AsAsyncAction());
 }
Exemplo n.º 12
0
 private void canvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(LoadImages(sender.Device).AsAsyncAction());
 }
Exemplo n.º 13
0
 private void BlurCanvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(ReflashBackground(sender, CurrentTrack?.PictureUrl).AsAsyncAction());
 }
Exemplo n.º 14
0
 private void CreateCanvasResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(CreateInitialResourcesAsync(sender).AsAsyncAction());
 }
Exemplo n.º 15
0
 private void CanvasControl_CreateResources(CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(PreparePage(sender).AsAsyncAction());
 }
Exemplo n.º 16
0
 private void Canvas_CreateResources(CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(CreateResources(sender).AsAsyncAction());
 }
Exemplo n.º 17
0
 private void Canvas_CreateResources(CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     init = false;
     args.TrackAsyncAction(Engine.LoadResources(this).AsAsyncAction());
 }