D2D1_COMPOSITE_MODE enumeration (d2d1_1.h)

Used to specify the blend mode for all of the Direct2D blending operations.

Syntax

typedef enum D2D1_COMPOSITE_MODE {
  D2D1_COMPOSITE_MODE_SOURCE_OVER = 0,
  D2D1_COMPOSITE_MODE_DESTINATION_OVER = 1,
  D2D1_COMPOSITE_MODE_SOURCE_IN = 2,
  D2D1_COMPOSITE_MODE_DESTINATION_IN = 3,
  D2D1_COMPOSITE_MODE_SOURCE_OUT = 4,
  D2D1_COMPOSITE_MODE_DESTINATION_OUT = 5,
  D2D1_COMPOSITE_MODE_SOURCE_ATOP = 6,
  D2D1_COMPOSITE_MODE_DESTINATION_ATOP = 7,
  D2D1_COMPOSITE_MODE_XOR = 8,
  D2D1_COMPOSITE_MODE_PLUS = 9,
  D2D1_COMPOSITE_MODE_SOURCE_COPY = 10,
  D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY = 11,
  D2D1_COMPOSITE_MODE_MASK_INVERT = 12,
  D2D1_COMPOSITE_MODE_FORCE_DWORD = 0xffffffff
} ;

Constants

 
D2D1_COMPOSITE_MODE_SOURCE_OVER
Value: 0
The standard source-over-destination blend mode.
D2D1_COMPOSITE_MODE_DESTINATION_OVER
Value: 1
The destination is rendered over the source.
D2D1_COMPOSITE_MODE_SOURCE_IN
Value: 2
Performs a logical clip of the source pixels against the destination pixels.
D2D1_COMPOSITE_MODE_DESTINATION_IN
Value: 3
The inverse of the D2D1_COMPOSITE_MODE_SOURCE_IN operation.
D2D1_COMPOSITE_MODE_SOURCE_OUT
Value: 4
This is the logical inverse to D2D1_COMPOSITE_MODE_SOURCE_IN.
D2D1_COMPOSITE_MODE_DESTINATION_OUT
Value: 5
The is the logical inverse to D2D1_COMPOSITE_MODE_DESTINATION_IN.
D2D1_COMPOSITE_MODE_SOURCE_ATOP
Value: 6
Writes the source pixels over the destination where there are destination pixels.
D2D1_COMPOSITE_MODE_DESTINATION_ATOP
Value: 7
The logical inverse of D2D1_COMPOSITE_MODE_SOURCE_ATOP.
D2D1_COMPOSITE_MODE_XOR
Value: 8
The source is inverted with the destination.
D2D1_COMPOSITE_MODE_PLUS
Value: 9
The channel components are summed.
D2D1_COMPOSITE_MODE_SOURCE_COPY
Value: 10
The source is copied to the destination; the destination pixels are ignored.
D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY
Value: 11
Equivalent to D2D1_COMPOSITE_MODE_SOURCE_COPY, but pixels outside of the source bounds are unchanged.
D2D1_COMPOSITE_MODE_MASK_INVERT
Value: 12
Destination colors are inverted according to a source mask.
D2D1_COMPOSITE_MODE_FORCE_DWORD
Value: 0xffffffff

Remarks

The figure here shows an example of each of the modes with images that have an opacity of 1.0 or 0.5.

An example image of each of the modes with opacity set to 1.0 or 0.5.

There can be slightly different interpretations of these enumeration values depending on where the value is used.

  • With a composite effect:

    D2D1_COMPOSITE_MODE_DESTINATION_COPY is equivalent to D2D1_COMPOSITE_MODE_SOURCE_COPY with the inputs inverted.

  • As a parameter to ID2D1DeviceContext::DrawImage: D2D1_COMPOSITE_MODE_DESTINATION_COPY is a no-op since the destination is already in the selected target.

Sample code

For an example that uses composite modes, download the Direct2D composite effect modes sample.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Header d2d1_1.h

See also

ID2D1DeviceContext::DrawImage