Gorgon
Show / Hide Table of Contents

Class GorgonTexture1D

A texture used to project an image onto a graphic primitive such as a triangle.

Inheritance
object
GorgonGraphicsResource
GorgonTexture1D
Implements
IGorgonNativeResource
IGorgonTexture1DInfo
IGorgonTextureResource
IGorgonNamedObject
IGorgonGraphicsObject
IGorgonImageInfo
IDisposable
Inherited Members
GorgonGraphicsResource.IsDisposed
GorgonGraphicsResource.Graphics
GorgonGraphicsResource.EvictionPriority
GorgonGraphicsResource.SetApplicationData(Guid, object)
GorgonGraphicsResource.GetApplicationData(Guid)
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public sealed class GorgonTexture1D : GorgonGraphicsResource, IGorgonNativeResource, IGorgonTexture1DInfo, IGorgonTextureResource, IGorgonNamedObject, IGorgonGraphicsObject, IGorgonImageInfo, IDisposable

Constructors

| Edit this page View Source

GorgonTexture1D(GorgonGraphics, GorgonTexture1DInfo)

Initializes a new instance of the GorgonTexture1D class.

Declaration
public GorgonTexture1D(GorgonGraphics graphics, GorgonTexture1DInfo textureInfo)
Parameters
Type Name Description
GorgonGraphics graphics

The GorgonGraphics interface that created this texture.

GorgonTexture1DInfo textureInfo

A IGorgonTexture1DInfo object describing the properties of this texture.

Remarks

This constructor creates an empty texture. Data may be uploaded to the texture at a later time if its Usage is not set to Immutable. If the Usage is set to Immutable with this constructor, then an exception will be thrown. To use an immutable texture, use the ToTexture1D(IGorgonImage, GorgonGraphics, GorgonTextureLoadOptions) extension method on the IGorgonImage type.

Exceptions
Type Condition
ArgumentNullException

Thrown when the graphics, or the textureInfo parameter is null.

ArgumentException

Thrown when the Usage is set to Immutable.

GorgonException

Thrown when the texture could not be created due to misconfiguration.

Properties

| Edit this page View Source

ArrayCount

Property to return the number of array levels for a 1D or 2D texture.

Declaration
public int ArrayCount { get; }
Property Value
Type Description
int
| Edit this page View Source

Binding

Property to return the flags to determine how the texture will be bound with the pipeline when rendering.

Declaration
public TextureBinding Binding { get; }
Property Value
Type Description
TextureBinding
Remarks

If the Usage property is set to Staging, then the texture binding will a value of None as staging textures do not support bindings of any kind.

| Edit this page View Source

Format

Property to return the format of the texture.

Declaration
public BufferFormat Format { get; }
Property Value
Type Description
BufferFormat
| Edit this page View Source

FormatInformation

Property to return the information about the format of the texture.

Declaration
public GorgonFormatInfo FormatInformation { get; }
Property Value
Type Description
GorgonFormatInfo
| Edit this page View Source

MipLevels

Property to return the number of mip-map levels for the texture.

Declaration
public int MipLevels { get; }
Property Value
Type Description
int
| Edit this page View Source

Name

Property to return the name of this object.

Declaration
public override string Name { get; }
Property Value
Type Description
string
Overrides
GorgonGraphicsResource.Name
| Edit this page View Source

ResourceType

Property to return the type of data in the resource.

Declaration
public override GraphicsResourceType ResourceType { get; }
Property Value
Type Description
GraphicsResourceType
Overrides
GorgonGraphicsResource.ResourceType
| Edit this page View Source

SizeInBytes

Property to return the size, in bytes, of the resource.

Declaration
public override int SizeInBytes { get; }
Property Value
Type Description
int
Overrides
GorgonGraphicsResource.SizeInBytes
| Edit this page View Source

TextureID

Property to return the ID for this texture.

Declaration
public int TextureID { get; }
Property Value
Type Description
int
| Edit this page View Source

Usage

Property to return the usage for the resource.

Declaration
public override ResourceUsage Usage { get; }
Property Value
Type Description
ResourceUsage
Overrides
GorgonGraphicsResource.Usage
| Edit this page View Source

Width

Property to return the width of the texture, in pixels.

Declaration
public int Width { get; }
Property Value
Type Description
int

