home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / toollib_2 / Examples / Tree / Builds / c / line_plott < prev    next >
Encoding:
Text File  |  1995-11-22  |  983 b   |  48 lines

  1. /*** line_plotter.c ***/
  2. /* A line_processor that plots lines
  3.  * (This implementation is for the RISC OS operating system and uses OSLib function calls)
  4.  * (c) Paul Field
  5.  * v1.00 - 21/11/95
  6.  */
  7.  
  8. #include "line_plotter.h"
  9.  
  10. #include "os.h"
  11. #include "colourtrans.h"
  12.  
  13.  
  14. static int origin_x;
  15. static int origin_y;
  16.  
  17.  
  18. static void line_plotter_initialise(void)
  19.  {}
  20.  
  21.  
  22.  
  23. static void line_plotter_add_line(colour c, int x0, int y0, int x1, int y1)
  24.  { os_colour converted_colour;
  25.  
  26.    converted_colour = (os_colour)(c << 8);  /* An os_colour is of the form BGR0 */
  27.  
  28.    colourtrans_set_gcol(converted_colour, 0, os_ACTION_OVERWRITE, NULL);
  29.    os_plot(os_MOVE_TO, x0+origin_x, y0+origin_y);
  30.    os_plot(os_PLOT_SOLID + os_PLOT_TO, x1+origin_x, y1+origin_y);
  31.  }
  32.  
  33.  
  34.  
  35. static void line_plotter_finished(void)
  36.  {}
  37.  
  38.  
  39.  
  40. void line_plotter_origin(int x, int y)
  41.  { origin_x = x;
  42.    origin_y = y;
  43.  }
  44.  
  45.  
  46.  
  47. const line_processor line_plotter = { line_plotter_initialise, line_plotter_add_line, line_plotter_finished };
  48.