ID2D1RenderTarget::FillOpacityMask(ID2D1Bitmap*,ID2D1Brush*,D2D1_OPACITY_MASK_CONTENT,constD2D1_RECT_F*,constD2D1_RECT_F*) method (d2d1.h)

Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target.

Syntax

void FillOpacityMask(
  [in]           ID2D1Bitmap               *opacityMask,
  [in]           ID2D1Brush                *brush,
                 D2D1_OPACITY_MASK_CONTENT content,
  [in, optional] const D2D1_RECT_F         *destinationRectangle,
  [in, optional] const D2D1_RECT_F         *sourceRectangle
);

Parameters

[in] opacityMask

Type: ID2D1Bitmap*

The opacity mask to apply to the brush. The alpha value of each pixel in the region specified by sourceRectangle is multiplied with the alpha value of the brush after the brush has been mapped to the area defined by destinationRectangle.

[in] brush

Type: ID2D1Brush*

The brush used to paint the region of the render target specified by destinationRectangle.

content

Type: D2D1_OPACITY_MASK_CONTENT

The type of content the opacity mask contains. The value is used to determine the color space in which the opacity mask is blended.

Note  Starting with Windows 8, the D2D1_OPACITY_MASK_CONTENT is not required. See the ID2D1DeviceContext::FillOpacityMask method, which has no D2D1_OPACITY_MASK_CONTENT parameter.
 

[in, optional] destinationRectangle

Type: const D2D1_RECT_F*

The region of the render target to paint, in device-independent pixels, or NULL. If NULL is specified, the brush paints a rectangle the same size as sourceRectangle, but positioned on the origin. If sourceRectangle isn't specified, the brush paints a rectangle the same size as the opacityMask bitmap and positioned on the origin.

[in, optional] sourceRectangle

Type: const D2D1_RECT_F*

The region of the bitmap to use as the opacity mask, in device-independent pixels, or NULL. If NULL is specified, the entire bitmap is used.

Return value

None

Remarks

For this method to work properly, the render target must be using the D2D1_ANTIALIAS_MODE_ALIASED antialiasing mode. You can set the antialiasing mode by calling the ID2D1RenderTarget::SetAntialiasMode method.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as FillOpacityMask) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods.

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1.h
Library D2d1.lib
DLL D2d1.dll

See also

ID2D1RenderTarget