Methods

| Edit this page View Source

CalculateSizeInBytes(IGorgonTexture1DInfo)

Function to calculate the size of a texture, in bytes with the given parameters.

Declaration
public static int CalculateSizeInBytes(IGorgonTexture1DInfo info)
Parameters
Type Name Description
IGorgonTexture1DInfo info

The IGorgonTexture1DInfo used to define a texture.

Returns
Type Description
int

The number of bytes for the texture.

Exceptions
Type Condition
ArgumentNullException

Thrown when the info parameter is null.

| Edit this page View Source

CalculateSizeInBytes(int, int, BufferFormat, int)

Function to calculate the size of a texture, in bytes with the given parameters.

Declaration
public static int CalculateSizeInBytes(int width, int arrayCount, BufferFormat format, int mipCount)
Parameters
Type Name Description
int width

The width of the texture.

int arrayCount

The number of array indices.

BufferFormat format

The format for the texture.

int mipCount

The number of mip map levels.

Returns
Type Description
int

The number of bytes for the texture.

| Edit this page View Source

CopyTo(GorgonTexture1D, GorgonRange?, int, int, int, int, int, CopyMode)

Function to copy this texture into another GorgonTexture1D.

Declaration
public void CopyTo(GorgonTexture1D destinationTexture, GorgonRange? sourceRange = null, int sourceArrayIndex = 0, int sourceMipLevel = 0, int destX = 0, int destArrayIndex = 0, int destMipLevel = 0, CopyMode copyMode = CopyMode.None)
Parameters
Type Name Description
GorgonTexture1D destinationTexture

The texture to copy into.

GorgonRange? sourceRange

[Optional] The dimensions of the source area to copy.

int sourceArrayIndex

[Optional] The array index of the sub resource to copy.

int sourceMipLevel

[Optional] The mip map level of the sub resource to copy.

int destX

[Optional] Horizontal offset into the destination texture to place the copied data.

int destArrayIndex

[Optional] The array index of the destination sub resource to copy into.

int destMipLevel

[Optional] The mip map level of the destination sub resource to copy into.

CopyMode copyMode

[Optional] Defines how data should be copied into the texture.

Remarks

Use this method to copy a specific sub resource of this GorgonTexture1D to another sub resource of a GorgonTexture1D, or to a different sub resource of the same texture. The sourceRange coordinates must be inside of the destination, if it is not, then the source data will be clipped against the destination region. No stretching or filtering is supported by this method.

Limited format conversion will be performed if the two textures are within the same bit group (e.g. R8G8B8A8_SInt is convertible to R8G8B8A8_UNorm and so on, since they are both R8G8B8A8). If the bit group does not match, then an exception will be thrown.

When copying sub resources (e.g. mip levels, array indices, etc...), the mip levels and array indices must be different if copying to the same texture. If they are not, an exception will be thrown.

The destination texture must not have a Usage of Immutable.

The copyMode flag defines how data will be copied into this texture. See the CopyMode enumeration for a description of the values.

caution

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

Exceptions
Type Condition
ArgumentNullException

Thrown when the texture parameter is null.

NotSupportedException

Thrown when the formats cannot be converted because they're not of the same group.

-or-

Thrown when the destinationTexture is the same as this texture, and the sourceArrayIndex, destArrayIndex, sourceMipLevel and the destMipLevel specified are pointing to the same subresource.

-or-

Thrown when this texture has a Usage of Immutable.

| Edit this page View Source

CopyTo(GorgonTexture2D, GorgonRange?, int, int, int, int, int, int, CopyMode)

Function to copy this texture into a GorgonTexture2D.

Declaration
public void CopyTo(GorgonTexture2D destinationTexture, GorgonRange? sourceRange = null, int sourceArrayIndex = 0, int sourceMipLevel = 0, int destX = 0, int destY = 0, int destArrayIndex = 0, int destMipLevel = 0, CopyMode copyMode = CopyMode.None)
Parameters
Type Name Description
GorgonTexture2D destinationTexture

The texture to copy into.

GorgonRange? sourceRange

[Optional] The dimensions of the source area to copy.

int sourceArrayIndex

[Optional] The array index of the sub resource to copy.

int sourceMipLevel

[Optional] The mip map level of the sub resource to copy.

int destX

