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
sourceimpl<'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
sourceimpl<'a> Clone for TextureBuilder<'a>
impl<'a> Clone for TextureBuilder<'a>
sourcefn clone(&self) -> TextureBuilder<'a>
fn clone(&self) -> TextureBuilder<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Default for TextureBuilder<'a>
impl<'a> Default for TextureBuilder<'a>
sourcefn default() -> TextureBuilder<'a>
fn default() -> TextureBuilder<'a>
Returns the “default value” for a type. Read more
impl<'a> Copy for TextureBuilder<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for TextureBuilder<'a>
impl<'a> Send for TextureBuilder<'a>
impl<'a> Sync for TextureBuilder<'a>
impl<'a> Unpin for TextureBuilder<'a>
impl<'a> UnwindSafe for TextureBuilder<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more