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)

Bugfixes:

  • #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 (3)

  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 https://github.com/Microsoft/cppwinrt:

      > 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.

Skip to main content