integration of halfsizing

This commit is contained in:
2020-02-16 16:21:27 +01:00
parent 2b26645b49
commit 23ce4cd337
4 changed files with 39 additions and 7 deletions

View File

@@ -4,6 +4,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include "../floatimg.h"
@@ -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();
}
}

View File

@@ -10,6 +10,8 @@
int verbosity;
float global_fvalue;
/* --------------------------------------------------------------------- */
int essai_geometrie(char *infile)
{
@@ -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 {
}
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;
/* --------------------------------------------------------------------- */
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;
}