logo
pub struct TextureBuilder<'a> { /* private fields */ }
Expand description

Builder for creating textures.

This is used to control all the various configuration options and such to create a texture. More documentation is provided on each method itself.

Implementations

Set the texture data of the texture.

See Render::create_texture for an example.

Set the width and height of the texture’s description.

For valid texture dimensions, width * height * TextureFormat::bytes_per_pixel should be equal to the texture’s buffer length.

See Render::create_texture for an example.

Set the format of the texture’s description.

For a valid texture format, TextureFormat::bytes_per_pixel * the texture dimensions’ width * height should be equal to the texture’s buffer length.

See Render::create_texture for an example.

Set the name of the texture.

Although optional, setting the name of a texture is highly recommended as it improves the debugging experience significantly.

The default is “unnamed”.

Build the texture.

See Render::create_texture for an example.

Errors

Returns an Error::InvalidArguments if the texture buffer’s length doesn’t match up against the texture’s dimensions and TextureFormat or if the texture dimensions have values lower or equal to 0.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.