FloatImg4PythonBinding/contrib/fimg2povhf.c

83 lines
1.7 KiB
C
Raw Normal View History

2022-01-08 17:48:18 +01:00
/*
* convertir une image flottante en champ d'altitude
*
* nouveau 64 ernest renan - 20220108
*/
#include <stdio.h>
#include <math.h>
#include "tthimage.h"
#include "floatimg.h"
int verbosity;
/* ------------------------------------------------------------------ */
int This_is_the_real_conversion(FloatImg *fimg, Image_Desc *hf, int k)
{
FloatImg mixed;
int foo;
float minmax[6];
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, fimg, hf, k);
#endif
foo = fimg_get_minmax_rgb(fimg, minmax);
fimg_print_minmax(minmax, "source");
return FULL_NUCKED;
}
/* ------------------------------------------------------------------ */
int Convertir_Fimg_to_Povhf(char *fimgname, char *hfname, int k)
{
FloatImg fimg;
Image_Desc *hf;
int wid, hei;
int foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %s %s %d )\n", __func__, fimgname, hfname, k);
#endif
foo = fimg_create_from_dump(fimgname, &fimg);
fprintf(stderr, "load of %s --> %d\n", fimgname, foo);
if (foo) {
return foo;
}
wid = fimg.width; hei = fimg.height; // nice alias
fprintf(stderr, "picture size %dx%d\n", wid, hei);
hf = Image_alloc(wid, hei, IMAGE_RGB);
fprintf(stderr, "hf alloc -> %p\n", hf);
if (NULL == hf) {
return NULL_POINTER;
}
foo = This_is_the_real_conversion(&fimg, hf, k);
fprintf(stderr, "real conversion -> %d\n", foo);
return FULL_NUCKED;
}
/* ------------------------------------------------------------------ */
int main(int argc, char *argv[])
{
int foo;
verbosity = 1;
Image_print_version(3);
fimg_print_version(3);
foo = Convertir_Fimg_to_Povhf("foo.fimg", "out.tga", 0);
fprintf(stderr, "retour conversion was %d\n", foo);
return 0;
}
/* ------------------------------------------------------------------ */