Skip to content

DrawContextExtensions.UseBlendMode(this IDrawContext, BlendMode) Method

Definition

Namespace: Brine2D.Rendering

Sets the blend mode and returns a scope that restores the previous mode on dispose.

public static Brine2D.Rendering.BlendModeScope UseBlendMode(this Brine2D.Rendering.IDrawContext context, Brine2D.Rendering.BlendMode blendMode);

Parameters

context IDrawContext

blendMode BlendMode

Returns

BlendModeScope

Example

using (drawContext.UseBlendMode(BlendMode.Additive))
{
    drawContext.DrawTexture(glowTexture, position);
}
// Previous blend mode is restored here.