home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Graphics / PerfectPaint / rexx / line / Arrows.rx < prev    next >
Text File  |  1999-05-18  |  2KB  |  128 lines

  1. /* Arrow */
  2.  
  3.     call addlib("rexxmathlib.library", 5, -30, 0)
  4.  
  5.     options results
  6.   parse ARG Port x y x2 y2 b 
  7.     ADDRESS value Port
  8.     pp_UpdateUndo
  9.  
  10.     Pi=3.1415926
  11.  
  12.     DXX=x2-x+1;DYY=y2-y+1
  13.  
  14.   XX=x;YY=y;XX2=x2;YY2=y2
  15.  
  16.     pp_GetPenSize
  17.     P=result*3
  18.  
  19.     pp_GetPenType
  20.     T=result
  21.  
  22.     pp_GetAlias
  23.     Alias=result
  24.  
  25.     pp_AliasOn
  26.  
  27.     if T=0 then
  28.     DO
  29.         pp_PenType 1;pp_PenSize 1;P=3
  30.     END
  31.  
  32.     pp_line x y x2 y2
  33.  
  34.     if T=0 then;DO;pp_PenSize 2;END
  35.  
  36.     If x>x2 then DO;tx=x;x=x2;x2=tx;ty=y;y=y2;y2=ty;END
  37.  
  38.     If y=y2 or x=x2 then DO;tx=XX;XX=XX2;XX2=tx;ty=YY;YY=YY2;YY2=ty;END
  39.  
  40.     Dx=abs(x2-x)+1;Dy=abs(y2-y)+1
  41.     If y>y2 then DO
  42.       Prot=0.5*Pi+ATan(Dx/Dy)
  43.         END
  44.         ELSE
  45.         DO
  46.       Prot=0.5*Pi-ATan(Dx/Dy)
  47.         END
  48.  
  49.         if x=x2 then DO;Prot=90*Pi/180;END
  50.         if y=y2 then DO;Prot=0;END
  51.  
  52.         co=Cos(Prot);si=Sin(Prot)
  53.  
  54.     if DXX<0 then DO
  55.         if DYY<0 then
  56.         DO
  57.             Z=-1
  58.         END
  59.         ELSE
  60.         DO
  61.             Z=1
  62.         END
  63.     END
  64.     ELSE
  65.     DO
  66.         if DYY<0 then
  67.         DO
  68.             Z=-1
  69.         END
  70.         ELSE
  71.         DO
  72.             Z=1
  73.         END                
  74.     END
  75.  
  76.     if y=y2 & DXX<0 then DO;Z=-1;END
  77.  
  78.     If DYY<0 or DXX<0 then DO
  79.         rox.0=XX+(1.5*P)*Z;roy.0=YY-(P)*Z
  80.       rox.1=XX+(1.5*P)*Z;roy.1=YY+(P)*Z
  81.         DO i=0 to 1
  82.         j=rox.i;k=roy.i
  83.         rox.i=trunc((j-XX)*co-(k-YY)*si+XX+0.5,3)
  84.         roy.i=trunc((j-XX)*si+(k-YY)*co+YY+0.5,3)
  85.       END
  86.         pp_AliasOff
  87.         pp_STARTpoly
  88.         pp_AddPoly rox.0 roy.0
  89.         pp_AddPoly rox.1 roy.1
  90.         pp_Addpoly XX YY
  91.         pp_AddPoly rox.0 roy.0        
  92.         pp_EndPolyF 
  93.         pp_AliasOn
  94.         pp_STARTpoly
  95.         pp_AddPoly rox.0 roy.0
  96.         pp_AddPoly rox.1 roy.1
  97.         pp_Addpoly XX YY
  98.         pp_AddPoly rox.0 roy.0        
  99.         pp_EndPoly
  100.     END
  101.     ELSE
  102.     DO
  103.       rox.2=XX2-(1.5*P)*Z;roy.2=YY2-(P)*Z
  104.       rox.3=XX2-(1.5*P)*Z;roy.3=YY2+(P)*Z
  105.         DO i=2 to 3
  106.         j=rox.i;k=roy.i
  107.         rox.i=trunc((j-XX2)*co-(k-YY2)*si+XX2+0.5,3)
  108.         roy.i=trunc((j-XX2)*si+(k-YY2)*co+YY2+0.5,3)
  109.       END
  110.         pp_AliasOff
  111.         pp_STARTpoly
  112.         pp_Addpoly XX2 YY2
  113.         pp_AddPoly rox.2 roy.2
  114.         pp_AddPoly rox.3 roy.3
  115.         pp_AddPoly XX2 YY2
  116.         pp_EndPolyF
  117.         pp_AliasOn
  118.         pp_STARTpoly
  119.         pp_Addpoly XX2 YY2
  120.         pp_AddPoly rox.2 roy.2
  121.         pp_AddPoly rox.3 roy.3
  122.         pp_AddPoly XX2 YY2
  123.         pp_EndPoly
  124.     END
  125.  
  126.     if T=0 then;DO;pp_PenType 0;END
  127.     if Alias=0 then DO;pp_AliasOff;END
  128.