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.
Перейти к файлу
Claire Andrews 98953e3ee0 Add CanvasDevice.DeviceLost 2015-06-02 10:32:29 -07:00
build Add icon link to the Win2D NuGet packages 2015-05-29 15:38:08 -07:00
numerics Replace explicit WINVER > 0x603 comparison with USE_LOCALLY_EMULATED_UAP_APIS define 2015-04-07 12:50:53 -07:00
samples KeyboardInputExample - bring the input pane back up when the user taps on the screen 2015-05-29 16:14:02 -07:00
tools Better docs explaining how to avoid refcount cycles when using Win2D XAML controls from managed code 2015-06-01 16:14:17 -07:00
winrt Add CanvasDevice.DeviceLost 2015-06-02 10:32:29 -07:00
.gitattributes Create - initial gitignore and gitattributes 2014-04-28 10:34:38 -07:00
.gitignore Ignore UpgradeLog.htm 2015-04-02 17:26:34 -07:00
CONTRIBUTING.md Consolidate tests/samples to the samples directory. 2015-05-22 10:22:15 -07:00
LICENSE.txt Add Apache 2.0 LICENSE.txt 2014-07-18 14:16:35 -07:00
README.md Fix readme .md formatting so it displays correctly on github 2015-05-27 11:08:57 -07:00
Win2D.81.sln Shorten the per-platform folder names in SimpleSample: SimpleSample\SimpleSample.Windows\ becomes SimpleSample\Windows\ 2015-05-28 17:58:27 -07:00
Win2D.proj Add smoke.cmd for quickly building and testing a subset of target flavors 2015-05-29 15:13:41 -07:00
Win2D.uap.sln UAP version of CoreWindowExample 2015-05-28 17:58:42 -07:00
build.cmd Use correct "Universal Windows Platform" terminology 2015-05-11 17:07:18 -07:00
smoke.cmd Add smoke.cmd for quickly building and testing a subset of target flavors 2015-05-29 15:13:41 -07: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# and C++ developers writing Windows apps for Windows 8.1, Windows Phone 8.1 and Windows 10. 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);
}

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

Clone Repository
Build NuGet Packages
  • If using Visual Studio 2013:
    • In Windows search, type 'Visual Studio Tools', and select that folder to open it
    • Launch 'Developer Command Prompt for VS2013'
  • If using Visual Studio 2015:
    • Launch 'MSBuild Command Prompt for VS2015'
  • 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.

If you are building with Visual Studio 2013, then the generated package is called "Win2D-NoUAP". This contains everything the usual Win2D package contains apart from any Universal Windows Platform binaries.