|
LET A$="(仮称)十進BASIC"
LET XSIZE=945
LET YSIZE=125
LET N=XSIZE/5
LET M=YSIZE/5
CALL GINIT(XSIZE,YSIZE)
LET H=100
SET TEXT FONT "MS 明朝" ,0
SET TEXT HEIGHT H
SET COLOR COLORINDEX(1,1,1)
PLOT TEXT ,AT 0,0 :A$
FILE GETSAVENAME F$,"dxfファイル|*.dxf"
IF F$="" THEN STOP
IF POS(UCASE$(F$),".DXF")=0 THEN LET F$=F$ & ".dxf"
OPEN #1:NAME F$
ERASE #1
PRINT #1:"0"
PRINT #1:"SECTION"
PRINT #1:"2"
PRINT #1:"ENTITIES"
LET XS=XSIZE/N
LET ZS=YSIZE/M
FOR X=0 TO XSIZE-1-XS STEP XS
FOR Z=0 TO YSIZE-1-ZS STEP ZS
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X
PRINT #1:"20"
CALL GETPOINT(X,Z,R,G,B) !'濃度値を高さへ
LET Y=.299*R+.587*G+.114*B
PRINT #1:Y/5
PRINT #1:"30"
PRINT #1:Z
PRINT #1:"11"
PRINT #1:X+XS
PRINT #1:"21"
CALL GETPOINT(X+XS,Z,R,G,B)
LET Y=.299*R+.587*G+.114*B
PRINT #1:Y/5
PRINT #1:"31"
PRINT #1:Z
PRINT #1:"12"
PRINT #1:X+XS
PRINT #1:"22"
CALL GETPOINT(X+XS,Z+ZS,R,G,B)
LET Y=.299*R+.587*G+.114*B
PRINT #1:Y/5
PRINT #1:"32"
PRINT #1:Z+ZS
PRINT #1:"13"
PRINT #1:X
PRINT #1:"23"
CALL GETPOINT(X,Z+ZS,R,G,B)
LET Y=.299*R+.587*G+.114*B
PRINT #1:Y/5
PRINT #1:"33"
PRINT #1:Z+ZS
NEXT Z
NEXT X
PRINT #1:"0"
PRINT #1:"ENDSEC"
PRINT #1:"0"
PRINT #1:"EOF"
CLOSE #1
FOR X=0 TO XSIZE-1 STEP XS
FOR Z=0 TO YSIZE-1 STEP ZS
CALL LINE(0,Z,XSIZE-1-XS,Z,255,0,0)
CALL LINE(X,0,X,YSIZE-1-ZS,255,0,0)
NEXT Z
NEXT X
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 GETPOINT(X,Y,R,G,B)
ASK PIXEL VALUE (X,Y) C
CALL RGB(C,R,G,B)
END SUB
EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET COLOR MIX(0) 0,0,0
SET COLOR MODE "NATIVE"
CLEAR
SET POINT STYLE 1
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET TEXT JUSTIFY "LEFT" , "TOP"
END SUB
EXTERNAL SUB PSET(X,Y,R,G,B)
LET RR=MIN(255,MAX(0,INT(R)))
LET GG=MIN(255,MAX(0,INT(G)))
LET BB=MIN(255,MAX(0,INT(B)))
SET COLOR COLORINDEX(RR/255,GG/255,BB/255)
PLOT POINTS: X , Y
END SUB
EXTERNAL SUB LINE(X0,Y0,X1,Y1,R,G,B)
SET COLOR COLORINDEX(R/255,G/255,B/255)
PLOT LINES : X0,Y0;X1,Y1
END SUB
|
|