45 unsigned int xsize, ysize;
47 unsigned char *pixbuf;
50 G_warning(
_(
"Unable to get image of current GL screen"));
54 if (
NULL == (fp = fopen(name,
"w"))) {
55 G_warning(
_(
"Unable to open file <%s> for writing"), name);
59 fprintf(fp,
"P6\n%d %d\n255\n", xsize, ysize);
61 for (y = ysize - 1; y >= 0; y--) {
62 for (x = 0; x < xsize; x++) {
63 unsigned char r = pixbuf[(y * xsize +
x) * 4 + 0];
64 unsigned char g = pixbuf[(y * xsize +
x) * 4 + 1];
65 unsigned char b = pixbuf[(y * xsize +
x) * 4 + 2];
93 unsigned char *pixbuf;
100 if (
NULL == (fp = fopen(name,
"w"))) {
101 G_warning(
_(
"Unable to open file <%s> for writing"), name);
105 fprintf(fp,
"P6\n%d %d\n255\n", xsize, ysize);
107 for (y = ysize - 1; y >= 0; y--) {
108 for (x = 0; x < xsize; x++) {
109 unsigned char r = pixbuf[(y * xsize +
x) * 4 + 0];
110 unsigned char g = pixbuf[(y * xsize +
x) * 4 + 1];
111 unsigned char b = pixbuf[(y * xsize +
x) * 4 + 2];
void G_free(void *)
Free allocated memory.
int gsd_getimage(unsigned char **, unsigned int *, unsigned int *)
Get image of current GL screen.
int GS_write_zoom(const char *name, unsigned int xsize, unsigned int ysize)
Write zoom to file.
void G_warning(const char *,...) __attribute__((format(printf
int GS_write_ppm(const char *name)
Save current GL screen to ppm file.
int gsd_writeView(unsigned char **, unsigned int, unsigned int)
Write view.