[Optional] Horizontal offset into the destination texture to place the copied data.

int destY

[Optional] Vertical offset into the destination texture to place the copied data.

int destArrayIndex

[Optional] The array index of the destination sub resource to copy into.

int destMipLevel

[Optional] The mip map level of the destination sub resource to copy into.

CopyMode copyMode

[Optional] Defines how data should be copied into the texture.

Remarks

Use this method to copy a specific sub resource of this GorgonTexture1D to another sub resource of a GorgonTexture2D The sourceRange coordinates must be inside of the destination, if it is not, then the source data will be clipped against the destination region. No stretching or filtering is supported by this method.

Limited format conversion will be performed if the two textures are within the same bit group (e.g. R8G8B8A8_SInt is convertible to R8G8B8A8_UNorm and so on, since they are both R8G8B8A8). If the bit group does not match, then an exception will be thrown.

When copying sub resources (e.g. mip levels, array indices, etc...), the mip levels and array indices must be different if copying to the same texture. If they are not, an exception will be thrown.

The destination texture must not have a Usage of Immutable.

The copyMode flag defines how data will be copied into this texture. See the CopyMode enumeration for a description of the values.

caution

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

Exceptions
Type Condition
ArgumentNullException

Thrown when the texture parameter is null.

NotSupportedException

Thrown when the formats cannot be converted because they're not of the same group.

-or-

Thrown when the destinationTexture is the same as this texture, and the sourceArrayIndex, destArrayIndex, sourceMipLevel and the destMipLevel specified are pointing to the same subresource.

-or-

Thrown when this texture has a Usage of Immutable.

| Edit this page View Source

CopyTo(GorgonTexture3D, GorgonRange?, int, int, int, int, int, int, CopyMode)

Function to copy this texture into a GorgonTexture3D.

Declaration
public void CopyTo(GorgonTexture3D destinationTexture, GorgonRange? sourceRange = null, int sourceArrayIndex = 0, int sourceMipLevel = 0, int destX = 0, int destY = 0, int destZ = 0, int destMipLevel = 0, CopyMode copyMode = CopyMode.None)
Parameters
Type Name Description
GorgonTexture3D destinationTexture

The texture to copy into.

GorgonRange? sourceRange

[Optional] The dimensions of the source area to copy.

int sourceArrayIndex

[Optional] The array index of the sub resource to copy.

int sourceMipLevel

[Optional] The mip map level of the sub resource to copy.

int destX

[Optional] Horizontal offset into the destination texture to place the copied data.

int destY

[Optional] Vertical offset into the destination texture to place the copied data.

int destZ

[Optional] Depth offset into the destination texture to place the copied data.

int destMipLevel

[Optional] The mip map level of the destination sub resource to copy into.

CopyMode copyMode

[Optional] Defines how data should be copied into the texture.

Remarks

Use this method to copy a specific sub resource of this GorgonTexture1D to another sub resource of a GorgonTexture3D. The sourceRange coordinates must be inside of the destination, if it is not, then the source data will be clipped against the destination region. No stretching or filtering is supported by this method.

Limited format conversion will be performed if the two textures are within the same bit group (e.g. R8G8B8A8_SInt is convertible to R8G8B8A8_UNorm and so on, since they are both R8G8B8A8). If the bit group does not match, then an exception will be thrown.

When copying sub resources (e.g. mip levels, array indices, etc...), the mip levels and array indices must be different if copying to the same texture. If they are not, an exception will be thrown.

The destination texture must not have a Usage of Immutable.

The copyMode flag defines how data will be copied into this texture. See the CopyMode enumeration for a description of the values.

caution

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

Exceptions
Type Condition
ArgumentNullException

Thrown when the texture parameter is null.

NotSupportedException

Thrown when the formats cannot be converted because they're not of the same group.

-or-

Thrown when this texture has a Usage of Immutable.

| Edit this page View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public override void Dispose()
Overrides
GorgonGraphicsResource.Dispose()
| Edit this page View Source

FromFile(GorgonGraphics, string, IGorgonImageCodec, GorgonTextureLoadOptions)

Function to load a texture from a file..

Declaration
public static GorgonTexture1D FromFile(GorgonGraphics graphics, string filePath, IGorgonImageCodec codec, GorgonTextureLoadOptions options = null)
Parameters
Type Name Description
GorgonGraphics graphics

