Bibliothèque de traitements d'images en virgule flottante.
http://la.buvette.org/photos/cumul/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
56 lines
1.2 KiB
/* |
|
* FLOATIMG |
|
* distorsions géométriques - coredumping ? |
|
*/ |
|
|
|
#include <stdio.h> |
|
|
|
#include "../floatimg.h" |
|
|
|
/* --------------------------------------------------------------------- */ |
|
/* |
|
* really crude function, need more work... |
|
*/ |
|
int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused) |
|
{ |
|
int wd, hd; |
|
int foo, x, y; |
|
float pixel[3]; |
|
|
|
#if DEBUG_LEVEL |
|
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, |
|
src, dst, notused); |
|
#endif |
|
|
|
/* no magic check here ? */ |
|
if (dst->width || dst->height) { |
|
fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst); |
|
fimg_describe(dst, "destination halfsize"); |
|
return -2; |
|
} |
|
|
|
wd = src->width / 2; hd = src->height / 2; |
|
foo = fimg_create(dst, wd, hd, FIMG_TYPE_RGB); |
|
if (foo) { |
|
fprintf(stderr, "%s: err create %d\n", __func__, foo); |
|
return -3; |
|
} |
|
|
|
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); |
|
abort(); |
|
} |
|
foo = fimg_plot_rgb(dst, x, y, pixel[0], pixel[1], pixel[2]); |
|
if (foo) { |
|
fprintf(stderr, "%s: err plot %d\n", foo); |
|
abort(); |
|
} |
|
} |
|
|
|
} |
|
return 0; |
|
} |
|
/* --------------------------------------------------------------------- */
|
|
|