Skip to main content

TextUpload

Trait TextUpload 

Source
pub trait TextUpload {
    // Required method
    fn upload_text(
        &self,
        size: RenderSize,
        rgba8: &[u8],
    ) -> Result<TextPixels, RenderError>;
}
Expand description

Where TextTextures keeps the pixels of a rasterized text: the GPU renderer uploads them to a texture, the CPU renderer keeps them.

Required Methods§

Source

fn upload_text( &self, size: RenderSize, rgba8: &[u8], ) -> Result<TextPixels, RenderError>

Takes rgba8, premultiplied sRGB-encoded RGBA of size with rows packed, as the renderer’s source for that text.

§Errors

Returns RenderError::InvalidImageData when rgba8 does not hold size, or the GPU’s upload failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TextUpload for CpuRenderer

Source§

fn upload_text( &self, size: RenderSize, rgba8: &[u8], ) -> Result<TextPixels, RenderError>

Source§

impl TextUpload for Renderer

Source§

fn upload_text( &self, size: RenderSize, rgba8: &[u8], ) -> Result<TextPixels, RenderError>

Implementors§