How to Create a Bitmap Brush
To create a bitmap brush, use the ID2D1RenderTarget::CreateBitmapBrush method and specify the bitmap brush properties. Some overloads enable you to specify the brush properties. The following code shows how to create a bitmap brush to fill a square, and a solid black brush to draw the outline of the square. The code produces the output shown in the following screen shot.
- Declare a variable of type ID2D1BitmapBrush.
- Load a bitmap from a resource. For more information, see How to Load a Bitmap from a Resource.
- Choose the extend modes (D2D1_EXTEND_MODE) and interpolation mode (D2D1_BITMAP_INTERPOLATION_MODE) of the bitmap brush and then call the CreateBitmapBrush method to create a brush, as shown in the following code.