2014-06-28 00:53:27 +04:00
|
|
|
# Windows Canvas
|
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
Windows Canvas 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.
|
|
|
|
|
|
|
|
Windows Canvas is work in progress and evolving rapidly. The goal of releasing this code
|
|
|
|
in an early, incomplete state is to solicit early developer feedback.
|
|
|
|
|
|
|
|
More information can be found on the [blog](http://blogs.msdn.com/b/windowscanvas/).
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
### Visual Studio
|
|
|
|
- Download [here](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
|
|
|
|
- Visual Studio 2013 Update 2 required
|
|
|
|
|
|
|
|
### Clone Repository
|
|
|
|
- Go to 'View' -> 'Team Explorer' -> 'Local Git Repositories' -> 'Clone'
|
|
|
|
- Add the Windows Canvas repository URL (https://github.com/Microsoft/WindowsCanvas.git) and hit 'Clone'
|
|
|
|
|
|
|
|
### 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 Windows Canvas 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 'Windows Canvas' (or a name of your choosing)
|
|
|
|
- Set 'Source' to the full path to the 'bin' directory (inside your cloned Windows Canvas repository)
|
|
|
|
- Click the 'Update' button
|
|
|
|
- Click 'OK'
|
|
|
|
|
|
|
|
## Quickstart
|
|
|
|
Follow the steps below to get started on writing your own apps.
|
|
|
|
|
|
|
|
A working sample can be found in the Samples directory.
|
|
|
|
|
|
|
|
- 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...'
|
|
|
|
- Select 'Windows Canvas' package and click 'Install'
|
|
|
|
- Click 'Close'
|
|
|
|
- Change Solution platform from 'Any CPU' to x86
|
|
|
|
- You are now ready to hit F5 (Build)
|
|
|
|
|
|
|
|
## Code Example
|
|
|
|
To give you a flavor of what the code looks like, here is a snippet:
|
|
|
|
```cs
|
2014-08-21 03:33:39 +04:00
|
|
|
canvasControl.Draw += canvasControl_Draw;
|
2014-07-29 21:50:27 +04:00
|
|
|
...
|
2014-08-21 03:33:39 +04:00
|
|
|
void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
|
2014-07-29 21:50:27 +04:00
|
|
|
{
|
|
|
|
args.DrawingSession.Clear(Colors.BlueViolet);
|
|
|
|
}
|
2014-06-28 00:53:27 +04:00
|
|
|
```
|
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
## Resources
|
|
|
|
|
|
|
|
### Project Backlog
|
|
|
|
- https://github.com/Microsoft/WindowsCanvas/wiki
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
### License
|
|
|
|
- [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
### Contributions
|
|
|
|
- Check out CONTRIBUTING in the root folder
|
2014-07-02 21:14:14 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
## Windows Canvas Directory Structure
|
2014-07-02 21:14:14 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**Note: For the bulk of interesting product code, go to /winrt/lib.**
|
2014-07-02 21:14:14 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/bin** - Binary files generated by the build
|
2014-07-02 21:14:14 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/build** - Shared, build-related resources that are common across projects
|
2014-07-02 21:14:14 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
- /Assets - Common Windows Store assets used for tests and samples
|
|
|
|
- /nuget - Resources needed for building the NuGet package
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/numeric** - Cross-platform vector and matrix library. There are three implementations:
|
|
|
|
- /Cpp
|
|
|
|
- /DotNet
|
|
|
|
- /WinRT
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/obj** - All intermediate object files generated during a build
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/samples** - Example projects showing how to use Windows Canvas
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/tests** - Test projects that consume Windows Canvas in a similar way to how an
|
|
|
|
external customer would. Each one is a Windows Store app. These tests are run for manual
|
|
|
|
verification.
|
|
|
|
- /CppConsumer
|
|
|
|
- /CsConsumer
|
|
|
|
- /ExampleGallery
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/tools** - Standalone utilities, separate from Canvas product code
|
|
|
|
- /codegen - Generates headers+IDL from XML resource files (you don't have to build this to build Windows Canvas)
|
|
|
|
- /copyright - Verifies the right copyright banner appears at the top of each source file
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-29 21:50:27 +04:00
|
|
|
**/winrt** - Windows Canvas product code and automated tests
|
|
|
|
- /dll - Build resources for the product dll
|
|
|
|
- /inc - Common includes
|
|
|
|
- /lib - All the projected IDL and runtime class implementations!
|
|
|
|
- /WinRTDirectX - projections for D3D/DXGI types
|
|
|
|
- /published - Contains headers included in the NuGet package that are required to use Windows Canvas
|
|
|
|
- /test.internal - Automated tests that link directly with winrt.lib to access internals of the implementation
|
|
|
|
- /test.external - Automated tests that use only the public WinRT interface
|
2014-06-28 00:53:27 +04:00
|
|
|
|
2014-07-02 21:14:14 +04:00
|
|
|
|