1. 01 May, 2020 1 commit
    • Mathias Wein's avatar
      Limit cursor drag in mirror mode elliptic selector shape · 4bca019b
      Mathias Wein authored
      Without any kind of barrier between left and right half,
      it was not really possible to select the min or max value
      as you could in a bar control.
      With this change, the cursor coordinate will be limited
      to the side where mouse dragging started.
      
      (cherry picked from commit 418ebf10)
      4bca019b
  2. 28 Mar, 2020 5 commits
    • Mathias Wein's avatar
      Support tablet events in visual color selector · 3fbc5552
      Mathias Wein authored
      By default they are disabled and can be enabled with
      setAcceptTabletEvents(true);
      This should fix input for the popup palette in cases where
      synthesized mouse events are not reliable, hopefully.
      3fbc5552
    • Mathias Wein's avatar
      Restructure color selector shapes (again) · dbe31716
      Mathias Wein authored
      Render a separate alpha mask:
      This allows a generic optimization to skip all invisible pixels when
      updating background. For triangle this alpha mask allows to skip ~50%
      pixels that were never displayed.
      Performance for ring shape stayed identical, was hoping for a small
      boost at least...
      
      Rework triangle code:
      Removed some unused variables and use widget space a little better.
      While at it, correct math that assumes certain widget geometry constraints.
      
      TODO: code to fit triangle inside ring needs a tweak.
      TODO: implement alpha mask for rectangle shape.
      dbe31716
    • Mathias Wein's avatar
      Make color selector aware of UI scaling · 6cb9e0bb
      Mathias Wein authored
      Qt virtualizes the coordinate system and keeps it independent
      of (Hi-DPI) UI scaling, that helps to not break applications
      not aware of this feature, but automatically upscaled images
      of course are not very nice especially with fractional factors.
      
      This commit tries to properly determine the true device pixel amounts
      and renders the selector at this resolution.
      
      Note: fractional scaling needs thorough testing with Qt 5.14,
      earlier versions are know to still have many rendering glitches.
      Only tested with Qt 5.12 and QT_SCALE_FACTOR environment variable so far.
      6cb9e0bb
    • Mathias Wein's avatar
      Pass QPointF to widget->shape conversion function · 2345024a
      Mathias Wein authored
      There is no reason to truncate values when QMouseEvent provides
      a QPointF and subsequent calculation are all float too.
      
      NOTE: Qt 5.12 does not appear to calculate QMouseEvent::localPos() with
      with fractional precision yet even though it definitely should with
      fractional UI scaling, and windowPos() does so.
      2345024a
    • Mathias Wein's avatar
      Ignore mouse events for buttons not handled · b4ca85de
      Mathias Wein authored
      This is required to propagate events for the popup palette
      to close on right-click.
      Also, it is not necessary to track ourselves which buttons are
      pressed, QMouseEvent::buttons() does that already.
      b4ca85de
  3. 05 Sep, 2019 10 commits
    • Mathias Wein's avatar
      Add back reworked HDR handling to KisVisualColorSelector · 5d9725e3
      Mathias Wein authored
      The exposure is currently auto-compensated, that means your
      selectable dynamic range changes with exposure.
      
      Also, since it is now possible to tell linear from gamma-curve RGB
      profiles apart, gamma of 2.2 then gets applied by the selector to
      keep that visually even brightness distribution of instead of having
      lighter values dominate the selector space.
      5d9725e3
    • Mathias Wein's avatar
      Break up KisVisualColorSelectorShape::getImageMap() · 0cb1e86e
      Mathias Wein authored
      - move rendering of the selector shape background into own function
        called renderBackground()
      - move conversion from KoColor data array to QImage to helper function
        called convertImageMap()
      
      This way it can be better specialized for optimizations.
      0cb1e86e
    • Mathias Wein's avatar
      Move setMask() calls from paintEvent() to resizeEvent() · 3cf5530e
      Mathias Wein authored
      Mask doesn't change otherwise, and it might even be too late to
      apply it without some duplicate rendering.
      
      Also set border width before resize to not force double repaint for
      correct rendering, and don't mimic resize by forcing min/max values.
      3cf5530e
    • Mathias Wein's avatar
      Don't call this->show() in a constructor · 1132b6db
      Mathias Wein authored
      QWidget::show() triggers a resizeEvent() which is a virtual function
      call, which is a really bad idea...
      Instead, make the function that created (possibly) hidden widgets
      to show() them.
      Also, the update() on the children in a resize event was redundant.
      1132b6db
    • Mathias Wein's avatar
      Big KisVisualColorSelector refactor, Part 2 (removing code) · 8d445606
      Mathias Wein authored
      Remove functions and attributes that were put in other classes or
      are no longer required.
      Also fix an oversight of possibly undefined "model" value.
      8d445606
    • Mathias Wein's avatar
      Big KisVisualColorSelector refactor, Part 1 (adding code) · a8958bc9
      Mathias Wein authored
      Basically, this makes KisVisualColorSelectorShape and subclasses as
      dumb as possible and let the selector itself decide how to handle stuff.
      The selector uses raw color model values as much as possible, this
      avoids a number of problems like jumpy handles and unnecessary re-rendering.
      
      - Move code for conversion between color and shape coordinates from
        shape to selector class, along with a number of required class attributes
      - Change mouse event handler to only care about the shape's handle position;
        Handles will now smoothly follow mouse, including movements outside the actual shape.
      - Only re-render the background image when the channels for it changed
      - Get rid of (failed) attempts to compress update signals;
        The selector really should be as smooth as possible IMO, signal compression
        is better done outside of the actual selector (as already done for the dialog)
      
      Note: HDR color ranges are currently not selectable, but it appears
      it was broken anyway, among some things in non-RGB color spaces that still
      need fixing as well.
      a8958bc9
    • Mathias Wein's avatar
      (coding style) make some function const · 5d550a12
      Mathias Wein authored
      5d550a12
    • Mathias Wein's avatar
      Don't allocate a QImage that should be overwritten anyway · 98cfd438
      Mathias Wein authored
      Instead, create a black image in case the conversion failed.
      This currently happens in L*a*b color space at certain channel depths.
      98cfd438
    • Mathias Wein's avatar
      Correct size of memory allocation · 11c8d745
      Mathias Wein authored
      11c8d745
    • Mathias Wein's avatar
      Cleanup KisVisualColorSelector signaling a bit: · 9f40b7f9
      Mathias Wein authored
      - connect all shapes to updateFromWidgets()
      - don't emit signals in setColorFromSibling() when we have to
        block them later, signal updates in updateFromWidgets() instead
      - call updateSelectorElements() directly in updateFromWidgets(),
        saves us a check in slotSetColor()
      9f40b7f9
  4. 05 Aug, 2018 1 commit
  5. 17 Jun, 2018 1 commit
  6. 18 Jan, 2018 1 commit
    • Boudewijn Rempt's avatar
      Do an exact match of the color if threshold is set to 1 · ba03f037
      Boudewijn Rempt authored
      If the threshold is set to 1, checking the difference between
      colors through a conversion to lab and cmsDeltaE will not be
      precise enough. A threshold of 1 means that no difference at
      all is allowed.
      
      This patch checks in relevant places whether the threshold is
      1 and then does a memcmp.
      
      BUG:385160
      ba03f037
  7. 23 Aug, 2017 1 commit
  8. 19 Nov, 2016 3 commits
  9. 17 Nov, 2016 1 commit
  10. 16 Nov, 2016 2 commits