return type is a LodePNG error code*/
| 2487 | |
| 2488 | /*return type is a LodePNG error code*/ |
| 2489 | static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd = bitdepth*/ |
| 2490 | { |
| 2491 | switch(colortype) |
| 2492 | { |
| 2493 | case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/ |
| 2494 | case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/ |
| 2495 | case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/ |
| 2496 | case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/ |
| 2497 | case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/ |
| 2498 | default: return 31; |
| 2499 | } |
| 2500 | return 0; /*allowed color type / bits combination*/ |
| 2501 | } |
| 2502 | |
| 2503 | static unsigned getNumColorChannels(LodePNGColorType colortype) |
| 2504 | { |
no outgoing calls
no test coverage detected