From a38f4a8c72db6b1acdd5cf5c5e54592dd12188aa Mon Sep 17 00:00:00 2001 From: tth Date: Sat, 20 Feb 2021 03:31:09 +0100 Subject: [PATCH] preparing BMP export --- floatimg.h | 5 ++++- funcs/Makefile | 3 +++ funcs/exporter.c | 4 ++++ funcs/fimg-bmp.c | 21 +++++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 funcs/fimg-bmp.c diff --git a/floatimg.h b/floatimg.h index 9d35c96c..4b0acbc5 100644 --- a/floatimg.h +++ b/floatimg.h @@ -3,7 +3,7 @@ * ugly code from tTh */ -#define FIMG_VERSION 117 +#define FIMG_VERSION 118 /* * in memory descriptor @@ -40,6 +40,7 @@ typedef struct { #define FILE_TYPE_TGA 4 #define FILE_TYPE_TIFF 5 #define FILE_TYPE_FITS 6 +#define FILE_TYPE_BMP 7 /* lib/contrast.c */ #define CONTRAST_NONE 0 @@ -182,6 +183,8 @@ int fimg_load_from_png(char *filename, FloatImg *fimg); int fimg_create_from_png(char *filename, FloatImg *fimg); int fimg_save_as_png(FloatImg *src, char *outname, int flags); +int fimg_save_as_bmp(FloatImg *src, char *outname, int flags); + int fimg_test_pattern(FloatImg *fimg, int type, double dval); int fimg_draw_something(FloatImg *fimg); diff --git a/funcs/Makefile b/funcs/Makefile index 8b29ebcc..c80ebcbe 100644 --- a/funcs/Makefile +++ b/funcs/Makefile @@ -35,6 +35,9 @@ displacement.o: displacement.c $(DEPS) fimg-png.o: fimg-png.c $(DEPS) gcc $(COPT) -c $< +fimg-bmp.o: fimg-bmp.c $(DEPS) + gcc $(COPT) -c $< + fimg-tiff.o: fimg-tiff.c $(DEPS) gcc $(COPT) -c $< diff --git a/funcs/exporter.c b/funcs/exporter.c index 26f3b13e..3e8340c4 100644 --- a/funcs/exporter.c +++ b/funcs/exporter.c @@ -57,6 +57,10 @@ switch(filetype) { foo = fimg_save_R_as_fits(pic, fname, 0); break; + case FILE_TYPE_BMP: + fprintf(stderr, "%s: file type BMP not implemented\n", __func__); + foo = -666; + default: foo = -1789; break; diff --git a/funcs/fimg-bmp.c b/funcs/fimg-bmp.c new file mode 100644 index 00000000..3959c820 --- /dev/null +++ b/funcs/fimg-bmp.c @@ -0,0 +1,21 @@ +/* + * Lecture/ecriture des images BMP + * ------------------------------- + */ + +#include +#include +#include + +#include "../floatimg.h" + +extern int verbosity; + +/* --------------------------------------------------------------------- */ +int fimg_save_as_bmp(FloatImg *src, char *outname, int flags) +{ + + +return -2; +} +/* --------------------------------------------------------------------- */