* Convert RGB colours to Greyscale using 29.9% Red, 58.7% Green, 11.4% Blue * (average luminosity formula, NTSC Colour Space) */
| 67 | * (average luminosity formula, NTSC Colour Space) |
| 68 | */ |
| 69 | static inline uint8_t RGBToGreyscale(uint8_t red, uint8_t green, uint8_t blue) |
| 70 | { |
| 71 | /* To avoid doubles and stuff, multiply it with a total of 65536 (16bits), then |
| 72 | * divide by it to normalize the value to a byte again. */ |
| 73 | return ((red * 19595) + (green * 38470) + (blue * 7471)) / 65536; |
| 74 | } |
| 75 | |
| 76 | |
| 77 | #ifdef WITH_PNG |
no outgoing calls
no test coverage detected