|
長さと角度をスライドバーで指定します。
スライドバーを動かした後、グラフィックウィンドゥ内をマウスでクリックしてください。
OPTION BASE 0
FILE GETNAME N$,"BMP,JPG,GIF,PNGファイル|*.BMP;*.JPG;*.GIF;*.PNG"
CALL PICTURELOAD(N$,XSIZE,YSIZE)
DIM M(XSIZE-1,YSIZE-1),MM(XSIZE-1,YSIZE-1)
ASK PIXEL ARRAY(0,0) M
LOCATE VALUE NOWAIT(1),RANGE 1 TO MIN(XSIZE,YSIZE)/5,AT 10:LENGTH
LOCATE VALUE NOWAIT(2),RANGE 0 TO 89,AT 45:TH
DO
LET LENGTH=INT(LENGTH)
LET TH=INT(TH)
CLEAR
SET TEXT HEIGHT YSIZE/10
SET COLOR COLORINDEX(0,0,0)
SET TEXT BACKGROUND "OPAQUE"
SET TEXT JUSTIFY "CENTER" , "TOP"
PLOT TEXT ,AT XSIZE/2,YSIZE/2 :"処理中"
FOR Y=0 TO YSIZE-1
SET TEXT JUSTIFY "LEFT" , "TOP"
PLOT TEXT ,AT 0,0 :USING$("###.#",Y/(YSIZE-1)*100)&"%"
FOR X=0 TO XSIZE-1
IF GETKEYSTATE(32)<0 OR GETKEYSTATE(13)<0 OR GETKEYSTATE(27)<0 THEN STOP
LET R=0
LET G=0
LET B=0
FOR L=0 TO LENGTH-1
IF GETKEYSTATE(32)<0 OR GETKEYSTATE(13)<0 OR GETKEYSTATE(27)<0 THEN STOP
LET XX=X+COS(TH*PI/180)*L
LET YY=Y+SIN(TH*PI/180)*L
IF XX>=0 AND XX<=XSIZE-1 AND YY>=0 AND YY<=YSIZE-1 THEN LET CC=M(INT(XX),INT(YY)) ELSE EXIT FOR
CALL RGB(CC,R0,G0,B0)
LET R=R+R0
LET G=G+G0
LET B=B+B0
NEXT L
LET R=INT(R/(L+1))
LET G=INT(G/(L+1))
LET B=INT(B/(L+1))
LET MM(X,Y)=SETRGB(R,G,B)
NEXT X
NEXT Y
MAT PLOT CELLS , IN 0,0; XSIZE-1,YSIZE-1:MM
DO !'ウェイト。マウスでウィンドゥ内をクリックする。
IF GetKeyState(32)<0 OR GetKeyState(13)<0 OR GetKeyState(27)<0 THEN STOP
MOUSE POLL X,Y,LL,RR
LOCATE VALUE NOWAIT(1):LENGTH
LOCATE VALUE NOWAIT(2):TH
LOOP WHILE LL=0 AND RR=0
LOOP
END
EXTERNAL FUNCTION SETRGB(R,G,B)
LET R=MIN(255,MAX(R,0))
LET G=MAX(0,MIN(G,255))
LET B=MAX(0,MIN(B,255))
LET SETRGB=B*65536+G*256+R
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 PICTURELOAD(N$,XSIZE,YSIZE)
CLEAR
SET COLOR MODE "NATIVE"
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
|
|