private static BlendingFactorSrc ConvertSource(BlendParameter param) { switch (param) { case BlendParameter.DestinationAlpha: return(BlendingFactorSrc.DstAlpha); case BlendParameter.DestinationColor: return(BlendingFactorSrc.DstColor); case BlendParameter.One: return(BlendingFactorSrc.One); case BlendParameter.OneMinusDestinationAlpha: return(BlendingFactorSrc.OneMinusDstAlpha); case BlendParameter.OneMinusDestinationColor: return(BlendingFactorSrc.OneMinusDstColor); case BlendParameter.OneMinusSourceAlpha: return(BlendingFactorSrc.OneMinusSrcAlpha); case BlendParameter.OneMinusSourceColor: return(BlendingFactorSrc.OneMinusSrcColor); case BlendParameter.SourceAlpha: return(BlendingFactorSrc.SrcAlpha); case BlendParameter.SourceAlphaSaturation: return(BlendingFactorSrc.SrcAlphaSaturate); case BlendParameter.SourceColor: return(BlendingFactorSrc.SrcColor); case BlendParameter.Zero: return(BlendingFactorSrc.Zero); default: throw new ArgumentOutOfRangeException(param.ToString()); } }
private static void SetFunction(BlendParameter source, BlendParameter destination) { var parameterSource = ConvertSource(source); var parameterDestination = ConvertDestination(destination); GL.BlendFunc(0, parameterSource, parameterDestination); }
public BlendOperation( BlendOperator op, BlendParameter sourceParam, BlendParameter destParam ) : this() { Operator = op; SourceParameter = sourceParam; DestinationParameter = destParam; }
private int ConvertBlendParam( BlendParameter blendParameter ) { switch ( blendParameter ) { case BlendParameter.Zero: return ( int ) SharpDX.Direct3D9.Blend.Zero; case BlendParameter.One: return ( int ) SharpDX.Direct3D9.Blend.One; case BlendParameter.SourceColor: return ( int ) SharpDX.Direct3D9.Blend.SourceColor; case BlendParameter.SourceAlpha: return ( int ) SharpDX.Direct3D9.Blend.SourceAlpha; case BlendParameter.DestinationColor: return ( int ) SharpDX.Direct3D9.Blend.DestinationColor; case BlendParameter.DestinationAlpha: return ( int ) SharpDX.Direct3D9.Blend.DestinationAlpha; case BlendParameter.InvertSourceColor: return ( int ) SharpDX.Direct3D9.Blend.InverseSourceColor; case BlendParameter.InvertSourceAlpha: return ( int ) SharpDX.Direct3D9.Blend.InverseSourceAlpha; case BlendParameter.InvertDestinationColor: return ( int ) SharpDX.Direct3D9.Blend.InverseDestinationColor; case BlendParameter.InvertDestinationAlpha: return ( int ) SharpDX.Direct3D9.Blend.InverseDestinationAlpha; default: throw new ArgumentException (); } }
/// <summary> /// Initializes a new instance of the <see cref="BlendState"/> structure. /// </summary> /// <param name="blendOperator">The blend function operator.</param> /// <param name="blendParameterSource">The source blend parameter.</param> /// <param name="blendParameterDestination">The destination blend parameter.</param> public BlendState(BlendOperator blendOperator, BlendParameter blendParameterSource, BlendParameter blendParameterDestination) { BlendOperator = blendOperator; BlendParameterSource = blendParameterSource; BlendParameterDestination = blendParameterDestination; }
private OpenTK.Graphics.OpenGL.BlendingFactorSrc MistyValueToOriginal( BlendParameter param ) { switch ( param ) { case BlendParameter.Zero: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.Zero; case BlendParameter.One: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.One; case BlendParameter.SourceAlpha: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.SrcAlpha; case BlendParameter.InvertSourceAlpha: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.OneMinusSrcAlpha; case BlendParameter.DestinationColor: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.DstColor; case BlendParameter.DestinationAlpha: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.DstAlpha; case BlendParameter.InvertDestinationColor: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.OneMinusDstColor; case BlendParameter.InvertDestinationAlpha: return OpenTK.Graphics.OpenGL.BlendingFactorSrc.OneMinusDstAlpha; default: throw new ArgumentException (); } }