added fimg_killcolors_a effect

This commit is contained in:
2020-02-07 18:01:28 +01:00
parent c48a3e4870
commit 622d011424
4 changed files with 71 additions and 4 deletions

37
funcs/sfx0.c Normal file
View File

@@ -0,0 +1,37 @@
/*
* FLOATIMG
* rampes diverses, trucs etranges
*/
#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];
}
return 0;
}
/* --------------------------------------------------------------------- */