Win2D 1.21.0 – SVG, improved HDR support, and bugfixes

Win2D version 1.21.0 is now available on NuGet (for Windows 10 or Windows / Phone 8.1) and GitHub.

New in this release:

  • Load, draw, and manipulate SVG (scalable vector graphics) documents  (requires Windows 10 Creators Update)
  • Load and save JpegXR images using extended precision pixel formats  (16 and 32 bit floating point, or 16 bit normalized integer)
  • ColorManagementProfile now supports Simple and Extended types as well as ICC color profiles  (requires Windows 10 Creators Update)
  • Added a CanvasComposition.CreateDrawingSession overload that allows specifying DPI
  • Building Win2D for UWP now requires Visual Studio 2017  (but if you are just using it in an app rather than compiling it yourself, both VS 2015 and 2017 continue to be supported)


  • #479 - CanvasVirtualControl OnRegionsInvalidated not triggered when launching app
  • #486 - Crash when resource loading completes after Canvas is already unloaded
  • #487 - ComputeHistogram does not take into account the SourceRectangle
  • #491 - CanvasControl & CanvasVirtualControl do not disable the accessibility view
  • #496 - Crash in Microsoft_Graphics_Canvas RegisteredEvent::Release
  • #498 - CanvasGradientMesh TensorPatch Colors documented incorrectly
  • #515 - Crash when passing a CanvasCommandList to CanvasImage.SaveAsync


Win2D supports a subset of SVG 1.1. For more details, see Direct2D's page about SVG support.

Code example:

// Load an SVG document.
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/sample.svg"));

using (var stream = await file.OpenReadAsync())
    svgDocument = await CanvasSvgDocument.LoadAsync(sender, stream);

// Draw it.
args.DrawingSession.DrawSvg(svgDocument, sender.Size);

// Modify the SVG.
var eye = svgDocument.FindElementById("right_eye");
eye.SetColorAttribute("fill", Colors.Red);


Comments (6)

  1. Imperial Dynamics says:

    PERFECT!!! I love Win2D beyond words!
    Nice to see you are still adding features!!
    Any chance Microsoft actively/aggressively promotes Win2D?. Many developers haven’t even heard about it, and it’s a shame coz win2d rocks

  2. camhusmj38 says:

    Is it possible that you could ship c++/winrt headers?

    1. C++/WinRT does not yet support everything required to use it with Win2D. Quoting from

      > Note: This RTM release fully supports consuming Windows Runtime APIs. While you can use the current functionality to define a class that implements one or more existing WinRT interfaces (as shown by samples defining FrameworkView classes), the current release does not provide any infrastructure for implementing a module (DLL or EXE) that hosts activatable WinRT components. Future releases will provide this support.

  3. casey.sun says:

    build errors.
    On a new PC with VS2017 installed, I cloned the source tree and executed build.cmd, it failed with several toolversion mismatch errors.
    I deleted all ToolsVersion=”12.0″ entries, and modified PlatformToolset prop to “v141”, then build completed with no error.

  4. Imperial Dynamics says:

    Hello Shawn,
    i have a simple question, please don’t make me open an issue on the blog for this…
    I had the simplest win2d uwp app:
    Just a canvascontrol with a draw method.
    In the draw method i was drawing two simple rect, one stationary, the other had its x coordinate decrease.
    The stationary was perfect but the moving rect had a small but noticeable flickering.
    It was driving me nuts and i couldn’t figure out the culprit.
    Perhaps it had to do with how i was forcing the draw handler?…
    specifically i had a dispatcherTimer that ticked every 30 fps (1000.0/30 ms). In the tick handler i merely called canvasControl.Invalidate();
    Changing the 30 value to something small e.g. 10 or to something large e.g. 60 did not remove the flickering.
    I was finally able to get rid off the flickering by changing the CanvasControl to a CanvasAnimatedControl (hence no need for a dispatcherTimer).
    My question to you please is: What is the recommended way to use a loop with a CanvasControl?
    THANK YOU my friend.

  5. blods says:

    LOVE WIN2D Keep up the great work

Skip to main content