3 changed files with 33 additions and 11 deletions
@ -0,0 +1,31 @@ |
|||
using System.IO; |
|||
using Avalonia.Controls.Platform.Surfaces; |
|||
using Avalonia.Media.Imaging; |
|||
using Avalonia.Platform; |
|||
using SkiaSharp; |
|||
|
|||
namespace Avalonia.Skia; |
|||
|
|||
internal class RenderTargetBitmapImpl : WriteableBitmapImpl, |
|||
IRenderTargetBitmapImpl, |
|||
IFramebufferPlatformSurface |
|||
{ |
|||
private readonly FramebufferRenderTarget _renderTarget; |
|||
|
|||
public RenderTargetBitmapImpl(PixelSize size, Vector dpi) : base(size, dpi, |
|||
SKImageInfo.PlatformColorType == SKColorType.Rgba8888 ? PixelFormats.Rgba8888 : PixelFormat.Bgra8888, |
|||
AlphaFormat.Premul) |
|||
{ |
|||
_renderTarget = new FramebufferRenderTarget(this); |
|||
} |
|||
|
|||
public IDrawingContextImpl CreateDrawingContext() => _renderTarget.CreateDrawingContext(); |
|||
|
|||
public bool IsCorrupted => false; |
|||
|
|||
public override void Dispose() |
|||
{ |
|||
_renderTarget.Dispose(); |
|||
base.Dispose(); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue