Class BlendState
Contains blend state for the device.
public class BlendState : GraphicsResource, IDisposable
- Inheritance
-
BlendState
- Implements
- Inherited Members
Constructors
BlendState()
Initializes a new instance of the BlendState class with the default values, using additive color and alpha blending.
public BlendState()
Fields
Additive
A built-in state object with settings for additive blend that is adding the destination data to the source data without using alpha.
public static readonly BlendState Additive
Field Value
Remarks
This built-in state object has the following settings:
Property | Value |
---|---|
ColorSourceBlend | SourceAlpha |
AlphaSourceBlend | SourceAlpha |
ColorDestinationBlend | One |
AlphaDestinationBlend | One |
AlphaBlend
A built-in state object with settings for alpha blend that is blending the source and destination data using alpha.
public static readonly BlendState AlphaBlend
Field Value
Remarks
This built-in state object has the following settings:
Property | Value |
---|---|
ColorSourceBlend | One |
AlphaSourceBlend | One |
ColorDestinationBlend | InverseSourceAlpha |
AlphaDestinationBlend | InverseSourceAlpha |
NonPremultiplied
A built-in state object with settings for blending with non-premultipled alpha that is blending source and destination data by using alpha while assuming the color data contains no alpha information.
public static readonly BlendState NonPremultiplied
Field Value
Remarks
This built-in state object has the following settings:
Property | Value |
---|---|
ColorSourceBlend | SourceAlpha |
AlphaSourceBlend | SourceAlpha |
ColorDestinationBlend | InverseSourceAlpha |
AlphaDestinationBlend | InverseSourceAlpha |
Opaque
A built-in state object with settings for opaque blend that is overwriting the source with the destination data.
public static readonly BlendState Opaque
Field Value
Remarks
This built-in state object has the following settings:
Property | Value |
---|---|
ColorSourceBlend | One |
AlphaSourceBlend | One |
ColorDestinationBlend | Zero |
AlphaDestinationBlend | Zero |
Properties
AlphaBlendFunction
Gets or sets the arithmetic operation when blending alpha values. The default is Add.
public BlendFunction AlphaBlendFunction { get; set; }
Property Value
- BlendFunction
A value from the BlendFunction enumeration.
AlphaDestinationBlend
Gets or sets the blend factor for the destination alpha, which is the percentage of the destination alpha included in the blended result. The default is One.
public Blend AlphaDestinationBlend { get; set; }
Property Value
AlphaSourceBlend
Gets or sets the alpha blend factor. The default is One.
public Blend AlphaSourceBlend { get; set; }
Property Value
BlendFactor
The color used as blend factor when alpha blending.
public Color BlendFactor { get; set; }
Property Value
Remarks
BlendFactor is set to this value when this BlendState is bound to a GraphicsDevice.
ColorBlendFunction
Gets or sets the arithmetic operation when blending color values. The default is Add.
public BlendFunction ColorBlendFunction { get; set; }
Property Value
- BlendFunction
A value from the BlendFunction enumeration.
ColorDestinationBlend
Gets or sets the blend factor for the destination color. The default is One.
public Blend ColorDestinationBlend { get; set; }
Property Value
ColorSourceBlend
Gets or sets the blend factor for the source color. The default is One.
public Blend ColorSourceBlend { get; set; }
Property Value
ColorWriteChannels
Gets or sets which color channels (RGBA) are enabled for writing during color blending. The default value is None.
public ColorWriteChannels ColorWriteChannels { get; set; }
Property Value
- ColorWriteChannels
A value from the ColorWriteChannels enumeration.
ColorWriteChannels1
Gets or sets which color channels (RGBA) are enabled for writing during color blending. The default value is None.
public ColorWriteChannels ColorWriteChannels1 { get; set; }
Property Value
- ColorWriteChannels
A value from the ColorWriteChannels enumeration.
ColorWriteChannels2
Gets or sets which color channels (RGBA) are enabled for writing during color blending. The default value is None.
public ColorWriteChannels ColorWriteChannels2 { get; set; }
Property Value
- ColorWriteChannels
A value from the ColorWriteChannels enumeration.
ColorWriteChannels3
Gets or sets which color channels (RGBA) are enabled for writing during color blending. The default value is None.
public ColorWriteChannels ColorWriteChannels3 { get; set; }
Property Value
- ColorWriteChannels
A value from the ColorWriteChannels enumeration.
IndependentBlendEnable
Enables use of the per-target blend states.
public bool IndependentBlendEnable { get; set; }
Property Value
this[int]
Returns the target specific blend state.
public TargetBlendState this[int index] { get; }
Parameters
index
intThe 0 to 3 target blend state index.
Property Value
- TargetBlendState
A target blend state.
MultiSampleMask
Gets or sets a bitmask which defines which samples can be written
during multisampling. The default is 0xffffffff
.
public int MultiSampleMask { get; set; }
Property Value
Methods
Dispose(bool)
The method that derived classes should override to implement disposing of managed and native resources.
protected override void Dispose(bool disposing)
Parameters
disposing
boolTrue if managed objects should be disposed.
Remarks
Native resources should always be released regardless of the value of the disposing parameter.