Class GorgonImageTextureExtensions
Extension methods used to create textures from images.
Inherited Members
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public static class GorgonImageTextureExtensions
Methods
| Edit this page View SourceToTexture1D(IGorgonImage, GorgonGraphics, GorgonTextureLoadOptions)
Function to create a GorgonTexture1D from a GorgonImage.
Declaration
public static GorgonTexture1D ToTexture1D(this IGorgonImage image, GorgonGraphics graphics, GorgonTextureLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IGorgonImage | image | The image used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTextureLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture1D | A new GorgonTexture1D containing the data from the |
Remarks
A GorgonImage is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GorgonImage into a GorgonTexture1D.
If specified, the options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoThis is not available on 1D textures, and is ignored.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ToTexture1DView(IGorgonImage, GorgonGraphics, GorgonTextureLoadOptions)
Function to create a GorgonTexture1DView from a GorgonImage.
Declaration
public static GorgonTexture1DView ToTexture1DView(this IGorgonImage image, GorgonGraphics graphics, GorgonTextureLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IGorgonImage | image | The image used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTextureLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture1DView | A new GorgonTexture1DView containing the data from the |
Remarks
A GorgonImage is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GorgonImage into a GorgonTexture1DView.
If specified, the options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoThis is not available on 1D textures, and is ignored.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ToTexture2D(IGorgonImage, GorgonGraphics, GorgonTexture2DLoadOptions)
Function to create a GorgonTexture2D from a GorgonImage.
Declaration
public static GorgonTexture2D ToTexture2D(this IGorgonImage image, GorgonGraphics graphics, GorgonTexture2DLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IGorgonImage | image | The image used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTexture2DLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture2D | A new GorgonTexture2D containing the data from the |
Remarks
A GorgonImage is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GorgonImage into a GorgonTexture2D.
If specified, the options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoWhen defined (i.e. not null), defines the multisampling to apply to the texture. If omitted, then the default is NoMultiSampling.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ToTexture2D(Bitmap, GorgonGraphics, GorgonTexture2DLoadOptions)
Function to create a GorgonTexture2D from a GDI+ bitmap.
Declaration
public static GorgonTexture2D ToTexture2D(this Bitmap gdiBitmap, GorgonGraphics graphics, GorgonTexture2DLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Bitmap | gdiBitmap | The GDI+ bitmap used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTexture2DLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture2D | A new GorgonTexture2D containing the data from the |
Remarks
A GDI+ bitmap is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GDI+ bitmap into a GorgonTexture2D.
The resulting GorgonTexture2D will only contain a single mip level, and single array level. The only image type available will be 2D (i.e. image with a width and height). The GDI+ bitmap should have a 32bpp rgba format, or a 24bpp rgb format or else an exception will be thrown.
The optional options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoWhen defined (i.e. not null), defines the multisampling to apply to the texture. If omitted, then the default is NoMultiSampling.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ToTexture2DView(IGorgonImage, GorgonGraphics, GorgonTexture2DLoadOptions)
Function to create a GorgonTexture2DView from a GorgonImage.
Declaration
public static GorgonTexture2DView ToTexture2DView(this IGorgonImage image, GorgonGraphics graphics, GorgonTexture2DLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IGorgonImage | image | The image used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTexture2DLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture2DView | A new GorgonTexture2DView containing the data from the |
Remarks
A GorgonImage is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GorgonImage into a GorgonTexture2DView. This view will be usable by pixel shaders.
If specified, the options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoWhen defined (i.e. not null), defines the multisampling to apply to the texture. If omitted, then the default is NoMultiSampling.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ToTexture2DView(Bitmap, GorgonGraphics, GorgonTexture2DLoadOptions)
Function to create a GorgonTexture2DView from a GDI+ bitmap.
Declaration
public static GorgonTexture2DView ToTexture2DView(this Bitmap gdiBitmap, GorgonGraphics graphics, GorgonTexture2DLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Bitmap | gdiBitmap | The GDI+ bitmap used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTexture2DLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture2DView | A new GorgonTexture2D containing the data from the |
Remarks
A GDI+ bitmap is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GDI+ bitmap into a GorgonTexture2DView. This view will be usable by pixel shaders.
The resulting GorgonTexture2DView will only contain a single mip level, and single array level. The only image type available will be 2D (i.e. image with a width and height). The GDI+ bitmap should have a 32bpp rgba format, or a 24bpp rgb format or else an exception will be thrown.
The optional options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoWhen defined (i.e. not null), defines the multisampling to apply to the texture. If omitted, then the default is NoMultiSampling.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ToTexture3D(IGorgonImage, GorgonGraphics, GorgonTextureLoadOptions)
Function to create a GorgonTexture3D from a GorgonImage.
Declaration
public static GorgonTexture3D ToTexture3D(this IGorgonImage image, GorgonGraphics graphics, GorgonTextureLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IGorgonImage | image | The image used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTextureLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture3D | A new GorgonTexture3D containing the data from the |
Remarks
A GorgonImage is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GorgonImage into a GorgonTexture3D.
If specified, the options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoThis is not available on 3D textures, and is ignored.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ToTexture3DView(IGorgonImage, GorgonGraphics, GorgonTextureLoadOptions)
Function to create a GorgonTexture3DView from a GorgonImage.
Declaration
public static GorgonTexture3DView ToTexture3DView(this IGorgonImage image, GorgonGraphics graphics, GorgonTextureLoadOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IGorgonImage | image | The image used to create the texture. |
GorgonGraphics | graphics | The graphics interface used to create the texture. |
GorgonTextureLoadOptions | options | [Optional] Options used to further define the texture. |
Returns
Type | Description |
---|---|
GorgonTexture3DView | A new GorgonTexture3DView containing the data from the |
Remarks
A GorgonImage is useful to holding image data in memory, but it cannot be sent to the GPU for use as a texture. This method allows an application to convert the GorgonImage into a GorgonTexture3DView. This view will be usable by pixel shaders.
If specified, the options
parameter will define how Gorgon and shaders should handle the texture. The GorgonTextureLoadOptions type contains the following:
- BindingWhen defined, will indicate the TextureBinding that defines how the texture will be bound to the graphics pipeline. If it is omitted, then the binding will be ShaderResource.
- UsageWhen defined, will indicate the preferred usage for the texture. If it is omitted, then the usage will be set to Default.
- Multisample infoThis is not available on 3D textures, and is ignored.
- ConvertToPremultipliedAlphaConverts the image to premultiplied alpha before uploading the image data to the texture.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |