boilerplate

This commit is contained in:
tth 2021-03-30 21:22:04 +02:00
parent 154bf0e188
commit 5c9f76c749
5 changed files with 56 additions and 10 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>