a big commit of garbage

This commit is contained in:
tth
2022-05-14 20:49:59 +02:00
parent 4dcc524fc4
commit 615321eca8
15 changed files with 173 additions and 35 deletions

View File

@@ -212,6 +212,20 @@ ret = fimg_decomp_rgbz_color(img, &tmp, k);
fimg_copy_data(&tmp, img);
fimg_destroy(&tmp);
return ret;
}
/* -------------------------------------------------------------- */
/* nouveau 14 mai 2022 */
static int run_gr2popcol(FloatImg *img, int k)
{
FloatImg tmp;
int ret;
memset(&tmp, 0, sizeof(FloatImg));
fimg_clone(img, &tmp, 0);
ret = graylevel2popcolors(img, &tmp, k);
fimg_copy_data(&tmp, img);
fimg_destroy(&tmp);
return ret;
}
/* -------------------------------------------------------------- */
@@ -424,6 +438,11 @@ switch (idFx) {
retval = fimg_highlight_color(image, image, 'R', 1.717);
break;
case CR_gr2popcol:
// fprintf(stderr, "******* TO BE DONE ********\n");
retval = run_gr2popcol(image, -1);
break;
default :
fprintf(stderr, "%s : effect #%d invalid\n",
__func__, idFx);

View File

@@ -41,5 +41,6 @@
49 splitlevel 1 1
50 decrgbzc 1 99
51 decrgbzg 1 99
60 gr2popcol 1 99
99 message 1 1.0
-1 end 1 1.0

View File

@@ -21,6 +21,38 @@
*/
extern int verbosity;
/* -------------------------------------------------------------- */
/* nouveau 14 mai 2022 rue Ernest Renan */
int graylevel2popcolors(FloatImg *src, FloatImg *dst, int k)
{
int x, y;
float rgb[3];
float theoric_maxval;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, k);
#endif
theoric_maxval = src->fval * src->count;
fprintf(stderr, "theoric maxval = %f\n", theoric_maxval);
fimg_clear(dst);
// fimg_export_picture(src, "src.png", 0);
for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++)
{
fimg_get_rgb(src, x, y, rgb);
rgb[1] = fabs(rgb[0] - rgb[2]);
fimg_put_rgb(dst, x, y, rgb);
}
}
// fimg_export_picture(dst, "dst.png", 0);
return 0;
}
/* -------------------------------------------------------------- */
/*
* please, add some parameters !

View File

@@ -3,6 +3,8 @@
* ---------------------------------------------------
*/
int graylevel2popcolors(FloatImg *src, FloatImg *dst, int k);
int incrustation_vignette(FloatImg *src, FloatImg *dst, int k);

View File

@@ -166,19 +166,19 @@ int experiment(void)
int foo;
FloatImg image, dest;
fprintf(stderr, "EXPERIMENT\n");
fprintf(stderr, "--------- EXPERIMENT ------------\n");
foo = fimg_create_from_dump("01137.fimg", &image);
foo = fimg_create_from_dump("mire.fimg", &image);
if (foo) {
fprintf(stderr, "%s: err %d on create_from_dump\n",
__func__, foo);
return -1;
}
foo = fimg_clone(&image, &dest, 1);
foo = fimg_copy_data(&image, &dest);
foo = fimg_clone(&image, &dest, 0);
incrustation_vignette(&image, &dest, 0);
foo = graylevel2popcolors(&image, &dest, 0);
fprintf(stderr, "POP COLOR- -> %d\n", foo);
fimg_export_picture(&dest, "foo.png", 0);