static void ValidateCannotCreateRenderTarget(CanvasDevice device, DirectXPixelFormat format, CanvasAlphaMode alphaMode) { ValidateUnsupportedPixelFormatException(() => { new CanvasRenderTarget(device, 16, 16, 96, format, alphaMode); }); }
static void ValidateCannotCreateBitmap(CanvasDevice device, DirectXPixelFormat format, CanvasAlphaMode alphaMode) { ValidateUnsupportedPixelFormatException(() => { CanvasBitmap.CreateFromBytes(device, new byte[1024], 4, 4, format, 96, alphaMode); }); }
private void CreatePanelSizeDependentResources() { _panelWidth = (float)layoutPanel.ActualWidth; _panelHeight = (float)layoutPanel.ActualHeight; // Regardless of display AC type, use the same render code. DirectXPixelFormat fmt = DirectXPixelFormat.R16G16B16A16Float; int numBuffers = 2; if (_swapChain == null) { _swapChain = new CanvasSwapChain( _device, _panelWidth, _panelHeight, _dispInfo.LogicalDpi, fmt, numBuffers, CanvasAlphaMode.Ignore); } else { _swapChain.ResizeBuffers( _panelWidth, _panelHeight, _dispInfo.LogicalDpi, fmt, numBuffers); } swapChainPanel.SwapChain = _swapChain; }
public void RestoreSuspendedState(CanvasDevice device, BinaryReader reader) { bitmapFormat = (DirectXPixelFormat)reader.ReadInt32(); bitmapData = reader.ReadByteArray(); Size = reader.ReadVector2(); reader.ReadCollection(Edits, () => EditGroup.RestoreSuspendedState(this, reader)); RecoverAfterDeviceLost(device); }
public async Task Load(CanvasDevice device, StorageFile file) { using (var stream = await file.OpenReadAsync()) { SourceBitmap = await CanvasBitmap.LoadAsync(device, stream); } bitmapFormat = sourceBitmap.Format; bitmapData = sourceBitmap.GetPixelBytes(); Size = sourceBitmap.Size.ToVector2(); Edits.Clear(); Edits.Add(new EditGroup(this)); SelectedEffect = null; }
static CanvasAlphaMode FirstSupportedAlphaMode(DirectXPixelFormat format) { return formatFlags.ContainsKey(format) ? SupportedAlphaModes(format).First() : CanvasAlphaMode.Premultiplied; }
static IEnumerable<CanvasAlphaMode> UnsupportedAlphaModes(DirectXPixelFormat format) { return GetAlphaModes(~formatFlags[format]); }
static CanvasAlphaMode FirstSupportedAlphaMode(DirectXPixelFormat format) { return(formatFlags.ContainsKey(format) ? SupportedAlphaModes(format).First() : CanvasAlphaMode.Premultiplied); }
static IEnumerable <CanvasAlphaMode> UnsupportedAlphaModes(DirectXPixelFormat format) { return(GetAlphaModes(~formatFlags[format])); }