MCPcopy Create free account
hub / github.com/creatale/node-dv / checkColorValidity

Function checkColorValidity

deps/lodepng/lodepng.cpp:2556–2568  ·  view source on GitHub ↗

return type is a LodePNG error code*/

Source from the content-addressed store, hash-verified

2554
2555/*return type is a LodePNG error code*/
2556static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd = bitdepth*/
2557{
2558 switch(colortype)
2559 {
2560 case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/
2561 case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/
2562 case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/
2563 case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/
2564 case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/
2565 default: return 31;
2566 }
2567 return 0; /*allowed color type / bits combination*/
2568}
2569
2570static unsigned getNumColorChannels(LodePNGColorType colortype)
2571{

Callers 2

lodepng_inspectFunction · 0.85
lodepng_encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected