29 #include <grass/gis.h>
30 #include <grass/glocale.h>
31 #include <grass/ogsf_proto.h>
32 #include <grass/gstypes.h>
46 unsigned int xsize, ysize;
48 unsigned char *pixbuf;
52 if (
NULL == (fp = fopen(name,
"w"))) {
53 G_warning(_(
"Unable to open file <%s> for writing"), name);
57 fprintf(fp,
"P6 %d %d 255\n", xsize, ysize);
59 for (y = ysize - 1; y >= 0; y--) {
60 for (x = 0; x < xsize; x++) {
61 unsigned char r = pixbuf[(y * xsize + x) * 4 + 0];
62 unsigned char g = pixbuf[(y * xsize + x) * 4 + 1];
63 unsigned char b = pixbuf[(y * xsize + x) * 4 + 2];
91 unsigned char *pixbuf;
95 if (
NULL == (fp = fopen(name,
"w"))) {
96 G_warning(_(
"Unable to open file <%s> for writing"), name);
100 fprintf(fp,
"P6 %d %d 255\n", xsize, ysize);
102 for (y = ysize - 1; y >= 0; y--) {
103 for (x = 0; x < xsize; x++) {
104 unsigned char r = pixbuf[(y * xsize + x) * 4 + 0];
105 unsigned char g = pixbuf[(y * xsize + x) * 4 + 1];
106 unsigned char b = pixbuf[(y * xsize + x) * 4 + 2];
void G_free(void *buf)
Free allocated memory.
int GS_write_zoom(const char *name, unsigned int xsize, unsigned int ysize)
Write zoom to file.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int GS_write_ppm(const char *name)
Save current GL screen to ppm file.
int gsd_getimage(unsigned char **pixbuf, unsigned int *xsize, unsigned int *ysize)
Get image of current GL screen.
int gsd_writeView(unsigned char **pixbuf, unsigned int xsize, unsigned int ysize)
Write view.