2019-03-04 02:22:55 +11:00
|
|
|
/*
|
|
|
|
* floatimg.h
|
|
|
|
*/
|
|
|
|
|
2019-05-20 17:47:13 +11:00
|
|
|
#define FIMG_VERSION 60
|
2019-03-04 02:22:55 +11:00
|
|
|
|
|
|
|
/*
|
|
|
|
* in memory descriptor
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int type;
|
|
|
|
float fval;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
float *R, *G, *B, *A;
|
|
|
|
|
|
|
|
int reserved;
|
|
|
|
} FloatImg;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* fimg file header
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
// char magic[8];
|
|
|
|
int w, h, t;
|
|
|
|
} FimgFhead;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* core module
|
|
|
|
*/
|
|
|
|
int fimg_create(FloatImg *fimg, int w, int h, int t);
|
|
|
|
int fimg_destroy(FloatImg *fimg);
|
|
|
|
|
|
|
|
int fimg_print_version(int k);
|
|
|
|
void fimg_printhead(FloatImg *h);
|
|
|
|
int fimg_describe(FloatImg *head, char *txt);
|
|
|
|
int fimg_fileinfo(char *fname, int *datas);
|
|
|
|
int fimg_plot_rgb (FloatImg *head, int x, int y, float r, float g, float b);
|
|
|
|
int fimg_clear(FloatImg *fimg);
|
|
|
|
int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b);
|
|
|
|
|
|
|
|
/* PNM files module */
|
|
|
|
int fimg_save_as_pnm(FloatImg *head, char *fname, int notused);
|
|
|
|
|
|
|
|
double fimg_timer_set(int whot);
|
|
|
|
double fimg_timer_get(int whot);
|
|
|
|
|
|
|
|
|
|
|
|
/* FIMG files module */
|
|
|
|
int fimg_fileinfos(char *fname, int *datas);
|
|
|
|
int fimg_dump_to_file(FloatImg *head, char *fname, int notused);
|
|
|
|
int fimg_create_from_dump(char *fname, FloatImg *head);
|
|
|
|
|
|
|
|
/* mathematics oprations */
|
|
|
|
float fimg_get_maxvalue(FloatImg *head);
|
|
|
|
int fimg_meanvalues(FloatImg *head, float means[4]);
|
|
|
|
int fimg_to_gray(FloatImg *head);
|
|
|
|
void fimg_add_cste(FloatImg *fi, float value);
|
|
|
|
void fimg_drand48(FloatImg *fi, float kmul);
|
|
|
|
|
2019-05-20 17:47:13 +11:00
|
|
|
/* various funcs modules */
|
2019-03-04 02:22:55 +11:00
|
|
|
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_draw_something(FloatImg *fimg);
|
|
|
|
|
|
|
|
|
|
|
|
|