FloatImg/funcs/killrgb.c

46 lines
878 B
C
Raw Normal View History

2021-10-05 00:35:56 +02: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-04 23:39:52 +01:00
int line, col;
2021-10-10 09:46:27 +02:00
int ir;
2021-10-05 00:35:56 +02:00
2021-10-10 09:46:27 +02:00
#if DEBUG_LEVEL
2022-07-06 10:27:55 +02:00
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, k);
2021-10-10 09:46:27 +02:00
#endif
2021-10-05 00:35:56 +02:00
2022-07-06 10:27:55 +02:00
if (k) { fprintf(stderr, "in %s k was %d\n", __func__, k); }
2021-10-05 00:35:56 +02:00
2022-07-06 10:27:55 +02:00
fimg_clear(dst);
2021-10-10 09:46:27 +02:00
ir = 0;
2021-10-05 00:35:56 +02:00
for (line=0; line<src->height; line++) {
2021-10-10 09:46:27 +02:00
// fprintf(stderr, "%s line %d\n", __func__, line);
for (col=0; col<(src->width-3); col+=3) {
2021-10-05 00:35:56 +02: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;
}
/* --------------------------------------------------------------------- */