Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    UIBatch Class

    Namespace: Stride.Graphics
    Assembly: Stride.Graphics.dll

    A utility class to batch and draw UI images.

    System.Object → DisposeBase → ComponentBase → BatchBase<UIBatch.UIImageDrawInfo> → UIBatch
    Derived from UIBatch:

    public class UIBatch : BatchBase<UIBatch.UIImageDrawInfo>, IDisposable, IComponent, IReferencable, ICollectorHolder
    Name Description
    Constructors
    UIBatch(GraphicsDevice)

    Initializes a new instance of the UIBatch class.

    Properties
    SDFSpriteFontEffect
    Methods
    Begin(GraphicsContext, ref Matrix, Nullable<BlendStateDescription>, SamplerState, Nullable<RasterizerStateDescription>, Nullable<DepthStencilStateDescription>, Int32)

    Begins a image batch rendering using the specified blend state, sampler, depth stencil, rasterizer state objects, and the view-projection transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp).

    Begin(GraphicsContext, ref Matrix, Nullable<BlendStateDescription>, Nullable<DepthStencilStateDescription>, Int32)

    Begins a image batch rendering using the specified blend state, depth stencil and a view-projection transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None).

    BeginCustom(GraphicsContext, Int32)
    DrawBackground(ref Matrix, ref Vector3, ref Color, Int32)

    Draw a colored background having provided size at the position specified by the world matrix.

    DrawCube(ref Matrix, ref Vector3, ref Color, Int32)

    Draw a cube of the provided size at the position specified by the world matrix having the provided color.

    DrawImage(Texture, ref Matrix, ref RectangleF, ref Vector3, ref Vector4, ref Color, Int32, ImageOrientation, SwizzleMode, Boolean)

    Batch a new border image draw to the draw list.

    DrawRectangle(ref Matrix, ref Vector3, ref Color, Int32)

    Draw a rectangle of the provided size at the position specified by the world matrix having the provided color.

    UpdateBufferValuesFromElementInfo(ref BatchBase<UIBatch.UIImageDrawInfo>.ElementInfo, IntPtr, IntPtr, Int32)
    | Improve this Doc View Source

    Constructors


    UIBatch(GraphicsDevice)

    Initializes a new instance of the UIBatch class.

    public UIBatch(GraphicsDevice device)
    Parameters
    Type Name Description
    GraphicsDevice device

    A valid instance of GraphicsDevice.

    | Improve this Doc View Source

    Properties


    SDFSpriteFontEffect

    public EffectInstance SDFSpriteFontEffect { get; }
    Property Value
    Type Description
    EffectInstance
    | Improve this Doc View Source

    Methods


    Begin(GraphicsContext, ref Matrix, Nullable<BlendStateDescription>, SamplerState, Nullable<RasterizerStateDescription>, Nullable<DepthStencilStateDescription>, Int32)

    Begins a image batch rendering using the specified blend state, sampler, depth stencil, rasterizer state objects, and the view-projection transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp).

    public void Begin(GraphicsContext graphicsContext, ref Matrix viewProjection, BlendStateDescription? blendState, SamplerState samplerState, RasterizerStateDescription? rasterizerState, DepthStencilStateDescription? depthStencilState, int stencilValue)
    Parameters
    Type Name Description
    GraphicsContext graphicsContext

    The graphics context to use.

    Matrix viewProjection

    The view projection matrix used for this series of draw calls

    System.Nullable<BlendStateDescription> blendState

    Blending options.

    SamplerState samplerState

    Texture sampling options.

    System.Nullable<RasterizerStateDescription> rasterizerState

    Rasterization options.

    System.Nullable<DepthStencilStateDescription> depthStencilState

    Depth and stencil options.

    System.Int32 stencilValue

    The value of the stencil buffer to take as reference


    Begin(GraphicsContext, ref Matrix, Nullable<BlendStateDescription>, Nullable<DepthStencilStateDescription>, Int32)

    Begins a image batch rendering using the specified blend state, depth stencil and a view-projection transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None).

    public void Begin(GraphicsContext graphicsContext, ref Matrix viewProjection, BlendStateDescription? blendState, DepthStencilStateDescription? depthStencilState, int stencilValue)
    Parameters
    Type Name Description
    GraphicsContext graphicsContext

    The graphics context to use.

    Matrix viewProjection

    The view projection matrix used for this series of draw calls

    System.Nullable<BlendStateDescription> blendState

    Blending options.

    System.Nullable<DepthStencilStateDescription> depthStencilState

    Depth and stencil options.

    System.Int32 stencilValue

    The value of the stencil buffer to take as reference


    BeginCustom(GraphicsContext, Int32)

    public void BeginCustom(GraphicsContext graphicsContext, int overrideEffect)
    Parameters
    Type Name Description
    GraphicsContext graphicsContext
    System.Int32 overrideEffect

    DrawBackground(ref Matrix, ref Vector3, ref Color, Int32)

    Draw a colored background having provided size at the position specified by the world matrix.

    public void DrawBackground(ref Matrix worldMatrix, ref Vector3 elementSize, ref Color color, int depthBias)
    Parameters
    Type Name Description
    Matrix worldMatrix

    The world matrix specifying the position of the element in the world

    Vector3 elementSize

    The size of the element

    Color color

    The color of the element

    System.Int32 depthBias

    The depth bias to use when drawing the element


    DrawCube(ref Matrix, ref Vector3, ref Color, Int32)

    Draw a cube of the provided size at the position specified by the world matrix having the provided color.

    public void DrawCube(ref Matrix worldMatrix, ref Vector3 elementSize, ref Color color, int depthBias)
    Parameters
    Type Name Description
    Matrix worldMatrix

    The world matrix specifying the position of the cube in the world

    Vector3 elementSize

    The size of the cube

    Color color

    The color of the cube

    System.Int32 depthBias

    The depth bias to use when drawing the element


    DrawImage(Texture, ref Matrix, ref RectangleF, ref Vector3, ref Vector4, ref Color, Int32, ImageOrientation, SwizzleMode, Boolean)

    Batch a new border image draw to the draw list.

    public void DrawImage(Texture texture, ref Matrix worldMatrix, ref RectangleF sourceRectangle, ref Vector3 elementSize, ref Vector4 borderSize, ref Color color, int depthBias, ImageOrientation imageOrientation = ImageOrientation.AsIs, SwizzleMode swizzle = SwizzleMode.None, bool snapImage = false)
    Parameters
    Type Name Description
    Texture texture

    The texture to use during the draw

    Matrix worldMatrix

    The world matrix of the element

    RectangleF sourceRectangle

    The rectangle indicating the source region of the texture to use

    Vector3 elementSize

    The size of the ui element

    Vector4 borderSize

    The size of the borders in the texture in pixels (left/top/right/bottom)

    Color color

    The color to apply to the texture image.

    System.Int32 depthBias

    The depth bias of the ui element

    ImageOrientation imageOrientation

    The rotation to apply on the image uv

    SwizzleMode swizzle

    Swizzle mode indicating the swizzle use when sampling the texture in the shader

    System.Boolean snapImage

    Indicate if the image needs to be snapped or not


    DrawRectangle(ref Matrix, ref Vector3, ref Color, Int32)

    Draw a rectangle of the provided size at the position specified by the world matrix having the provided color.

    public void DrawRectangle(ref Matrix worldMatrix, ref Vector3 elementSize, ref Color color, int depthBias)
    Parameters
    Type Name Description
    Matrix worldMatrix

    The world matrix specifying the position of the rectangle in the world

    Vector3 elementSize

    The size of the rectangle

    Color color

    The color of the rectangle

    System.Int32 depthBias

    The depth bias to use when drawing the element


    UpdateBufferValuesFromElementInfo(ref BatchBase<UIBatch.UIImageDrawInfo>.ElementInfo, IntPtr, IntPtr, Int32)

    protected override void UpdateBufferValuesFromElementInfo(ref BatchBase<UIBatch.UIImageDrawInfo>.ElementInfo elementInfo, IntPtr vertexPtr, IntPtr indexPtr, int vertexOffset)
    Parameters
    Type Name Description
    BatchBase.ElementInfo<> elementInfo
    System.IntPtr vertexPtr
    System.IntPtr indexPtr
    System.Int32 vertexOffset
    Overrides
    Stride.Graphics.BatchBase<Stride.Graphics.UIBatch.UIImageDrawInfo>.UpdateBufferValuesFromElementInfo(Stride.Graphics.BatchBase.ElementInfo<>, System.IntPtr, System.IntPtr, System.Int32)

    Inherited Members

    BatchBase<UIBatch.UIImageDrawInfo>.ResourceContextPool
    BatchBase<UIBatch.UIImageDrawInfo>.ResourceContext
    BatchBase<UIBatch.UIImageDrawInfo>.mutablePipeline
    BatchBase<UIBatch.UIImageDrawInfo>.graphicsDevice
    BatchBase<UIBatch.UIImageDrawInfo>.blendState
    BatchBase<UIBatch.UIImageDrawInfo>.rasterizerState
    BatchBase<UIBatch.UIImageDrawInfo>.samplerState
    BatchBase<UIBatch.UIImageDrawInfo>.depthStencilState
    BatchBase<UIBatch.UIImageDrawInfo>.stencilReferenceValue
    BatchBase<UIBatch.UIImageDrawInfo>.sortMode
    BatchBase<UIBatch.UIImageDrawInfo>.Effect
    BatchBase<UIBatch.UIImageDrawInfo>.GraphicsContext
    BatchBase<UIBatch.UIImageDrawInfo>.DefaultEffect
    BatchBase<UIBatch.UIImageDrawInfo>.DefaultEffectSRgb
    BatchBase<UIBatch.UIImageDrawInfo>.TextureComparer
    BatchBase<UIBatch.UIImageDrawInfo>.BackToFrontComparer
    BatchBase<UIBatch.UIImageDrawInfo>.FrontToBackComparer
    BatchBase<UIBatch.UIImageDrawInfo>.Destroy()
    BatchBase<UIBatch.UIImageDrawInfo>.Parameters
    BatchBase<UIBatch.UIImageDrawInfo>.Begin(GraphicsContext, EffectInstance, SpriteSortMode, Nullable<BlendStateDescription>, SamplerState, Nullable<DepthStencilStateDescription>, Nullable<RasterizerStateDescription>, Int32)
    BatchBase<UIBatch.UIImageDrawInfo>.PrepareForRendering()
    BatchBase<UIBatch.UIImageDrawInfo>.CheckBeginHasBeenCalled(String)
    BatchBase<UIBatch.UIImageDrawInfo>.CheckEndHasBeenCalled(String)
    BatchBase<UIBatch.UIImageDrawInfo>.End()
    BatchBase<UIBatch.UIImageDrawInfo>.Draw(Texture, BatchBase.ElementInfo<>)
    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.OnNameChanged()
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation