D2D1_PRIMITIVE_BLEND enumeration

Used to specify the geometric blend mode for all Direct2D primitives.

Syntax


typedef enum  { 
  D2D1_PRIMITIVE_BLEND_SOURCE_OVER  = 0,
  D2D1_PRIMITIVE_BLEND_COPY         = 1,
  D2D1_PRIMITIVE_BLEND_MIN          = 2,
  D2D1_PRIMITIVE_BLEND_ADD          = 3
} D2D1_PRIMITIVE_BLEND;

Constants

D2D1_PRIMITIVE_BLEND_SOURCE_OVER

The standard source-over-destination blend mode.

D2D1_PRIMITIVE_BLEND_COPY

The source is copied to the destination; the destination pixels are ignored.

D2D1_PRIMITIVE_BLEND_MIN

The resulting pixel values use the minimum of the source and destination pixel values. Available in Windows 8 and later.

D2D1_PRIMITIVE_BLEND_ADD

The resulting pixel values are the sum of the source and destination pixel values. Available in Windows 8 and later.

Remarks

Blend modes

For aliased rendering (except for MIN mode), the output value O is computed by linearly interpolating the value blend(S, D) with the destination pixel value, based on the amount that the primitive covers the destination pixel.

The table here shows the primitive blend modes for both aliased and antialiased blending. The equations listed in the table use these elements:

  • O = Output
  • S = Source
  • SA = Source Alpha
  • D = Destination
  • DA = Destination Alpha
  • C = Pixel coverage
Primitive blend modeAliased blendingAntialiased blendingDescription
D2D1_PRIMITIVE_BLEND_SOURCE_OVERO = (S + (1 – SA) * D) * C + D * (1 – C)O = S * C + D *(1 – SA *C)The standard source-over-destination blend mode.
D2D1_PRIMITIVE_BLEND_COPYO = S * C + D * (1 – C)O = S * C + D * (1 – C)The source is copied to the destination; the destination pixels are ignored.
D2D1_PRIMITIVE_BLEND_MINO = Min(S + 1-SA, D) O = Min(S * C + 1 – SA *C, D)The resulting pixel values use the minimum of the source and destination pixel values. Available in Windows 8.1 and later.
D2D1_PRIMITIVE_BLEND_ADDO = (S + D) * C + D * (1 – C)O = S * C + DThe resulting pixel values are the sum of the source and destination pixel values. Available in Windows 8.1 and later.

 

An illustration of Direct2D primitive blend modes with varying opacity and backgrounds.

An illustration of the primitive blend modes with varying opacity and backgrounds.

Requirements

Minimum supported client

Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | Windows Store apps]

Minimum supported phone

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

Header

D2d1_1.h

See also

ID2D1DeviceContext::SetPrimitiveBlend
ID2D1DeviceContext::GetPrimitiveBlend

 

 

Community Additions

ADD
Show:
© 2014 Microsoft