Browse Source

Make it possible to construct a Direct2D BitmapImpl from a ID2D1Bitmap directly, instead of only via WIC imaging factories.

pull/859/head
Jeremy Koritzinsky 9 years ago
parent
commit
17a43dacfa
  1. 20
      src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs

20
src/Windows/Avalonia.Direct2D1/Media/Imaging/BitmapImpl.cs

@ -64,6 +64,21 @@ namespace Avalonia.Direct2D1.Media
BitmapCreateCacheOption.CacheOnLoad);
}
/// <summary>
/// Initialize a new instance of the <see cref="BitmapImpl"/> class
/// with a bitmap backed by GPU memory.
/// </summary>
/// <param name="d2DBitmap">The GPU bitmap.</param>
/// <remarks>
/// This bitmap must be either from the same render target,
/// or if the render target is a <see cref="SharpDX.Direct2D1.DeviceContext"/>,
/// the device associated with this context, to be renderable.
/// </remarks>
public BitmapImpl(SharpDX.Direct2D1.Bitmap d2DBitmap)
{
_direct2D = d2DBitmap;
}
/// <summary>
/// Gets the width of the bitmap, in pixels.
/// </summary>
@ -77,14 +92,13 @@ namespace Avalonia.Direct2D1.Media
public virtual void Dispose()
{
WicImpl.Dispose();
_direct2D?.Dispose();
}
/// <summary>
/// Gets the WIC implementation of the bitmap.
/// </summary>
public Bitmap WicImpl
{
get; }
public Bitmap WicImpl { get; }
/// <summary>
/// Gets a Direct2D bitmap to use on the specified render target.

Loading…
Cancel
Save