tweaking & cleaning

This commit is contained in:
tTh 2022-10-28 05:53:07 +02:00
parent ca9947e7cc
commit 4efe885d9a
1 changed files with 29 additions and 48 deletions

View File

@ -11,26 +11,23 @@
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
/* /*
* fonction en chantier -> coredump probable * fonction en chantier -> coredump probable
* je ne sais pas à quoi va servir le paramètre 'flags' ... * je ne sais pas a quoi va servir le parametre 'flags' ...
* 7 nov 2007: * 7 nov 2007:
* le flag a disparu, il contient maintenant la valeur de * le flag a disparu, il contient maintenant la valeur de
* la composante verte. lol. * la composante verte. lol.
*/ */
int int Image_cadre_burp_0(Image_Desc *img, int p1, int p2, int gval)
Image_cadre_burp_0(Image_Desc *img, int p1, int p2, int gval)
{ {
int x, y, zz, v; int x, y, zz, v;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s p1=%d p2=%d flg=0x%02x\n", __func__, p1, p2, gval); fprintf(stderr, ">>> %s ( %p %d %d 0x%02x )\n", __func__, img, p1, p2, gval);
#endif #endif
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{
v = (x * 256) / img->width; v = (x * 256) / img->width;
for (zz=0; zz<p1; zz++) for (zz=0; zz<p1; zz++) {
{
y = zz; y = zz;
(img->Rpix[y])[x] = 0; (img->Rpix[y])[x] = 0;
(img->Gpix[y])[x] = gval; (img->Gpix[y])[x] = gval;
@ -43,11 +40,9 @@ for (x=0; x<img->width; x++)
} }
} }
for (y=p1; y<img->height-p1; y++) for (y=p1; y<img->height-p1; y++) {
{
v = (y * 256) / img->height; v = (y * 256) / img->height;
for (zz=0; zz<p2; zz++) for (zz=0; zz<p2; zz++) {
{
x = zz; x = zz;
(img->Rpix[y])[x] = 0; (img->Rpix[y])[x] = 0;
(img->Gpix[y])[x] = gval; (img->Gpix[y])[x] = gval;
@ -70,8 +65,7 @@ return FUNC_IS_BETA;
* 1er Juillet 2022: la colere est toujours la, mais ce n'est pas la * 1er Juillet 2022: la colere est toujours la, mais ce n'est pas la
* meme qu'il y a vingt ans... * meme qu'il y a vingt ans...
*/ */
int int Image_cadre_burp_1(Image_Desc *img, int p1, int p2, int flags)
Image_cadre_burp_1(Image_Desc *img, int p1, int p2, int flags)
{ {
int x, xx, y, yy, v; int x, xx, y, yy, v;
@ -81,14 +75,12 @@ int x, xx, y, yy, v;
fprintf(stderr, ">>> %s ( %p %d %d $%x )\n", __func__, img, p1, p2, flags); fprintf(stderr, ">>> %s ( %p %d %d $%x )\n", __func__, img, p1, p2, flags);
#endif #endif
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{
v = (x * 256) / img->width; v = (x * 256) / img->width;
#if DEBUG_LEVEL > 1 #if DEBUG_LEVEL > 1
printf("%s : debug %d %d\n", __func__, x, v); printf("%s : debug %d %d\n", __func__, x, v);
#endif #endif
for (yy=0; yy<p1; yy++) for (yy=0; yy<p1; yy++) {
{
y = yy; y = yy;
(img->Rpix[y])[x] = TOPV-v; (img->Rpix[y])[x] = TOPV-v;
(img->Gpix[y])[x] = TOPV; (img->Gpix[y])[x] = TOPV;
@ -101,11 +93,9 @@ for (x=0; x<img->width; x++)
} }
} }
for (y=p1; y<img->height-p1; y++) for (y=p1; y<img->height-p1; y++) {
{
v = (y * 256) / img->height; v = (y * 256) / img->height;
for (xx=0; xx<p2; xx++) for (xx=0; xx<p2; xx++) {
{
x = xx; x = xx;
(img->Rpix[y])[x] = 0; (img->Rpix[y])[x] = 0;
(img->Gpix[y])[x] = TOPV; (img->Gpix[y])[x] = TOPV;
@ -118,8 +108,7 @@ for (y=p1; y<img->height-p1; y++)
} }
} }
if (flags & 1) if (flags & 1) {
{
fprintf(stderr, "plop from %s\n", __func__); fprintf(stderr, "plop from %s\n", __func__);
} }
@ -133,8 +122,7 @@ return OLL_KORRECT;
* des exemples des objets POV de tTh * des exemples des objets POV de tTh
* *
*/ */
int int Image_cadre_burp_2(Image_Desc *img, int taille, int pr, int pg, int pb)
Image_cadre_burp_2(Image_Desc *img, int taille, int pr, int pg, int pb)
{ {
int x, y, zz; int x, y, zz;
@ -142,10 +130,8 @@ int x, y, zz;
fprintf(stderr, ">>> %s: sz %d, rgb %d %d %d\n", __func__, taille, pr, pg, pb); fprintf(stderr, ">>> %s: sz %d, rgb %d %d %d\n", __func__, taille, pr, pg, pb);
#endif #endif
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{ for (zz=0; zz<taille; zz++) {
for (zz=0; zz<taille; zz++)
{
y = zz; y = zz;
(img->Rpix[y])[x] |= pr; (img->Rpix[y])[x] |= pr;
(img->Gpix[y])[x] ^= pg; (img->Gpix[y])[x] ^= pg;
@ -158,10 +144,8 @@ for (x=0; x<img->width; x++)
} }
} }
for (y=taille; y<img->height-taille; y++) for (y=taille; y<img->height-taille; y++) {
{ for (zz=0; zz<taille; zz++) {
for (zz=0; zz<taille; zz++)
{
x = zz; x = zz;
(img->Rpix[y])[x] |= pr; (img->Rpix[y])[x] |= pr;
(img->Gpix[y])[x] ^= pg; (img->Gpix[y])[x] ^= pg;
@ -177,13 +161,13 @@ for (y=taille; y<img->height-taille; y++)
return OLL_KORRECT; return OLL_KORRECT;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_cadre_burp_3(Image_Desc *img, int taille, int pr, int pg, int pb)
Image_cadre_burp_3(Image_Desc *img, int taille, int pr, int pg, int pb)
{ {
int foo; int foo;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "Cadre burp3 on %p\n", img); fprintf(stderr, ">>> %s ( %p %d %d %d %d)\n", __func__, img, taille,
pr, pg, pb);
#endif #endif
foo = Image_cadre_burp_2(img, taille, pr, pg, pb); foo = Image_cadre_burp_2(img, taille, pr, pg, pb);
@ -201,7 +185,7 @@ int foo;
int r, g, b; int r, g, b;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s : img at %p, taille=%d\n", __func__, img, taille); fprintf(stderr, ">>> %s ( %p %d )\n", __func__, img, taille);
#endif #endif
#define RASTA_RAND 4 #define RASTA_RAND 4
@ -210,33 +194,30 @@ rect.x = rect.y = 0;
rect.w = img->width; rect.w = img->width;
rect.h = img->height; rect.h = img->height;
for (foo=0; foo<taille; foo++) for (foo=0; foo<taille; foo++) {
{
r = 220 + (rand() % RASTA_RAND); r = 220 + (rand() % RASTA_RAND);
b = 10 + (rand() % RASTA_RAND); b = 10 + (rand() % RASTA_RAND);
Image_draw_rect(img, &rect, r, 10, b); Image_draw_rect(img, &rect, r, 12, b);
rect.x++; rect.y++; rect.x++; rect.y++;
rect.h-=2; rect.w-=2; rect.h-=2; rect.w-=2;
} }
for (foo=0; foo<taille; foo++) for (foo=0; foo<taille; foo++) {
{
r = 220 + (rand() % RASTA_RAND); r = 220 + (rand() % RASTA_RAND);
g = 200 + (rand() % RASTA_RAND); g = 200 + (rand() % RASTA_RAND);
Image_draw_rect(img, &rect, r, g, 10); Image_draw_rect(img, &rect, r, g, 12);
rect.x++; rect.y++; rect.x++; rect.y++;
rect.h-=2; rect.w-=2; rect.h-=2; rect.w-=2;
} }
for (foo=0; foo<taille; foo++) for (foo=0; foo<taille; foo++) {
{
g = 220 + (rand() % RASTA_RAND); g = 220 + (rand() % RASTA_RAND);
b = 10 + (rand() % RASTA_RAND); b = 10 + (rand() % RASTA_RAND);
Image_draw_rect(img, &rect, 10, g, b); Image_draw_rect(img, &rect, 12, g, b);
rect.x++; rect.y++; rect.x++; rect.y++;
rect.h-=2; rect.w-=2; rect.h-=2; rect.w-=2;
} }
img->modified = 1; img->modified = 1;
return FUNC_IS_BETA; return OLL_KORRECT;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/