home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 344b.lha / plplot_v2.6 / drivers / README < prev   
Encoding:
Text File  |  1990-01-27  |  3.2 KB  |  80 lines

  1. Making a new driver is pretty easy.  If you can write a C program that
  2. can draw a line on the given device, you can probably write a plplot
  3. driver for it.
  4.  
  5. Overview
  6. The best way to create a new driver is to start with one of the old ones.
  7. At the minimum you will need to supply routines to (1) open/initialize the
  8. device, (2) draw a line between two points on the device, and (3) close
  9. the device.  These three routines are discussed further below.
  10. After writing the routines you will need to update the dispatch table
  11. (dispatch.c) in the drivers directory.
  12.  
  13. The initialization routine.
  14.    This routine is of type void and takes no arguments. This routine
  15.    sets up the resolution and page size for plplot. It accomplishes this
  16.    by calling the following routines:
  17.  
  18.    (1) setpxl(float x, float y)  
  19.        Set the resolution in dots per mm in the x and y directions.
  20.        example -- setpxl(40.,40.)    40 dots/mm or 1016 dpi
  21.  
  22.    (2) setphy(int minx, int maxx, int miny, int maxy)
  23.        Set the min and max page coordinates for the device.  The values
  24.        passed to your line drawing routine will be within this range.
  25.        example -- setphy(0,10299,0,7649)
  26.  
  27.    (3) scol(int color) 
  28.        Set default pen color.
  29.        example -- scol(1)
  30.        
  31.    (4) swid(int width)
  32.        Set default pen width.
  33.        example -- swid(1)
  34.  
  35.    (5) smod(int mode)
  36.        Set/clear interactive device flag. If mode == 1 device is interactive
  37.        i.e. a terminal (plplot will wait for user input before clearing
  38.        the screen). If mode == 0 device is not interactive.
  39.        example -- smod(0) 
  40.  
  41.     Portrait/landscape mode of plotting is set by the driver.  See the
  42.     supplied drivers for one method of doing this.  If you are writing
  43.     a new dirver you might want to ignore this for now (add it in later).
  44.  
  45. The line drawing routine
  46.     This should be of type void. It should draw a line between two points
  47.     It takes the following integer arguments
  48.        x1 - x coord of first point
  49.        y1 - y coord of first point
  50.        x2 - x coord of second point
  51.        y2 - y coord of second point
  52.     These will all be within the range specified by setphy() in the
  53.     initialization routine.
  54.  
  55. The close/tidy routine
  56.     This is of type void. It takes no arguments.  Use it to cleanup
  57.     and recover any allocated resources.
  58.  
  59.  
  60. Updating the dispatch table
  61.     You'll need to update the dispatch table in dispatch.c.
  62.     Add the function declarations for your 3 driver routines to the
  63.     others near the top of the file. Update the dispatch table.
  64.     The first entry is a character string that is printed out in
  65.     the device selection menu.  The 4th entry should be the name
  66.     of your initialization routine. The 5th your line routine and the
  67.     8th your close/tidy routine.  All the others can be set to NULL
  68.     (You'll probably want to add these later).
  69.  
  70.  
  71. Note: I've noticed that the pattern fill routines mess up on low
  72. resolution devices. I got around this by faking plplot into thinking
  73. that the device has high resolution by using setpxl() and setphy()
  74. to make a high resolution virtual page.  I then scale down the values
  75. I receive in the line drawing routine before passing them on to the
  76. device. An example of this is in the iff driver.
  77.  
  78. Tony
  79. resolution 
  80.