home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / sampler / 03 / bgi-rect / roundrct.src < prev    next >
Encoding:
Text File  |  1988-01-29  |  1.7 KB  |  38 lines

  1. {->>>>RoundedRectangle<<<<-------------------------------------}
  2. {                                                              }
  3. { Filename : ROUNDRCT.SRC -- Last Modified 1/23/88             }
  4. {                                                              }
  5. {                            by Jeff Duntemann                 }
  6. {                            Turbo Pascal V4.0                 }
  7. {                                                              }
  8. { This routine draws a rectangle at X,Y; Width pixels wide and }
  9. { Height pixels high; with rounded corners of radius R.        }
  10. {                                                              }
  11. { The Graph unit must be USED for this procedure to compile.   }
  12. {                                                              }
  13. { From COMPLETE TURBO PASCAL, Third Edition, by Jeff Duntemann }
  14. {        Scott, Foresman & Co. 1988  ISBN 0-673-38355-5        }
  15. {--------------------------------------------------------------}
  16.  
  17. PROCEDURE RoundedRectangle(X,Y,Width,Height,R : Word);
  18.  
  19. VAR
  20.   ULData,LLData,LRData,URData : ArcCoordsType;
  21.  
  22. BEGIN
  23.   { First we draw each corner arc and save its coordinates: }
  24.   Arc(X+R,Y+R,90,180,R);
  25.   GetArcCoords(ULData);
  26.   Arc(X+R,Y+Height-R,180,270,R);
  27.   GetArcCoords(LLData);
  28.   Arc(X+Width-R,Y+Height-R,270,360,R);
  29.   GetArcCoords(LRData);
  30.   Arc(X+Width-R,Y+R,0,90,R);
  31.   GetArcCoords(URData);
  32.   { Next we draw the four connecting lines: }
  33.   Line(ULData.XEnd,ULData.YEnd,LLData.XStart,LLData.YStart);
  34.   Line(LLData.XEnd,LLData.YEnd,LRData.XStart,LRData.YStart);
  35.   Line(LRData.XEnd,LRData.YEnd,URData.XStart,URData.YStart);
  36.   Line(URData.XEnd,URData.YEnd,ULData.XStart,ULData.YStart);
  37. END;
  38.