Description
The WithData
method allows you to specify the raw byte data for a texture that is being built using the Texture2DBuilder
. This method is part of a fluent interface, enabling you to chain multiple configuration methods together to customize the texture before finalizing it with the Finish
method.
Usage
To use the WithData
method, you need to have an instance of Texture2DBuilder
. Call WithData
on this instance, passing in a byte array that contains the texture data. This method returns the same Texture2DBuilder
instance, allowing for method chaining.
Example
// Example of using WithData method
byte[] textureData = LoadTextureData(); // Assume this method loads your texture data
Texture2DBuilder builder = new Texture2DBuilder();
builder.WithSize(256, 256) // Set the size of the texture
.WithFormat(ImageFormat.RGBA8) // Set the format of the texture
.WithData(textureData) // Set the raw data for the texture
.Finish(); // Finalize and create the texture