From e9e9684117719204929821028ba9dbb7915ea119 Mon Sep 17 00:00:00 2001 From: kraxel Date: Sun, 28 Mar 2004 11:31:57 +0000 Subject: Initial revision --- wr/write-ppm.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 wr/write-ppm.c (limited to 'wr/write-ppm.c') diff --git a/wr/write-ppm.c b/wr/write-ppm.c new file mode 100644 index 0000000..d16035b --- /dev/null +++ b/wr/write-ppm.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "readers.h" +#include "writers.h" +#include "viewer.h" + +/* ---------------------------------------------------------------------- */ +/* save */ + +static int +ppm_write(FILE *fp, struct ida_image *img) +{ + fprintf(fp,"P6\n" + "# written by ida " VERSION "\n" + "# http://bytesex.org/ida/\n" + "%d %d\n255\n", + img->i.width,img->i.height); + fwrite(img->data, img->i.height, 3*img->i.width, fp); + return 0; +} + +static struct ida_writer ppm_writer = { + label: "PPM", + ext: { "ppm", NULL}, + write: ppm_write, +}; + +static void __init init_wr(void) +{ + write_register(&ppm_writer); +} -- cgit