Compare commits

...

2 Commits

Author SHA1 Message Date
tth 5c9f76c749 boilerplate 2021-03-30 21:22:04 +02:00
tth 154bf0e188 a small debug func 2021-03-30 19:48:55 +02:00
7 changed files with 63 additions and 13 deletions

View File

@ -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

View File

@ -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__,

View File

@ -4,6 +4,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#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__);

View File

@ -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);

View File

@ -1,6 +0,0 @@
/*
* PLASMA !!!
*/
#include <stdio.h>

View File

@ -4,7 +4,7 @@
* http://la.buvette.org/photos/cumul
*/
#define FIMG_VERSION 127
#define FIMG_VERSION 128
/*
* in memory descriptor
@ -15,9 +15,7 @@ typedef struct {
int type;
float fval;
int count;
float *R, *G, *B, *A;
int reserved;
} FloatImg;
@ -64,6 +62,7 @@ int fimg_type_is_valid(int type);
int fimg_print_version(int k);
void fimg_print_sizeof(void);
void fimg_printhead(FloatImg *h);
void fimg_printdims(char *txt, FloatImg *pi);
int fimg_describe(FloatImg *head, char *txt);
char *fimg_str_type(int type);
int fimg_plot_rgb (FloatImg *head, int x, int y,

View File

@ -57,6 +57,11 @@ fprintf(stderr, " sz filehead = %lu\n", sizeof(FimgFileHead));
fprintf(stderr, " sz filter = %lu\n", sizeof(FimgFilter3x3));
}
/* --------------------------------------------------------------------- */
void fimg_printdims(char *txt, FloatImg *pi)
{
fprintf(stderr, "# %s %dx%d\n", txt, pi->width, pi->height);
}
/* --------------------------------------------------------------------- */
void fimg_printhead(FloatImg *h)
{
printf("%5d %5d %2d %p %p %p %p\n", h->width, h->height, h->type,