| 79 | } |
| 80 | |
| 81 | static int |
| 82 | nearest(const RGB *c, const RGB *pal, int n) |
| 83 | { |
| 84 | int best = 0, bestd = 0x7fffffff, i; |
| 85 | for (i = 0; i < n; i++) { |
| 86 | int d = coldist(c, &pal[i]); |
| 87 | if (d < bestd) { bestd = d; best = i; } |
| 88 | } |
| 89 | return best; |
| 90 | } |
| 91 | |
| 92 | /* --------------------------------------------------------- */ |
| 93 | /* IFF output */ |
no test coverage detected