Browse Source

Make actual RenderTargetBitmap implement IRenderTarget

pull/228/head
Nikita Tsukanov 11 years ago
parent
commit
6859f62d12
  1. 21
      src/Perspex.SceneGraph/Media/Imaging/RenderTargetBitmap.cs
  2. BIN
      tests/Perspex.RenderTests/TestBase.cs

21
src/Perspex.SceneGraph/Media/Imaging/RenderTargetBitmap.cs

@ -10,7 +10,7 @@ namespace Perspex.Media.Imaging
/// <summary> /// <summary>
/// A bitmap that holds the rendering of a <see cref="IVisual"/>. /// A bitmap that holds the rendering of a <see cref="IVisual"/>.
/// </summary> /// </summary>
public class RenderTargetBitmap : Bitmap, IDisposable public class RenderTargetBitmap : Bitmap, IDisposable, IRenderTarget
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="RenderTargetBitmap"/> class. /// Initializes a new instance of the <see cref="RenderTargetBitmap"/> class.
@ -27,18 +27,6 @@ namespace Perspex.Media.Imaging
/// </summary> /// </summary>
public new IRenderTargetBitmapImpl PlatformImpl => (IRenderTargetBitmapImpl)base.PlatformImpl; public new IRenderTargetBitmapImpl PlatformImpl => (IRenderTargetBitmapImpl)base.PlatformImpl;
/// <summary>
/// Renders an <see cref="IVisual"/> into the bitmap.
/// </summary>
/// <param name="visual">The visual to render.</param>
/// <remarks>
/// Before calling this method, ensure that <paramref name="visual"/> has been measured.
/// </remarks>
public void Render(IVisual visual)
{
PlatformImpl.Render(visual);
}
/// <summary> /// <summary>
/// Disposes of the bitmap. /// Disposes of the bitmap.
/// </summary> /// </summary>
@ -58,5 +46,12 @@ namespace Perspex.Media.Imaging
IPlatformRenderInterface factory = PerspexLocator.Current.GetService<IPlatformRenderInterface>(); IPlatformRenderInterface factory = PerspexLocator.Current.GetService<IPlatformRenderInterface>();
return factory.CreateRenderTargetBitmap(width, height); return factory.CreateRenderTargetBitmap(width, height);
} }
public IDrawingContext CreateDrawingContext() => PlatformImpl.CreateDrawingContext();
void IRenderTarget.Resize(int width, int height)
{
throw new NotSupportedException();
}
} }
} }

BIN
tests/Perspex.RenderTests/TestBase.cs

Binary file not shown.
Loading…
Cancel
Save