DEF FN_parse(O%,T%,C$,U%)
LOCAL D%,V%,R%:DIM V% LOCAL 15
D%=FN_instr(C$,".","(",")",1)
WHILE D%
SYS !(!O%+4),O%
R%=FN_checkargs(O%,3,LEFT$(C$,D%-1),V%)
IF R% THEN =R%
SYS !(!O%+8),O%
O%=V%!8
C$=MID$(C$,D%+1)
D%=FN_instr(C$,".","(",")",1)
ENDWHILE
=FN_checkargs(O%,T%,C$,U%)
REM. Demonstration of GDI+ library
LineEndSquare = 1
LineEndRound = 2
LineEndTriangle = 3
LineEndSquareAnchor = &11
LineEndRoundAnchor = &12
LineEndDiamond = &13
LineEndArrow = &14
LineStartSquare = &100
LineStartRound = &200
LineStartTriangle = &300
LineStartSquareAnchor = &1100
LineStartRoundAnchor = &1200
LineStartDiamond = &1300
LineStartArrow = &1400
LineDash = &10000
LineDot = &20000
LineDashDot = &30000
LineDashDotDot = &40000
INSTALL @lib$+"GDIPLIB_"
VDU 23,22,640;480;8,16,16,128
PROC_gdipinit
REM Near-horizontal line to demonstrate antialiasing
pencolour% = &FFFF0000 : REM. Opaque red
penstyle% = LineStartArrow + LineEndArrow
penwidth = 4.0
pen% = FN_gdipcreatepen(pencolour%, penstyle%, penwidth)
PROC_gdipline(pen%, 0, 200, 1280, 210)
PROC_gdipdeletepen(pen%)
REM Near vertical line to demonstrate antialiasing
pencolour% = &FF008000 : REM. Opaque dark green
penstyle% = LineDashDot
penwidth = 2.0
pen% = FN_gdipcreatepen(pencolour%, penstyle%, penwidth)
PROC_gdipline(pen%, 200, 0, 210, 960)
PROC_gdipdeletepen(pen%)
REM Bezier curve from four control points
pencolour% = &FF0000FF : REM. Opaque blue
penstyle% = LineStartRound + LineEndArrow
penwidth = 5.0
pen% = FN_gdipcreatepen(pencolour%, penstyle%, penwidth)
PROC_gdipbezier(pen%, 20, 20, 200, 200, 400, 600, 800, 600)
PROC_gdipdeletepen(pen%)
REM Ellipse made from 360-degree arc
pencolour% = &A0FF8000 : REM. Translucent orange
penstyle% = 0
penwidth = 3.0
pen% = FN_gdipcreatepen(pencolour%, penstyle%, penwidth)
PROC_gdiparc(pen%, 500, 500, 150, 100, 0, 360)
LINE 500, 500, 500, 500
PROC_gdipdeletepen(pen%)
REM Filled sector, 3/4 of an ellipse
brushcolour% = &FFFF00FF : REM. Opaque magenta
brush% = FN_gdipcreatebrush(brushcolour%)
PROC_gdipsector(brush%, 900, 800, 100, 150, 90, 270)
LINE 900, 800, 900, 800
PROC_gdipdeletebrush(brush%)
REM Filled five-pointed star
brushcolour% = &FF808080 : REM. Opaque grey
brush% = FN_gdipcreatebrush(brushcolour%)
DIM X(4), Y(4)
X() = 1100,900,1060,1000,940
Y() = 430,430,320,500,320
PROC_gdippolygon(brush%, 5, X(), Y(), 0)
*GSAVE alternate 900,320,200,180
PROC_gdippolygon(brush%, 5, X(), Y(), 1)
*GSAVE winding 900,320,200,180
PROC_gdipdeletebrush(brush%)
REM Square drawn with polyline
pencolour% = &FF000000 : REM. Opaque black
penstyle% = 0
penwidth = 2.0
pen% = FN_gdipcreatepen(pencolour%, penstyle%, penwidth)
DIM xx(4), yy(4)
xx() = 500,500,600,600,500
yy() = 700,800,800,700,700
PROC_gdippolyline(pen%, 5, xx(), yy())
PROC_gdipdeletepen(pen%)
REM Angled ellipse drawn with polybezier
pencolour% = &FF00FF00 : REM. Opaque bright greenn
penstyle% = 0
penwidth = 2.0
pen% = FN_gdipcreatepen(pencolour%, penstyle%, penwidth)
PROCgdipellipse(pen%, 350, 800, 50, 100, PI/4)
PROC_gdipdeletepen(pen%)
PROC_gdipexit
END
DEF PROCgdipellipse(pen%, x, y, a, b, t)
LOCAL c, d, o, p, q, r, x(), y()
DIM x(12), y(12)
c=a*SIN(t) : a=a*COS(t)
d=b*SIN(t) : b=b*COS(t)
o=a*0.552285 : q=c*0.552285
p=b*0.552285 : r=d*0.552285
x() = x-a,x-a-r,x-o-d,x-d,x+o-d,x+a-r,x+a,x+a+r,x+o+d,x+d,x-o+d,x-a+r,x-a
y() = y+c,y-p+c,y-b+q,y-b,y-b-q,y-p-c,y-c,y+p-c,y+b-q,y+b,y+b+q,y+p+c,y+c
PROC_gdippolybezier(pen%, 13, x(), y())
ENDPROC
REM Wrapper for GDIPLIB
DEF FN_gdipcreatepen(C%, S%, w)
DEF FN_gdipcreatebrush(C%)
DEF PROC_gdipdeletepen(P%)
DEF PROC_gdipdeletebrush(B%)
DEF PROC_gdipline(P%, x1, y1, x2, y2)
DEF PROC_gdippolyline(P%, N%, x(), y())
DEF PROC_gdipbezier(P%, x1, y1, x2, y2, x3, y3, x4, y4)
DEF PROC_gdippolybezier(P%, N%, x(), y())
DEF PROC_gdiparc(P%, xc, yc, xr, yr, as, ad)
DEF PROC_gdipsector(B%, xc, yc, xr, yr, as, ad)
DEF PROC_gdippolygon(B%, N%, x(), y(), M%)
DEF FN_gdipg
DEF PROC_gdipinit : PROC_gdip_redirect : PROC_gdipinit : ENDPROC
DEF PROC_gdipexit
DEF PROC_bbc2api(RETURN x, RETURN y)
DEF FN_f4(A#)
etc...
REM Wrapper for GDIPLIB
DEF FN_gdipcreatepen(C%, S%, w)
DEF FN_gdipcreatebrush(C%)
DEF PROC_gdipdeletepen(P%)
DEF PROC_gdipdeletebrush(B%)
DEF PROC_gdipline(P%, x1, y1, x2, y2)
DEF PROC_gdippolyline(P%, N%, x(), y())
DEF PROC_gdipbezier(P%, x1, y1, x2, y2, x3, y3, x4, y4)
DEF PROC_gdippolybezier(P%, N%, x(), y())
DEF PROC_gdiparc(P%, xc, yc, xr, yr, as, ad)
DEF PROC_gdipsector(B%, xc, yc, xr, yr, as, ad)
DEF PROC_gdippolygon(B%, N%, x(), y(), M%)
DEF FN_gdipg
DEF PROC_gdipinit : PROC_gdip_redirect : PROC_gdipinit
DEF PROC_gdipexit
DEF PROC_bbc2api(RETURN x, RETURN y)
DEF FN_f4(A#)
ENDPROC