home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / plot.zip / PLT.doc < prev    next >
Text File  |  1989-11-17  |  15KB  |  354 lines

  1.                                 PLT:
  2.                              Version 1.3
  3.                           November 16, 1989
  4.  
  5.                            Rich Champeaux
  6.                              Jim Miller
  7.  
  8.  
  9. NOTICE:  PLT: is not in the public domain.  We reserve all rights to both the
  10.          executable and the source.  PLT: may not be sold without expressed,
  11.          written permission of either Rich Champeaux or Jim Miller.  PLT: is
  12.          however, freely distributable provided that this file accompanies it.
  13.  
  14.  
  15. PLT: is a file-handler that emulates a plotter by accepting HP-GL commands, 
  16. creating a raster image, and then dumping it to any Preferences supported 
  17. graphics printer.  The current resolution set with preferences is used, 
  18. allowing PLT: to make full use of a printer's capability.  
  19.  
  20. PLT: accepts virtually all of the standard HP-GL commands, including scaling
  21. and text.  The commands that were not implemented are those which are
  22. generally contained in an extended graphics cartridge, such as: circles, 
  23. arcs, filled regions, etc.
  24.  
  25.  
  26. PLT: Features:
  27.  
  28.    - Lines are stored in a tree/linked list structure untill the handler is
  29.      closed or the command AF or PG is recieved.  The plot is then rasterized
  30.      and dumped to the printer in strips.  This allows plots to be printed
  31.      with resolutions and page sizes for which a raster for the entire page
  32.      would not fit in memory.
  33.      
  34.    - Pens can be assigned colors and thicknesses.  The pen colors are defined
  35.      by RGB values, and thicknesses are defined in pixel widths.  The pens
  36.      can be defined in an environment variable or when the handler is opened.
  37.      The number of bit planes used for the raster depends on the number of
  38.      different colors requested, not the number of pens.  Therefore, 7 black
  39.      pens and 5 red pens of various thicknesses, would only take 2 bit planes.
  40.    
  41.    - PLT: supports variable paper sizes.  It knows the standard paper sizes,
  42.      A, B, C, D, and E, and can also use the paper size defined by the limits 
  43.      fields of Preference's Graphic 2 screen.  The entire width of any dot
  44.      matrix printer supported by Preferences can be used, including wide 
  45.      carriage printers.  If the requested page size is too large to be 
  46.      printed, a requester is displayed, giving the option to reduce the size
  47.      of the plot (keeping the aspect ratio) to the maximum size of the 
  48.      printer.  The plot can also be reduced to the page size specified by 
  49.      Preferences.
  50.      
  51.    - PLT: has a preview mode that displays the plot on the screen.  The 
  52.      aspect ratio of the requested page is preserved.  This allows the plot 
  53.      to be displayed on the screen the way it will appear on paper.  
  54.      A 640 x 400 screen is used to provide maximum resolution.
  55.      
  56.    - PLT: v1.3 supports multiple, disk-resident fonts.  The fonts can be 
  57.      changed or created by the user.  An included program, 'cf', is used to
  58.      convert the fonts from a text representation of the vectors to a
  59.      format usable by PLT:.  Fonts are loaded in only when needed, and 
  60.      fonts can be changed durring a plot with the CS, CA, SS, and SA HP-GL
  61.      commands.  A standard ascii font and a math-greek font are included
  62.      with this release.
  63.    
  64.    - PLT: can also be used by programs that assume that a plotter is 
  65.      connected to the serial port by using the CMD command.  For example:
  66.         CMD serial.device PLT:
  67.    
  68.    - PLT: has two memory usage modes that it can run in: memory-squander and
  69.      memory-conserve.  The memory-squander mode sits a tree structure on top
  70.      of the linked list to speed up inserts.  The memory-conserve mode uses
  71.      only a linked list.  The memory-squander mode is much faster than the
  72.      memory-conserve mode since it's insert time is O(log2(n)), but it 
  73.      requires twice as much memory per line.  The memory-conserve mode's 
  74.      insert time is O(n), and becomes unbearably slow as the number of lines
  75.      becomes greater than about 8000.  The memory-conserve mode does, however,
  76.      allow twice as many lines to be plotted.  PLT: v1.3 defaults to the 
  77.      memory-squander mode and will automatically remove the tree and switch to
  78.      the memory-conserve mode when availble memory is less than 2k.
  79.  
  80. -----------------------------------------------------------------------------
  81.  
  82. Installing PLT:
  83.  
  84.    1) Copy the file 'plt-handler' to the L: directory.
  85.    2) Create a directory and assign "PLTDATA:" to it.
  86.    3) copy the files 'ascii', 'math-greek', and 'pltfontnames' to the
  87.       directory 'PLTDATA:'
  88.    4) Add the following to the mountlist:
  89.    
  90.       PLT:        Handler   = L:plt-handler
  91.                   StartUp   = P/000-1
  92.                   StackSize = 5000
  93.                   Priority  = 5
  94.                   GlobVec   = 1
  95.       #
  96.       
  97.       
  98.       (Note: the StartUp field is used to pass default parameters to the
  99.        handler.  It is explained below.)
  100.        
  101.    5) Mount the handler using the command 'mount PLT:'
  102.    
  103. -----------------------------------------------------------------------------
  104.  
  105. Switches and Pen Definitions:
  106.  
  107.    PLT:'s mode switches and pen definitions are recieved from three sources:
  108. the mountlist entry, an environment variable, and the file name path.  All
  109. three sources use the following format:
  110.  
  111.       SWITCHES/RGB-t/RGB-t/RGB-t...
  112.  
  113.       where:
  114.          SWITCHES could be:  A..E  Selects standard page sizes A,B,C,D, or E.
  115.                                    (default is A)
  116.          
  117.                                 P  Selects the page size specified by the 
  118.                                    limits fields of Preferences' Graphics 2
  119.                                    screen.
  120.                                    
  121.                                 R  Reduces the plot (keeping the aspect ratio)
  122.                                    to the size specified by the limits fields
  123.                                    of Preferences' Graphics 2 screen.
  124.                                    
  125.                                 S  Draws plot on preview screen.
  126.                                 
  127.                                 W  Displays a status window when plotting to
  128.                                    printer. (default)
  129.                                    
  130.                                 M  Forces PLT: to use the memory-conserve
  131.                                    mode.
  132.                                  
  133.                                 L  Makes the label command do a carriage
  134.                                    return when it receives a line feed.
  135.                                    This switch allows copatability with the
  136.                                    Amiga since the newline character on the 
  137.                                    amiga is a linefeed.
  138.                                    
  139.                      (A '-' can be prefixed to a switch to negate it.)
  140.          
  141.          Pens are described as: RGB-t
  142.             where:
  143.                                 RGB is the color of the pen in hex.
  144.                                 t   is the pen thickness in pixels. (optional,
  145.                                     defaults to 1).
  146.                                     
  147.       Ex.
  148.          SB/000-1/f00-3/0c3-2
  149.          -WP/0f0/000-2/f30
  150.          /000-1/0f0-1/f00-2
  151.          DRM
  152.          C-R/000-1
  153.          
  154.    The switches and pen definitions defined in the mountlist or the 
  155. environment variable "pltinfo" are used as the defaults for PLT:.  If the
  156. environment variable exists, the entry in the mountlist is ignored.  These
  157. defaults can be temparily overridden by the switches and pen definitions
  158. passed to PLT: as the file path (Ex. PLT:SB/000-1/f00-2).  The switches
  159. specified with the file path selectively override the defaults.  For
  160. example, if the defaults were 'SBWR' and the switches specified in the file
  161. path were '-S-R' then the S and R switches would be negated, but the other
  162. switches would be unaffected.  Defining pens in the file path, however,
  163. completly replaces the default pen definitions.  A maximum of 15 pens can
  164. be defined.  If a pen is selected whose number is greater than the total
  165. number of defined pens, then the pen number is MODed with the total number
  166. of defined pens.
  167.  
  168.    To define the switches and pen definitions in the mountlist, use the field
  169. 'StartUp'.
  170.  
  171.    Ex.      StartUp = P/000-1/f00-1/0f0-1/00f-1
  172.    
  173. The StartUp field appears to be limited to 39 characters and cannot start 
  174. with a '-'.  If you require more characters or a leading '-', use the 
  175. environment variable.
  176.  
  177.    The enviroment variable used is "pltinfo".  It is set in the following
  178. manner:
  179.  
  180.    setenv pltinfo P/000-1/f00-1/0f0-1/00f-1
  181.    
  182. The enviroment variable has the advantage of being easily changed after PLT:
  183. has been mounted.
  184.  
  185. -----------------------------------------------------------------------------
  186.  
  187. Fonts:
  188.  
  189.    The fonts of PLT: are disk resident and user modifiable.  The fonts are
  190. stored in the directory PLTDATA:.  A file in that directory, 'pltfontnames',
  191. contains the names of the fonts accessible to PLT:.  The file contains a list
  192. of font names, one name per line, that are to be associated with the font
  193. numbers 0 thru 50.  The fonts are selected using the HP-GL character set
  194. commands: CS, CA, SS, SA.  CS and CA designate the standard and alternate
  195. fonts, respectively.  SS is then used to make the standard font the current
  196. font, and SA is used to make the alternate font the standard font.  The 
  197. default font is font 0, which is the first font listed in the file 
  198. 'pltfontnames'.
  199.  
  200.    The fonts are described by a text file, whose name ends with the extension
  201. '.fnt', and then must be compiled with the program 'cf' before they can be 
  202. used by PLT:.  The characters consist of 1 or more strokes of the pen.  Each 
  203. character in the font has an entry which specifies the value of the character 
  204. and a list of end points describing each stroke of the pen.
  205.  
  206.    The first 2 numbers in the file contain the width and height of the
  207. character cell.  Large characters, such as capital letters should completely
  208. fill the cell, however, the characters are allowed to have end points that
  209. lie outside of the cell.
  210.  
  211.    The first line of each character entry consists of an '*' followed by the
  212. value of the character.  The remaining part of the line is a comment.  
  213. Following that are the pen strokes that make up the character.  Each stroke
  214. consists of a number indicating the number of end points in the stroke,
  215. followed by the the starting location of the stroke, followed by the end
  216. points of the lines in the stroke.  Below is an example of a character entry.
  217. The comments on the right are only for the documentation and should not be
  218. in the actual font file.
  219.  
  220.  
  221. *  48 '0'      Below are comments that should not be in the actual file
  222. 8              <- number of end points (lines) in the first stroke.
  223. 12 3           <- starting point of the first stroke
  224. 12 18          <- end point of the first line in the stroke
  225. 9 21           <-|
  226. 3 21           <-|
  227. 0 18           <-|
  228. 0 3            <-|- more end points
  229. 3 0            <-|
  230. 9 0            <-|
  231. 12 3           <-|
  232. 1              <- number of end points (lines) in the next stroke
  233. 10 20          <- starting point of next stroke
  234. 2 1            <- end point of the only line in the second stroke
  235.  
  236.    The character entry is ended by the occurance of the '*' marking the next
  237. character entry.
  238.  
  239.    The font file is compiled and placed in the PLTDATA: directory by the 
  240. program 'cf'.
  241.  
  242.    Ex.   cf ascii
  243.  
  244. The font file is assumed to end with the extension '.fnt'.
  245.  
  246.    The cf program is only a simple state machine, so it does not handle errors
  247. very well.  It merely tells you what the character it discovered the error at
  248. was and the position of that character in the file.  Source to the cf program
  249. is included with this release.
  250.  
  251. -----------------------------------------------------------------------------
  252.  
  253. Specifing the Raster Height:
  254.  
  255.    The maximum height of the raster that PLT: uses when it prints a strip of
  256. the plot can be specified by the user.  The user specifies the maximum number
  257. of lines in the raster using the enviroment variable 'PltMaxRasHgt'.
  258.  
  259.    Ex.   setenv PltMaxRasHgt 100
  260.    
  261.    Specifing the maximum raster height is a way of controlling the amount of
  262. memory that PLT: uses for the raster.  The actual raster height that is used
  263. is always a multiple of the number of lines that the printer driver can print
  264. in one "strip" at the specified resolution.  The minimum raster height, and 
  265. the default, is the height of one "strip".
  266.  
  267. -----------------------------------------------------------------------------
  268.  
  269. Specifing the Left Margin:
  270.  
  271.    The left margin of the plot can be specified in inches using the environment
  272. variable 'PltXOffset'.  
  273.  
  274.    Ex.   setenv PltXOffset 0.5
  275.    
  276.    The value is only accurate to one tenth of an inch.
  277.  
  278. -----------------------------------------------------------------------------
  279.  
  280. Operation:
  281.  
  282. PLT: can be used in a variety of manners. 
  283.  
  284. 1.      You can copy files containing HP-GL commands to the handler.
  285.             Ex.  copy <filename> PLT:
  286.         
  287. 2.      You can direct a CAD package to plot to a file and give the 
  288.         filaname as "PLT:"
  289.         
  290. 3.      You can redirect output from a CAD package heading towards
  291.         the serial port to the handler.
  292.             Ex.  cmd serial.device PLT:
  293.         
  294. 4.      You can write your own applications that write directly to the
  295.         handler PLT:.
  296.             Ex.   file=fopen("PLT:","w");
  297.  
  298. -----------------------------------------------------------------------------
  299.  
  300. Memory:
  301.  
  302. PLT: does take up quite a bit of memory.  Not as much as a full raster image,
  303. but still quite alot.
  304.  
  305. PLT: code needs      35K
  306. printer.device needs 49K
  307. raster varies from    5K - 14K
  308. each lines takes     28 bytes  (or 16 in the Memory Conserve mode)
  309.  
  310.  
  311. Before data is read, PLT: removes about 90K - 100K from your system.
  312.  
  313. An average plot will usually require an additional 30-50k.
  314. A complex plot will usually require about 180K or more.
  315.  
  316. -----------------------------------------------------------------------------
  317.  
  318.  
  319. QUESTIONS or BUG REPORTS
  320.  
  321.    Since there have been so many changes to PLT: from v1.2, there are sure to
  322. be numerous bugs lurking in the code.  Any questions or bug reports should be
  323. sent to the following addresses:
  324.  
  325. Rich Champeaux
  326. rchampe@hubcap.clemson.edu
  327.  
  328. or
  329.  
  330. Jim Miller
  331. jvmiller@rdrc.rpi.edu
  332.  
  333. or send US mail to: 
  334.  
  335. Rich Champeaux
  336. 11 Mansfield Dr.
  337. Chelmsford, MA  01824
  338.  
  339. (Sending US mail to the above address will be slow, since that is my home
  340.  address, not my school address)
  341.  
  342.    Every attempt will be made to solve your problems within a reasonable 
  343. amount of time.
  344.  
  345.  
  346. | It would be appreciated if anyone using PLT: would email or US mail your
  347. | comments to one of the above addresses.  Even an "I am using PLT:" message
  348. | is welcome.  We have put a lot of effort into PLT: and since we did not
  349. | write PLT: for a profit, but merely for the ego boost, we would like to
  350. | know approximately how many people are using it, and what they think about
  351. | it.  Thank you.
  352. |
  353. | Rich Champeaux
  354.