Texture Create( string name, bool anonymous, System.ReadOnlySpan<System.Byte> data, int dataLength )

robot_2Generated
code_blocksInput

Description

The Create method in the TextureBuilder class is used to create a new Texture object. This method allows you to specify the name of the texture, whether it should be anonymous, and provide the raw data for the texture along with its length.

Usage

To use the Create method, you need to have a TextureBuilder instance. You can then call the method with the appropriate parameters:

  • name: A string representing the name of the texture. This can be used for identification purposes.
  • anonymous: A bool indicating whether the texture should be anonymous. If true, the texture will not be associated with a specific name.
  • data: A ReadOnlySpan<byte> containing the raw byte data for the texture. This data represents the pixel information.
  • dataLength: An int specifying the length of the data provided.

Example

// Example of creating a texture using TextureBuilder
TextureBuilder builder = new TextureBuilder();

// Define texture data
string textureName = "MyTexture";
bool isAnonymous = false;
byte[] textureData = new byte[] { /* byte data representing the texture */ };
int dataLength = textureData.Length;

// Create the texture
Texture texture = builder.Create(textureName, isAnonymous, textureData, dataLength);