home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / progem.lzh / apndx7.prf < prev    next >
Encoding:
Text File  |  1987-06-23  |  3.2 KB  |  105 lines

  1. .!****************************************************************************
  2. .! 
  3. .! ANTIC PUBLISHING INC., COPYRIGHT 1985.  REPRINTED BY PERMISSION.
  4. .!
  5. .! ** Professional GEM ** by Tim Oren
  6. .!
  7. .! Proff File by ST enthusiasts at
  8. .! Case Western Reserve University
  9. .! Cleveland, Ohio
  10. .! uucp : decvax!cwruecmp!bammi
  11. .! csnet: bammi@case
  12. .! arpa : bammi%case@csnet-relay
  13. .! compuserve: 71515,155
  14. .!
  15. .!****************************************************************************
  16. .!
  17. .!            Begin Appendix 7
  18. .!
  19. .!***************************************************************************
  20. .!
  21. .!
  22. .AP VII Sample Code for Part IX
  23. /*
  24. >>>>>>>>>>>>>>>> Routines to set clip to a GRECT <<<<<<<<<<<<<<<<
  25. */
  26.  
  27.         VOID
  28. grect_to_array(area, array)     /* convert x,y,w,h to upr lt x,y and    */
  29.         GRECT   *area;          /*                    lwr rt x,y        */
  30.         WORD    *array;
  31.         {
  32.         *array++ = area->g_x;
  33.         *array++ = area->g_y;
  34.         *array++ = area->g_x + area->g_w - 1;
  35.         *array = area->g_y + area->g_h - 1;
  36.         }
  37.  
  38.         VOID
  39. set_clip(clip_flag, s_area)     /* set clip to specified area           */
  40.         WORD    clip_flag;
  41.         GRECT   *s_area;
  42.         {
  43.         WORD    pxy[4];
  44.  
  45.         grect_to_array(s_area, pxy);
  46.         vs_clip(vdi_handle, clip_flag, pxy);
  47.         }
  48. .bp
  49. /*
  50. >>>>>>>>>> Routines to set attributes before output <<<<<<<<<<<<
  51. */
  52.         VOID
  53. rr_perim(mode, color, type, width, pxy)      /* Draw a rounded    */
  54.         WORD    mode, color, width, *pxy;    /* rectangle outline */
  55.         {
  56.         vswr_mode(vdi_handle, mode);
  57.         vsl_color(vdi_handle, color);
  58.         vsl_type(vdi_handle, type);
  59.         vsl_width(vdi_handle, width);
  60.         v_rbox(vdi_handle, pxy);
  61.         vswr_mode(vdi_handle, MD_REPLACE);
  62.         }
  63.  
  64.         VOID
  65. pl_perim(mode, type, color, width, npts, pxy)     /* Draw a polygonal */
  66.                                                   /* figure           */
  67.         WORD    mode, type, color, width, npts, *pxy;
  68.         {
  69.         vswr_mode(vdi_handle, mode);
  70.         vsl_type(vdi_handle, type);
  71.         vsl_color(vdi_handle, color);
  72.         vsl_width(vdi_handle, width);
  73.         v_pline(vdi_handle, npts, pxy);
  74.         }
  75.  
  76.         VOID                  /* Draw a filled polygonal area */
  77. pl_fill(mode, perim, color, interior, style, npts, pxy)
  78.         WORD    mode, perim, color, interior, style, npts, *pxy;
  79.         {
  80.         vswr_mode(vdi_handle, mode);
  81.         vsf_color(vdi_handle, color);
  82.         vsf_style(vdi_handle, style);
  83.         vsf_interior(vdi_handle, interior);
  84.         vsf_perimeter(vdi_handle, perim);
  85.         v_fillarea(vdi_handle, npts, pxy);
  86.         }
  87.  
  88.         VOID                  /* Draw a filled rectangle    */
  89. rect_fill(mode, perim, color, interior, style, pxy)
  90.         WORD    mode, perim, color, style, interior, *pxy;
  91.         {
  92.         vswr_mode(vdi_handle, mode);
  93.         vsf_color(vdi_handle, color);
  94.         vsf_style(vdi_handle, style);
  95.         vsf_interior(vdi_handle, interior);
  96.         vsf_perimeter(vdi_handle, perim);
  97.         vr_recfl(vdi_handle, pxy);
  98.         }
  99. .!
  100. .!****************************************************************************
  101. .!
  102. .!            End Appendix 7
  103. .!
  104. .!****************************************************************************
  105.