| 1 |
greg |
3.1 |
#ifndef lint
|
| 2 |
greg |
3.2 |
static const char RCSid[] = "$Id: hexbit.c,v 3.1 2003/02/22 02:07:27 greg Exp $";
|
| 3 |
greg |
3.1 |
#endif
|
| 4 |
|
|
/*
|
| 5 |
|
|
* Convert from Radiance picture to bitmap usable by hexbit4x1.fnt
|
| 6 |
|
|
*
|
| 7 |
|
|
* pipe input from "pvalue -h -b -di [picture]"
|
| 8 |
|
|
*/
|
| 9 |
|
|
|
| 10 |
|
|
#include <stdio.h>
|
| 11 |
|
|
|
| 12 |
|
|
main()
|
| 13 |
|
|
{
|
| 14 |
|
|
int xres, yres;
|
| 15 |
|
|
int i, j, i1,i2,i3,i4;
|
| 16 |
|
|
|
| 17 |
|
|
if (scanf("-Y %d +X %d\n", &yres, &xres) != 2)
|
| 18 |
|
|
exit(1);
|
| 19 |
|
|
for (i = 0; i < yres; i++) {
|
| 20 |
|
|
for (j = 0; j < xres/4; j++) {
|
| 21 |
|
|
if (scanf("%d\n%d\n%d\n%d\n", &i1, &i2, &i3, &i4) != 4)
|
| 22 |
|
|
exit(1);
|
| 23 |
|
|
printf("%01X", (i1<128)<<3|(i2<128)<<2|(i3<128)<<1|(i4<128));
|
| 24 |
|
|
}
|
| 25 |
|
|
for (j = xres%4; j--; ) /* should get it, but too lazy */
|
| 26 |
|
|
scanf("%*d\n");
|
| 27 |
|
|
putchar('\n');
|
| 28 |
|
|
}
|
| 29 |
|
|
exit(0);
|
| 30 |
|
|
}
|