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"))) {
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];
92 unsigned char *pixbuf;
99 if (
NULL == (fp = fopen(
name,
"w"))) {
104 fprintf(fp,
"P6\n%d %d\n255\n", xsize, ysize);
106 for (y = ysize - 1; y >= 0; y--) {
107 for (
x = 0;
x < xsize;
x++) {
108 unsigned char r = pixbuf[(y * xsize +
x) * 4 + 0];
109 unsigned char g = pixbuf[(y * xsize +
x) * 4 + 1];
110 unsigned char b = pixbuf[(y * xsize +
x) * 4 + 2];
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
int gsd_writeView(unsigned char **, unsigned int, unsigned int)
Write view.
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.
int GS_write_ppm(const char *name)
Save current GL screen to ppm file.