TIFFファイルを作る
OPTION CHARACTER BYTE FILE GETNAME F$, "BMP,JPG,GIFファイル|*.BMP;*.JPG;*.GIF" CALL PICTURELOAD(F$,XSIZE,YSIZE) INPUT PROMPT "SAVE FILENAME(.TIF)=":F$ IF POS(F$,".")=0 THEN LET F$=F$ & ".TIF" CALL TIFFSAVEFULL(F$,0,0,XSIZE-1,YSIZE-1) END
EXTERNAL SUB TIFFSAVEFULL(F$,XS,YS,XE,YE) OPTION CHARACTER BYTE LET XSIZE=XE-XS+1 LET YSIZE=YE-YS+1 OPEN #1:NAME F$ LET OFFSET=XSIZE*YSIZE*3+8 PRINT #1:"II"; PRINT #1:MKI$(42); PRINT #1:MKL$(OFFSET); FOR Y=YS TO YE FOR X=XS TO XE CALL GETPOINT(X,Y,R,G,B) PRINT #1:CHR$(R);CHR$(G);CHR$(B); NEXT X NEXT Y PRINT #1:MKI$(14); PRINT #1:MKI$(256);MKI$(3);MKL$(1);MKL$(XSIZE); PRINT #1:MKI$(257);MKI$(3);MKL$(1);MKL$(YSIZE); PRINT #1:MKI$(258);MKI$(3);MKL$(3); PRINT #1:MKL$(XSIZE*YSIZE*3+182); PRINT #1:MKI$(259);MKI$(3);MKL$(1);MKL$(1); PRINT #1:MKI$(262);MKI$(3);MKL$(1);MKL$(2); PRINT #1:MKI$(273);MKI$(4);MKL$(1);MKL$(8); PRINT #1:MKI$(274);MKI$(3);MKL$(1);MKL$(1); PRINT #1:MKI$(277);MKI$(3);MKL$(1);MKL$(3); PRINT #1:MKI$(278);MKI$(3);MKL$(1);MKL$(YSIZE); PRINT #1:MKI$(279);MKI$(4);MKL$(1); PRINT #1:MKL$(XSIZE * YSIZE * 3); PRINT #1:MKI$(280);MKI$(3);MKL$(3); PRINT #1:MKL$(XSIZE * YSIZE * 3 + 188); PRINT #1:MKI$(281);MKI$(3);MKL$(3); PRINT #1:MKL$(XSIZE * YSIZE * 3 + 194); PRINT #1:MKI$(284);MKI$(3);MKL$(1);MKL$(1); PRINT #1:MKI$(339);MKI$(3);MKL$(3); PRINT #1:MKL$(XSIZE * YSIZE * 3 + 200); PRINT #1:MKI$(0);MKI$(0); PRINT #1:MKI$(8);MKI$(8);MKI$(8); PRINT #1:MKI$(0);MKI$(0);MKI$(0); PRINT #1:MKI$(255);MKI$(255);MKI$(255); PRINT #1:MKI$(1);MKI$(1);MKI$(1); 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 FUNCTION MKL$(A) 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 MKL$=A$ & B$ & C$ & D$ 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
|