I just checked how rectangles and circles are stored. It looks like at least rectangles can be simplified. They contain every single sampled point (adjusted to be a rectangle).
My suggestion is to add an attribute to the strokes element in XML called filled. If present it is filled, and if absent then not filled. If I remember correctly even non-closed polygons can be filled, but I have to check. I think that a simple "fill" flag is all that is needed to make it work. On Mon, Mar 24, 2014 at 7:52 PM, Denis Auroux <aur...@math.berkeley.edu> wrote: > After checking: indeed, GnomeCanvasPolygon implements filled polygons and > uses the same GnomeCanvasPoints structure as GnomeCanvasLine for storing the > coordinates of the successive points. So, by far the easiest way to extend > things is to have stroke elements carry a filled-in flag to determine > whether to represent them as GnomeCanvasPolygon or GnomeCanvasLine; then you > can have UI to create rectangles and circles (full or empty) using a > ruler-like mechanism, and UI to convert strokes in a selection from filled > to empty or vice-versa. (Or you could have a filler tool that fills/unfills > the strokes you select with it; etc.: possibilities are endless). > > Denis > > > On 03/24/2014 07:36 PM, Denis Auroux wrote: >> >> Hi all, >> >>>> I want the same feature too. Denis, what do you think is the best way >>>> to implement this? Just add an "fill-in" flag and >>>> fill any polygon created (including non-rectangles/circles)? or be >>>> more specific and only fill rectangles and circles? >> >> >> Actually, in the xoj file format, if you're willing to continue to think >> of circles as polygons (as is already the case for circles created by >> the shape recognizer), then there is indeed an advantage to still >> thinking of them as <stroke> elements: backwards compatibility. >> >> If you were to add an enclosing tag such as >> <fill color="black"> ... </fill> >> around a <stroke> section, current xournal would read the contents >> ignoring the fill and just treating it as a stroke without filling it. >> You could then put the successive coordinates in the <stroke>, ending >> back where you started so it looks like a closed path even without a >> fill-capable version of xournal. >> >> That said, it's also fine to just create a new tag and have existing >> versions of xournal discard the new elements they can't render. But if >> you think of it as filled polygons then I think (1) gnome-canvas knows >> how to render them (?), and (2) you might as well reuse the stroke >> manipulation code that's elsewhere. >> >>> I have a *really* hard time to trigger shape recognition with my wacom >>> tablet. I advocate for a normal "add triangle, rectangle, circle" >>> shape. >> >> >> Rectangles and circles are certainly worth doing -- the ruler should be >> expanded into a larger selection of geometric tools, and rectangles and >> circles are the first ones. I do think many wacom users can deal with >> the shape recognizer okay, but there's all the non-tablet users out >> there who certainly can't get it to work with a mouse or touchpad. >> >> [Hint for drawing rectangles with the recognizer: do one side at a time, >> going around the rectangle. If all four sides get recognized as straight >> lines then they should combine.] >> >> I view triangles as less urgent, in part because they can't be drawn >> intuitively in a single gesture (unlike rectangles where you can just >> drag from one corner to the opposite corner, and circles where either >> corners or center + radius are reasonably intuitive). Clicking >> successive corner points a la xfig or other vector drawing programs is a >> UI disaster in my opinion. >> >> Denis >> > > -- > Denis Auroux aur...@math.berkeley.edu > University of California, Berkeley Tel: 510-642-4367 > Department of Mathematics Fax: 510-642-8204 > 817 Evans Hall # 3840 > Berkeley, CA 94720-3840 -- --dmg --- Daniel M. German http://turingmachine.org ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Xournal-devel mailing list Xournal-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xournal-devel