Class Gorgon2D1BitEffect
An effect that renders an image as if it were 1 bit image.
Inherited Members
Namespace: Gorgon.Renderers
Assembly: Gorgon.Renderers.Gorgon2D.dll
Syntax
public class Gorgon2D1BitEffect : Gorgon2DEffect, IGorgonNamedObject, IDisposable, IGorgonGraphicsObject, IGorgon2DCompositorEffect
Remarks
This effect renders a 1-bit color image by using a Threshold to determine which bit is on, and which is off. If a color value falls within the Threshold, then a bit is set as on, otherwise it will be set as off.
Constructors
| Edit this page View SourceGorgon2D1BitEffect(Gorgon2D)
Initializes a new instance of the Gorgon2D1BitEffect class.
Declaration
public Gorgon2D1BitEffect(Gorgon2D renderer)
Parameters
Type | Name | Description |
---|---|---|
Gorgon2D | renderer | The renderer used to draw the effect. |
Properties
| Edit this page View SourceConvertAlphaChannel
Property to set or return whether the alpha channel should be included in the conversion.
Declaration
public bool ConvertAlphaChannel { get; set; }
Property Value
Type | Description |
---|---|
bool |
Invert
Property to set or return whether to invert the texel colors.
Declaration
public bool Invert { get; set; }
Property Value
Type | Description |
---|---|
bool |
Threshold
Property to set or return the range of values that are considered to be "on".
Declaration
public GorgonRangeF Threshold { get; set; }
Property Value
Type | Description |
---|---|
GorgonRangeF |
UseAverage
Property to set or return whether to use an average of the texel colors or to use a grayscale calculation.
Declaration
public bool UseAverage { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceBegin(GorgonBlendState, GorgonDepthStencilState, GorgonRasterState, GorgonCameraCommon)
Function to begin rendering the effect.
Declaration
public void Begin(GorgonBlendState blendState = null, GorgonDepthStencilState depthStencilState = null, GorgonRasterState rasterState = null, GorgonCameraCommon camera = null)
Parameters
Type | Name | Description |
---|---|---|
GorgonBlendState | blendState | [Optional] A user defined blend state to apply when rendering. |
GorgonDepthStencilState | depthStencilState | [Optional] A user defined depth/stencil state to apply when rendering. |
GorgonRasterState | rasterState | [Optional] A user defined rasterizer state to apply when rendering. |
GorgonCameraCommon | camera | [Optional] The camera to use when rendering. |
Dispose(bool)
Releases unmanaged and - optionally - managed resources
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
| Edit this page View SourceEnd()
Function to end the effect rendering.
Declaration
public void End()
OnBeforeRender(GorgonRenderTargetView, bool)
Function called prior to rendering.
Declaration
protected override void OnBeforeRender(GorgonRenderTargetView output, bool sizeChanged)
Parameters
Type | Name | Description |
---|---|---|
GorgonRenderTargetView | output | The final render target that will receive the rendering from the effect. |
bool | sizeChanged | true if the output size changed since the last render, or false if it's the same. |
Overrides
Remarks
Applications can use this to set up common states and other configuration settings prior to executing the render passes. This is an ideal method to initialize and resize your internal render targets (if applicable).
OnGetBatchState(int, IGorgon2DEffectBuilders, bool)
Function called to build a new (or return an existing) 2D batch state.
Declaration
protected override Gorgon2DBatchState OnGetBatchState(int passIndex, IGorgon2DEffectBuilders builders, bool statesChanged)
Parameters
Type | Name | Description |
---|---|---|
int | passIndex | The index of the current rendering pass. |
IGorgon2DEffectBuilders | builders | The builder types that will manage the state of the effect. |
bool | statesChanged | true if the blend, raster, or depth/stencil state was changed. false if not. |
Returns
Type | Description |
---|---|
Gorgon2DBatchState | The 2D batch state. |
Overrides
| Edit this page View SourceOnInitialize()
Function called to initialize the effect.
Declaration
protected override void OnInitialize()
Overrides
Remarks
Applications must implement this method to ensure that any required resources are created, and configured for the effect.
Render(GorgonTexture2DView, GorgonRenderTargetView)
Function to render an effect under the Gorgon2DCompositor.
Declaration
public void Render(GorgonTexture2DView texture, GorgonRenderTargetView output)
Parameters
Type | Name | Description |
---|---|---|
GorgonTexture2DView | texture | The texture to render into the next target. |
GorgonRenderTargetView | output | The render target that will receive the final output. |