diff --git a/experiment/Makefile b/experiment/Makefile index 68b0e82..bcaa853 100644 --- a/experiment/Makefile +++ b/experiment/Makefile @@ -2,7 +2,7 @@ #  experiments -COPT = -Wall -fpic -g -DDEBUG_LEVEL=0 -lm +COPT = -Wall -fpic -g -DDEBUG_LEVEL=1 -lm DEPS = ../floatimg.h ../libfloatimg.a Makefile LIBS = -ltiff -lpnglite -lcfitsio diff --git a/experiment/assemblage.c b/experiment/assemblage.c index 6cca803..d6ac38d 100644 --- a/experiment/assemblage.c +++ b/experiment/assemblage.c @@ -12,6 +12,12 @@ int verbosity; /* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */ +/* + * le prototype de base avec trop peu de parametres, mais + * c'est assez dur de formaliser la structure des informations + * a transmettre de fonction en fonction, et commant on peut + * integrer cette mecanique dans singlepass.c ?!#@ + */ int premier_essai(int largeur, int hauteur, char *outname) { FloatImg grande, incrust; @@ -36,12 +42,15 @@ if (foo) { return -1; } -foo = incrustator_0(&incrust, &grande, 333, 333, 0); +#define FLAGS 0 +foo = incrustator_0(&incrust, &grande, 111, 111, FLAGS); +#undef FLAGS if (foo) { - fprintf(stderr, "%s: Kkrkr %d sur incrustator_0\n", __func__, foo); + fprintf(stderr, "%s: err %d sur incrustator_0\n", __func__, foo); return -1; } + foo = fimg_export_picture(&grande, outname, 0); if (foo) { fprintf(stderr, "%s: error %d export '%s'\n", __func__, diff --git a/experiment/incrustator.c b/experiment/incrustator.c index eed2e45..096e33c 100644 --- a/experiment/incrustator.c +++ b/experiment/incrustator.c @@ -4,6 +4,7 @@ #include #include +#include #include "../floatimg.h" @@ -11,11 +12,44 @@ extern int verbosity; +/* ---------------------------------------------------------------- */ +static int check_boundaries(FloatImg *from, FloatImg *to, FimgArea51 *a51) +{ + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, from, to, a51); +fimg_printdims("from", from); +fimg_printdims("to ", to); +#endif + +/* just a small molly-guard */ +if ( (a51->w < 0) || (a51->h < 0) ) { + fprintf(stderr, "%s: fubar on %p\n", __func__, a51); + abort(); /* FY Bro ! */ + } + +return -1; +} +/* ---------------------------------------------------------------- */ +static int move_pixels(FloatImg *from, FloatImg *to, + FimgArea51 *a51, int flags) +{ + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__, + from, to, a51, flags); +#endif + +return -1; +} /* ---------------------------------------------------------------- */ int incrustator_0(FloatImg *psrc, FloatImg *pdst, int xpos, int ypos, int flags) { -int y, srcpos, dstpos, szl; +int y, srcpos, dstpos, szl; +int foo; + +FimgArea51 area; #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %p %p %d %d 0x%04X\n", __func__, psrc, pdst, @@ -28,6 +62,10 @@ if (verbosity > 1) { } /* check boudaries */ +area.x = xpos; area.y = ypos; +area.w = psrc->width; area.h = psrc->height; +foo = check_boundaries(psrc, pdst, &area); + if ( (xpos < 0) || (xpos > pdst->width - psrc->width) || (ypos < 0) || (ypos > pdst->height - psrc->height) ) { fprintf(stderr, "%s: boudary error\n", __func__); diff --git a/experiment/incrustator.h b/experiment/incrustator.h index 9cd2b88..1e75cd6 100644 --- a/experiment/incrustator.h +++ b/experiment/incrustator.h @@ -2,6 +2,11 @@ * incrustator experimental */ +typedef struct { + int w, h; + int x, y; + unsigned long magic; + } FimgArea51; int incrustator_0(FloatImg *psrc, FloatImg *pdst, int xpos, int ypos, int flags); diff --git a/experiment/plasma314.c b/experiment/plasma314.c deleted file mode 100644 index 83f9df3..0000000 --- a/experiment/plasma314.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * PLASMA !!! - */ - -#include -