FloatImg/funcs/killrgb.c

46 lines
822 B
C
Raw Normal View History

2021-10-05 09:35:56 +11:00
/*
* KILL RGB !
*
* nouveau TerreBlanque 4 octobre 2021
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include "../floatimg.h"
#include "tests.h"
/* --------------------------------------------------------------------- */
int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k)
{
2022-02-05 09:39:52 +11:00
int line, col;
2021-10-10 18:46:27 +11:00
int ir;
2021-10-05 09:35:56 +11:00
2021-10-10 18:46:27 +11:00
#if DEBUG_LEVEL
2021-10-05 09:35:56 +11:00
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
2021-10-10 18:46:27 +11:00
src, dst, k);
#endif
2021-10-05 09:35:56 +11:00
fimg_clear(dst);
2021-10-10 18:46:27 +11:00
ir = 0;
2021-10-05 09:35:56 +11:00
for (line=0; line<src->height; line++) {
2021-10-10 18:46:27 +11:00
// fprintf(stderr, "%s line %d\n", __func__, line);
for (col=0; col<(src->width-3); col+=3) {
2021-10-05 09:35:56 +11:00
dst->R[ir ] = src->R[ir]; ir++;
dst->G[ir+1] = src->G[ir]; ir++;
dst->B[ir+2] = src->B[ir]; ir++;
}
}
return 0;
}
/* --------------------------------------------------------------------- */