ID2D1RenderTarget::FillOpacityMask method

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


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

Parameters

opacityMask [in]

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.

brush [in]

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.

destinationRectangle [in, optional]

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.

sourceRectangle [in, optional]

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

This method does not return a value.

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

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1RenderTarget
Opacity Masks Example

 

 

Community Additions

ADD
Show:
© 2014 Microsoft