public async Task CreateDocument(Util.CreateDocumentParameters parameters) { command_New.Activate = false; command_Open.Activate = false; await ApplyAllResources(); var folder = parameters.Folder; var name = parameters.Name; var width = parameters.Width; var height = parameters.Height; var renderBufferCount = parameters.bufferCount; StorageFolder documentStorageFolder = await folder.CreateFolderAsync(name); CurrentDCDocument = new DirectCanvasDocument(DCRenderView.GetDevice(), documentStorageFolder); await CurrentDCDocument.CreateAsync(width, height, renderBufferCount, parameters.CreateDocumentResourcesOption.HasFlag(Util.CreateDocumentResourcesOption.Plugin)); CurrentCanvasCase = CurrentDCDocument.canvasCase; CurrentCanvasCase.Name = name; command_Save.Activate = true; command_Import.Activate = true; command_Export.Activate = true; command_Undo.CanvasCase = CurrentCanvasCase; command_Redo.CanvasCase = CurrentCanvasCase; command_ResetCanvasPosition.Activate = true; CurrentRenderDataProvider = CurrentCanvasCase.ViewRenderer.RenderDataProvider; DefaultRenderDataProvider = CurrentCanvasCase.ViewRenderer.RenderDataProvider; }
private void Test1_Click(object sender, RoutedEventArgs e) { InitTest(); var device = dcRenderView.GetDevice(); Size a = swapChainPanel.RenderSize; canvasview.Move(random0.Next(0, (int)a.Width - 512), random0.Next(0, (int)a.Height - 512)); RenderTexture texture1 = new RenderTexture(dcRenderView.GetDevice(), 64, 64, true); texture1.GenerateMips(); RenderTexture texture2 = new RenderTexture(dcRenderView.GetDevice(), 64, 64, false); TestRender();//测试通过 }
private void Grid_Loaded(object sender, RoutedEventArgs e) { dcRenderView = new DCRenderView(); dcRenderView.SetSwapChainPanel(swapChainPanel); dcRenderView.SetLogicSize(swapChainPanel.RenderSize); dcRenderView.ClearRenderTarget(); dcRenderView.Present(); swapChainPanel.SizeChanged += SwapChainPanel_SizeChanged; RenderTexture tex1 = new RenderTexture(dcRenderView.GetDevice(), 64, 128, true); tex1.Clear(); }
public async Task OpenDocument(StorageFolder folder) { command_New.Activate = false; command_Open.Activate = false; await ApplyAllResources(); CurrentDCDocument = new DirectCanvasDocument(DCRenderView.GetDevice(), folder); await CurrentDCDocument.LoadAsync(); CurrentCanvasCase = CurrentDCDocument.canvasCase; foreach (StorageFile file in await CurrentDCDocument.animationsFolder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)) { if (".DCAnimation".Equals(file.FileType, StringComparison.CurrentCultureIgnoreCase)) { var animation = await DirectCanvasAnimationFormat.LoadFromFileAsync(file); LoadedAnimation.Add(animation.Guid, animation); } else if (".DCTimeline".Equals(file.FileType, StringComparison.CurrentCultureIgnoreCase)) { var timeline = await DirectCanvasTimelineFormat.LoadFromFileAsync(file); LoadedTimeline.Add(timeline.Guid, timeline); } } command_Save.Activate = true; command_Import.Activate = true; command_Export.Activate = true; command_Undo.CanvasCase = CurrentCanvasCase; command_Redo.CanvasCase = CurrentCanvasCase; command_ResetCanvasPosition.Activate = true; CurrentRenderDataProvider = CurrentCanvasCase.ViewRenderer.RenderDataProvider; DefaultRenderDataProvider = CurrentCanvasCase.ViewRenderer.RenderDataProvider; }
async Task LoadResourceFun() { await Task.WhenAll(Brush.LoadStaticResourcesAsync(), BlendMode.LoadStaticResourcesAsync()); default2DVertexShader = await VertexShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\default2DVertexShader.cso"); default2DPixelShader = await PixelShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\default2DPixelShader.cso"); PS2DTex1 = await PixelShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\PS2DTex1.cso"); Texture2TT = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\Texture2TT.cso"); TextureEmptyTest = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\TextureEmptyTest.cso"); TT2Texture = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\TT2Texture.cso"); TTPartCopy = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\TTPartCopy.cso"); TTReplace = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\TTReplace.cso"); TexturePartClear = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\TexturePartClear.cso"); CExport = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\CExport.cso"); CImport = await ComputeShader.LoadAsync(DCRenderView.GetDevice(), "DirectCanvasRenderEngine\\CImport.cso"); }