Texture2DBuilder WithData( System.Byte[] data, int dataLength )

book_4_sparkGenerated
code_blocksInput

Description

The WithData method of the Texture2DBuilder class allows you to specify the raw byte data for a texture. This method is part of a fluent interface, enabling you to chain multiple configuration methods together to build a texture with specific properties.

Usage

To use the WithData method, you need to provide a byte array that contains the texture data. This method returns the Texture2DBuilder instance, allowing for method chaining.

Example usage:

var textureBuilder = new Texture2DBuilder();
textureBuilder.WithData(myTextureData)
              .WithSize(256, 256)
              .WithFormat(ImageFormat.RGBA8)
              .Finish();

In this example, myTextureData is a byte array containing the texture data. The texture is configured to be 256x256 pixels with an RGBA8 format, and then the Finish method is called to create the texture.

Example

var textureBuilder = new Texture2DBuilder();
textureBuilder.WithData(myTextureData)
              .WithSize(256, 256)
              .WithFormat(ImageFormat.RGBA8)
              .Finish();