Browse Source

integration of halfsizing

master
tth 3 years ago
parent
commit
23ce4cd337
  1. 2
      floatimg.h
  2. 5
      funcs/geometry.c
  3. 32
      funcs/t.c
  4. 7
      tools/fimgfx.c

2
floatimg.h

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
* floatimg.h
*/
#define FIMG_VERSION 90
#define FIMG_VERSION 91
/*
* in memory descriptor

5
funcs/geometry.c

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include "../floatimg.h"
@ -40,12 +41,12 @@ for (y=0; y<hd; y++) { @@ -40,12 +41,12 @@ for (y=0; y<hd; y++) {
for (x=0; x<wd; x++) {
foo = fimg_get_rgb(src, x*2, y*2, pixel);
if (foo) {
fprintf(stderr, "%s: err get %d\n", foo);
fprintf(stderr, "%s: err get %d\n", __func__, foo);
abort();
}
foo = fimg_plot_rgb(dst, x, y, pixel[0], pixel[1], pixel[2]);
if (foo) {
fprintf(stderr, "%s: err plot %d\n", foo);
fprintf(stderr, "%s: err plot %d\n", __func__, foo);
abort();
}
}

32
funcs/t.c

@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
int verbosity;
float global_fvalue;
/* --------------------------------------------------------------------- */
int essai_geometrie(char *infile)
{
@ -35,7 +37,7 @@ if (foo) { @@ -35,7 +37,7 @@ if (foo) {
return -2;
}
fimg_describe(&result, "result after halfsize");
if (verbosity) fimg_describe(&result, "result after halfsize");
foo = fimg_save_as_pnm(&result, "something.pnm", 0);
@ -57,12 +59,23 @@ else { @@ -57,12 +59,23 @@ else {
}
foo = fimg_save_as_pnm(&fimg, "something.pnm", 0);
if (foo) {
fprintf(stderr, "%s: err save %d\n", __func__, foo);
return -6;
}
foo = fimg_killcolors_a(&fimg, 0.0);
foo = fimg_save_as_pnm(&fimg, "colorskilled-a.pnm", 0);
if (foo) {
fprintf(stderr, "%s: err save %d\n", __func__, foo);
return -6;
}
foo = fimg_killcolors_b(&fimg, 0.0);
foo = fimg_save_as_pnm(&fimg, "colorskilled-b.pnm", 0);
if (foo) {
fprintf(stderr, "%s: err save %d\n", __func__, foo);
return -6;
}
return 0;
@ -159,11 +172,24 @@ return 0; @@ -159,11 +172,24 @@ return 0;
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo;
int foo, opt;
puts("++++++++++++++++++++++++++++++++");
global_fvalue = 1.0;
while ((opt = getopt(argc, argv, "hk:v")) != -1) {
switch(opt) {
// case 'h': help(0); break;
case 'k': global_fvalue = atof(optarg); break;
case 'v': verbosity++; break;
}
}
foo = essai_geometrie("foo.fimg");
if (foo) {
fprintf(stderr, "************ %d\n", foo);
}
return 0;
}

7
tools/fimgfx.c

@ -19,7 +19,7 @@ typedef struct { @@ -19,7 +19,7 @@ typedef struct {
int nbarg;
} Fx;
enum fxid { Fx_cos01, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0 };
enum fxid { Fx_cos01, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0 };
Fx fx_list[] = {
{ "cos01", Fx_cos01, 0 },
@ -27,6 +27,7 @@ Fx fx_list[] = { @@ -27,6 +27,7 @@ Fx fx_list[] = {
{ "pow2", Fx_pow2, 0 },
{ "sqrt", Fx_sqrt, 0 },
{ "gray0", Fx_gray0, 0 },
{ "halfsz0", Fx_halfsz0, 0 },
{ NULL, 0, 0 }
};
@ -112,6 +113,10 @@ switch (act) { @@ -112,6 +113,10 @@ switch (act) {
fimg_to_gray(&src); fimg_copy_data(&src, &dest);
break;
case Fx_halfsz0:
fprintf(stderr, "not implemented\n");
return -3;
default:
fprintf(stderr, "*** %s : %d is bad action\n", __func__, act);
break;

Loading…
Cancel
Save