The graphics interface that will own the texture.

string filePath

The path to the file.

IGorgonImageCodec codec

The codec that is used to decode the the data in the stream.

GorgonTextureLoadOptions options

[Optional] Options used to further define the texture.

Returns
Type Description
GorgonTexture1D

A new GorgonTexture1D

Remarks

This will load an IGorgonImage from a file on disk and put it into a GorgonTexture1D object.

If specified, the optionsparameter 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 infoNot used by 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 graphics, filePath, or the codec parameter is null.

ArgumentEmptyException

Thrown when the filePath parameter is empty.

| Edit this page View Source

FromStream(GorgonGraphics, Stream, IGorgonImageCodec, long?, GorgonTextureLoadOptions)

Function to load a texture from a Stream.

Declaration
public static GorgonTexture1D FromStream(GorgonGraphics graphics, Stream stream, IGorgonImageCodec codec, long? size = null, GorgonTextureLoadOptions options = null)
Parameters
Type Name Description
GorgonGraphics graphics

The graphics interface that will own the texture.

Stream stream

The stream containing the texture image data.

IGorgonImageCodec codec

The codec that is used to decode the the data in the stream.

long? size

[Optional] The size of the image in the stream, in bytes.

GorgonTextureLoadOptions options

[Optional] Options used to further define the texture.

Returns
Type Description
GorgonTexture1D

A new GorgonTexture1D

Remarks

This will load an IGorgonImage from a stream and put it into a GorgonTexture1D object.

If the size option is specified, then the method will read from the stream up to that number of bytes, so it is up to the user to provide an accurate size. If it is omitted then the stream length - stream position is used as the total size.

If specified, the optionsparameter 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 infoNot used by 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 graphics, stream, or the codec parameter is null.

IOException

Thrown if the stream is write only.

EndOfStreamException

Thrown if reading the image would move beyond the end of the stream.

| Edit this page View Source

GetReadWriteView(BufferFormat, int, int, int)

Function to create a new GorgonTexture1DReadWriteView for this texture.

Declaration
public GorgonTexture1DReadWriteView GetReadWriteView(BufferFormat format = BufferFormat.Unknown, int firstMipLevel = 0, int arrayIndex = 0, int arrayCount = 0)
Parameters
Type Name Description
BufferFormat format

[Optional] The format for the view.

int firstMipLevel

[Optional] The first mip map level (slice) to start viewing from.

int arrayIndex

[Optional] The array index to start viewing from.

int arrayCount

[Optional] The number of array indices to view.

Returns
Type Description
GorgonTexture1DReadWriteView

A GorgonTexture1DReadWriteView used to bind the texture to a shader.

Remarks

This will create an unordered access view that makes a texture accessible to shaders using unordered access to the data. This allows viewing of the texture data in a different format, or even a subsection of the texture from within the shader.

The format parameter is used present the texture data as another format type to the shader. If this parameter is omitted, then the format of the texture will be used.

The firstMipLevel parameter defines the starting mip level to allow access to within the shader. If this value falls outside of the range of available mip levels, then it will be clipped to the upper and lower bounds of the mip chain. If this value is left at 0, then only the first mip level is used.

The arrayIndex and arrayCount parameters define the starting array index and the number of array indices to allow access to within the shader. If these values are left at 0, then all array indices will be accessible.

Exceptions
Type Condition
GorgonException

Thrown when this texture does not have a TextureBinding of ReadWriteView.

-or-

Thrown when this texture has a Usage of Staging.

ArgumentException

Thrown when the format is typeless or is not a supported format for unordered access views.

| Edit this page View Source

GetShaderResourceView(BufferFormat, int, int, int, int)

Function to create a new GorgonTexture1DView for this texture.

Declaration
public GorgonTexture1DView GetShaderResourceView(BufferFormat format = BufferFormat.Unknown, int firstMipLevel = 0, int mipCount = 0, int arrayIndex = 0, int arrayCount = 0)
Parameters
Type Name Description
BufferFormat format

[Optional] The format for the view.

int firstMipLevel

[Optional] The first mip map level (slice) to start viewing from.

int mipCount

[Optional] The number of mip map levels to view.

int arrayIndex

[Optional] The array index to start viewing from.

int arrayCount

