PSDファイルを作る(Ver 2.5)
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(.PSD)=":F$ IF POS(F$,".")=0 THEN LET F$=F$ & ".PSD" CALL PSDSAVE(F$,0,0,XSIZE-1,YSIZE-1) END
EXTERNAL SUB PSDSAVE(F$,XS,YS,XE,YE) OPTION CHARACTER BYTE IF F$="" THEN STOP LET XSIZE=XE-XS+1 LET YSIZE=YE-YS+1 OPEN #1:NAME F$,ACCESS OUTPUT PRINT #1:"8BPS"; PRINT #1:MKI2$(1); PRINT #1:REPEAT$(CHR$(0),6); PRINT #1:MKI2$(3); PRINT #1:MKL2$(YSIZE); PRINT #1:MKL2$(XSIZE); PRINT #1:MKI2$(8); PRINT #1:MKI2$(3); PRINT #1:REPEAT$(CHR$(0),12); PRINT #1:MKI2$(0); FOR Y=YS TO YE FOR X=XS TO XE CALL GETPOINT(X,Y,R,G,B) PRINT #1:CHR$(R); NEXT X NEXT Y FOR Y=YS TO YE FOR X=XS TO XE CALL GETPOINT(X,Y,R,G,B) PRINT #1:CHR$(G); NEXT X NEXT Y FOR Y=YS TO YE FOR X=XS TO XE CALL GETPOINT(X,Y,R,G,B) PRINT #1:CHR$(B); NEXT X NEXT Y CLOSE #1 END SUB
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
EXTERNAL FUNCTION MKI2$(A) !'BIG-ENDIAN 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 MKI2$=B$ & A$ END FUNCTION
EXTERNAL FUNCTION MKL2$(A) !'BIG-ENDIAN OPTION CHARACTER BYTE DECLARE STRING A$,B$,C$,D$ IF A<0 THEN LET A=A+2^32 LET A$=CHR$(MOD(A,256)) LET B$=CHR$(MOD(INT(A/256),256)) LET C$=CHR$(MOD(INT(A/65536),256)) LET D$=CHR$(MOD(INT(A/16777216),256)) LET MKL2$=D$ & C$ & B$ & A$ END FUNCTION
|