two new operators (mini & maxi)

This commit is contained in:
2019-11-20 11:12:16 +01:00
parent ca4bfcff05
commit b62b5a4805
6 changed files with 83 additions and 10 deletions

View File

@@ -16,6 +16,8 @@ float global_fvalue;
#define OP_SUB 2
#define OP_MIX 3
#define OP_MUL 4
#define OP_MINI 5
#define OP_MAXI 6
typedef struct {
int code;
char *op;
@@ -26,6 +28,8 @@ Opcode opcodes[] = {
{ OP_SUB, "sub" },
{ OP_MIX, "mix" },
{ OP_MUL, "mul" },
{ OP_MINI, "mini" },
{ OP_MAXI, "maxi" },
{ 0, NULL }
};
static void pr_opcodes(void)
@@ -57,11 +61,11 @@ 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");
pr_opcodes();
if (verbosity) fimg_print_version(1);
exit(0);
}
@@ -83,6 +87,10 @@ switch (action) {
break;
case OP_MUL:
foo = fimg_add(A, B, D); break;
case OP_MINI:
foo = fimg_maximum(A, B, D); break;
case OP_MAXI:
foo = fimg_minimum(A, B, D); break;
default:
foo = -99; break;
@@ -125,7 +133,7 @@ if (action < 0) {
}
/*
* load the two source files, and check comatibility
* load the two source files, and check compatibility
*/
if ((foo=fimg_create_from_dump(argv[optind], &srcA))) {
fprintf(stderr, "read error on '%s' is %d\n", argv[optind], foo);