home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 20
/
AACD20.BIN
/
AACD
/
Graphics
/
PerfectPaint
/
rexx
/
line
/
Arrows.rx
< prev
next >
Wrap
Text File
|
1999-05-18
|
2KB
|
128 lines
/* Arrow */
call addlib("rexxmathlib.library", 5, -30, 0)
options results
parse ARG Port x y x2 y2 b
ADDRESS value Port
pp_UpdateUndo
Pi=3.1415926
DXX=x2-x+1;DYY=y2-y+1
XX=x;YY=y;XX2=x2;YY2=y2
pp_GetPenSize
P=result*3
pp_GetPenType
T=result
pp_GetAlias
Alias=result
pp_AliasOn
if T=0 then
DO
pp_PenType 1;pp_PenSize 1;P=3
END
pp_line x y x2 y2
if T=0 then;DO;pp_PenSize 2;END
If x>x2 then DO;tx=x;x=x2;x2=tx;ty=y;y=y2;y2=ty;END
If y=y2 or x=x2 then DO;tx=XX;XX=XX2;XX2=tx;ty=YY;YY=YY2;YY2=ty;END
Dx=abs(x2-x)+1;Dy=abs(y2-y)+1
If y>y2 then DO
Prot=0.5*Pi+ATan(Dx/Dy)
END
ELSE
DO
Prot=0.5*Pi-ATan(Dx/Dy)
END
if x=x2 then DO;Prot=90*Pi/180;END
if y=y2 then DO;Prot=0;END
co=Cos(Prot);si=Sin(Prot)
if DXX<0 then DO
if DYY<0 then
DO
Z=-1
END
ELSE
DO
Z=1
END
END
ELSE
DO
if DYY<0 then
DO
Z=-1
END
ELSE
DO
Z=1
END
END
if y=y2 & DXX<0 then DO;Z=-1;END
If DYY<0 or DXX<0 then DO
rox.0=XX+(1.5*P)*Z;roy.0=YY-(P)*Z
rox.1=XX+(1.5*P)*Z;roy.1=YY+(P)*Z
DO i=0 to 1
j=rox.i;k=roy.i
rox.i=trunc((j-XX)*co-(k-YY)*si+XX+0.5,3)
roy.i=trunc((j-XX)*si+(k-YY)*co+YY+0.5,3)
END
pp_AliasOff
pp_STARTpoly
pp_AddPoly rox.0 roy.0
pp_AddPoly rox.1 roy.1
pp_Addpoly XX YY
pp_AddPoly rox.0 roy.0
pp_EndPolyF
pp_AliasOn
pp_STARTpoly
pp_AddPoly rox.0 roy.0
pp_AddPoly rox.1 roy.1
pp_Addpoly XX YY
pp_AddPoly rox.0 roy.0
pp_EndPoly
END
ELSE
DO
rox.2=XX2-(1.5*P)*Z;roy.2=YY2-(P)*Z
rox.3=XX2-(1.5*P)*Z;roy.3=YY2+(P)*Z
DO i=2 to 3
j=rox.i;k=roy.i
rox.i=trunc((j-XX2)*co-(k-YY2)*si+XX2+0.5,3)
roy.i=trunc((j-XX2)*si+(k-YY2)*co+YY2+0.5,3)
END
pp_AliasOff
pp_STARTpoly
pp_Addpoly XX2 YY2
pp_AddPoly rox.2 roy.2
pp_AddPoly rox.3 roy.3
pp_AddPoly XX2 YY2
pp_EndPolyF
pp_AliasOn
pp_STARTpoly
pp_Addpoly XX2 YY2
pp_AddPoly rox.2 roy.2
pp_AddPoly rox.3 roy.3
pp_AddPoly XX2 YY2
pp_EndPoly
END
if T=0 then;DO;pp_PenType 0;END
if Alias=0 then DO;pp_AliasOff;END