tweaking & cleaning

This commit is contained in:
tTh 2022-10-28 05:53:07 +02:00
parent ca9947e7cc
commit 4efe885d9a

View File

@ -11,26 +11,23 @@
/*::------------------------------------------------------------------::*/
/*
* 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:
* le flag a disparu, il contient maintenant la valeur de
* la composante verte. lol.
*/
int
Image_cadre_burp_0(Image_Desc *img, int p1, int p2, int gval)
int Image_cadre_burp_0(Image_Desc *img, int p1, int p2, int gval)
{
int x, y, zz, v;
#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
for (x=0; x<img->width; x++)
{
for (x=0; x<img->width; x++) {
v = (x * 256) / img->width;
for (zz=0; zz<p1; zz++)
{
for (zz=0; zz<p1; zz++) {
y = zz;
(img->Rpix[y])[x] = 0;
(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;
for (zz=0; zz<p2; zz++)
{
for (zz=0; zz<p2; zz++) {
x = zz;
(img->Rpix[y])[x] = 0;
(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
* meme qu'il y a vingt ans...
*/
int
Image_cadre_burp_1(Image_Desc *img, int p1, int p2, int flags)
int Image_cadre_burp_1(Image_Desc *img, int p1, int p2, int flags)
{
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);
#endif
for (x=0; x<img->width; x++)
{
for (x=0; x<img->width; x++) {
v = (x * 256) / img->width;
#if DEBUG_LEVEL > 1
printf("%s : debug %d %d\n", __func__, x, v);
#endif
for (yy=0; yy<p1; yy++)
{
for (yy=0; yy<p1; yy++) {
y = yy;
(img->Rpix[y])[x] = TOPV-v;
(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;
for (xx=0; xx<p2; xx++)
{
for (xx=0; xx<p2; xx++) {
x = xx;
(img->Rpix[y])[x] = 0;
(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__);
}
@ -133,8 +122,7 @@ return OLL_KORRECT;
* des exemples des objets POV de tTh
*
*/
int
Image_cadre_burp_2(Image_Desc *img, int taille, int pr, int pg, int pb)
int Image_cadre_burp_2(Image_Desc *img, int taille, int pr, int pg, int pb)
{
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);
#endif
for (x=0; x<img->width; x++)
{
for (zz=0; zz<taille; zz++)
{
for (x=0; x<img->width; x++) {
for (zz=0; zz<taille; zz++) {
y = zz;
(img->Rpix[y])[x] |= pr;
(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 (zz=0; zz<taille; zz++)
{
for (y=taille; y<img->height-taille; y++) {
for (zz=0; zz<taille; zz++) {
x = zz;
(img->Rpix[y])[x] |= pr;
(img->Gpix[y])[x] ^= pg;
@ -177,13 +161,13 @@ for (y=taille; y<img->height-taille; y++)
return OLL_KORRECT;
}
/*::------------------------------------------------------------------::*/
int
Image_cadre_burp_3(Image_Desc *img, int taille, int pr, int pg, int pb)
int Image_cadre_burp_3(Image_Desc *img, int taille, int pr, int pg, int pb)
{
int foo;
#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
foo = Image_cadre_burp_2(img, taille, pr, pg, pb);
@ -201,7 +185,7 @@ int foo;
int r, g, b;
#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
#define RASTA_RAND 4
@ -210,33 +194,30 @@ rect.x = rect.y = 0;
rect.w = img->width;
rect.h = img->height;
for (foo=0; foo<taille; foo++)
{
for (foo=0; foo<taille; foo++) {
r = 220 + (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.h-=2; rect.w-=2;
}
for (foo=0; foo<taille; foo++)
{
for (foo=0; foo<taille; foo++) {
r = 220 + (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.h-=2; rect.w-=2;
}
for (foo=0; foo<taille; foo++)
{
for (foo=0; foo<taille; foo++) {
g = 220 + (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.h-=2; rect.w-=2;
}
img->modified = 1;
return FUNC_IS_BETA;
return OLL_KORRECT;
}
/*::------------------------------------------------------------------::*/