MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / render_tinyvg_texture

Function render_tinyvg_texture

src/renderer.rs:945–958  ·  view source on GitHub ↗
(
    tvg_data: &[u8],
    dest_width: f32,
    dest_height: f32,
    clip: &Option<(i32, i32, i32, i32)>,
)

Source from the content-addressed store, hash-verified

943/// Decodes from raw bytes, then delegates to `render_tinyvg_image`.
944#[cfg(feature = "tinyvg")]
945fn render_tinyvg_texture(
946 tvg_data: &[u8],
947 dest_width: f32,
948 dest_height: f32,
949 clip: &Option<(i32, i32, i32, i32)>,
950) -> Option<RenderTarget> {
951 use tinyvg::Decoder;
952 let decoder = Decoder::new(std::io::Cursor::new(tvg_data));
953 let image = match decoder.decode() {
954 Ok(img) => img,
955 Err(_) => return None,
956 };
957 render_tinyvg_image(&image, dest_width, dest_height, clip)
958}
959
960/// Render a decoded `tinyvg::format::Image` to a RenderTarget, scaled to fit the given dimensions.
961#[cfg(feature = "tinyvg")]

Callers 1

renderFunction · 0.85

Calls 1

render_tinyvg_imageFunction · 0.85

Tested by

no test coverage detected