commit du matin, pinpin
This commit is contained in:
parent
95beee167d
commit
64489f5707
129
Lib/combine.c
129
Lib/combine.c
@ -29,13 +29,11 @@ Image_combine_lines(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||
{
|
||||
int foo, x, y, my, r, g, b;
|
||||
|
||||
if (sy == 0)
|
||||
{
|
||||
if (sy == 0) {
|
||||
fprintf(stderr, "Combine Lines: sy is zer0 and zak is %d\n", zak);
|
||||
return DIVISOR_IS_ZERO;
|
||||
}
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine Lines: sources are differents (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
@ -43,19 +41,15 @@ if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Combine lines: %d %d\n", sy, oy);
|
||||
#endif
|
||||
for (y=0; y<s1->height; y++)
|
||||
{
|
||||
for (y=0; y<s1->height; y++) {
|
||||
my = (y+oy) / sy;
|
||||
for (x=0; x<s1->width; x++)
|
||||
{
|
||||
if ( my&1 )
|
||||
{
|
||||
for (x=0; x<s1->width; x++) {
|
||||
if ( my&1 ) {
|
||||
r = (s1->Rpix[y])[x];
|
||||
g = (s1->Gpix[y])[x];
|
||||
b = (s1->Bpix[y])[x];
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
r = (s2->Rpix[y])[x];
|
||||
g = (s2->Gpix[y])[x];
|
||||
b = (s2->Bpix[y])[x];
|
||||
@ -79,13 +73,11 @@ Image_combine_columns(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||
{
|
||||
int foo, x, y, mx, r, g, b;
|
||||
|
||||
if (sx == 0)
|
||||
{
|
||||
if (sx == 0) {
|
||||
fprintf(stderr, "Combine Columns: sx is zer0\n");
|
||||
return DIVISOR_IS_ZERO;
|
||||
}
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine Lines: sources are differents (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
@ -94,19 +86,15 @@ if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
fprintf(stderr, "Combine columns: %d %d\n", sx, ox);
|
||||
#endif
|
||||
|
||||
for (y=0; y<s1->height; y++)
|
||||
{
|
||||
for (x=0; x<s1->width; x++)
|
||||
{
|
||||
for (y=0; y<s1->height; y++) {
|
||||
for (x=0; x<s1->width; x++) {
|
||||
mx = (x+ox) / sx;
|
||||
if ( mx&1 )
|
||||
{
|
||||
if ( mx & 1 ) {
|
||||
r = (s1->Rpix[y])[x];
|
||||
g = (s1->Gpix[y])[x];
|
||||
b = (s1->Bpix[y])[x];
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
r = (s2->Rpix[y])[x];
|
||||
g = (s2->Gpix[y])[x];
|
||||
b = (s2->Bpix[y])[x];
|
||||
@ -140,38 +128,30 @@ fprintf(stderr, "Checker (%p, %p) -> %p [%d,%d] [%d,%d]\n",
|
||||
s1, s2, d, sx, sy, ox, oy);
|
||||
#endif
|
||||
|
||||
if (zak)
|
||||
{
|
||||
fprintf(stderr, "%s: param 'zak' = %d, must be 0.\n", __func__,
|
||||
zak);
|
||||
if (zak) {
|
||||
fprintf(stderr, "%s: 'zak' = %d, must be 0.\n", __func__, zak);
|
||||
}
|
||||
|
||||
if ( sx==0 || sy==0 )
|
||||
{
|
||||
if ( sx==0 || sy==0 ) {
|
||||
fprintf(stderr, "Combine Checker: sx or sy is Zero\n");
|
||||
return DIVISOR_IS_ZERO;
|
||||
}
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine Checker: sources are differents (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (y=0; y<s1->height; y++)
|
||||
{
|
||||
for (y=0; y<s1->height; y++) {
|
||||
my = (y+oy) / sy;
|
||||
for (x=0; x<s1->width; x++)
|
||||
{
|
||||
for (x=0; x<s1->width; x++) {
|
||||
mx = (x+ox) / sx;
|
||||
if ( (mx&1) != (my&1) )
|
||||
{
|
||||
if ( (mx&1) != (my&1) ) {
|
||||
r = (s1->Rpix[y])[x];
|
||||
g = (s1->Gpix[y])[x];
|
||||
b = (s1->Bpix[y])[x];
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
r = (s2->Rpix[y])[x];
|
||||
g = (s2->Gpix[y])[x];
|
||||
b = (s2->Bpix[y])[x];
|
||||
@ -186,7 +166,6 @@ for (y=0; y<s1->height; y++)
|
||||
return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* houba, celle-ci va me donner du mal, et on peut la
|
||||
* considerer comme pas finie, c'est a dire, entre autre,
|
||||
@ -205,14 +184,12 @@ int xcenter, ycenter;
|
||||
int x, y, r1, v1, b1, r2, b2, v2;
|
||||
float fx2, fy2, dmax, coef;
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine Cercle Flou: differents sources (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, d)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, d)) ) {
|
||||
fprintf(stderr, "Combine Cercle Flou: source != dest (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
@ -228,11 +205,9 @@ fprintf(stderr, "\tdmax: %f\n", dmax);
|
||||
fflush(stderr); /* vraiment necessaire ? */
|
||||
#endif
|
||||
|
||||
for (y=0; y<s1->height; y++)
|
||||
{
|
||||
for (y=0; y<s1->height; y++) {
|
||||
fy2 = (float)((y-ycenter)*(y-ycenter));
|
||||
for (x=0; x<s1->width; x++)
|
||||
{
|
||||
for (x=0; x<s1->width; x++) {
|
||||
fx2 = (float)((x-xcenter)*(x-xcenter));
|
||||
|
||||
r1 = (s1->Rpix[y])[x];
|
||||
@ -256,7 +231,9 @@ for (y=0; y<s1->height; y++)
|
||||
(d->Bpix[y])[x] = (int)(b1*(1.0-coef)+b2*coef);
|
||||
|
||||
}
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "x %4d y %4d c %f\n", x, y, coef);
|
||||
#endif
|
||||
}
|
||||
|
||||
return OLL_KORRECT;
|
||||
@ -274,48 +251,39 @@ int foo;
|
||||
int x, y, r, g, b;
|
||||
int vertical, offset;
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine Diagonale: differents sources (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
if (s1->height > s1->width)
|
||||
{
|
||||
if (s1->height > s1->width) {
|
||||
vertical = 1;
|
||||
offset = (s1->height - s1->width) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
vertical = 0;
|
||||
offset = (s1->width - s1->height) / 2;
|
||||
}
|
||||
|
||||
for (y=0; y<s1->height; y++)
|
||||
{
|
||||
for (x=0; x<s1->width; x++)
|
||||
{
|
||||
if ( vertical )
|
||||
{
|
||||
for (y=0; y<s1->height; y++) {
|
||||
for (x=0; x<s1->width; x++) {
|
||||
if ( vertical ) {
|
||||
if (x > (y-offset)) foo=1;
|
||||
else foo=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if ((x-offset) > y) foo=1;
|
||||
else foo=0;
|
||||
}
|
||||
|
||||
foo = yo ? !foo : foo; /* strange hack */
|
||||
|
||||
if (foo)
|
||||
{
|
||||
if (foo) {
|
||||
r = (s1->Rpix[y])[x];
|
||||
g = (s1->Gpix[y])[x];
|
||||
b = (s1->Bpix[y])[x];
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
r = (s2->Rpix[y])[x];
|
||||
g = (s2->Gpix[y])[x];
|
||||
b = (s2->Bpix[y])[x];
|
||||
@ -343,16 +311,13 @@ Image_combine_minmax(Image_Desc *s1, Image_Desc *s2, Image_Desc *d, int flg)
|
||||
int foo, x, y, r, g, b;
|
||||
int r1, r2, g1, g2, b1, b2;
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine MinMax: differents sources (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (y=0; y<s1->height; y++)
|
||||
{
|
||||
for (x=0; x<s1->width; x++)
|
||||
{
|
||||
for (y=0; y<s1->height; y++) {
|
||||
for (x=0; x<s1->width; x++) {
|
||||
r1 = (s1->Rpix[y])[x];
|
||||
g1 = (s1->Gpix[y])[x];
|
||||
b1 = (s1->Bpix[y])[x];
|
||||
@ -361,8 +326,7 @@ for (y=0; y<s1->height; y++)
|
||||
g2 = (s2->Gpix[y])[x];
|
||||
b2 = (s2->Bpix[y])[x];
|
||||
|
||||
if (flg)
|
||||
{
|
||||
if (flg) {
|
||||
r = max(r1, r2);
|
||||
g = max(g1, g2);
|
||||
b = max(b1, b2);
|
||||
@ -393,23 +357,19 @@ Image_combine_if_not_black(Image_Desc *s1, Image_Desc *s2, Image_Desc *d)
|
||||
{
|
||||
int foo, x, y, r, g, b;
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine If Not Black: differents sources (%d)\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (y=0; y<s1->height; y++)
|
||||
{
|
||||
for (x=0; x<s1->width; x++)
|
||||
{
|
||||
for (y=0; y<s1->height; y++) {
|
||||
for (x=0; x<s1->width; x++) {
|
||||
/* XXX Image_getRGB(s1, x, y, &r, &g, &b); */
|
||||
r = (s1->Rpix[y])[x];
|
||||
g = (s1->Gpix[y])[x];
|
||||
b = (s1->Bpix[y])[x];
|
||||
|
||||
if ( r==0 && g==0 && b==0 )
|
||||
{
|
||||
if ( r==0 && g==0 && b==0 ) {
|
||||
/* XXX Image_getRGB(s2, x, y, &r, &g, &b); */
|
||||
r = (s2->Rpix[y])[x];
|
||||
g = (s2->Gpix[y])[x];
|
||||
@ -437,8 +397,7 @@ Image_poke_2zones(Image_Desc *src, Image_Desc *ia, Image_Desc *ib,
|
||||
int foo;
|
||||
/* Image_Rect rect; */
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||
fprintf(stderr, "Poke 2 Zone: src & dst: %d %s\n",
|
||||
foo, Image_err2str(foo));
|
||||
return foo;
|
||||
|
@ -47,7 +47,7 @@ for (x=0; x<=xmax; x+=w) {
|
||||
|
||||
dst->modified = 1;
|
||||
|
||||
return FUNC_NOT_FINISH;
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
@ -62,7 +62,8 @@ int foo;
|
||||
fprintf(stderr, "Pixeliz X: appel de test, pas finalise.\n");
|
||||
#endif
|
||||
|
||||
foo = Image_pixeliz_0(src, dst, 5, 13);
|
||||
foo = Image_pixeliz_0(src, dst, 5, 15);
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Pixeliz X: valeur obtenue: %d\n", foo);
|
||||
#endif
|
||||
@ -78,10 +79,14 @@ Image_pixeliz_Y(Image_Desc *src, Image_Desc *dst)
|
||||
{
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Pixeliz Y: appel de test, pas finalise.\n");
|
||||
#endif
|
||||
|
||||
foo = Image_pixeliz_0(src, dst, 13, 5);
|
||||
#if DEBUG_LEVEL
|
||||
foo = Image_pixeliz_0(src, dst, 15, 5);
|
||||
fprintf(stderr, "Pixeliz Y: valeur obtenue: %d\n", foo);
|
||||
#endif
|
||||
|
||||
return foo;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ int main(int argc, char *argv[])
|
||||
int foo;
|
||||
|
||||
fprintf(stderr, "-------------- %s ------------\n", argv[0]);
|
||||
foo = Image_t16x24_chars_map("16x24thin", "all16x24chars.tga", 0);
|
||||
foo = Image_t16x24_chars_map("16x24thin", "all16x24chars.tga", 0);
|
||||
foo = Image_t16x24_chars_map("bigfont.txt", "all16X24chars.tga", 0);
|
||||
fprintf(stderr, "--------------------------\n");
|
||||
Image_print_error("Essai fonte 16x24", foo);
|
||||
|
@ -318,11 +318,11 @@ switch (commande)
|
||||
foo = Image_noise(src, dst, GIP(0));
|
||||
break;
|
||||
case EFF_PIXELX:
|
||||
fprintf(stderr, "Experimental : pixel X !\n");
|
||||
/* fprintf(stderr, "Experimental : pixel X !\n"); */
|
||||
foo = Image_pixeliz_X(src, dst);
|
||||
break;
|
||||
case EFF_PIXELY:
|
||||
fprintf(stderr, "Experimental : pixel Y!\n");
|
||||
/* fprintf(stderr, "Experimental : pixel Y!\n"); */
|
||||
foo = Image_pixeliz_Y(src, dst);
|
||||
break;
|
||||
case EFF_FIVE: /* XXX */
|
||||
|
Loading…
Reference in New Issue
Block a user