2019-03-03 16:22:55 +01:00
|
|
|
/*
|
|
|
|
* floatimg.h
|
|
|
|
*/
|
|
|
|
|
2019-09-03 19:35:45 +02:00
|
|
|
#define FIMG_VERSION 71
|
2019-03-03 16:22:55 +01: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 {
|
2019-07-08 06:28:04 +02:00
|
|
|
char magic[8];
|
2019-03-03 16:22:55 +01:00
|
|
|
int w, h, t;
|
2019-07-08 06:28:04 +02:00
|
|
|
} FimgFileHead;
|
2019-03-03 16:22:55 +01:00
|
|
|
|
2019-08-07 11:55:29 +02:00
|
|
|
|
|
|
|
#define FIMG_TYPE_GRAY 1
|
|
|
|
#define FIMG_TYPE_RGB 3
|
|
|
|
#define FIMG_TYPE_RGBA 4
|
|
|
|
|
2019-03-03 16:22:55 +01:00
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
|
2019-08-08 17:16:20 +02:00
|
|
|
/* 'operats' module */
|
|
|
|
int fimg_add(FloatImg *a, FloatImg *b, FloatImg *d);
|
|
|
|
int fimg_sub(FloatImg *a, FloatImg *b, FloatImg *d);
|
|
|
|
int fimg_mul(FloatImg *a, FloatImg *b, FloatImg *d);
|
|
|
|
|
2019-03-03 16:22:55 +01:00
|
|
|
/* PNM files module */
|
|
|
|
int fimg_save_as_pnm(FloatImg *head, char *fname, int notused);
|
2019-06-29 19:33:23 +02:00
|
|
|
int fimg_load_from_pnm(char *fname, FloatImg *head, int notused);
|
2019-03-03 16:22:55 +01:00
|
|
|
|
|
|
|
double fimg_timer_set(int whot);
|
|
|
|
double fimg_timer_get(int whot);
|
|
|
|
|
|
|
|
|
2019-08-24 13:06:51 +02:00
|
|
|
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
|
|
|
|
|
2019-03-03 16:22:55 +01:00
|
|
|
/* 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 08:47:13 +02:00
|
|
|
/* various funcs modules */
|
2019-03-03 16:22:55 +01: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);
|
|
|
|
|
2019-08-28 21:08:59 +02:00
|
|
|
int parse_WxH(char *str, int *pw, int *ph);
|
2019-03-03 16:22:55 +01:00
|
|
|
|
|
|
|
|