GNOME Bugzilla – Bug 631106
Replace diagonal striped stipple pattern for marching ants with checkerboard
Last modified: 2018-05-24 12:51:09 UTC
Replace diagonal striped stipple pattern for marching ants with checkerboard pattern. I'm creating this bug so that my patch and explanation aren't lost. Will add them in the comments.
Created attachment 171500 [details] [review] [PATCH] Replace diagonal striped stipple pattern for marching ants with checkerboard app/widgets/gimpcairo.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
Currently, the stipple pattern for marching ants has diagonal stripes. It is used as a cairo source, and selection outline is stroked using the pattern using cairo_mask(). The selection outline becomes a mask, where opaque regions are rendered using the pattern below and transparent regions are not. The stipple pattern is as follows: 01234567 0 xxxx 1 xxx x 2 xx xx 3 x xxx 4 xxxx 5 xxxx 6 xxxx 7 xxxx An index is also used to rotate the pattern diagonally from the top-left corner to the bottom-right corner (and hence march the ants). This works fine and dandy, except for the case where you have selections of 40 - 50 degrees when zoomed out. In that case, a lot of the time, there is no outline shown because the pattern is empty there. Screenshot of this effect is coming up.
Created attachment 171503 [details] Badly stroked selection (master)
Created attachment 171504 [details] Badly stroked selections (2.6) This effect is seen in 2.6 as well. But because the stipple pattern is mirrored, the effect is seen in selection edges around 135 degrees.
Created attachment 171507 [details] Better stroked selections (checkerboard pattern) The patch moves to a checkerboard pattern. With this, there is an improvement in the way the selection can be seen more clearly. A side-effect of this patch is that the ants are not marching so smoothly anymore. They appear to jump. But I still think this patch should go in, as the current state is worse. In any case, you are not going to see smoothly marching ants in the curves of selections when zoomed out with any stipple pattern when using this cairo_mask() method. It is very difficult to come up with good patterns because of the way they are used with the selection outline as a mask. The perfect selection stroking would of course be to walk and stroke the selection edges and maybe even reduce the selection geometry.. but this would not perform as well as the cairo method used now, or is not so simple.
I also proposed to Mitch that we could adopt a hybrid approach, where, when we are zoomed in and can see only manhattan selection edges around individual pixels, we use the diagonal stipple pattern, and when we are zoomed out, we use the checkerboard pattern.
Muks, thing bug has only your comments :) soI have no idea any more why I proposed that... I think it just looked weird in my tests?
Created attachment 342647 [details] [review] Patch updated for current code location
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/342.