[Optional] The number of array indices to view.

Returns
Type Description
GorgonTexture1DView

A GorgonTexture1DView used to bind the texture to a shader.

Remarks

This will create a view that makes a texture accessible to shaders. This allows viewing of the texture data in a different format, or even a subsection of the texture from within the shader.

The format parameter is used present the texture data as another format type to the shader. If this value is left at the default of Unknown, then the format from the this texture is used. The format must be castable to the format of this texture. If it is not, an exception will be thrown.

The firstMipLevel and mipCount parameters define the starting mip level and the number of mip levels to allow access to within the shader. If these values fall outside of the range of available mip levels, then they will be clipped to the upper and lower bounds of the mip chain. If these values are left at 0, then all mip levels will be accessible.

The arrayIndex and arrayCount parameters define the starting array index and the number of array indices to allow access to within the shader. If these values are left at 0, then all array indices will be accessible.

Exceptions
Type Condition
ArgumentException

Thrown if the format is a typeless format.

GorgonException

Thrown when this texture does not have a TextureBinding of ShaderResource.

-or-

Thrown when this texture has a usage of Staging.

| Edit this page View Source

GetStagingTexture()

Function to get a staging texture from this texture.

Declaration
public GorgonTexture1D GetStagingTexture()
Returns
Type Description
GorgonTexture1D

A new GorgonTexture1D containing a copy of the data in this texture, with a usage of Staging.

Remarks

This allows an application to make a copy of the texture for editing on the CPU. The resulting staging texture, once edited, can then be reuploaded to the same texture, or another texture.

Exceptions
Type Condition
GorgonException

Thrown when this texture has a Usage of Immutable.

| Edit this page View Source

SetData(IGorgonImageBuffer, GorgonRange?, int, int, CopyMode)

Function to update the texture, or a sub section of the texture with data from a IGorgonImageBuffer contained within a IGorgonImage.

Declaration
public void SetData(IGorgonImageBuffer imageBuffer, GorgonRange? destinationRange = null, int destArrayIndex = 0, int destMipLevel = 0, CopyMode copyMode = CopyMode.None)
Parameters
Type Name Description
IGorgonImageBuffer imageBuffer

The image buffer that contains the data to copy.

GorgonRange? destinationRange

[Optional] The region on the texture to update.

int destArrayIndex

[Optional] The array index to update.

int destMipLevel

[Optional] The mip map level to update.

CopyMode copyMode

[Optional] Flags to indicate how to copy the data.

Remarks

This will upload data from a IGorgonImageBuffer in a IGorgonImage to a sub section of the texture (e.g. a mip level, array index, etc...). The method will determine how to best upload the data depending on the Usage of the texture. For example, if the texture has a Usage of Default, then internally, this method will update to the GPU directly. Otherwise, if it is Dynamic, or Staging, it will use a locking pattern which uses the CPU to write data to the texture. The latter pattern is good if the texture has to change one or more times per frame, otherwise, the former is better where the texture is updated less than once per frame (i.e. Dynamic is good for multiple times per frame, Default is good for once per frame or less).

Users who wish to capture a smaller portion of the source imageBuffer can use the GetRegion(in Rectangle) method to extract a region from a buffer in a IGorgonImage.

If the user supplies a destinationRange, then the data will be copied to the region in the texture specified by the parameter, otherwise if the parameter is omitted, the full size of the texture (depending on mip level) is used. This value is clipped against the width/height of the mip level (e.g. A 256x256 image at mip level 2 would be 64x64).

The destMipLevel, and destArrayIndex define which mip map level, and/or array index will receive the data. If omitted, the first mip level and/or array index is used. Like the destinationRange, these values are clipped against the MipLevels and ArrayCount values respectively.

The copyMode parameter defines how the copy will be performed. If the texture has a Usage of Dynamic or Default and the copyMode is set to Discard then the contents of the texture are discarded before updating, if it is set to NoOverwrite, then the data will be copied to the destination if we know the GPU is not using the portion being updated. If the copyMode is set to None, then Discard is used. For textures created with a Usage of Staging, the CopyMode will be ignored and act as though None were passed.

Please note that no format conversion, or image manipulation (other than clipping against the destinationRange) is performed by this method. So it is up to the user to ensure that their source data is in the correct format and at the correct size.

