|
!'ドーナツ形変換 (R1>0の時)
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
CLEAR
LET R1=50 !' R1=0で円形変換
LET YYSIZE=YSIZE*2+2*R1
LET XXSIZE=YYSIZE
CALL GINIT(XXSIZE,YYSIZE)
FOR YS=0 TO YSIZE-1 STEP .25
FOR XS=0 TO XSIZE-1 STEP .25
LET TH=(XSIZE-1-XS)/(XSIZE-1)*359-90
LET R=YS
LET XX=(R+R1)*COS(RAD(TH))
LET YY=(R+R1)*SIN(RAD(TH))
LET C=M(XS,YS)
CALL RGB(C,RR,GG,BB)
CALL PSET(XX+XXSIZE/2,YY+YYSIZE/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
|
|