I'm not sure what you mean exactly by "line drawing algorithm". Do you mean just the process of drawing with the pen?
If so: position data is received from the stylus or other input devices; if there hasn't been enough motion since the last point (by default 0.3 pixel) we discard the information and wait for more motion; then we draw a line segment from the previous point to the new one, with the given width (that of the pen in general, except if you have pressure sensitivity on your tablet and that option is enabled, then it's the pressure reported by the stylus times the pen width). The actual drawing of line segments is done by inserting GnomeCanvasLine objects into the GnomeCanvas that represents the document on screen. libgnomecanvas then takes care of the actual drawing, or rather it calls the libart_lgpl library which does the actual drawing. If you mean the shape recognizer detection of lines, it's a different story. We treat the stroke as a piece of wire and calculate its center of mass (x_0,y_0) and its inertia matrix (integrals of (x-x_0)^2, (x-x_0)(y-y_0), and (y-y_0)^2 along the wire). If the suitably normalized inertia matrix has small enough determinant then the wire is "long and thin" and we declare it to be a line. Denis On 10/01/2014 05:24 AM, Shuhao wrote: > Hey, > > I'm curious to how the xournal line drawing algorithm works. Is there a > document somewhere documenting its process? This algorithm is the best > I've seen from a couple of programs and I'm wondering how exactly it's > accomplished. Unfortunately my C skills are not as good and somewhat > rusty so I'm having some trouble reading through the xo-paint file. > > Thanks, > Shuhao > > ------------------------------------------------------------------------------ > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer > http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk > _______________________________________________ > Xournal-devel mailing list > Xournal-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/xournal-devel > -- Denis Auroux UC Berkeley, Department of Mathematics aur...@math.berkeley.edu Institut Henri Poincare, Paris aur...@ihp.fr ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ Xournal-devel mailing list Xournal-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xournal-devel