FloatImg/funcs/sfx0.c

56 lines
1.1 KiB
C
Raw Normal View History

2020-02-07 18:01:28 +01:00
/*
* FLOATIMG
2020-02-13 20:44:22 +01:00
* effets spéciaux àlc sur les couleurs
2020-02-07 18:01:28 +01:00
*/
#include <stdio.h>
#include "../floatimg.h"
/* --------------------------------------------------------------------- */
/*
* OMG ! a Color Graphic Adaptor emulator :)
*/
int fimg_killcolors_a(FloatImg *fimg, float fval)
{
int nbpix, foo;
if (FIMG_TYPE_RGB != fimg->type) {
fprintf(stderr, "%s: bad src type %d on %p\n", __func__,
fimg->type, fimg);
return -8;
}
nbpix = fimg->width * fimg->height;
for (foo=0; foo<nbpix; foo++) {
if (fimg->R[foo] > fimg->G[foo])
fimg->B[foo] = fimg->R[foo];
else
fimg->B[foo] = fimg->G[foo];
2020-02-07 20:09:03 +01:00
}
return 0;
}
/* --------------------------------------------------------------------- */
int fimg_killcolors_b(FloatImg *fimg, float fval)
{
int nbpix, foo;
if (FIMG_TYPE_RGB != fimg->type) {
fprintf(stderr, "%s: bad src type %d on %p\n", __func__,
fimg->type, fimg);
return -8;
2020-02-07 18:01:28 +01:00
}
2020-02-07 20:09:03 +01:00
nbpix = fimg->width * fimg->height;
for (foo=0; foo<nbpix; foo++) {
if (fimg->R[foo] > fimg->B[foo])
fimg->G[foo] = fimg->R[foo];
else
fimg->G[foo] = fimg->B[foo];
}
2020-02-07 18:01:28 +01:00
return 0;
}
/* --------------------------------------------------------------------- */