Class ImageEffect
Post effect base class.
[DataContract]
public abstract class ImageEffect : DrawEffect, IComponent, IReferencable, ICollectorHolder, IImageEffect, IGraphicsRenderer, IGraphicsRendererBase, IGraphicsRendererCore, IDisposable
- Inheritance
-
ImageEffect
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ImageEffect()
Initializes a new instance of the ImageEffect class.
protected ImageEffect()
ImageEffect(RenderContext, string)
Initializes a new instance of the ImageEffect class.
protected ImageEffect(RenderContext context, string name = null)
Parameters
context
RenderContextThe context.
name
stringThe name.
Exceptions
- ArgumentNullException
context
ImageEffect(string, bool)
Initializes a new instance of the ImageEffect class.
protected ImageEffect(string name, bool supersample = false)
Parameters
Exceptions
- ArgumentNullException
context
Properties
DepthStencil
Gets the output depth stencil texture.
protected Texture DepthStencil { get; }
Property Value
- Texture
The depth stencil output.
EnableSetRenderTargets
Gets or sets a boolean to enable GraphicsDevice.SetDepthAndRenderTargets from output. Default is true
.
protected bool EnableSetRenderTargets { get; set; }
Property Value
- bool
A boolean to enable GraphicsDevice.SetDepthAndRenderTargets from output. Default is
true
HasDepthStencilOutput
Gets a value indicating whether this effect has depth stencil output texture binded.
protected bool HasDepthStencilOutput { get; }
Property Value
- bool
true
if this instance has depth stencil output; otherwise,false
.
InputCount
Gets the number of input textures.
public int InputCount { get; }
Property Value
- int
The input count.
OutputCount
Gets the number of output render target.
public int OutputCount { get; }
Property Value
- int
The output count.
Methods
DisposeCreatedRenderTargetViews(RenderDrawContext)
Dispose the render target views that have been created.
protected virtual void DisposeCreatedRenderTargetViews(RenderDrawContext context)
Parameters
context
RenderDrawContext
GetInput(int)
Gets an input texture by the specified index.
public Texture GetInput(int index)
Parameters
index
intThe index.
Returns
- Texture
Texture.
Exceptions
GetOutput(int)
Gets an output render target for the specified index.
public Texture GetOutput(int index)
Parameters
index
intThe index.
Returns
- Texture
RenderTarget.
Exceptions
GetSafeInput(int)
Gets a non-null input texture by the specified index.
protected Texture GetSafeInput(int index)
Parameters
index
intThe index.
Returns
- Texture
Texture.
Exceptions
GetSafeOutput(int)
Gets an non-null output render target for the specified index.
protected Texture GetSafeOutput(int index)
Parameters
index
intThe index.
Returns
- Texture
RenderTarget.
Exceptions
NewScopedRenderTarget2D(TextureDescription)
Gets a render target with the specified description, scoped for the duration of the DrawEffect.DrawCore.
protected Texture NewScopedRenderTarget2D(TextureDescription description)
Parameters
description
TextureDescription
Returns
- Texture
A new instance of texture.
NewScopedRenderTarget2D(int, int, PixelFormat, MipMapCount, TextureFlags, int)
Gets a render target output for the specified description, scoped for the duration of the DrawEffect.DrawCore.
protected Texture NewScopedRenderTarget2D(int width, int height, PixelFormat format, MipMapCount mipCount, TextureFlags flags = TextureFlags.ShaderResource | TextureFlags.RenderTarget, int arraySize = 1)
Parameters
width
intThe width.
height
intThe height.
format
PixelFormatDescribes the format to use.
mipCount
MipMapCountNumber of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.
flags
TextureFlagsSets the texture flags (for unordered access...etc.)
arraySize
intSize of the texture 2D array, default to 1.
Returns
- Texture
A new instance of texture class.
NewScopedRenderTarget2D(int, int, PixelFormat, TextureFlags, int)
Gets a render target output for the specified description with a single mipmap, scoped for the duration of the DrawEffect.DrawCore.
protected Texture NewScopedRenderTarget2D(int width, int height, PixelFormat format, TextureFlags flags = TextureFlags.ShaderResource | TextureFlags.RenderTarget, int arraySize = 1)
Parameters
width
intThe width.
height
intThe height.
format
PixelFormatDescribes the format to use.
flags
TextureFlagsSets the texture flags (for unordered access...etc.)
arraySize
intSize of the texture 2D array, default to 1.
Returns
- Texture
A new instance of texture class.
PostDrawCore(RenderDrawContext)
protected override void PostDrawCore(RenderDrawContext context)
Parameters
context
RenderDrawContext
PreDrawCore(RenderDrawContext)
protected override void PreDrawCore(RenderDrawContext context)
Parameters
context
RenderDrawContext
Reset()
Resets the state of this effect.
public override void Reset()
SetDepthOutput(Texture, Texture)
Sets the render target output.
public void SetDepthOutput(Texture depthStencilView, Texture renderTargetView)
Parameters
depthStencilView
TextureThe depth stencil output view.
renderTargetView
TextureThe render target output view.
SetDepthOutput(Texture, params Texture[])
Sets the render target outputs.
public void SetDepthOutput(Texture depthStencilView, params Texture[] renderTargetViews)
Parameters
depthStencilView
TextureThe depth stencil output view.
renderTargetViews
Texture[]The render target output views.
SetInput(int, Texture)
Sets an input texture
public void SetInput(int slot, Texture texture)
Parameters
SetOutput(Texture)
Sets the render target output.
public void SetOutput(Texture view)
Parameters
view
TextureThe render target output view.
Exceptions
SetOutput(params Texture[])
Sets the render target outputs.
public void SetOutput(params Texture[] views)
Parameters
views
Texture[]The render target output views.
SetRenderTargets(RenderDrawContext)
Set the render targets for the image effect.
protected virtual void SetRenderTargets(RenderDrawContext context)
Parameters
context
RenderDrawContext
SetScissorRectangle(Rectangle?)
Binds a single scissor rectangle to the rasterizer stage.
public void SetScissorRectangle(Rectangle? value)
Parameters
value
Rectangle?The scissor rectangle.
SetScissorRectangles(ReadOnlySpan<Rectangle>)
Binds a set of scissor rectangles to the rasterizer stage.
public void SetScissorRectangles(ReadOnlySpan<Rectangle> values)
Parameters
values
ReadOnlySpan<Rectangle>The set of scissor rectangles to bind.
Remarks
Only MaxViewportAndScissorRectangleCount viewports can be used simultaneously
SetViewport(Viewport?)
Binds a single viewport to the rasterizer stage.
public void SetViewport(Viewport? value)
Parameters
value
Viewport?The viewport.
SetViewports(ReadOnlySpan<Viewport>)
Binds a set of viewports to the rasterizer stage.
public void SetViewports(ReadOnlySpan<Viewport> values)
Parameters
values
ReadOnlySpan<Viewport>The set of viewports to bind.
Remarks
Only MaxViewportAndScissorRectangleCount scissors can be used simultaneously