Skip to content

Visual Color Selector enhancements

Mathias Wein requested to merge (removed):color-selector-enhancements into master

This is a collection of mostly detail improvements with the goal to improve user experience with the KisVisualColorSelector, especially when used for the popup palette.

selector_comparison

popup_palette_comparison

Overview of changes:

KisVisualColorSelector (and childs)

  • Don't round widget handle coordinates to nearest integers on circular selector, it just makes them move jiggly. QPainter with antialiasing handles float coordinates just fine
  • Made rendering aware of UI scaling so it doesn't have to be upscaled by Qt
  • Render an alpha mask for the selector shapes on resize; this allows a generic optimization to skip invisible pixels on redraws. So now triangle shape also skips invisible pixels efficiently. Long term goal is also to make it easier to implement HDR output via OpenGL widgets, but's a bit of speculation whether this will really help...
  • Reworked triangle shape:
    • Made calculation more generic instead of assuming an equilateral triangle
    • Tweak mask and active area to have less unused space, which allows tighter fit inside ring selector
  • Support tablet events (can be toggled on and off)
  • Ignore mouse events without effect. That way they bubble up to the parent widget (required to not block popup palette right-click action)

Color Selector Dialog

  • Added a tab widget that offers numeric HSV/HSI/HSL/HSY controls matching the current selector model (for RGB color spaces)
  • Added colon to spinbox labels to be consistent with other UI elements
  • Fixed spinboxes not reloading the new values when color space changes

Popup Palette

  • Don't try to connect to "requestCloseContainer" signal that only the spinning triangle selector implements. It's not required anymore now that the color selector passes on right-click events.
  • Properly center the selector; uneven dimensions and rounding caused it to be slightly off-center

Test Plan

First, enable KisVisualColorSelector for the popup palette in kritarc: "popuppalette/usevisualcolorselector=true"

Make sure the popup palette works as intended, i.e. closes as expected, color selector works smoothly with mouse and tablet stylus. Apparently on Windows, the current release does not work very well due to not handling tablet events, no idea if that's wintab or windows ink specific.

Keep an eye on performance/CPU load, since tablet events come at higher frequency AFAIK. It seems fine for me, but I only have an older Wacom with rather low report rate and a 60Hz monitor. Also Hi-DPI will have to render more pixels now.

For the color selection dialogs (foreground/backgroud color) make sure the HSV/HSI/HSL/HSY tab really shows the correct labels, and is hidden when the selector is using non-RGB color spaces

And keep an eye on any visual glitches or inaccuracies (especially with the triangle selector shapes) that could be introduced by the changes. If possible test with UI scaling. Fractional scaling (like 125%, 150%) is probably still not fully fixed in Qt and needs to be forced by QT_SCALE_FACTOR=x.yz or QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough, but feel free to share your experience.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Mathias Wein

Merge request reports

Loading