diff --git a/src/Avalonia.Visuals/Platform/IBitmapImpl.cs b/src/Avalonia.Visuals/Platform/IBitmapImpl.cs index 12ac28e880..8b7327d00d 100644 --- a/src/Avalonia.Visuals/Platform/IBitmapImpl.cs +++ b/src/Avalonia.Visuals/Platform/IBitmapImpl.cs @@ -1,6 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; using System.IO; namespace Avalonia.Platform @@ -31,5 +32,11 @@ namespace Avalonia.Platform /// /// The stream. void Save(Stream stream); + + /// + /// Gets a pointer to the pixel data. + /// + /// IntPtr to the pixel data. + IntPtr GetPixels(); } } diff --git a/src/Skia/Avalonia.Skia/BitmapImpl.cs b/src/Skia/Avalonia.Skia/BitmapImpl.cs index 00ab770e01..1888bd9273 100644 --- a/src/Skia/Avalonia.Skia/BitmapImpl.cs +++ b/src/Skia/Avalonia.Skia/BitmapImpl.cs @@ -23,6 +23,7 @@ namespace Avalonia.Skia static void ReleaseProc(IntPtr address, object ctx) { ((IUnmanagedBlob) ctx).Dispose(); + } private static readonly SKBitmapReleaseDelegate ReleaseDelegate = ReleaseProc; @@ -60,6 +61,11 @@ namespace Avalonia.Skia public int PixelWidth { get; private set; } public int PixelHeight { get; private set; } + public IntPtr GetPixels() + { + return Bitmap.GetPixels(); + } + class BitmapDrawingContext : DrawingContextImpl { private readonly SKSurface _surface;