MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / load_image

Method load_image

native/shared/src/textures.rs:90–100  ·  view source on GitHub ↗
(&mut self, file_data: &[u8])

Source from the content-addressed store, hash-verified

88 }
89
90 pub fn load_image(&mut self, file_data: &[u8]) -> f64 {
91 let img = match image::load_from_memory(file_data) {
92 Ok(img) => img.to_rgba8(),
93 Err(_) => return 0.0,
94 };
95 let width = img.width();
96 let height = img.height();
97 let data = img.into_raw();
98
99 self.images.alloc(ImageData { data, width, height })
100 }
101
102 pub fn image_resize(&mut self, handle: f64, new_w: u32, new_h: u32) {
103 if let Some(img_data) = self.images.get_mut(handle) {

Callers 7

bloom_load_imageFunction · 0.80
bloom_load_imageFunction · 0.80
bloom_load_imageFunction · 0.80
bloom_load_imageFunction · 0.80
bloom_load_imageFunction · 0.80
bloom_load_image_bytesFunction · 0.80
bloom_load_imageFunction · 0.80

Calls 3

allocMethod · 0.80
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected