Class GorgonTextureBlitter
Provides functionality for blitting a texture to the currently active render target.
Implements
Inherited Members
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public class GorgonTextureBlitter : IDisposable
Constructors
| Edit this page View SourceGorgonTextureBlitter(GorgonGraphics)
Initializes a new instance of the GorgonTextureBlitter class.
Declaration
public GorgonTextureBlitter(GorgonGraphics graphics)
Parameters
Type | Name | Description |
---|---|---|
GorgonGraphics | graphics | The graphics interface used to create the required objects for blitting. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
Methods
| Edit this page View SourceBlit(GorgonTexture2DView, Point, in GorgonColor?, GorgonBlendState, GorgonSamplerState, GorgonPixelShader, GorgonConstantBuffers)
Function to draw a texture to the current render target.
Declaration
public void Blit(GorgonTexture2DView texture, Point destination, in GorgonColor? color = null, GorgonBlendState blendState = null, GorgonSamplerState samplerState = null, GorgonPixelShader pixelShader = null, GorgonConstantBuffers psConstantBuffers = null)
Parameters
Type | Name | Description |
---|---|---|
GorgonTexture2DView | texture | The texture to draw. |
Point | destination | The location on the target to draw into. |
GorgonColor? | color | [Optional] The color to apply to the texture when drawing. |
GorgonBlendState | blendState | [Optional] The type of blending to perform. |
GorgonSamplerState | samplerState | [Optional] The sampler state used to define how to sample the texture. |
GorgonPixelShader | pixelShader | [Optional] A pixel shader used to apply effects to the texture. |
GorgonConstantBuffers | psConstantBuffers | [Optional] A list of constant buffers for the pixel shader if they're required. |
Remarks
This is a utility method used to draw a (2D) texture to the current render target. This is handy for quick testing to ensure things are working as they should.
important
This method, while quite handy, should not be used for performance sensitive work as it is not the most optimal means of displaying texture data.
See Also
| Edit this page View SourceBlit(GorgonTexture2DView, Rectangle, in Rectangle?, in GorgonColor?, GorgonBlendState, GorgonSamplerState, GorgonPixelShader, GorgonConstantBuffers)
Function to blit the texture to the specified render target.
Declaration
public void Blit(GorgonTexture2DView texture, Rectangle destRect, in Rectangle? sourceRegion = null, in GorgonColor? color = null, GorgonBlendState blendState = null, GorgonSamplerState samplerState = null, GorgonPixelShader pixelShader = null, GorgonConstantBuffers pixelShaderConstants = null)
Parameters
Type | Name | Description |
---|---|---|
GorgonTexture2DView | texture | The texture that will be blitted to the render target. |
Rectangle | destRect | The layout area to blit the texture into. |
Rectangle? | sourceRegion | The region on the texture to start blitting from. |
GorgonColor? | color | The color used to tint the diffuse value of the texture. |
GorgonBlendState | blendState | The blending state to apply. |
GorgonSamplerState | samplerState | The sampler state to apply. |
GorgonPixelShader | pixelShader | The pixel shader used to override the default pixel shader. |
GorgonConstantBuffers | pixelShaderConstants | The pixel shader constant buffers to use. |
BlitFullScreen(GorgonTexture2DView, GorgonBlendState, GorgonSamplerState)
Function to blit a texture to the full size of the current view.
Declaration
public void BlitFullScreen(GorgonTexture2DView texture, GorgonBlendState blendState = null, GorgonSamplerState samplerState = null)
Parameters
Type | Name | Description |
---|---|---|
GorgonTexture2DView | texture | The texture to blit. |
GorgonBlendState | blendState | [Optional] The blending state to apply. |
GorgonSamplerState | samplerState | [Optiona] The sampler state to apply. |
Remarks
This method blits the texture to the full size of the current view. It does this by rendering a single triangle that is large enough to encompass the entire view and calculating the texture coordinates on the triangle so that the texture is displayed correctly. This is faster than blitting a quad because there's only a single triangle to render, thus the fill time is cut down.
If the blendState
is not used, then the system will default to no blending.
If the samplerState
is not used, then the system will default to point sampling.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()