rem por William Martínez, Treinta y Tres, Uruguay, América del Sur (metfar@adinet.com.uy) hexa$="0123456789ABCDEF" rem Moficacion: toma el nombre de fichero de linea de comandos rem open "I",#1,"z.xpm" open "I",#1,programarg$ (1) input #1,a$ if a$="/* XPM */" then print "Ahora si... es un xpm" else print "¡No es un XPM!!":system input #1,a$ nom$=ltrim$(right$(a$,len(a$)-13-instr(a$,"static char *"))) nom$=left$(nom$,instr(nom$,"[")-1) ?"El nombre de la imagen es ";nom$ input #1,a$ ancho=val(a$) a$=right$(a$,len(a$)-instr(a$," ")):alto=val(a$) a$=right$(a$,len(a$)-instr(a$," ")):colos=val(a$) a$=right$(a$,len(a$)-instr(a$," ")):invs=val(a$) ?" Ancho: ";ancho ?" Alto: ";alto ?"Cantidad de Colores: ";colos ?" Transparencias: ";invs mode ancho,alto Synchronize 1 t=t+1 rem Matriz de valores rgb de colores dim colores(colos+5,3) rem Vector de caracteres coloflash$="" while t<=colos input #1,a$ rem Suma caracter de referencia coloflash$=coloflash$+left$(a$,1) a$=ltrim$(rtrim$(right$(a$,len(a$)-instr(a$,"c")-1))) trans=0 if a$="None" then trans=1 if left$(a$,1)="#" then a$=right$(a$,len(a$)-instr(a$,"#")-1) rem //Extrae de la cadena los valores de rojo,verde y azul if trans=0 then coler=(instr(hexa$,left$(a$,1))-1)*16+instr(hexa$,left$(a$,1))-1:a$=right$(a$,4) if trans=0 then coleg=(instr(hexa$,left$(a$,1))-1)*16+instr(hexa$,left$(a$,1))-1:a$=right$(a$,2) if trans=0 then coleb=(instr(hexa$,left$(a$,1))-1)*16+instr(hexa$,left$(a$,1))-1 rem si es transparente, toma el valor 256 en rojo [ colores(x,1) ] if trans=1 then colores(t,1)=256 else colores(t,1)=coler:colores(t,2)=coleg:colores(t,3)=coleb t=t+1 wend rela=ancho/t rem Asigna y muestra la paleta for f=1 to t rem asigna el valor de color a la paleta ink f,colores(f,1),colores(f,2),colores(f,3) for q=0 to rela:line(f+q*t,0)-(f+q*t,alto),f:next q next locate 10,15:print "Cargando pantalla... ¡aguarde!" Synchronize line(0,0)-(ancho,alto),0,bf on error goto fin for y=0 to alto if not eof(1) then input #1,a$ for x=0 to ancho te$=mid$(a$,x+2,1) if instr(coloflash$,te$)<>0 and colores(instr(coloflash$,te$),1)<256 then a=instr(coloflash$,te$):plot x,y,a next x:next y goto fin label fin Synchronize get a$ system