Browse Source

add a proposed GetPixels method to IBitmapImpl with skia implementation.

pull/1293/head
Dan Walmsley 8 years ago
parent
commit
82069d7acc
  1. 7
      src/Avalonia.Visuals/Platform/IBitmapImpl.cs
  2. 6
      src/Skia/Avalonia.Skia/BitmapImpl.cs

7
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
/// </summary>
/// <param name="stream">The stream.</param>
void Save(Stream stream);
/// <summary>
/// Gets a pointer to the pixel data.
/// </summary>
/// <returns>IntPtr to the pixel data.</returns>
IntPtr GetPixels();
}
}

6
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;

Loading…
Cancel
Save