Description
The WithWidth
method is part of the TextureBuilder
class in the Sandbox namespace. It allows you to specify the width of a texture that you are building. This method is useful when you want to set or change the width of a texture during its construction process.
Usage
To use the WithWidth
method, you need to have an instance of TextureBuilder
. Call the method on this instance and pass the desired width as an integer parameter. The method returns the same TextureBuilder
instance, allowing for method chaining.
Example
// Example of using WithWidth method
TextureBuilder builder = new TextureBuilder();
builder = builder.WithWidth(1024); // Set the width of the texture to 1024 pixels
// Continue building the texture with other methods
builder = builder.WithHeight(512);
builder = builder.WithFormat(ImageFormat.RGBA8);
// Finally, create the texture
Texture texture = builder.Create("MyTexture", false, data, data.Length);