Denis Auroux twisted the bytes to say:
Denis> After checking: indeed, GnomeCanvasPolygon implements filled polygons Denis> and uses the same GnomeCanvasPoints structure as GnomeCanvasLine for Denis> storing the coordinates of the successive points. So, by far the Denis> easiest way to extend things is to have stroke elements carry a Denis> filled-in flag to determine whether to represent them as Denis> GnomeCanvasPolygon or GnomeCanvasLine; then you can have UI to create Denis> rectangles and circles (full or empty) using a ruler-like mechanism, Denis> and UI to convert strokes in a selection from filled to empty or Denis> vice-versa. (Or you could have a filler tool that fills/unfills the Denis> strokes you select with it; etc.: possibilities are endless). Ok, thanks to all your suggestions I have this proposal. If the first and the last points are exactly in the same point, then it is a polygon. Otherwise it is a normal stroke. If we have a flag that indicates that the polygon is to be filled, then we fill it. So what I am advocating for is: 1. A flag to the stroke that indicates if it is to be filled. 2. If the flag is TRUE, and the first and last strokes in the same location, then fill it. otherwise do not. 3. Store the flag in the XOJ file as an attribute of the stroke element. Here is a proof of concept:
2014-03-24-Note-20-41.pdf
Description: Adobe PDF document
Denis> Denis 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> -- Denis> Denis Auroux aur...@math.berkeley.edu Denis> University of California, Berkeley Tel: 510-642-4367 Denis> Department of Mathematics Fax: 510-642-8204 Denis> 817 Evans Hall # 3840 Denis> Berkeley, CA 94720-3840 -- Daniel M. German "Science clears the fields on which W. Heisenberg -> technology can build. " http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
------------------------------------------------------------------------------ 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