Compare commits

..

No commits in common. "090a7719713ebe542d8ed0838b4dc367eec4e0c2" and "8990d1f9a9ce7bd2be93a63b56f42ee74e14d264" have entirely different histories.

3 changed files with 8 additions and 34 deletions

View File

@ -295,21 +295,10 @@ usage : fimgstats [options] file.fimg
Operations diverses sur ou entre des images.
\begin{verbatim}
usage:
Usage:
fimgops [options] A.fimg B.fimg operator D.fimg
operators:
add 1
sub 2
mix 3
mul 4
options:
-g convert output to gray
-k N.N set float value
-v increase verbosity
\end{verbatim}
Pour l'operateur \texttt{mix}, le paramêtre flottant doit
être fourni en utilisant l'option \texttt{-k}.
\subsection{fimg2png, fimg2pnm, fimg2tiff}
\index{fimg2png}\label{fimg2png}

View File

@ -7,14 +7,9 @@
int verbosity;
/* --------------------------------------------------------------------- */
float global_fvalue;
/* --------------------------------------------------------------------- */
#define OP_ADD 1
#define OP_SUB 2
#define OP_MIX 3
#define OP_MUL 4
typedef struct {
int code;
@ -24,7 +19,6 @@ typedef struct {
Opcode opcodes[] = {
{ OP_ADD, "add" },
{ OP_SUB, "sub" },
{ OP_MIX, "mix" },
{ OP_MUL, "mul" },
{ 0, NULL }
};
@ -33,7 +27,7 @@ static void pr_opcodes(void)
Opcode *optr;
puts("operators:");
for (optr = opcodes; optr->code; optr++) {
printf("\t%-15s %d\n", optr->op, optr->code);
printf("\t%-20s %d\n", optr->op, optr->code);
}
}
static int look_opcode(char *txt)
@ -58,10 +52,6 @@ static void help(int lj)
puts("usage:\n\tfimgops [options] A.fimg B.fimg operator D.fimg");
pr_opcodes();
puts("options:");
puts("\t-g convert output to gray");
puts("\t-k N.N set float value");
puts("\t-v increase verbosity");
if (verbosity) fimg_print_version(1);
exit(0);
}
@ -76,11 +66,6 @@ switch (action) {
foo = fimg_add(A, B, D); break;
case OP_SUB:
foo = fimg_sub(A, B, D); break;
case OP_MIX:
if (verbosity) fprintf(stderr, "fvalue is %f\n",
global_fvalue);
foo = fimg_interpolate(A, B, D, global_fvalue);
break;
case OP_MUL:
foo = fimg_add(A, B, D); break;
default:
@ -94,6 +79,7 @@ return foo;
int main(int argc, char *argv[])
{
int foo, opt, action;
float fvalue;
char *operator;
FloatImg srcA, srcB, dest;
@ -101,7 +87,7 @@ FloatImg srcA, srcB, dest;
while ((opt = getopt(argc, argv, "hk:v")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'k': global_fvalue = atof(optarg); break;
case 'k': fvalue = atof(optarg); break;
case 'v': verbosity++; break;
}
}
@ -155,8 +141,7 @@ foo = fimg_create(&dest, srcA.width, srcA.height, srcA.type);
foo = exec_operator(&srcA, &srcB, action, &dest);
if (foo) {
fprintf(stderr, "operator '%s' exec give us a %d\n",
operator, foo);
fprintf(stderr, "operator exec give us a %d\n", foo);
}
foo = fimg_dump_to_file(&dest, argv[optind+3], 0);

View File

@ -19,7 +19,7 @@ int foo;
if (3 != argc) {
fimg_print_version(1);
fprintf(stderr, "usage:\n\t%s foo.png bar.png\n", argv[0]);
fprintf(stderr, "usage:\n\t%s foo.fimg bar.png\n", argv[0]);
exit(1);
}
@ -33,8 +33,8 @@ if (foo) {
fimg_describe(&fimg, "oups");
foo = fimg_dump_to_file(&fimg, argv[2], 0);
fprintf(stderr, "save as fimg -> %d\n", foo);
foo = fimg_save_as_pnm(&fimg, "t.pnm", 0);
fprintf(stderr, "save as pnm -> %d\n", foo);
return 0;
}