2022-06-27 09:48:18 +11:00
|
|
|
/*
|
|
|
|
* pixeliz.c
|
|
|
|
* ---------
|
|
|
|
*
|
|
|
|
* nouveau 23 Juin 2003, je ne sais pas quoi mettre dedans...
|
|
|
|
* 14 mars 2007: je ne sais toujours pas...
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "../tthimage.h"
|
|
|
|
|
|
|
|
/*::------------------------------------------------------------------::*/
|
2022-09-13 09:11:53 +11:00
|
|
|
int Image_pixeliz_0(Image_Desc *src, Image_Desc *dst, int w, int h)
|
2022-06-27 09:48:18 +11:00
|
|
|
{
|
|
|
|
int x, y, foo, N;
|
|
|
|
int r, g, b;
|
|
|
|
int xmax, ymax;
|
|
|
|
Image_Rect zone;
|
|
|
|
|
|
|
|
#if DEBUG_LEVEL
|
|
|
|
fprintf(stderr, "Pixeliz 0: en chantier w %d h %d\n", w, h);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
|
|
|
fprintf(stderr, "%s : images are differents %d\n", __func__, foo);
|
|
|
|
return foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
zone.w = w;
|
|
|
|
zone.h = h;
|
|
|
|
|
|
|
|
xmax = src->width - w;
|
|
|
|
ymax = src->height - h;
|
|
|
|
|
|
|
|
for (x=0; x<=xmax; x+=w) {
|
|
|
|
zone.x = x;
|
|
|
|
for (y=0; y<=ymax; y+=h) {
|
|
|
|
zone.y = y;
|
|
|
|
/* Image_dump_rect(&zone, "z", 0); */
|
|
|
|
|
|
|
|
foo = Image_stats_zone_0(src, &zone, &r, &g, &b, &N, &N, &N);
|
|
|
|
foo = Image_paint_rect(dst, &zone, r, g, b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dst->modified = 1;
|
|
|
|
|
2022-07-11 15:14:45 +11:00
|
|
|
return FUNC_IS_BETA;
|
2022-06-27 09:48:18 +11:00
|
|
|
}
|
|
|
|
/*::------------------------------------------------------------------::*/
|
|
|
|
/*
|
|
|
|
* fonction d'appel de test
|
|
|
|
*/
|
2022-09-21 09:06:11 +11:00
|
|
|
int Image_pixeliz_X(Image_Desc *src, Image_Desc *dst)
|
2022-06-27 09:48:18 +11:00
|
|
|
{
|
|
|
|
int foo;
|
|
|
|
|
2022-07-07 21:52:00 +11:00
|
|
|
#if DEBUG_LEVEL
|
2022-06-27 09:48:18 +11:00
|
|
|
fprintf(stderr, "Pixeliz X: appel de test, pas finalise.\n");
|
2022-07-07 21:52:00 +11:00
|
|
|
#endif
|
2022-06-27 09:48:18 +11:00
|
|
|
|
2022-08-23 02:53:30 +11:00
|
|
|
foo = Image_pixeliz_0(src, dst, 5, 16);
|
2022-07-11 15:14:45 +11:00
|
|
|
|
2022-07-07 21:52:00 +11:00
|
|
|
#if DEBUG_LEVEL
|
2022-06-27 09:48:18 +11:00
|
|
|
fprintf(stderr, "Pixeliz X: valeur obtenue: %d\n", foo);
|
2022-07-07 21:52:00 +11:00
|
|
|
#endif
|
2022-06-27 09:48:18 +11:00
|
|
|
|
|
|
|
return foo;
|
|
|
|
}
|
|
|
|
/*::------------------------------------------------------------------::*/
|
|
|
|
/*
|
|
|
|
* fonction d'appel de test
|
|
|
|
*/
|
2022-09-21 09:06:11 +11:00
|
|
|
int Image_pixeliz_Y(Image_Desc *src, Image_Desc *dst)
|
2022-06-27 09:48:18 +11:00
|
|
|
{
|
|
|
|
int foo;
|
|
|
|
|
2022-08-22 00:51:06 +11:00
|
|
|
#if DEBUG_LEVEL > 1
|
2022-06-27 09:48:18 +11:00
|
|
|
fprintf(stderr, "Pixeliz Y: appel de test, pas finalise.\n");
|
2022-07-11 15:14:45 +11:00
|
|
|
#endif
|
2022-06-27 09:48:18 +11:00
|
|
|
|
2022-08-23 02:53:30 +11:00
|
|
|
foo = Image_pixeliz_0(src, dst, 16, 5);
|
2022-08-22 00:51:06 +11:00
|
|
|
|
|
|
|
#if DEBUG_LEVEL
|
2022-06-27 09:48:18 +11:00
|
|
|
fprintf(stderr, "Pixeliz Y: valeur obtenue: %d\n", foo);
|
2022-07-11 15:14:45 +11:00
|
|
|
#endif
|
2022-06-27 09:48:18 +11:00
|
|
|
|
|
|
|
return foo;
|
|
|
|
}
|
|
|
|
/*::------------------------------------------------------------------::*/
|