(
tvg_data: &[u8],
dest_width: f32,
dest_height: f32,
clip: &Option<(i32, i32, i32, i32)>,
)
| 943 | /// Decodes from raw bytes, then delegates to `render_tinyvg_image`. |
| 944 | #[cfg(feature = "tinyvg")] |
| 945 | fn 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")] |
no test coverage detected