End of sprint – added rendertargets


New features added to Win2D this sprint:

Breaking changes:

  • NuGet packages are now marked as prerelease, so will only be visible in Manage NuGet Packages if the Include Prerelease (as opposed to Stable Only) option is set
  • Renamed CanvasBitmap.SizeInDips property to CanvasBitmap.Size
  • CanvasStrokeStyle.DashCap now defaults to Square rather than Flat
  • If you don’t specify a size, DrawText now defaults to 20pt (was 32)

A render target is a special kind of bitmap that you can draw onto.  First create one:

    CanvasRenderTarget renderTarget = new CanvasRenderTarget(canvasControl,
new Size(256, 256));

Then draw to it:

    using (var drawingSession = renderTarget.CreateDrawingSession())
    {
        drawingSession.Clear(Colors.CornflowerBlue);
        drawingSession.DrawText("Hello, rendertarget!", 0, 0, Colors.Black);
    }

The resulting bitmap can be displayed using DrawImage or a CanvasImageBrush.


Comments (0)

Skip to main content