Message-Id: <3.0.32.19970717210432.006e5bf4@mail.geocities.com> Date: Fri, 18 Jul 1997 00:11:42 -0300 To: djgpp AT delorie DOT com From: Guilherme Silveira Subject: HELP ME! QUICK! Mime-Version: 1.0 Content-Type: text/enriched; charset="us-ascii" Precedence: bulk Please, I don't know what's wrong with this program, I was trying to use him to create a mask for one picture by using another picture, please, take a look at it and tell me what's wrong: <<----------------------------BOF-------------------------> #include < #include "allegro.h" int main(int argc,char *argv[]){ BITMAP *the_image; PALLETE the_pallete; int line=0; int column=0; int poe=0; char poe2; poe2=' '; int i; allegro_init(); set_gfx_mode(GFX_AUTODETECT, 1024, 768, 0, 0); set_pallete(the_pallete); the_image = load_bitmap(argv[1], the_pallete); blit(the_image, screen,0,0,0,0,1024,500); int letra[25]; for(i=0;i<<25;i++) letra[i]=0; char tela[500][1024]; for(line=0;line<<500;line++){ for(column=0;column<<1024;column++) tela[line][column]=' '; } line=0; column=0; for(line=0;line<h;line++){ for(column=0;column<w;column++){ poe=getpixel(screen,column,line); if(getr(poe)==0 && getb(poe)==0 && getg(poe)==0) poe2=' '; else{ if(line!=0){ if(tela[line-1][column]!=' '){ poe2=tela[line-1][column]; tela[line][column]=poe2; continue; } } if(column!=0){ if(tela[line][column-1]!=' '){ poe2=tela[line][column-1]; tela[line][column]=poe2; continue; } } if(column!=1024 && line!=0){ if(tela[line-1][column+1]!=' '){ poe2=tela[line-1][column+1]; tela[line][column]=poe2; continue; } } if(column+1!=1024 && line!=0 && tela[line][column+1]!=' '){ if(tela[line-1][column+2]!=' '){ poe2=tela[line-1][column+2]; tela[line][column]=poe2; continue; } } if(column+2!=1024 && line!=0 && tela[line-1][column+2]!=' '){ if(tela[line-1][column+3]!=' '){ poe2=tela[line-1][column+3]; tela[line][column]=poe2; continue; } } if(column+3!=1024 && line!=0 && tela[line-1][column+3]!=' '){ if(tela[line-1][column+4]!=' '){ poe2=tela[line-1][column+4]; tela[line][column]=poe2; continue; } } for(i=0;letra[i]==1;i++) i=i; if(i==0) poe2='a'; if(i==1) poe2='b'; if(i==2) poe2='c'; if(i==3) poe2='d'; if(i==4) poe2='e'; if(i==5) poe2='f'; if(i==6) poe2='g'; if(i==7) poe2='h'; if(i==8) poe2='i'; if(i==9) poe2='j'; if(i==10) poe2='k'; if(i==11) poe2='l'; if(i==12) poe2='m'; if(i==13) poe2='n'; if(i==14) poe2='o'; if(i==15) poe2='p'; if(i==16) poe2='q'; if(i==17) poe2='r'; if(i==18) poe2='s'; if(i==19) poe2='t'; if(i==20) poe2='u'; if(i==21) poe2='v'; if(i==22) poe2='w'; if(i==23) poe2='x'; if(i==24) poe2='y'; if(i==25) poe2='z'; letra[i]=1; } tela[line][column]=poe2; } } FILE *fout; fout=fopen(argv[2],"w"); fprintf(fout,"char array[%d][%d]=\n",the_image->h,the_image->w); for(line=0;line<h;line++){ fprintf(fout,"{"); for(column=0;column<w;column++){ fprintf(fout,"\'%c\',",tela[line][column]); } fprintf(fout,"},\n"); } fprintf(fout,"};\n\n\n"); fclose(fout); return(0); } <<----------------------------EOF-------------------------> If you study this code a litle you'll know what it will do. Thanks Guilherme --------------------------------------------------------------- Guilherme Silveira - Sao Paulo - Brasil 18/09/1981 - Until Today... carlos AT usway DOT com - thedarkage AT mail DOT geocities DOT com What about taking a look on my page: http://www.geocities.com/SiliconValley/Way/5441/ DJGPP - Visual Basic - C/C++ - Xcom - Warcraft II THE DARK AGE