MCPcopy Create free account
hub / github.com/cococry/leif / lf_load_texture_data_resized

Function lf_load_texture_data_resized

leif.c:2089–2096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2087}
2088
2089unsigned char* lf_load_texture_data_resized(const char* filepath, int32_t w, int32_t h, int32_t* channels, bool flip) {
2090 int32_t width, height;
2091 stbi_uc* data = lf_load_texture_data(filepath, &width, &height, channels, flip);
2092 unsigned char* downscaled_image = (unsigned char*)malloc(sizeof(unsigned char) * w * h * *channels);
2093 stbir_resize_uint8_linear(data, width, height, *channels, downscaled_image, w, h, 0,(stbir_pixel_layout)*channels);
2094 stbi_image_free(data);
2095 return downscaled_image;
2096}
2097
2098unsigned char* lf_load_texture_data_resized_factor(const char* filepath, int32_t wfactor, int32_t hfactor, int32_t* width, int32_t* height, int32_t* channels, bool flip) {
2099 unsigned char* image = stbi_load(filepath, width, height, channels, STBI_rgb_alpha);

Callers

nothing calls this directly

Calls 1

lf_load_texture_dataFunction · 0.85

Tested by

no test coverage detected