File: make_image.cc

package info (click to toggle)
gri 2.4.2-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,540 kB
  • ctags: 1,966
  • sloc: cpp: 32,542; lisp: 3,243; perl: 806; makefile: 548; sh: 253
file content (15 lines) | stat: -rw-r--r-- 396 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// make 8bit or 16bit data for testing gri

#include <stdio.h>
int main() 
{
    for (int i = 0; i < 5; i++) {
	for (int j = 0; j < 5; j++) {
	    unsigned short int v = (unsigned short int)((i + 2 * j) * 255.0 / 12.0);
	    //unsigned char v = (unsigned char)((i + 2 * j) * 255.0 / 12.0);
	    fwrite(&v, sizeof(v), 1, stdout);
	    fprintf(stderr, "%d ", v);
	}
	fprintf(stderr, "\n");
    }
}