MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / stbi__tga_get_comp

Function stbi__tga_get_comp

lite/example/cpp_example/mge/cv/stb_image.h:6335–6356  ·  view source on GitHub ↗

returns STBI_rgb or whatever, 0 on error

Source from the content-addressed store, hash-verified

6333#ifndef STBI_NO_TGA
6334// returns STBI_rgb or whatever, 0 on error
6335static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16) {
6336 // only RGB or RGBA (incl. 16bit) or grey allowed
6337 if (is_rgb16)
6338 *is_rgb16 = 0;
6339 switch (bits_per_pixel) {
6340 case 8:
6341 return STBI_grey;
6342 case 16:
6343 if (is_grey)
6344 return STBI_grey_alpha;
6345 // fallthrough
6346 case 15:
6347 if (is_rgb16)
6348 *is_rgb16 = 1;
6349 return STBI_rgb;
6350 case 24: // fallthrough
6351 case 32:
6352 return bits_per_pixel / 8;
6353 default:
6354 return 0;
6355 }
6356}
6357
6358static int stbi__tga_info(stbi__context* s, int* x, int* y, int* comp) {
6359 int tga_w, tga_h, tga_comp, tga_image_type, tga_bits_per_pixel, tga_colormap_bpp;

Callers 2

stbi__tga_infoFunction · 0.85
stbi__tga_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected