Struct ark_api::render::TextureBuilder
source · 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§
source§impl<'a> TextureBuilder<'a>
impl<'a> TextureBuilder<'a>
sourcepub fn data(&mut self, buffer: &'a [u8]) -> &mut Self
pub fn data(&mut self, buffer: &'a [u8]) -> &mut Self
Set the texture data of the texture.
See Render::create_texture for an example.
sourcepub fn dimensions(&mut self, width: usize, height: usize) -> &mut Self
pub fn dimensions(&mut self, width: usize, height: usize) -> &mut Self
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.
sourcepub fn format(&mut self, format: TextureFormat) -> &mut Self
pub fn format(&mut self, format: TextureFormat) -> &mut Self
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.
sourcepub fn name(&mut self, name: &'a str) -> &mut Self
pub fn name(&mut self, name: &'a str) -> &mut Self
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”.
sourcepub fn build(&self) -> Result<Texture, Error>
pub fn build(&self) -> Result<Texture, Error>
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§
source§impl<'a> Clone for TextureBuilder<'a>
impl<'a> Clone for TextureBuilder<'a>
source§fn clone(&self) -> TextureBuilder<'a>
fn clone(&self) -> TextureBuilder<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more