<p>I'm capturing data from a tablet using Java (JPen library rocks) and would like to be able to paint a penstroke in a more natural way.</p>

<p>Currently I'm drawing the pen stroke as straight line segments each with a different Stroke thickness.  </p>

<p>There has to be something in Java's Graphics Library that lets me to this more efficiently.</p>

<p>Right?</p>

[{'answer_id': 42592, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>PostScript RIPs often convert circles to curves and curves to a series of straight line segments. The number of segments depends on the flatness setting which defaults to one suitable for the raster display resolution.</p>\n\n<p>A thick line or thick line segments can be converted to a skinny filled polygon.</p>\n'}, {'answer_id': 42646, 'author': 'Will', 'author_id': 816, 'author_profile': 'https://Stackoverflow.com/users/816', 'pm_score': 1, 'selected': False, 'text': '<p>I\'ve never done this, but here are a couple things you could try. First, you could implement a custom <a href="http://java.sun.com/javase/6/docs/api/java/awt/Stroke.html" rel="nofollow noreferrer">Stroke</a> that creates skinny trapezoids. The width of the end caps would be a function of the pressure at the end points. If that works, you could try to make the line segments look more natural by using <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve" rel="nofollow noreferrer">Bezier curves</a> to form "curvy trapezoids". You might be able to use <a href="http://java.sun.com/javase/6/docs/api/java/awt/geom/QuadCurve2D.html" rel="nofollow noreferrer">QuadCurve2D</a> to help.</p>\n'}, {'answer_id': 111556, 'author': 'jjrv', 'author_id': 16509, 'author_profile': 'https://Stackoverflow.com/users/16509', 'pm_score': 1, 'selected': False, 'text': '<p>There\'s a more general solution available at least. The feature was added to Inkscape based on a <a href="http://levien.com/spiro/" rel="nofollow noreferrer">recent algorithm</a>. You can see it applied directly to your problem in <a href="http://andy.brisgeek.com/" rel="nofollow noreferrer">some screenshots</a>. It can extrude any shape brush along the path to mimic a paintbrush for example, but you\'d have to port it to Java from the algorithm in the first link or from the Inkscape sources. Also, it\'s covered by patents so you\'d have to release your code under the GPL (the author gives explicit permission) or buy a patent license.</p>\n'}]
['https://Stackoverflow.com/questions/42546', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2443/']