IDCompositionEffectGroup::SetOpacity(float) method (dcomp.h)

Changes the value of the Opacity property.


HRESULT SetOpacity(
  [in] float opacity


[in] opacity

Type: float

The new value of the Opacity property.

Return value


If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. See DirectComposition Error Codes for a list of error codes.


The opacity is interpreted as completely transparent for all values less than or equal to 0, and as completely opaque for all values greater than or equal to 1. All values between 0 and 1 represent partial opacity.

This method fails if the opacity parameter is NaN, positive infinity, or negative infinity.

If the Opacity property was previously animated, this method removes the animation and sets the Opacity property to the specified static value.


Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header dcomp.h
Library Dcomp.lib
DLL Dcomp.dll

See also