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 db86d59710 Bump version number to 0.0.8 2014-11-17 09:08:30 -08:00
build Bump version number to 0.0.8 2014-11-17 09:08:30 -08:00
numerics Include version info in DLLs and NuGet packages 2014-10-31 10:54:12 -07:00
samples/SimpleSample Bump version number to 0.0.8 2014-11-17 09:08:30 -08:00
tests Change how DPI works when loading bitmaps 2014-11-12 17:51:18 -08:00
tools Effect API specifies angles in radians rather than degrees 2014-11-07 14:14:02 -08:00
winrt Change how DPI works when loading bitmaps 2014-11-12 17:51:18 -08:00
.gitattributes Create - initial gitignore and gitattributes 2014-04-28 10:34:38 -07:00
.gitignore A few minor source tree cleanups 2014-08-26 14:11:15 -07:00
CONTRIBUTING.md Updated README.md and CONTRIBUTING.md 2014-09-07 21:28:05 -07:00
LICENSE.txt Add Apache 2.0 LICENSE.txt 2014-07-18 14:16:35 -07:00
README.md CanvasControl.ClearColor property 2014-10-29 16:56:09 -07:00
Win2D.proj Include version info in DLLs and NuGet packages 2014-10-31 10:54:12 -07:00
Win2D.sln Use ComArray to manage CoTaskMemAlloc/CoTaskMemFree memory 2014-10-07 14:26:36 -07:00
build.cmd build.cmd now generates "local" prerelease packages 2014-09-12 14:58:20 -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 Store apps for Windows 8.1 and Windows Phone 8.1. It utilizes the power of Direct2D, and integrates seamlessly with XAML and ICoreWindow.

Win2D is work in progress and evolving rapidly. The goal of releasing this code in an early, incomplete state is to solicit early developer feedback.

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"

<Grid>
    <canvas:CanvasControl x:Name="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);
}

Setup

Visual Studio

  • Download here
  • Requires Visual Studio 2013 Update 2 or greater
  • If using Visual Studio Express, requires the 'for Windows' version (not 'for Windows Desktop')

Clone Repository

Build NuGet Packages

  • In Windows search, type 'Visual Studio Tools', and select that folder to open it
  • Launch 'Developer Command Prompt for VS2013'
  • 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'

Quickstart

Follow the steps below to get started on writing your own apps.

  • Go to 'File' -> 'New' -> 'Project...'
  • Select 'Visual C#' -> 'Store Apps' -> 'Universal Apps'
  • Create a 'Blank App (Universal Apps)'
  • Set a 'Name' of your choosing
  • Click 'OK'
  • Go to 'Tools' -> 'NuGet Package Manager' -> 'Manage NuGet Packages for Solution...'
  • If installing the locally built version, change 'Stable Only' to 'Include Prerelease'
  • Select 'Win2D' package and click 'Install'
  • Click 'Close'
  • Change Solution platform from 'Any CPU' to x86
  • You are now ready to hit F5 (Build)

A working sample can be found in the Samples directory.