Stipplegen vs Inkscape bug (?)
  • I love doing images with stipplegen, and getting good results depends on a bunch of parameters.  Thus a good deal of experimentation is required.   Fiddle with parameters, stipplegen for a while, judge results using inkscape with stroke equal to expected pen tip diameter, rinse, repeat.

     But inkscape gets in my way by preventing accurate observation of results.  8^(

     To me it seems like a fairly obvious inkscape bug, yet my searching in the bug reports at bugs.launchpad.net/inkscape nets me nothing relevant.

     I am asking whether the following seems like an inkscape bug, or have I got fog in my cockpit???

     Stroking a circle (or a circle path) with a stroke width greater than the circle diameter gives an unexpected result:
     When stroking a circle, if the stroke width is greater than the circle diameter, then the inkscape rendering is hollowed out.  This problem does not occur when stroking a square.  See screenshot below.  I have found, to my chagrin, that this problem causes me to misjudge the stipplegen parameters needed for a good print.
     
     I have found a workaround, but it adds hours to each iteration...I tell inkscape to not stroke, but to fill instead.  Then I outset all the thousands of circles by an amount equal to the radius of my pen tip.
      
    Have I missed something obvious? is there a better workaround? should I file an inkscape bug report? ???

    image
  • I can confirm this behavior, on both Inkscape 0.91 and 0.92.

    This behavior it is known to the Inkscape team, but I don't know if this is regarded as a "bug" or not-- it may be considered a predictable artifact of the rendering method that is used. See here, for example: http://tavmjong.free.fr/blog/?p=1257

    If you'd like to ask the Inkscape team about this, I'd suggest starting with a question at https://answers.launchpad.net/inkscape , rather than filing a bug report. (Of course, filing a bug report wouldn't be out of the question-- this is "unexpected" behavior.)

    However, none of that really answers your fundamental issue here. The "right" solution is neither to worry about the rendering, nor to fill circles slowly, but to draw fast, filled circles within StippleGen. My solution to this is to replace each hollow circle with a single
    spiral, which can be plotted quite quickly.

    The newest version of StippleGen, which is not yet available in compiled form, does have the ability to generate these spirals. You can download it here: https://github.com/evil-mad/stipplegen  
    You'll also need Processing, from processing.org , as well as the ControlP5 library and Toxic Libs library.

    You can download those from:
  • Wow!!  Thanks for the very useful response.

    Tavmjong Bah's blog looks like a really good resource, thank you for pointing me toward it - dunno how I've missed it, I guess 'cause I had only looked at his tutorials.

    I certainly agree that your change to StippleGen is the "right" fix...realtime feedback for sure is ideal.  I'm delighted that you have continued development of StippleGen.  Woohoo!!  Because you have gone to that much effort, I guess I will be "forced" to go to the much lesser effort of compiling it - and thus I thank you very much for the download pointers.
  • Processing is wonderful; I imagine that you'll very much prefer being able to tweak the code directly, too.
  • Yes indeed, I've been having fun tweaking the code.  (Sometimes I think that coding is more fun than actually using the code.)

    I really like the spirals that can be drawn in your newer version.  I especially like your clever use of a spiral turning into a circle as fill.  I still wanted a way to visualize the effect of pen width plotting without having to leave the StippleGen environment.  I think I have achieved that, plus a few other things, in the file StippleGen2_4_1_5.pde
    I haven't actually printed from the new version, but in just fooling around with it I think my workflow will be substantially smoother.

    Previous workflow:
    1.  Use StippleGen2, adjusting # of dots, min.size, size range for best possible appearance.  This is not the appearance which will be created when a finite-width pen plots the result, so "best appearance" is really a guess.  Save .svg.
    2.  Import .svg into Inkscape.  Do a long complicated process to account for pen width stroked onto my target object.  Evaluate (guess) where the density or contrast of the image needs adjusting to give a better result.
    3.  Open image again in Photoshop, and apply the results of the evaluation.
    4.  Go back to number 1 above.

    New workflow:
    1.  Use StippleGen2+.  Select "filled circles on output" (woohoo!).  Select "add pen width to display circles".  In addition to the original three controls, also modify contrast by using the "dot gain" slider and the "scaling by area/diameter" toggle.  Adjust til it looks good.  This is the way it will look on the egg.
    2.  If results of 1 can't be made good, go to Photoshop with a very clear idea of where to make changes, then go to 1 again.

     Change Log:
     
     v 2.40.01.05
     * Cleaned up by removing test cases, etc.
     * In general, uses "///" to mark areas that need attention.
     
     v 2.40.01.03
     * GUI controls to save and load control values for next time, using named saves.
       (if this feature stays in, it really needs a dropdown selection list)
       (Actually, it might really be better to store the values in the svg file if this is feasible, no need for save/load)
     * Add gamma (aka "dot gain") control to modify dot size modulation i.e. local_contrast = f(brightness).
       (Computation is at back end, so needs no restart-on-change.)
     
     v 2.40.01.01
     * Compiling in Processing 3.3
     * Increased vertical extent of GUI back to 800, for more accurate visualization of typical eggbot print area.
         (did this on the theory that v 2.0 reduced extent for typical screen sizes of the day, but that screen sizes have typically increased since then.
     * Increased control area by two rows, for additional controls
     * Add GUI option to make StippleGen display visually match the results of plotting with specified pen width.  (Add pen stroke width to display of filled circles) 
     * Minimize spiral path lengths in output, iff pen width being used in display,
         when generating filled circle.
     * Decrease default # of stipples in order to make the interface more responsive when first loaded.
         (should/can we save and restore when shutdown???)