Code Examples

The following code examples demonstrate specific features of the Direct2D API. Unlike Samples, separate source code is not provided.

ExampleDescription
Advanced Path Geometries Example Shows how to create a complex drawing by using geometry paths.
Brush Types Example Shows how to use solid color brushes, linear gradient brushes, radial gradient brushes, and bitmap brushes.
Clip with Axis Aligned Rectangle Example Shows how to use an axis-aligned rectangle to clip a region.
Clip with a Bitmap Mask Example Shows how to clip a region with a bitmap mask.
Clip with Layers Example Show how to clip a region with layers.
Combine Geometries Example Demonstrates geometry combination operations.
Create Geometry Groups Example Draws two geometry groups and combines them using different fill modes.
Draw Bitmap With Extend Mode Example Draw Bitmaps using different extend modes.
Draw Rectangle Example Draws a grid background and several rectangles.
Geometries Example Shows how to create simple and path geometries.
GDI Interop Render Target Example Shows how to draw GDI content to an Hwnd GDI-compatible render target.
Layers with Parameters Example Shows how to use layers with content bounds, opacity masks, and geometric masks.
Multiple Transforms Example Show how to apply multiple transformations to a render target
Opacity Masks Example Shows how to create opacity masks from different types of brushes.
Read Geometry Data Example Shows how to read geometry data from a path geometry by creating a subclass of the ID2D1SimplifiedGeometrySink interface.
Render Targets Example Demonstrates render target drawing operations.
Single Transforms Example Shows how to apply different transformations to a render target.
Stroke Style Example Demonstrates stroke styles with different line join settings and different dash styles.
Transform Brushes Example Shows how to transform brushes.
Transform Geometries Example Shows how to transform geometries.

 

Related topics

Samples

 

 

Send comments about this topic to Microsoft

Build date: 1/22/2012

Community Additions

Show: