Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Win2D is an easy-to-use Windows Runtime (WinRT) API for immediate-mode 2D graphics rendering with GPU acceleration. It's ideal for creating simple games, displays such as charts, and other simple 2D graphics.
You can use Win2D in your WinUI (Windows App SDK) apps, using either C# or C++. Win2D utilizes the power of Direct2D, and it integrates seamlessly with XAML in WinUI (Windows App SDK).
Win2D is available as a standalone NuGet package, or as source code (for the source code, see the Win2D repo on GitHub).
Features
Win2D includes an extensive set of features to support lots of different scenarios. Here's a list of most of them, with useful links to related docs and Win2D API references to learn more.
Bitmap graphics
- Load, save and draw bitmap images
- Render to texture
- Use bitmaps as opacity masks
- Sprite batch API for efficiently drawing large numbers of bitmaps
- Use block compressed bitmap formats to save memory
- Load, save, and draw virtual bitmaps, which can be larger than the maximum GPU texture size and are automatically split into tiles
Vector graphics
- Draw primitive shapes (lines, rectangles, circles, etc.) or arbitrarily complex geometry
- Fill shapes using solid colors, image brushes, or linear and radial gradients
- Draw lines of any width with flexible stroke styles (dotted, dashed, etc.)
- High quality antialiasing
- Rich geometry manipulation (union, intersect, compute point on path, tessellate, etc.)
- Clip drawing to arbitrary geometric regions
- Capture drawing operations in command lists for later replay
- Rasterize ink strokes (from a stylus)
- Load, draw, and manipulate SVG vector graphics
Powerful image processing effects
- Blurs
- Blends
- Color adjustments (brightness, contrast, exposure, highlights & shadows, etc.)
- Filters (convolve, edge detection, emboss, sharpen)
- Lighting
- Custom pixel shaders
- Fully custom effects
- And many more...
Text
- Fully internationalized Unicode text rendering
- Text layouts can be drawn, measured, or hit-tested against
- Convert text outlines to geometry
- Enumerate fonts and query their metrics
- Draw or manipulate individual glyph runs to create custom text layouts
Next steps
Next, to learn about creating a simple app, try out the Build a simple Win2D app tutorial. You can also consult the features list below to discover all the things Win2D can do. To learn more about advanced topics, you can refer to the collection of articles included in the documentation here as well.
Windows developer