add a func for testing paint_rec

This commit is contained in:
tTh 2023-11-14 13:04:56 +01:00
parent 4ab69cced3
commit 378a1046a0
1 changed files with 46 additions and 2 deletions

View File

@ -17,6 +17,50 @@
#include "../tthimage.h"
#include "essais.h"
/* ============================== */
int essai_draw_paint_rect(char *outga)
{
Image_Desc *img;
Image_Rect rect;
int foo, x, y;
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outga);
rect.x = 8; rect.y = 8;
rect.w = 6; rect.h = 6;
if (NULL==(img=Image_alloc(64, 32, 3))) {
abort();
}
for (x=0; x<img->width; x+=2) {
for (y=0; y<img->height; y+=2) {
Image_plotRGB(img, x, y, 200, 200, 200);
}
}
foo = Image_draw_rect(img, &rect, 192, 128, 64);
if (foo) {
fprintf(stderr, "%s: err %d draw rect\n", __func__, foo);
return foo;
}
rect.x = 24;
foo = Image_paint_rect(img, &rect, 64, 128, 192);
if (foo) {
fprintf(stderr, "%s: err %d paint rect\n", __func__, foo);
return foo;
}
foo = Image_TGA_save(outga, img, 0);
if (foo) {
fprintf(stderr, "%s: err %d save '%s'\n", __func__, foo, outga);
return foo;
}
return OLL_KORRECT;
}
/*::------------------------------------------------------------------::*/
/* nouveau vacances de fevrier 2010 */
int Essayer_les_alphas(char *fname, int k)
@ -946,9 +990,9 @@ return 0;
}
/*::------------------------------------------------------------------::*/
/*
* 2023-09-30 this function need more work
*/
int
Test_copie_de_rectangles(char *nomsource)
int Test_copie_de_rectangles(char *nomsource)
{
Image_Desc *source, *image, *finale;
int foo, w, h, x, y;