PCXファイルを作る
OPTION CHARACTER BYTE FILE GETNAME F$, "BMP,JPG,GIFファイル|*.BMP;*.JPG;*.GIF" IF F$="" THEN STOP CALL PICTURELOAD(F$,XSIZE,YSIZE) INPUT PROMPT "SAVE FILENAME(.PCX)=":N$ IF POS(N$,".")=0 THEN LET N$=N$ & ".PCX" CALL PCXSAVEFULL(N$,0,0,XSIZE-1,YSIZE-1) END
EXTERNAL SUB PCXSAVEFULL(F$,XS,YS,XE,YE) OPTION CHARACTER BYTE OPEN #1:NAME F$ PRINT #1:CHR$(10);CHR$(5); PRINT #1:CHR$(1);CHR$(8); PRINT #1:MKI$(XS); PRINT #1:MKI$(YS); PRINT #1:MKI$(XE); PRINT #1:MKI$(YE); PRINT #1:MKI$(96); PRINT #1:MKI$(96); PRINT #1:REPEAT$(CHR$(0),48); PRINT #1:CHR$(0);CHR$(3); PRINT #1:MKI$(XE-XS+1); PRINT #1:MKI$(1); PRINT #1:REPEAT$(CHR$(0),58); FOR Y=YS TO YE LET X=XS DO CALL GETPOINT(X,Y,R0,G0,B0) LET NUM=0 DO LET NUM=NUM+1 CALL GETPOINT(X+NUM,Y,R,G,B) LOOP WHILE R0=R AND NUM<63 AND X+NUM<=XE IF NUM=1 AND R0<192 THEN PRINT #1:CHR$(R0); ELSE PRINT #1:CHR$(192+NUM); PRINT #1:CHR$(R0); END IF LET X=X+NUM LOOP WHILE X<=XE LET X=XS DO CALL GETPOINT(X,Y,R0,G0,B0) LET NUM=0 DO LET NUM=NUM+1 CALL GETPOINT(X+NUM,Y,R,G,B) LOOP WHILE G0=G AND NUM<63 AND X+NUM<=XE IF NUM=1 AND G0<192 THEN PRINT #1:CHR$(G0); ELSE PRINT #1:CHR$(192+NUM); PRINT #1:CHR$(G0); END IF LET X=X+NUM LOOP WHILE X<=XE LET X=XS DO CALL GETPOINT(X,Y,R0,G0,B0) LET NUM=0 DO LET NUM=NUM+1 CALL GETPOINT(X+NUM,Y,R,G,B) LOOP WHILE B0=B AND NUM<63 AND X+NUM<=XE IF NUM=1 AND B0<192 THEN PRINT #1:CHR$(B0); ELSE PRINT #1:CHR$(192+NUM); PRINT #1:CHR$(B0); END IF LET X=X+NUM LOOP WHILE X<=XE NEXT Y CLOSE #1 END SUB
EXTERNAL FUNCTION MKI$(A) OPTION CHARACTER BYTE DECLARE STRING A$,B$ IF A<0 THEN LET A=A+65536 LET A$=CHR$(MOD(A,256)) LET B$=CHR$(INT(A/256)) LET MKI$=A$ & B$ END FUNCTION
EXTERNAL SUB RGB(X,R,G,B) LET B=MOD(INT(X/65536),256) LET G=MOD(INT(X/256),256) LET R=MOD(X,256) END SUB
EXTERNAL SUB GETPOINT(X,Y,R,G,B) ASK PIXEL VALUE (X,Y) C CALL RGB(C,R,G,B) END SUB
EXTERNAL SUB PICTURELOAD(N$,XSIZE,YSIZE) SET COLOR MODE "NATIVE" CLEAR SET POINT STYLE 1 GLOAD N$ LET XSIZE=PIXELX(1)+1 LET YSIZE=PIXELY(1)+1 SET BITMAP SIZE XSIZE,YSIZE SET WINDOW 0,XSIZE-1,YSIZE-1,0 END SUB
|