private async void Test2_Click(object sender, RoutedEventArgs e) { InitTest(); FileOpenPicker picker1 = new FileOpenPicker(); picker1.FileTypeFilter.Add("*"); var file = await picker1.PickSingleFileAsync(); if (file == null) { return; } var fOpen = (await file.OpenReadAsync()).AsStream(); byte[] bData = new byte[fOpen.Length]; fOpen.Read(bData, 0, (int)fOpen.Length); var task2 = await PixelShader.CompileAndCreateAsync(dcRenderView.GetDevice(), bData); PixelShader shader = task2; canvasview.SetPixelShader(shader); TestRender();//测试通过 }
private void InitTest() { var device = dcRenderView.GetDevice(); if (canvasview == null) { canvasview = new CSRect(device, 512, 512); canvasview.SetPixelShader(dcRenderView.DefaultResource.default2DPixelShader); canvasview.SetVertexShader(dcRenderView.DefaultResource.default2DVertexShader); } }
public void SetCanvasCase(CanvasCase canvasCase) { CanvasCase = canvasCase; CanvasRect = new CSRect(CanvasCase.DeviceResources, CanvasCase.Width, CanvasCase.Height); CanvasRect.SetVertexShader(AppController.CurrentController.default2DVertexShader); CanvasRect.SetPixelShader(AppController.CurrentController.PS2DTex1); CanvasRect.Position = new Vector2( ((float)swapChainPanel.ActualWidth * logicScale - CanvasCase.Width) * 0.5f, ((float)swapChainPanel.ActualHeight * logicScale - CanvasCase.Height) * 0.5f); paintAgent = CanvasCase.PaintAgent; canvasCase.ViewRenderer.RenderAll(); PresentContent(); }