home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_01_02 / 1n02025b < prev    next >
Text File  |  1990-07-09  |  2KB  |  45 lines

  1.  
  2. #include        <stdio.h>
  3.  
  4. /******************************************************************
  5. *       lj_bar3d - draw a 3 dimensional bar for a bar chart
  6. *
  7. *       Parameters:
  8. *       left (in) - left edge of bar in dots
  9. *               top (in) - top edge of bar in dots
  10. *               right (in) - right edge of bar in dots
  11. *               bottom (in) - bottom edge of bar in dots
  12. *               pattern (in) - fill pattern to use
  13. *               depth (in) - depth of 3 dimensional effect in dots
  14. *               topflag (in) - true for top bar, false for others
  15. *
  16. *       Notes:
  17. *               1.  A depth equal to 25% of the width works out well.
  18. *
  19. *               2.      Valid patterns are 1 through 6.
  20. *
  21. *       Copyright:
  22. *               Original code by William H. Roetzheim (619) 669-6970
  23. **********************************************************************/
  24.  
  25. void    lj_bar3d(int left, int top, int right, int bottom, int pattern,
  26.                  int depth, int topflag)
  27. {
  28.  
  29.         /* first draw body of bar */
  30.         fprintf(stdprn, "\033*p%dx%dY", left, top);             /* position cursor */
  31.         fprintf(stdprn, "\033*c%dA", right - left);             /* bar width */
  32.         fprintf(stdprn, "\033*c%dB", bottom - top);             /* bar height */
  33.         fprintf(stdprn, "\033*c%dG", pattern);                  /* pattern */
  34.         fprintf(stdprn, "\033*c3P");                                    /* print the bar */
  35.  
  36.         /* now draw the 3d effect */
  37.         if (topflag)
  38.         {
  39.                 lj_line(left, top, left + depth, top - depth);
  40.                 lj_line(left + depth, top - depth, right + depth, top - depth);
  41.                 lj_line(right + depth, top - depth, right, top);
  42.                 lj_line(right + depth, top - depth, right + depth, bottom - depth);
  43.         }
  44. }
  45.