refactoring fonderie, step 1

This commit is contained in:
2020-11-02 14:51:48 +01:00
parent d50f2145ba
commit 8cc7695d70
7 changed files with 143 additions and 166 deletions

View File

@@ -12,9 +12,7 @@
#include "fonctions.h"
#include "crapulator.h"
int verbosity;
int convert_to_gray;
/* -------------------------------------------------------------- */
@@ -27,17 +25,16 @@ char ligne[200];
/* here, we put the picz in the fifo machinery */
foo = insert_picture(image);
if (foo) {
fprintf(stderr, "%s : err %d on insert\n", __func__, foo);
fprintf(stderr, "%s: err %d on insert\n", __func__, foo);
return foo;
}
sprintf(ligne, "p8/%05d.png", numero);
foo = export_fifo(ligne, proc, step);
if (foo) {
fprintf(stderr, "%s : err %d on export\n", __func__, foo);
fprintf(stderr, "%s: err %d on export\n", __func__, foo);
return foo;
}
numero++; /* VERY IMPORTANT :) */
return 0;
@@ -67,7 +64,7 @@ puts("");
return 0;
}
/* -------------------------------------------------------------- */
#define BLANK 30
#define BLANK 40
int demarre_la_machine(char *pattern, char *outdir, int szfifo,
int outfx, int step)
@@ -110,7 +107,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
/* first step : read the current grabed picz from disk,
and put it in our private buffer */
foo = fimg_load_from_dump(cptr, &input);
if (foo) {
fprintf(stderr, "load #%d from dump -> %d\n", idx, foo);
continue;
@@ -118,8 +114,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
/* ========================= */
/* FSCKING INPUT FILTER HERE */
foo = crapulator(&input, idx);
foo = crapulator(&input, 0, 0.42);
if (foo) {
fprintf(stderr, "%s crapulator -> %d\n", __func__, foo);
exit(1);
@@ -148,26 +143,41 @@ else {
return 8;
}
/* -------------------------------------------------------------- */
void help(void)
{
puts("\tFONDERIE\noptions:");
puts("\t-g\tconvert to gray");
puts("\t-I\tinput glob pattern");
puts("\t-O\toutput directory");
puts("\t-T\tfifo size");
puts("\t-v\tincrease verbosity");
puts("\t-x\toutput effect");
exit(0);
}
/* -------------------------------------------------------------- */
int main (int argc, char *argv[])
{
int foo, opt;
int fifosize = 10;
char *in_pattern = "capture/?????.fimg";
char *out_dir = "p8";
int in_effect = 0;
int out_effect = 0;
int steps = 1;
// float maxlevel = 2500.0;
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", argv[0],
__DATE__, __TIME__);
fimg_print_version(2);
while ((opt = getopt(argc, argv, "gI:O:s:T:vx:")) != -1) {
while ((opt = getopt(argc, argv, "ghI:O:s:T:vx:")) != -1) {
switch(opt) {
case 'g': convert_to_gray = 1;
break;
case 'h': help();
break;
case 'I': in_pattern = optarg;
break;
case 'O': out_dir = optarg;