caution

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

Examples

The following is an example showing how to upload an image into a texture using different techniques:

using DX = SharpDX;

IGorgonImage image = ... // Load an image from a source.
var texture = new GorgonTexture1D(graphics, new GorgonTexture1DInfo
{
   Width = image.Width,
   Format = image.Format,
   ArrayCount = 4,
   MipLevels = 4,
   // This will trigger a direct upload to the GPU, use Dynamic or Staging for CPU writable uploads.
   // Dynamic is useful if the texture needs updating once or more per frame.
   Usage = ResourceUsage.Default  
});

// Set the image to the first array and mip level at the full size.
texture.SetData(image.Buffers[0]);

// Set the image to the 3rd array index, and 2nd mip level, at position 10 on the texture, with width of 50.
// Also, set it so that we're copying to another
texture.SetData(image.Buffers[0], new GorgonRange(10, 50), 2, 2, copyMode: CopyMode.NoOverwrite);

// Set a portion of the source image.
texture.SetData(image.Buffers[0].GetRegion(new DX.Rectangle(10, 10, 50, 1));
Exceptions
Type Condition
NotSupportedException

Thrown if this image has a usage of Immutable, or has a binding of DepthStencil.

ArgumentException

Thrown if the imageBuffer contains data in a BufferFormat that does not have the same size, in bytes, as the Format of this texture.

-or-

Thrown if the BufferFormat of the imageBuffer is compressed and the Format of this texture is not (or vice versa).

-or-

Thrown if the BufferFormat of the imageBuffer is packed and the Format of this texture is not (or vice versa).

See Also
IGorgonImage
IGorgonImageBuffer
BufferFormat
CopyMode
| Edit this page View Source

ToImage()

Function to convert this texture to a IGorgonImage.

Declaration
public IGorgonImage ToImage()
Returns
Type Description
IGorgonImage

A new IGorgonImage containing the texture data.

Exceptions
Type Condition
GorgonException

Thrown when this texture has a Usage set to Immutable.

| Edit this page View Source

ToImage(int, int?)

Function to convert the texture data at the specified array index, and/or mip map level into a GorgonImage.

Declaration
public IGorgonImage ToImage(int mipLevel, int? arrayIndex = null)
Parameters
Type Name Description
int mipLevel

The mip level in the texture to copy from.

int? arrayIndex

[Optional] The array index in the texture to copy from.

Returns
Type Description
IGorgonImage

A new IGorgonImage containing the data in the array index and mip level.

Remarks

If the arrayIndex is passed in, then only that array index will be copied to the resulting image. If it is omitted, then the entire array will be returned.

Exceptions
Type Condition
GorgonException

Thrown when this texture has a Usage set to Immutable.

| Edit this page View Source

ToPixel(GorgonRangeF)

Function to convert a texel rectangle into a pixel rectangle.

Declaration
public GorgonRange ToPixel(GorgonRangeF texelCoordinates)
Parameters
Type Name Description
GorgonRangeF texelCoordinates

The texel rectangle to convert.

Returns
Type Description
GorgonRange

The pixel rectangle.

| Edit this page View Source

ToPixel(float)

Function to convert a texel coordinate into a pixel coordinate.

Declaration
public int ToPixel(float texelCoordinates)
Parameters
Type Name Description
float texelCoordinates

The texel coordinates to convert.

Returns
Type Description
int

The pixel coordinates.

| Edit this page View Source

ToTexel(GorgonRange)

Function to convert a pixel rectangle into a texel rectangle.

Declaration
public GorgonRangeF ToTexel(GorgonRange pixelCoordinates)
Parameters
Type Name Description
GorgonRange pixelCoordinates

The pixel rectangle to convert.

Returns
Type Description
GorgonRangeF

The texel rectangle.

| Edit this page View Source

ToTexel(int)

Function to convert a pixel coordinate into a texel coordinate.

Declaration
public float ToTexel(int pixelCoordinates)
Parameters
Type Name Description
int pixelCoordinates

The pixel coordinate to convert.

Returns
Type Description
float

The texel coordinates.

Implements

IGorgonNativeResource
IGorgonTexture1DInfo
IGorgonTextureResource
IGorgonNamedObject
IGorgonGraphicsObject
IGorgonImageInfo
IDisposable

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author