Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.
Перейти к файлу
Shawn Hargreaves ed41d9cdd0 Update to SDK 17134 (April 2018 Update) 2018-04-30 12:21:03 -07:00
build Update to SDK 17134 (April 2018 Update) 2018-04-30 12:21:03 -07:00
samples Remove obsolete WindowsMobile SDK reference 2018-04-04 15:56:06 -07:00
tools Fix sample exporter handling of "Shared" subfolder 2018-04-10 19:51:10 +00:00
winrt Update to SDK 17134 (April 2018 Update) 2018-04-30 12:21:03 -07:00
.gitattributes Create - initial gitignore and gitattributes 2014-04-28 10:34:38 -07:00
.gitignore Ignore *.VC.db 2016-05-03 13:38:09 -07:00
CONTRIBUTING.md Update Visual Studio and SDK version mentions in docs 2018-04-17 14:39:20 -07:00
LICENSE.txt Change license from Apache 2.0 to MIT - manually update files that include handwritten license text 2015-07-06 21:37:39 -07:00
README.md Update to SDK 17134 (April 2018 Update) 2018-04-30 12:21:03 -07:00
Win2D.proj Disable running test.external from Win2D.proj due to vstest bug, and link vstest workarounds to the bugs that track them 2018-04-17 20:27:35 +00:00
Win2D.uap.sln Remove 8.1 support: merge the .uap and .shared projects 2018-02-23 15:24:39 -08:00
build.cmd Remove 8.1 support: assorted other cleanups 2018-02-23 15:25:05 -08:00
smoke.cmd Remove 8.1 support: assorted other cleanups 2018-02-23 15:25:05 -08:00

README.md

Win2D

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.

Where to get it
How to use it
More info

Code Example

To give you a flavor of what the code looks like, here is a snippet of XAML:

xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"

<Grid>
    <canvas:CanvasControl Draw="canvasControl_Draw" ClearColor="CornflowerBlue" />
</Grid>

and C#:

void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
    args.DrawingSession.DrawEllipse(155, 115, 80, 30, Colors.Black, 3);
    args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow);
}

or C++/CX:

void MainPage::CanvasControl_Draw(CanvasControl^ sender, CanvasDrawEventArgs^ args)
{
    args->DrawingSession->DrawEllipse(155, 115, 80, 30, Colors::Black, 3);
    args->DrawingSession->DrawText("Hello, world!", 100, 100, Colors::Yellow);
}

or VB:

Sub canvasControl_Draw(sender As CanvasControl, args As CanvasDrawEventArgs)
    args.DrawingSession.DrawEllipse(155, 115, 80, 30, Colors.Black, 3)
    args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow)
End Sub

Using Win2D

The documentation explains how to install Visual Studio, add the Win2D NuGet package to your project, and get started using the API.

Building Win2D from source

Requirements
  • Visual Studio 2017 with Tools for Universal Windows Apps 15.0.27428.01 and Windows SDK 17134
Clone Repository
Build NuGet Packages
  • Launch 'Developer Command Prompt for VS2017'
  • Change directory to your cloned Win2D repository and run 'build'
Point Visual Studio at the resulting 'bin' directory
  • In Visual Studio, go to 'Tools' -> 'NuGet Package Manager' -> 'Package Manager Settings'
  • Choose 'Package Sources'
  • Click the '+' button to add a new source
  • Set 'Name' to 'Win2D' (or a name of your choosing)
  • Set 'Source' to the full path to the 'bin' directory (inside your cloned Win2D repository)
  • Click the 'Update' button
  • Click 'OK'

Locally built versions of Win2D are marked as prerelease, so you must change the 'Stable Only' setting to 'Include Prerelease' when adding them to your project.

Legacy support for Windows 8.1

Win2D 1.21.0 was the last release to support the Windows 8.1 and Windows Phone 8.1 platforms. From Win2D 1.22.0 onward, only the Windows Universal Platform (UWP) is supported.

Legacy Win2D support for Windows and Phone 8.1 is available as a NuGet package and from the win81 branch on github.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.