www.delorie.com/gnu/docs/hp2xx/hp2xxinf_19.html   search  
 
Buy GNU books!


HP2XX, A HP-GL Converter

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5 Dots and lines

Here are some basics about the generation of dots and lines within hp2xx. I mention them, because there is something left to be improved here...

Some HP-GL codes cause hp2xx to generate points rather than lines of length zero. There is a subtle difference between both. Depending on the current output format, special code for points will be generated, and occasionally, a point will look different from a zero-length line. Use `-m epic' for such an example.

Line thicknesses can vary. Especially for thick lines, the matter of line caps (how lines are ended, e.g. with a round cap) becomes relevant. (According to the HPGL/2 references, these issues are only relevant for lines wider than 3.5 mm). hp2xx does not yet offer complete support for these features - currently your best bet is to use `-m eps' or `-m pdf', as hp2xx will simply emit the corresponding linestyle commands of those formats instead of having to calculate all the details itself. While most line end cap types are supported even in the raster modes (since version 3.4.3), this applies especially to the mitering options, i.e. the way the junction is drawn. To force a certain type of line caps, you can also use `-m eps', edit the resulting Encapsulated PostScript file, look for a line with setlinecap in it (near line 45), and select the line cap of your choice by modifying the PostScript command setlinecap accordingly. You can also use Metafont (via `-m mf') and replace the picked pen "pencircle" by some other type. However, both methods are far from convenient.

The internal rasterization done by versions of hp2xx before 3.4.3 was a simple process based on positioning squares (roughly corresponding to the linewidth) by the Bresenham algorithm. Since 3.4.3, a modified algorithm for drawing wide lines - based on an IBM Technical Bulletin written by Alan Murphy - is employed, which also supports true endcap drawing. The current code still does not support the various miter options, e.g. drawing out the endpoints of two lines so that they meet in an exact triangle or a blunt wedge. Unfortunately the current layout makes it hard to implement such a feature, as the internal representation of the command sequence is just another sequential list of lines without any indication of intersections.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003