Begin Method (SpriteBlendMode, SpriteSortMode, SaveStateMode, Matrix)

SpriteBatch.Begin Method (SpriteBlendMode, SpriteSortMode, SaveStateMode, Matrix)

Prepares the graphics device for drawing sprites with specified blending, sorting, and render state options, and a global transform matrix.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public void Begin (
         SpriteBlendMode blendMode,
         SpriteSortMode sortMode,
         SaveStateMode stateMode,
         Matrix transformMatrix


Blending options to use when rendering.
Sorting options to use when rendering.
Rendering state options.
A matrix to apply to position, rotation, scale, and depth data passed to Draw.

This method must be called before any calls to Draw. When all the sprites have been drawn, call End.

Begin sets the following render states.

Begin sets the following sampler states.

If Begin is called with SaveStateMode set to None, then these states must be reset by the caller if they are used elsewhere. Calling Begin with SaveStateMode set to SaveState will reset these values properly, but may adversely affect performance.

Use transformMatrix to apply the same transformation to all sprites drawn by this SpriteBatch. This matrix can be any combination of translation, scaling, or rotation operations. This matrix is applied to the position, rotation, scale, and depth values provided to Draw.

Xbox 360, Windows XP SP2, Windows Vista, Zune

Community Additions

© 2016 Microsoft