2022-06-27 00:48:18 +02: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 00:11:53 +02:00
|
|
|
int Image_pixeliz_0(Image_Desc *src, Image_Desc *dst, int w, int h)
|
2022-06-27 00:48:18 +02: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 06:14:45 +02:00
|
|
|
return FUNC_IS_BETA;
|
2022-06-27 00:48:18 +02:00
|
|
|
}
|
|
|
|
/*::------------------------------------------------------------------::*/
|
|
|
|
/*
|
|
|
|
* fonction d'appel de test
|
|
|
|
*/
|
2022-09-21 00:06:11 +02:00
|
|
|
int Image_pixeliz_X(Image_Desc *src, Image_Desc *dst)
|
2022-06-27 00:48:18 +02:00
|
|
|
{
|
|
|
|
int foo;
|
|
|
|
|
2022-07-07 12:52:00 +02:00
|
|
|
#if DEBUG_LEVEL
|
2022-06-27 00:48:18 +02:00
|
|
|
fprintf(stderr, "Pixeliz X: appel de test, pas finalise.\n");
|
2022-07-07 12:52:00 +02:00
|
|
|
#endif
|
2022-06-27 00:48:18 +02:00
|
|
|
|
2022-08-22 17:53:30 +02:00
|
|
|
foo = Image_pixeliz_0(src, dst, 5, 16);
|
2022-07-11 06:14:45 +02:00
|
|
|
|
2022-07-07 12:52:00 +02:00
|
|
|
#if DEBUG_LEVEL
|
2022-06-27 00:48:18 +02:00
|
|
|
fprintf(stderr, "Pixeliz X: valeur obtenue: %d\n", foo);
|
2022-07-07 12:52:00 +02:00
|
|
|
#endif
|
2022-06-27 00:48:18 +02:00
|
|
|
|
|
|
|
return foo;
|
|
|
|
}
|
|
|
|
/*::------------------------------------------------------------------::*/
|
|
|
|
/*
|
|
|
|
* fonction d'appel de test
|
|
|
|
*/
|
2022-09-21 00:06:11 +02:00
|
|
|
int Image_pixeliz_Y(Image_Desc *src, Image_Desc *dst)
|
2022-06-27 00:48:18 +02:00
|
|
|
{
|
|
|
|
int foo;
|
|
|
|
|
2022-08-21 15:51:06 +02:00
|
|
|
#if DEBUG_LEVEL > 1
|
2022-06-27 00:48:18 +02:00
|
|
|
fprintf(stderr, "Pixeliz Y: appel de test, pas finalise.\n");
|
2022-07-11 06:14:45 +02:00
|
|
|
#endif
|
2022-06-27 00:48:18 +02:00
|
|
|
|
2022-08-22 17:53:30 +02:00
|
|
|
foo = Image_pixeliz_0(src, dst, 16, 5);
|
2022-08-21 15:51:06 +02:00
|
|
|
|
|
|
|
#if DEBUG_LEVEL
|
2022-06-27 00:48:18 +02:00
|
|
|
fprintf(stderr, "Pixeliz Y: valeur obtenue: %d\n", foo);
|
2022-07-11 06:14:45 +02:00
|
|
|
#endif
|
2022-06-27 00:48:18 +02:00
|
|
|
|
|
|
|
return foo;
|
|
|
|
}
|
|
|
|
/*::------------------------------------------------------------------::*/
|