Редагувати

Поділитися через


Flood effect

Use the flood effect to generate a bitmap based on the specified color and alpha value. You can use this effect when you want a specific color as an input for an effect, like a background color.

Note

The effect passes along the specified color value as specified. You must manually pre-multiply the values if you plan to pass the output to effects that expect a pre-multiplied input.

The CLSID for this effect is CLSID_D2D1Flood.

The flood effect has no input image.

Example image

example image of the flood effect outputting green.

ComPtr<ID2D1Effect> floodEffect;
m_d2dContext->CreateEffect(CLSID_D2D1Flood, &floodEffect);

floodEffect->SetValue(D2D1_FLOOD_PROP_COLOR, D2D1::Vector4F(0.0f, 1.0f, 0.0f, 1.0f));

m_d2dContext->BeginDraw();
m_d2dContext->DrawImage(floodEffect.Get());
m_d2dContext->EndDraw();

Effect properties

Display name and index enumeration Description
Color
D2D1_FLOOD_PROP_COLOR
The color and opacity of the bitmap. This property is a D2D1_VECTOR_4F. The individual values for each channel are of type FLOAT, unbounded and unitless. The effect doesn't modify the values for the channels.
The RGBA values for each channel range from 0 to 1.
The type is D2D1_VECTOR_4F.
The default value is {0.0f, 0.0f, 0.0f, 1.0f}.

Output bitmap

This effect generates a logically infinite sized bitmap.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]
Minimum supported server Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]
Header d2d1effects.h
Library d2d1.lib, dxguid.lib

ID2D1Effect