internal override void tileImage(Microsoft.Graphics.Canvas.CanvasBitmap canvasBitmap, int x, int y, int w, int h) { setGraphics(canvas.CreateDrawingSession()); base.setClip(clip); base.tileImage(canvasBitmap, x, y, w, h); base.removeClip(); dispose(); }
public DrawImagePainter(Rectangle clip, Microsoft.Graphics.Canvas.CanvasBitmap canvasBitmap, int x, int y, int alpha) : base(clip) { this.clip = clip; this.canvasBitmap = canvasBitmap; this.x = x; this.y = y; this.alpha = alpha; }
public DrawImagePainter(Rectangle clip, Microsoft.Graphics.Canvas.CanvasBitmap canvasBitmap, int x, int y, int alpha) : base(clip) { this.clip = clip; this.canvasBitmap = canvasBitmap; this.x = x; this.y = y; this.alpha = alpha; }
public TileImagePainter(Shape clip, Microsoft.Graphics.Canvas.CanvasBitmap canvasBitmap, int x, int y, int w, int h, int alpha) : base(clip) { this.clip = clip; this.canvasBitmap = canvasBitmap; this.x = x; this.y = y; this.w = w; this.h = h; this.alpha = alpha; }
private void FillSurfaceWithBitmap(Microsoft.Graphics.Canvas.CanvasBitmap canvasBitmap) { Microsoft.Graphics.Canvas.UI.Composition.CanvasComposition.Resize(_surface, canvasBitmap.Size); using (var session = Microsoft.Graphics.Canvas.UI.Composition.CanvasComposition.CreateDrawingSession(_surface)) { session.Clear(Windows.UI.Colors.Transparent); session.DrawImage(canvasBitmap); } }
private void DisplayFrame(Direct3D11CaptureFrame frame) { // Resize and device-lost leverage the same function on the // Direct3D11CaptureFramePool. Refactoring it this way avoids // throwing in the catch block below (device creation could always // fail) along with ensuring that resize completes successfully and // isn’t vulnerable to device-lost. bool needsReset = false; bool recreateDevice = false; if ((frame.ContentSize.Width != _lastSize.Width) || (frame.ContentSize.Height != _lastSize.Height)) { needsReset = true; _lastSize = frame.ContentSize; } try { // Take the D3D11 surface and draw it into a // Composition surface. // Convert our D3D11 surface into a Win2D object. Microsoft.Graphics.Canvas.CanvasBitmap canvasBitmap = Microsoft.Graphics.Canvas.CanvasBitmap.CreateFromDirect3D11Surface(_canvasDevice, frame.Surface); //_currentFrame = canvasBitmap; // Helper that handles the drawing for us. FillSurfaceWithBitmap(canvasBitmap); } // This is the device-lost convention for Win2D. catch (Exception e) when(_canvasDevice.IsDeviceLost(e.HResult)) { System.Diagnostics.Debug.WriteLine("Canvas Device is Lost!!"); // We lost our graphics device. Recreate it and reset // our Direct3D11CaptureFramePool. needsReset = true; recreateDevice = true; } if (needsReset) { ResetFramePool(frame.ContentSize, recreateDevice); } }