public void Render(IDrawingContextImpl context) { var finalRenderSurface = context.CreateLayer(_destRect.Size); if (finalRenderSurface is null) { context.Clear(Colors.Aqua); return; } using (var renderSurfaceCtx = finalRenderSurface.CreateDrawingContext(null)) { using (_lottieCanvas.CreateSession(_destRect.Size, finalRenderSurface, new DrawingContext(renderSurfaceCtx))) { _compositionLayer.Draw(_lottieCanvas, _matrix, 255); } } context.DrawBitmap(RefCountable.Create(finalRenderSurface), 1, new Rect(new Point(), finalRenderSurface.PixelSize.ToSize(1)), _destRect); finalRenderSurface.Dispose(); }
public void RecreateBitmap(IDrawingContextImpl drawingContext, Size size, double scaling) { if (Size != size || Scaling != scaling) { var resized = RefCountable.Create(drawingContext.CreateLayer(size)); using (var context = resized.Item.CreateDrawingContext(null)) { Bitmap.Dispose(); context.Clear(default);
public RenderLayer( IDrawingContextImpl drawingContext, Size size, double scaling, IVisual layerRoot) { Bitmap = RefCountable.Create(drawingContext.CreateLayer(size)); Size = size; Scaling = scaling; LayerRoot = layerRoot; IsEmpty = true; }
public RenderLayer( IDrawingContextImpl drawingContext, Size size, double scaling, IVisual layerRoot) { _drawingContext = drawingContext; Bitmap = drawingContext.CreateLayer(size); Size = size; Scaling = scaling; LayerRoot = layerRoot; }
public void ResizeBitmap(Size size, double scaling) { if (Size != size || Scaling != scaling) { var resized = RefCountable.Create(_drawingContext.CreateLayer(size)); using (var context = resized.Item.CreateDrawingContext(null)) { context.Clear(Colors.Transparent); context.DrawImage(Bitmap, 1, new Rect(Size), new Rect(Size)); Bitmap.Dispose(); Bitmap = resized; Size = size; } } }
private IRef <IRenderTargetBitmapImpl> GetOverlay( IDrawingContextImpl parentContext, Size size, double scaling) { var pixelSize = size * scaling; if (_overlay == null || _overlay.Item.PixelWidth != pixelSize.Width || _overlay.Item.PixelHeight != pixelSize.Height) { _overlay?.Dispose(); _overlay = RefCountable.Create(parentContext.CreateLayer(size)); } return(_overlay); }
public void RecreateBitmap(IDrawingContextImpl drawingContext, Size size, double scaling) { if (Size != size || Scaling != scaling) { var resized = RefCountable.Create(drawingContext.CreateLayer(size)); using (var context = resized.Item.CreateDrawingContext(null)) { context.Clear(Colors.Transparent); Bitmap.Dispose(); Bitmap = resized; Scaling = scaling; Size = size; IsEmpty = true; } } }