GNOME Bugzilla – Bug 355520
Make palette search smarter
Last modified: 2006-09-12 13:14:29 UTC
Previously, palette searching (used by the context-palette-fore|background-* actions for choosing adjacent palette colors, and eyedropping) would proceed from the start of the palette. This was inconvenient when duplicates of the same color existed in a palette. The attached patch fixes this, doing a proximity-based search as was always my intention for the palette searching function. It will try to select colors nearest (in terms of position in the palette) to the previously selected color first. Searching proceeds like this: ...753102468... (where 0 was the previously selected entry). This will usually be more appropriate than searching from the start; related color sets are likely to be grouped together in any human-made palette. Summary of effected things: - context-palette-fore|background-* actions - context-swatch-fore|background-* actions - eyedropping (effects the attempt to match the eyedropped color to a corresponding palette entry)
Created attachment 72576 [details] [review] improve palette search Tries colors in this kind of order: The previously selected color, the next color, the previous color, the next next color, the previous previous color...... Changes are only to the gimp_palette_editor_get_index function.
I hope I didn't break it, but it appeared to me that the whole thing can be simplified a little ... 2006-09-12 Sven Neumann <sven@gimp.org> * app/widgets/gimppaletteeditor.c (gimp_palette_editor_get_index): applied a modified patch from David Gowers that changes the search behaviour to favour colors in the neighborhood of the selected color (bug #355520).
Seems to work fine. Thanks.