Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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.

License

NotificationsYou must be signed in to change notification settings

microsoft/Win2D

Repository files navigation

Moving Win2D over to WindowsAppSdk and WinUI3 is a work in progress, and some features such as CanvasAnimatedControl have partial or no support.

Win2D

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphicsrendering with GPU acceleration. It is available to C#, C++ and VB developerswriting apps for WinUI3. It utilizes the powerof Direct2D, and integrates seamlessly with XAML.

Visit theDirectX Landing Page for more resources for DirectX developers.

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:CanvasControlDraw="canvasControl_Draw"ClearColor="CornflowerBlue" /></Grid>

and C#:

voidcanvasControl_Draw(CanvasControlsender,CanvasDrawEventArgsargs){args.DrawingSession.DrawEllipse(155,115,80,30,Colors.Black,3);args.DrawingSession.DrawText("Hello, world!",100,100,Colors.Yellow);}

or C++/CX:

voidMainPage::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++/WinRT:

voidMainPage::CanvasControl_Draw(CanvasControlconst& sender, CanvasDrawEventArgsconst& args){    args.DrawingSession().DrawEllipse(155,115,80,30,Colors::Black(),3);    args.DrawingSession().DrawText(L"Hello, world!",100,100,Colors::Yellow());}

or VB:

SubcanvasControl_Draw(senderAsCanvasControl,argsAsCanvasDrawEventArgs)args.DrawingSession.DrawEllipse(155,115,80,30,Colors.Black,3)args.DrawingSession.DrawText("Hello, world!",100,100,Colors.Yellow)EndSub

Using Win2D

Thedocumentation explains how to install VisualStudio, add the Win2D NuGet package to your project, and get started using the API.

Building Win2D from source

Requirements
  • Visual Studio 2019 16.9 with Tools for Universal Windows Apps 15.0.27428.01 and Windows SDK 18362
Clone Repository
Build NuGet Packages
  • Launch 'Developer Command Prompt for VS2019'
  • 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 'StableOnly' setting to 'Include Prerelease' when adding them to your project.


This project has adopted theMicrosoft Open Source Code of Conduct.For more information see theCode of Conduct FAQ or contactopencode@microsoft.com with any additional questions or comments.

About

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.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp