|
!'双曲変換
FILE GETNAME F$,"BMP,JPG,GIF,PNGファイル|*.BMP;*.JPG;*.GIF;*.PNG"
CALL PICTURELOAD(F$,XSIZE,YSIZE)
DIM M(0 TO XSIZE-1,0 TO YSIZE-1)
ASK PIXEL ARRAY (0,0) M
!'双曲変換
!' X'=X/(A+ABS(Y))
!' Y'=Y/(B+ABS(X))
!'INPUT PROMPT "A=":A
!'INPUT PROMPT "B=":B
LET A=XSIZE/8
LET B=YSIZE/8
CLEAR
FOR YS=0 TO YSIZE-1 STEP .5
LET Y=YS-YSIZE/2
FOR XS=0 TO XSIZE-1 STEP .5
LET X=XS-XSIZE/2
LET XX=X/(A+ABS(Y))*A
LET YY=Y/(B+ABS(X))*B
LET C=M(INT(X+XSIZE/2),INT(Y+YSIZE/2))
CALL RGB(C,RR,GG,BB)
CALL PSET(XX+XSIZE/2,YY+YSIZE/2,RR,GG,BB)
NEXT XS
NEXT YS
END
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 GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET COLOR MODE "NATIVE"
CLEAR
SET POINT STYLE 1
SET WINDOW 0,XSIZE-1,YSIZE-1,0
END SUB
EXTERNAL SUB PSET(X,Y,R,G,B)
SET COLOR COLORINDEX(R/255,G/255,B/255)
PLOT POINTS:X,Y
END SUB
EXTERNAL SUB PICTURELOAD(N$,XSIZE,YSIZE)
SET COLOR MODE "NATIVE"
CLEAR
SET POINT STYLE 1
IF N$="" THEN STOP
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
|
|