Commit 93ef7c8e authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Merge in new internal color picker dialog!

Tremble, dear commit reader, for a new era of color picking has arrived!

This is the second part of my Google Summer of Code 206 project. It is a internal color selector, that can handle wide-gamut colors, pick colors from the screen (which is smart enough to identify Krita canvases and pick the correct color managed color that way). It also changes properly using the lut manager exposure controls, and it’s main element, the visual color selector can use the advanced color selector config.

This selector is also intergrated into a kis_color_button and used where ever I could port it reliably. It’ll also show up in the pop-up palette.

Furthermore, this merge contains little palette usability things, like being able to see the swatch name, search by swatch name and have the split->layer functionality use a palette to name the resultant layers. Also allows custom-pattern to be mindful of the active selection.

Anyway, needs a lot of testing!

CCMAIL:kimageshop@kde.org
Ref T2337
Ref T2438

Squashed commit of the following:

commit 1cf85278
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Sep 6 16:16:24 2016 +0200

    Fix build

commit d39cecc3
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Sep 6 15:32:08 2016 +0200

    Rename the internal color selector dialog to reflect it being a dialog

commit afc8658b
Merge: 27d4034e 91bdcfe3
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Sep 6 15:22:33 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 27d4034e
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Sep 3 16:35:23 2016 +0200

    Fix screencolor picker label.

    Ref T2438

commit 29d34d88
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Sep 3 16:20:07 2016 +0200

    Fix color conversion issues with the selector.

    Now the selector will show grayscale on a mask, and will update upon changing the image color space.

    Ref T2438

commit 3dc39758
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Sep 2 17:47:53 2016 +0200

    Simplify Gradient Map filter and make it usable as a filter layer.

    There's some awkwardness with the first two generic gradients as the color isn't stored, but this is good for now.

    Fixes T1837

commit 4a4f704e
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 17:34:00 2016 +0200

    Fix drawing the gradient

commit 13f83919
Author: Julian Thijssen <Nimthora@gmail.com>
Date:   Fri Sep 2 17:30:51 2016 +0200

    Nearest neighbour filtering applies on all zoom levels

commit 0a4a62bc
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 16:36:02 2016 +0200

    Refactor KisColorSource to use KoColor in a saner way

commit 58bf4b9a
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 16:21:40 2016 +0200

    Make KoSegmentGradient::colorAt threadsafe

commit 54df09f8
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 16:21:19 2016 +0200

    Make this class safe

    It means we don't cache the QImage, but there is no alternative

commit 362c78b8
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 16:21:02 2016 +0200

    Warn that this class is not threadsafe

commit cd02553f
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 16:06:51 2016 +0200

    Make KoStopGradient::colorAt threadsave

    Sneakily, the "buffer" variable was made a class variable. Marking
    it mutable allows us to change it from a const function, which hides
    the fact that this is global data (doubly hidden by there not being
    an m_ prefix), which makes the const function thread unsafe.

commit 904cc82d
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 15:56:24 2016 +0200

    Also revert the patch

commit 349b5e77
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 14:57:27 2016 +0200

    Try harder to find the tag files on Windows and OSX

    This is yet another KoResourcePaths problem...
    BUG:366757

commit dbaa7bcd
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 13:56:14 2016 +0200

    Fix logic error...

    I shouldn't code during a sprint, only afterwards

commit 71692523
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 12:09:42 2016 +0200

    Fix typo

commit 88bf822c
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 11:56:59 2016 +0200

    Go back to ki18n 5.17 for now

    To avoid the system-language bug until it's fixed.
    CCBUG:368007

commit 6f057f46
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 11:35:54 2016 +0200

    Remove unused ui file

    (Was forgotten in

    commit 010c0f3066d872d0f91ec3a38057b4fcaedca4ad
    Author: Boudewijn Rempt <boud@valdyas.org>
    Date:   Sat Mar 30 12:22:40 2013 +0100

        Remove unimplemented custom palette dialog
    )

commit 4e053745
Author: Eugene Ingerman <geneing@gmail.com>
Date:   Tue Aug 30 22:14:51 2016 -0700

    Fixing https://bugs.kde.org/show_bug.cgi?id=367901. Removing wait which
    causes possible race condition.

commit 99b11b2b
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Fri Sep 2 14:30:20 2016 +0200

    Improve the view selection when color picking

    We can easily grab a list of all existing views and check whether
    they are under the cursor. Color picking from a krita image now
    gets the color directly no matter the active window or view.

commit 16c8832c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Sep 2 12:18:36 2016 +0200

    Port the last areas to use the KisColorButton as far as possible.

    There's still the grid docker, which has a bit of a UI problem, and then rest is flake and friends.

    Ref T2438

commit ef9aeb29
Merge: ceaafb00 58364da5
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Sep 1 22:04:37 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit ceaafb00
Merge: f70701dc 853e42fd
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Sep 1 13:30:58 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit f70701dc
Merge: ed649432 fe21cb5b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 31 22:37:24 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit ed649432
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 31 22:32:02 2016 +0200

    Add the kiscolorbutton in more places

commit d635b53e
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 29 11:52:25 2016 +0200

    Make the UI layout of the internal color selector a little nicer.

    Ref T2438

commit cf7c567a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 28 15:08:03 2016 +0200

    Fix issue with gamut alarm default space

commit 364d1b3c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 28 15:02:21 2016 +0200

    Use sRGB for the UI

commit 23dcf5d9
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 28 14:54:46 2016 +0200

    Replace kcolorbutton with new kiscolorbutton in several places.

    The new dialog is accesible from all these places.

    There's still several places where they still need to be replaced.

    Ref T2438

commit c5621355
Author: Sven Langkamp <sven.langkamp@gmail.com>
Date:   Sat Aug 27 10:50:40 2016 +0200

    Pick color from canvas directly if the cursor is over the canvas

commit 1afa4384
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Aug 26 18:29:19 2016 +0200

    Use internal visual selector in the Pop-up palette.

    This means you finally can have your shape of choice inside the pop-up palette!

    Needs testing, obviously.

    Ref T2438

commit 9a07179d
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Aug 26 16:10:31 2016 +0200

    Fix updating in modal dialog.

    Also add an extra check for 8bit so we can be a bit more precise in 16bit and higher.

    Ref T2438

commit cdd0cd6a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Aug 26 15:15:24 2016 +0200

    Fix offset for circular shape.

commit 97372d6e
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Aug 25 11:43:14 2016 +0200

    Make the custom pattern widget take the selection into account.

    Now, if you have a selection, it'll use only that area to retreive the pattern from.

    I was thinking of whether it needed an extra toggle, but both Scott and Boud thought it was implicit that having a selection means you want to use it.

    This is my first time playing with selection code, so a glance would be nice.

    Auditors: dkazakov

commit de26f01f
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 19:20:13 2016 +0200

    Check for colorspaces with or not and, a cs can't be all at the same time.

    This fixes floating point from the visual selector shape again. :)

    Ref T2438

commit 80a8d54e
Merge: 389c2bd5 da04c19d
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 16:22:56 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 389c2bd5
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 16:21:23 2016 +0200

    Fork KColorButton, make it use internal selector dialog.

    For now only in the fill layers.

    Ref T2438

commit c71c0b69
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 14:37:50 2016 +0200

    Add config struct to kisinternalcolorselector

    Ref T2438

commit 439cc77b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 13:54:36 2016 +0200

    Add offset to circle and rectangle as well.

    And more cursor fixes... grrrr.

commit fcdc7cd1
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 12:43:06 2016 +0200

    Fix errors in HSL formula.

    Also fix hsx cursor wiggling position _again_...

commit ba6dd494
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 11:18:01 2016 +0200

    Fix loading on config change.

commit 28505a74
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 10:33:52 2016 +0200

    Fix HSX cursor position on 0 sat, AGAIN.

    This is the best I can give it.

commit 68739e5d
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 08:57:09 2016 +0200

    Use Advanced Color Selector Configuration to set visual's shape, p.2

    The debugging.

    Probably not all bugs, but the obvious ones are gone now.

commit e7d52d68
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 08:05:58 2016 +0200

    Use Advanced Color Selector Configuration to set visual's shape, P3

    P2 came before p2. Anyway, this implements resizing. Now left-over debugging.

commit 6995071a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 24 00:12:25 2016 +0200

    Use Advanced Color Selector Configuration to set visual's shape, P1

    Now only need p2: the debugging, and p3: the resizening...

    But happy this is out of the way.

    Ref T2438

commit 763a373b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 22:15:09 2016 +0200

    Add Hex code widget that only outputs and reads sRGB colors.

    Nothing else understands having hexcode in other spaces anyway.

    Ref T2438

commit 04707daf
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Tue Aug 23 18:55:04 2016 +0200

    Move KisColorInput to libs/ui/widgets

commit fbc74f15
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 16:11:21 2016 +0200

    Add colorspace locking to the internal selector.

    So it doesn't flip between colorspaces all the time.

    Also fixes a crash in KoDualColorButton

    Ref T2438

commit c33f2ae2
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 15:02:47 2016 +0200

    Remove qstring compare in commonly called function.

    Should speed things up.

commit 12799aca
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 14:44:46 2016 +0200

    Make mouse press event select a color too.

    Also speed up the timers a little bit.

commit b97cef85
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 13:58:11 2016 +0200

    Allow the modal dialog to have ok/cancel buttons as well.

    According to boud, some desktop enviroments have no close button on dialogs.

    Ref T2438

commit 960bde48
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 13:56:55 2016 +0200

    Make color selector faster.

    By removing a mask check.

    Ref T2438

commit e06052e2
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 10:52:40 2016 +0200

    Turn on tagging for palettes.

    This was a matter of toggling an option. Beware that tagging with palettes will have all the bugs associated with the other tagging options.

    With the colorname hover-options, this means that this fixes
    BUG:360453

commit 82d1a1b7
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 10:40:41 2016 +0200

    Make the color names drop down update when you choose a color on the palette itself.

    Seemed like it should to me.

commit e0ed2fd7
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 23 10:29:40 2016 +0200

    Add the ability to let the layer split use color names from a palette.

    This also implements two 'closest match' functions in kocolorset. One for the name, the other only for the index.

    BUG:348837

commit 73eb12ee
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 22 16:52:10 2016 +0200

    Add a little combobox that allows you to search the palette colornames

    If I was better with regexp it might've been a bit smoother, but at the least you can now type in a colorname to select it quickly.

    Ref T2438

commit 68c2c8ed
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 21 14:29:24 2016 +0200

    Add some offset to the triangle selector.

    Also fix some issues with setting hsv and fix and remove some debug.

commit 6d3b11f6
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 21 11:46:46 2016 +0200

    Make column-count work with colorset widget.

    Now the palette swatches align :)

    Ref 2438

commit bc1ad37b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 23:30:51 2016 +0200

    Add using the colornames in the approprite colorset widgets.

    The palette docker doesn't have the ability to give tooltips due being a slightly different model, so hence the extra label.

    I also tried setting the kocolorsetwidget the size of the current column count, but this crashes on startup for reasons I cannot understand.

commit 22ccd662
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 21:42:32 2016 +0200

    Make prettier and change previous color focus event.

    Ref 2438

commit 8c291425
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 19:24:35 2016 +0200

    change kodualcolorbutton about to simply code.

    This doesn't prevent a crash when closing all available documents, sadly.

commit eb1232be
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 18:22:49 2016 +0200

    Fix channel-order, hue rortaton and the mirrored circle border

commit 0718fb65
Merge: 541b596e bba9f1c8
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 16:49:09 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 541b596e
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 16:47:42 2016 +0200

    Make drawing the image slightly faster.

    But it's not fast enough yet. Also using QImage everywhere now, it's a bit more sensible...

    Ref T2438

commit b440e55a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 14:42:56 2016 +0200

    Fix a bunch of minor issues.

commit 6655f984
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 14:28:44 2016 +0200

    Add display color converters to the KoColorSetWidget/KoColorPatch

    Ref T2438

commit b5a0d6c3
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 13:30:35 2016 +0200

    Fix selector on single-dimension hue wheel, also rotate hue.

    Ref T2438

commit f8fb2e08
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 20 12:34:19 2016 +0200

    Add cursor position to the triangle.

    I spent 9+ hours trying to figure out how to make one where the value length fully vertical, but failed, so gave up and copied the kis_color_selector_triangle solution.

    Ref 2438

commit 36e4b72c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Aug 19 12:18:40 2016 +0200

    Attempt to fix flickering... this doesn't fix it :/

    Makes the code simpler though...

commit 0442f67e
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Aug 19 12:05:55 2016 +0200

    Add anti-aliasing to the shapes.

    The jaggies were starting to annoy me.

    Might make the pixmap into a image later just so we can have proper transparency.

commit 8aef9fe6
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Aug 19 11:23:55 2016 +0200

    Fix clamping again.

    The previous code made not much sense...

commit 87376428
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Aug 19 00:00:28 2016 +0200

    Add triangle and elliptical visual selectors and set default to ring+triangle

    This is a bit finicky still. Also weird bugs with Qt cause flickering when changing widgets, due to having to force them to show. :/ Might need to think a bit longer about this...

    Ref T2438

commit fd5f3a2d
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Aug 18 12:38:08 2016 +0200

    Add mirrored border.

    This is useful for non-cyclic channels.

commit d7a4e7e9
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Aug 18 02:19:10 2016 +0200

    Implement rectangle border

    Not too useful and actually a little slow, but good practice.

commit 20febd11
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 17 21:54:38 2016 +0200

    Add KoColorSetWidget, and KoColorPatches for current/previous color

    Also rearranged the widget a lot. The KoColorSetWidget is automatically filled with the first palette in the list(which is, as always, concept cookie), and the palette is saved... right now on leave and accept events, which might not be the most intuitive, but at the least it is saved and loaded correctly.

    Neither widget has the color management from the displayrenderer, as that would require me editing those directly.

    I would like an eye on said save/load code.
    Auditors: rempt

commit d9fc35c3
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 17 17:35:32 2016 +0200

    Add anti-cursor resetting measures, and add docs.

    The cursor won't flip about when desaturated, but saturation itself is
    still very tricky. Either way, outside updates won't affect a thing.

commit d09605cb
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 17 16:07:17 2016 +0200

    Fix HSV mode

    Turns out there was an 'undefined' value...

    Ref T2438

commit 5282f861
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 17 15:39:40 2016 +0200

    Do clamping in color space traits properly.

    Previous version just didn't work. This fixes the HSL output.

    Ref T2438

commit c6119f6d
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 17 15:30:50 2016 +0200

    Don't manage non-floating-point spaces

commit 589b5c64
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 17 12:59:27 2016 +0200

    Fix display configuration updating.

    That's now fully working :)

    Ref T2438

commit 553efe20
Merge: e4b42d28 ffc4d9cf
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 20:52:03 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit e4b42d28
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 20:48:32 2016 +0200

    Fix non-painting space deformation

    By disabling it... this looks a bit odd, might be changed.

    Ref T2337

commit 0246b4ba
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 18:58:22 2016 +0200

    Enable High range color picking for the visual selector.

    It has huge issues when using a color space that isn't the displayrenderer's but I think that can be fixed.

    Ref T2337

commit 62a4f7c6
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 18:57:35 2016 +0200

    Fix spinbox updating float.

    Again, could be prettier.

    Ref T2337

commit ae0fd531
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 18:25:25 2016 +0200

    Enable typing hdr values into spinbox.

    This could probably be a little more elegant...

    Ref 2337

commit a5c0408a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 17:30:01 2016 +0200

    Make the display color converter of the dualcolor button get updated.

    This enables the the display color converter on the internal color selector too.
    There are still update and range bugs, the range bugs being tricky and the update bugs being probably due wrong signal being connect, but I am pretty pleased with this.

    Ref T2337

commit ca0a0333
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 15:09:59 2016 +0200

    Add HSI and HSY support to the visual color selector.

    This was mostly an experiment, which was succesful in proving to me that
    the HSL and HSV functions have issues with non-chromatic values. HSY and HSI are more notably slow, so kept HSL as the RGB default.

    Ref T2337

commit b7a45b00
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 15:08:45 2016 +0200

    Clamp normalised values before pouring into pixel.

    This should prevent roll-overs, but it doesn't fix the bug I was initially trying to fix, which instead seems to be a bugged HSL function.

    Ref 2337

commit db436ad7
Merge: 00b8d54f a819895c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Aug 16 12:22:54 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 00b8d54f
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 15 21:33:40 2016 +0200

    Attempt to further add displayconverter integration...

    I can't get much further here due the inability for kodualcolorbutton
    to have a display renderer, due MVC. Fun times...

    Ref T2337

commit 0eee3399
Merge: 0c201bc0 d07cdb63
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 15 17:05:50 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 0c201bc0
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 15 17:04:54 2016 +0200

    Initial implementation displayrenderer

    Will need to change it now...

commit 9c39f81c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 15 15:25:22 2016 +0200

    Fix rounding-error wiggles.

    By not allowing the thing to update it self...

    Ref T2337

commit c52ca3f4
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 15 14:42:22 2016 +0200

    Make moving the cursor around more pleasant

    Ref T2337

commit 5f161976
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Aug 15 13:23:00 2016 +0200

    Fix order of Hue, make single-dimension-cursors nicer.

    Ref 2337

commit 692d4d26
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 14 19:28:34 2016 +0200

    Fix order-error.

    Ref 2337

commit 9acd7f15
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 14 18:19:32 2016 +0200

    Fix HSL and HSV

    Of course, using HSL and HSV brings back our friend the 'wigglyness', so I'll need to do something about that in time.

    Ref T2337
    Ref T2438

commit 31931e3a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Aug 14 17:38:32 2016 +0200

    Add visual selector shapes.

    These now work fully for the channels. They give nice squares.
    I made a base class that only deals with the events and the classes, and added a rectangular subclass. This way we can make our circles and wheels and whatever easily.

    Ref T2337
    Ref T2438

commit e3f78b79
Merge: 273dd04a ebc8a43c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 13 15:01:25 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 273dd04a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 13 14:57:12 2016 +0200

    Add screen color picking widget.

    This is a widget with a button that allows you to select anywhere on the screen. It's not smart enough yet to recognise Krita windows and canvases and to select the color managed value, but it is a nice self contained widget, which I find pretty impressive already.

    Ref T2337, T2838

commit ea086782
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 10 23:41:49 2016 +0200

    Give spinboxes names, fix order spinboxes, do cleanup.

    Ref T2337 T2438

commit 37d1a1cc
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 10 16:46:57 2016 +0200

    Change spinboxes to numerical spinboxes.

    Ref T2337

commit 99feb3b8
Merge: 6f18c4c3 92c253ac
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 10 16:09:58 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 6f18c4c3
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Aug 10 16:05:58 2016 +0200

    Make internal color selector dialog possible to do modal mode.

    So right now, KoDualColorButton has Non-modal mode on the foreground color and modal mode on the background color.

    Also contains a lot of cleanup, the UI files for example now working
    properly.

    Ref T2337 T2438

commit fbdce997
Merge: 38398393 6530b6db
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 6 12:47:42 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 38398393
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 6 12:42:37 2016 +0200

    Remove signal compressor, use block signals instead.

    This makes the updating of the spinboxes much easier. Might
    be using this method more commonly.

    Ref T2337, T2438

commit 55350f02
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sat Aug 6 01:16:17 2016 +0200

    Move KoDualColorButton, attach internal color selector.

    It doesn't crash, it updates, gets updated, can select colors, wide gamut colors, changes configuration based
    on selected color's color space... It still needs to be cleaned up and have fluid updating. Also 90% of the rest of
    the selector, but I first want to get this updating slot signal mess clean.

    Can I keep using QObject::sender()? It's making my life very easy.

    Auditors: rempt
    Ref T2337, T2438

commit 6d336838
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jul 28 18:04:40 2016 +0200

    Add very simple 'colorselection' dialog with a widget containing spinboxes.

    Right now the spinbox widget is able to adapt itself to all colorspaces, and having it
    as a separate widget makes it into a nice building block for other uses too.

    I can't actually connect this to anything, because all our color buttons seem to be K and Ko,
    so that will be the big task tomorrow...

    Ref: T2337, T2438
    Auditors: rempt

commit 7ce94758
Merge: 38c4fc32 9ed50d15
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jul 27 22:21:40 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 38c4fc32
Merge: 54776118 e308ed0f
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 28 17:46:16 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 54776118
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 28 17:43:20 2016 +0200

    Add rant why per-shot looks won't work after wasting afternoon on it.

    The tl;dr is that OCIO's documentation is extremely vague.

    Ref T2337

commit a3b224b6
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Jun 24 13:16:01 2016 +0200

    Fix loading of default gamut warning color.

    Always set the color space of the kocolor, kids.

    ref T2337

commit 652405d3
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Jun 24 12:54:17 2016 +0200

    Add adaptation state slider.

    This allows you to set whether or not to adapt the white point, that is,
    to set the white point to the screen white(full slider) or to convert all whiteson screen to the white point of the profile when using absolute colorimetric
    as intent.

    This is useful to simulate paper-colour.

    Ref T2337

commit aea525ca
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Fri Jun 24 10:32:37 2016 +0200

    Fix builds on gcc 6

commit 67f4e5a2
Merge: 519f9c1f 159a6126
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 22:00:22 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 519f9c1f
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 19:49:56 2016 +0200

    Add option to set default Proofing Options.

    These will work for images with no proofing options, so, old loaded images
    and new images. With this it is feature complete, and people can start testing.

    Ref T2337
    Ref T1238

commit 062db74d
Merge: 2e057e7a 76255392
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 15:16:54 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 2e057e7a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 15:15:24 2016 +0200

    Clean up all the debug messages.

    It's... quieter in the terminal now.

    Ref T2337

commit 7ff7e60b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 15:01:02 2016 +0200

    Cleanup: Make projection color a defined tag.

commit 604efc8d
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:50:20 2016 +0200

    Not sure if this isn't the correct code instead...

    Ref T2337

commit 7c669703
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:42:04 2016 +0200

    Load embedded proofing profiles if they exist, and add them to the profile registery.

    Needs testing for obvious reasons.

    Ref T2337

commit 119906b2
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:27:07 2016 +0200

    Add embedding of the proofing profile.

    This is so that we can later unembed them.

    Ref T2337

commit 9ef1dad7
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 14:15:47 2016 +0200

    Load Warning Colors properly from file.

    Now the out of gamut warning can be written into file as XML
    and loaded from file as XML.

    Ref T2337

commit 6a57cf08
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 13:49:49 2016 +0200

    Fix naming conventions.

    I was using gamut warnings/alarms, and softproofing and soft proofing.

    The standard is (Out of )Gamut Warnings and Soft Proofing.

    Ref T2337

commit 4faa8b57
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 23 13:37:49 2016 +0200

    Disable softproofing in floating point spaces.

    There's a bunch of little niggling bugs that crop up when soft proofing
    in floating point spaces, amongst which the inability of the proofing
    mechanism to see floating point values higher than 1.0 fall outside of
    the gamut of the color space, let alone recognising whether it can go
    inside the gamut of the proofing space.

    See also http://ninedegreesbelow.com/bug-reports/soft-proofing-problems.html

    For now, it's best to disable softproofing on floating point spaces.
    Might need a more official check, though.

    Ref 2337

commit 91d7da8c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 16:26:52 2016 +0200

    Make views smart enough to track softproof/gamutcheck-state.

    Also add a floating message to say when the softproofing or gamutcheck
    is turned on in the view. Wording may change.

    Ref T2337

commit 5c48dd2c
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 16:26:35 2016 +0200

    Fix Build

commit 6bacfcda
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 14:45:52 2016 +0200

    Add attempt at saving color to xml.

    This fails due to me not being able to load the xml, due object-bonanza.

    ref T2337

commit 3bbf025b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 22 12:49:06 2016 +0200

    Intitial saving/loading of config.[unstable]

    Works, but might change later.

commit 1f733e28
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 21 20:21:15 2016 +0200

    Refactor the proofing transform system for better caching.

    This now makes the transform separately from the actual transforming,
    which means it's easier to cache and to update. Softproofing is now
    gone from usable to user-friendly.

    Still needs saving/loading and little setting-bugs fixed.

    ref T2337

commit 8371c417
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 21 18:20:48 2016 +0200

    Enable Gamut color and proofing intent.

    The image now stored proofing intent, and the monitor intent is the general
    rendering intent.

    This also allows us to set the gamut warning color, however, for updating
    you currently need to switch profiles as well. I'll make a seperate
    generateSoftProofingTransform function, to cache the transform better, so it's
    easier to update.

    Ref 2337

commit 9d9ce380
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 21 14:18:05 2016 +0200

    Add softproofing section to image properties menu.

    Now, the proofing in the image can be changed.

    Also fixes that ugly little square problem with the kocoloractionpopup button.

    Ref T1238, T2337

commit 8d7b4418
Merge: e2ee9ff5 d58645ed
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 16 13:28:24 2016 +0200

    Merge remote-tracking branch 'origin/master' into krita-testing-wolthera

commit e2ee9ff5
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 15:56:50 2016 +0200

    Cache the transform unelegantly.

    This does cause a significant speed-up, but it's a bit fiddly.
    Regardless, the speed-up is enough to make this usable.

commit f643fc7b
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 14:49:16 2016 +0200

    Fix softproofing

    It's slow again :/

commit cbc91c07
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 12:45:43 2016 +0200

    Fix setting softproofing and gamutcheck flags.

commit 9ae336ed
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Tue Jun 14 12:44:50 2016 +0200

    Cache the color space engine to make it faster

    It doesn't fix everything, but it fixes quite a bit.
    Ref T210

commit d4358901
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Mon Jun 13 17:59:18 2016 +0200

    Add base implementation softproofing with toggles.

    It doesn't really work yet :/

    Ref: T210
    Ref: T2337

commit 7de02569
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Sun Jun 12 16:10:31 2016 +0200

    Create the proofing transform

    This doesn't use the caching graph stuff, which is too complex
    to refactor for now.

commit 00efd627
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Sun Jun 12 16:10:05 2016 +0200

    Add a per-image proofing settings class

commit d3bd5375
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Sun Jun 12 14:44:50 2016 +0200

    Push work-in-progress proofing

commit bb97947a
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 9 16:42:18 2016 +0200

    Fix copy-paste error

commit 9ed934a8
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Thu Jun 9 16:30:09 2016 +0200

    Add OCIO Look support.

    The code is based of that of Blender, as I couldn't figure out how else to
    apply looks. The OCIO api wasn't clear about it, nor could I find much information,
    but it somewhat works and doesn't crash.

    Auditors: rempt, dkazakov
    Ref: T210

commit 2819ad66
Author: Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
Date:   Wed Jun 8 12:21:25 2016 +0200

    Add softproofing to the lcms conversion tests

    I am not fully sure if I understand the softproofing function, but the alarm works.
parent 4049ee18
......@@ -382,9 +382,7 @@ void RGBToHSL(float r, float g, float b, float *h, float *s, float *l)
*h = (r == m ? 3.0 + g2 : 5.0 - r2);
*h *= 60;
if (*h == 360.) {
*h = 0;
}
*h = fmod(*h, 360.0);
}
void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b)
......@@ -403,6 +401,7 @@ void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b)
m = l + l - v;
sv = (v - m) / v;
h = fmod(h, 360.0);
h /= 60.0;
sextant = static_cast<int>(h);
fract = h - sextant;
......
......@@ -78,3 +78,8 @@ qreal KoDumbColorDisplayRenderer::maxVisibleFloatValue(const KoChannelInfo *chan
Q_ASSERT(chaninfo);
return chaninfo->getUIMax();
}
const KoColorSpace* KoDumbColorDisplayRenderer::getPaintingColorSpace() const
{
return KoColorSpaceRegistry::instance()->rgb8();
}
......@@ -80,6 +80,12 @@ public:
*/
virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const = 0;
/**
* @brief getColorSpace
* @return the painting color space, this is useful for determining the transform.
*/
virtual const KoColorSpace* getPaintingColorSpace() const = 0;
Q_SIGNALS:
void displayConfigurationChanged();
......@@ -103,6 +109,8 @@ public:
virtual qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const;
virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const;
virtual const KoColorSpace* getPaintingColorSpace() const;
static KoColorDisplayRendererInterface* instance();
};
......
......@@ -157,9 +157,12 @@ struct KoColorSpaceTrait {
Q_ASSERT((int)values.count() == (int)channels_nb);
channels_type c;
for (uint i = 0; i < channels_nb; i++) {
c = (channels_type)
((float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i]);
float b = qBound((float)KoColorSpaceMathsTraits<channels_type>::min,
(float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i],
(float)KoColorSpaceMathsTraits<channels_type>::max);
c = (channels_type)b;
nativeArray(pixel)[i] = c;
}
}
inline static void multiplyAlpha(quint8 * pixels, quint8 alpha, qint32 nPixels) {
......
......@@ -137,6 +137,37 @@ qint32 KoColorSet::nColors()
return m_colors.count();
}
qint32 KoColorSet::getIndexClosestColor(KoColor color, bool useGivenColorSpace)
{
qint32 closestIndex = 0;
quint8 highestPercentage = 0;
quint8 testPercentage = 0;
KoColor compare = color;
for (qint32 i=0; i<nColors(); i++) {
KoColor entry = m_colors.at(i).color;
if (useGivenColorSpace==true && compare.colorSpace()!=entry.colorSpace()) {
entry.convertTo(compare.colorSpace());
} else if(compare.colorSpace()!=entry.colorSpace()) {
compare.convertTo(entry.colorSpace());
}
testPercentage = (255 - compare.colorSpace()->difference(compare.data(), entry.data()));
if (testPercentage>highestPercentage)
{
closestIndex = i;
highestPercentage = testPercentage;
}
}
return closestIndex;
}
QString KoColorSet::closestColorName(KoColor color, bool useGivenColorSpace)
{
int i = getIndexClosestColor(color, useGivenColorSpace);
QString name = m_colors.at(i).name;
return name;
}
bool KoColorSet::saveToDevice(QIODevice *dev) const
{
QTextStream stream(dev);
......
......@@ -85,6 +85,26 @@ public:
KoColorSetEntry getColor(quint32 index);
qint32 nColors();
/**
* @brief getIndexClosestColor
* function that matches the color to all colors in the colorset, and returns the index
* of the closest match.
* @param color the color you wish to compare.
* @param useGivenColorSpace whether to use the color space of the color given
* when the two colors' colorspaces don't match. Else it'll use the entry's colorspace.
* @return returns the int of the closest match.
*/
qint32 getIndexClosestColor(KoColor color, bool useGivenColorSpace = true);
/**
* @brief closestColorName
* convenience function to get the name of the closest match.
* @param color
* @param useGivenColorSpace
* @return
*/
QString closestColorName(KoColor color, bool useGivenColorSpace = true);
private:
......
......@@ -66,6 +66,7 @@ set(kritaui_LIB_SRCS
dialogs/kis_dlg_png_import.cpp
dialogs/kis_dlg_import_image_sequence.cpp
dialogs/kis_delayed_save_dialog.cpp
dialogs/kis_dlg_internal_color_selector.cpp
flake/kis_node_dummies_graph.cpp
flake/kis_dummies_facade_base.cpp
flake/kis_dummies_facade.cpp
......@@ -253,7 +254,12 @@ set(kritaui_LIB_SRCS
widgets/kis_color_label_selector_widget.cpp
widgets/kis_color_filter_combo.cpp
widgets/kis_elided_label.cpp
widgets/kis_spinbox_color_selector.cpp
widgets/kis_screen_color_picker.cpp
widgets/kis_visual_color_selector.cpp
widgets/KoDualColorButton.cpp
widgets/kis_color_input.cpp
widgets/kis_color_button.cpp
input/kis_input_manager.cpp
input/kis_input_manager_p.cpp
input/kis_extended_modifiers_mapper.cpp
......@@ -455,6 +461,7 @@ ki18n_wrap_ui(kritaui_LIB_SRCS
forms/KisDetailsPaneBase.ui
forms/KisOpenPaneBase.ui
brushhud/kis_dlg_brush_hud_config.ui
forms/wdgdlginternalcolorselector.ui
dialogs/kis_delayed_save_dialog.ui
input/config/kis_input_configuration_page.ui
input/config/kis_edit_profiles_dialog.ui
......
......@@ -90,6 +90,7 @@ KisColorsetChooser::KisColorsetChooser(QWidget* parent): QWidget(parent)
QSharedPointer<KoAbstractResourceServerAdapter> adapter(new KoResourceServerAdapter<KoColorSet>(rserver));
m_itemChooser = new KoResourceItemChooser(adapter, this);
m_itemChooser->setItemDelegate(new ColorSetDelegate(this));
m_itemChooser->showTaggingBar(true);
m_itemChooser->setFixedSize(250, 250);
m_itemChooser->setRowHeight(30);
m_itemChooser->setColumnCount(1);
......
......@@ -440,6 +440,7 @@ void KisViewManager::setCurrentView(KisView *view)
resourceProvider()->slotImageSizeChanged();
resourceProvider()->slotOnScreenResolutionChanged();
Q_EMIT viewChanged();
}
......
......@@ -212,6 +212,11 @@ public Q_SLOTS:
Q_SIGNALS:
void floatingMessageRequested(const QString &message, const QString &iconName);
/**
* @brief viewChanged
* sent out when the view has changed.
*/
void viewChanged();
private Q_SLOTS:
......
......@@ -141,6 +141,10 @@ struct KisDisplayColorConverter::Private
return maxValue;
}
virtual const KoColorSpace* getPaintingColorSpace() const {
return m_parent->paintingColorSpace();
}
private:
KisDisplayColorConverter *m_parent;
QPointer<KoCanvasResourceManager> m_resourceManager;
......
......@@ -68,18 +68,19 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
m_page->lblResolutionValue->setText(QLocale().toString(image->xRes()*72, 2)); // XXX: separate values for x & y?
//Set the canvas projection color:
m_defaultColorAction = new KoColorPopupAction(this);
m_defaultColorAction->setCurrentColor(m_image->defaultProjectionColor());
m_defaultColorAction->setToolTip(i18n("Change the background color of the image"));
m_page->bnBackgroundColor->setDefaultAction(m_defaultColorAction);
//Set the canvas projection color: backgroundColor
KoColor background = m_image->defaultProjectionColor();
background.setOpacity(1.0);
m_page->bnBackgroundColor->setColor(background);
m_page->sldBackgroundColor->setRange(0.0,1.0,2);
m_page->sldBackgroundColor->setSingleStep(0.05);
m_page->sldBackgroundColor->setValue(m_image->defaultProjectionColor().opacityF());
KisSignalCompressor *compressor = new KisSignalCompressor(500 /* ms */, KisSignalCompressor::POSTPONE, this);
connect(m_defaultColorAction, SIGNAL(colorChanged(const KoColor&)), compressor, SLOT(start()));
connect(m_page->bnBackgroundColor, SIGNAL(changed(KoColor)), compressor, SLOT(start()));
connect(m_page->sldBackgroundColor, SIGNAL(valueChanged(qreal)), compressor, SLOT(start()));
connect(compressor, SIGNAL(timeout()), this, SLOT(setCurrentColor()));
connect(m_defaultColorAction, SIGNAL(colorChanged(const KoColor&)), this, SLOT(setCurrentColor()));
//Set the color space
m_page->colorSpaceSelector->setCurrentColorSpace(image->colorSpace());
......@@ -91,17 +92,15 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
m_page->ckbBlackPointComp->setChecked(m_proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
m_gamutWarning = new KoColorPopupAction(this);
m_gamutWarning->setCurrentColor(m_proofingConfig->warningColor);
m_gamutWarning->setToolTip(i18n("Set color used for warning"));
m_page->gamutAlarm->setDefaultAction(m_gamutWarning);
m_page->gamutAlarm->setColor(m_proofingConfig->warningColor);
m_page->gamutAlarm->setToolTip(i18n("Set color used for warning"));
m_page->sldAdaptationState->setMaximum(20);
m_page->sldAdaptationState->setMinimum(0);
m_page->sldAdaptationState->setValue((int)m_proofingConfig->adaptationState*20);
KisSignalCompressor *softProofConfigCompressor = new KisSignalCompressor(500, KisSignalCompressor::POSTPONE,this);
connect(m_gamutWarning, SIGNAL(colorChanged(KoColor)), softProofConfigCompressor, SLOT(start()));
connect(m_page->gamutAlarm, SIGNAL(changed(KoColor)), softProofConfigCompressor, SLOT(start()));
connect(m_page->proofSpaceSelector, SIGNAL(colorSpaceChanged(const KoColorSpace*)), softProofConfigCompressor, SLOT(start()));
connect(m_page->cmbIntent, SIGNAL(currentIndexChanged(int)), softProofConfigCompressor, SLOT(start()));
connect(m_page->ckbBlackPointComp, SIGNAL(stateChanged(int)), softProofConfigCompressor, SLOT(start()));
......@@ -142,7 +141,9 @@ const KoColorSpace * KisDlgImageProperties::colorSpace()
void KisDlgImageProperties::setCurrentColor()
{
KisLayerUtils::changeImageDefaultProjectionColor(m_image, m_defaultColorAction->currentKoColor());
KoColor background = m_page->bnBackgroundColor->color();
background.setOpacity(m_page->sldBackgroundColor->value());
KisLayerUtils::changeImageDefaultProjectionColor(m_image, background);
}
void KisDlgImageProperties::setProofingConfig()
......@@ -153,7 +154,7 @@ void KisDlgImageProperties::setProofingConfig()
m_proofingConfig->proofingProfile = m_page->proofSpaceSelector->currentColorSpace()->profile()->name();
m_proofingConfig->proofingModel = m_page->proofSpaceSelector->currentColorSpace()->colorModelId().id();
m_proofingConfig->proofingDepth = "U8";//default to this
m_proofingConfig->warningColor = m_gamutWarning->currentKoColor();
m_proofingConfig->warningColor = m_page->gamutAlarm->color();
m_proofingConfig->adaptationState = (double)m_page->sldAdaptationState->value()/20.0;
qDebug()<<"set proofing config in properties: "<<m_proofingConfig->proofingProfile;
m_image->setProofingConfiguration(m_proofingConfig);
......
......@@ -24,8 +24,6 @@
#include "ui_wdgimageproperties.h"
class KoColorSpace;
class KoColorPopupAction;
class WdgImageProperties : public QWidget, public Ui::WdgImageProperties
{
Q_OBJECT
......@@ -58,8 +56,6 @@ private:
WdgImageProperties * m_page;
KisImageWSP m_image;
KoColorPopupAction *m_defaultColorAction;
KoColorPopupAction *m_gamutWarning;
KisProofingConfigurationSP m_proofingConfig;
};
......
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QList>
#include <QAbstractSpinBox>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QPointer>
#include "KoColorSpaceRegistry.h"
#include <KoColorSet.h>
#include <KoResourceServerProvider.h>
#include <KoResourceServer.h>
#include "kis_signal_compressor.h"
#include "KisViewManager.h"
#include "KoColorDisplayRendererInterface.h"
#include "kis_spinbox_color_selector.h"
#include "kis_dlg_internal_color_selector.h"
#include "ui_wdgdlginternalcolorselector.h"
#include "kis_config.h"
#include "kis_config_notifier.h"
#include "kis_color_input.h"
struct KisDlgInternalColorSelector::Private
{
bool allowUpdates = true;
KoColor currentColor;
KoColor previousColor;
KoColor sRGB = KoColor(KoColorSpaceRegistry::instance()->rgb8());
const KoColorSpace *currentColorSpace;
bool lockUsedCS = false;
bool chooseAlpha = false;
KisSignalCompressor *compressColorChanges;
const KoColorDisplayRendererInterface *displayRenderer;
KisHexColorInput *hexColorInput;
};
KisDlgInternalColorSelector::KisDlgInternalColorSelector(QWidget *parent, KoColor color, Config config, const QString &caption, const KoColorDisplayRendererInterface *displayRenderer)
: QDialog(parent)
,m_d(new Private)
{
setModal(config.modal);
this->setFocusPolicy(Qt::ClickFocus);
m_ui = new Ui_WdgDlgInternalColorSelector();
m_ui->setupUi(this);
setWindowTitle(caption);
m_d->currentColor = color;
m_d->currentColorSpace = m_d->currentColor.colorSpace();
m_d->displayRenderer = displayRenderer;
m_ui->spinboxselector->slotSetColor(color);
connect(m_ui->spinboxselector, SIGNAL(sigNewColor(KoColor)), this, SLOT(slotColorUpdated(KoColor)));
m_ui->visualSelector->slotSetColor(color);
m_ui->visualSelector->setDisplayRenderer(displayRenderer);
m_ui->visualSelector->setConfig(false, config.modal);
if (config.visualColorSelector) {
connect(m_ui->visualSelector, SIGNAL(sigNewColor(KoColor)), this, SLOT(slotColorUpdated(KoColor)));
connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), m_ui->visualSelector, SLOT(ConfigurationChanged()));
} else {
m_ui->visualSelector->hide();
}
if (config.screenColorPicker) {
connect(m_ui->screenColorPicker, SIGNAL(sigNewColorPicked(KoColor)),this, SLOT(slotColorUpdated(KoColor)));
} else {
m_ui->screenColorPicker->hide();
}
//TODO: Add disable signal as well. Might be not necessary...?
KisConfig cfg;
QString paletteName = cfg.readEntry("internal_selector_active_color_set", QString());
KoResourceServer<KoColorSet>* rServer = KoResourceServerProvider::instance()->paletteServer(false);
KoColorSet *savedPal = rServer->resourceByName(paletteName);
if (savedPal) {
m_ui->paletteBox->setColorSet(savedPal);
} else {
savedPal = rServer->resources().first();
if (savedPal) {
m_ui->paletteBox->setColorSet(savedPal);
}
}
if (config.paletteBox) {
connect(m_ui->paletteBox, SIGNAL(colorChanged(KoColor,bool)), this, SLOT(slotColorUpdated(KoColor)));
m_ui->paletteBox->setDisplayRenderer(displayRenderer);
} else {
m_ui->paletteBox->hide();
}
if (config.prevNextButtons) {
m_ui->currentColor->setColor(m_d->currentColor);
m_ui->currentColor->setDisplayRenderer(displayRenderer);
m_ui->previousColor->setColor(m_d->currentColor);
m_ui->previousColor->setDisplayRenderer(displayRenderer);
connect(this, SIGNAL(accepted()), this, SLOT(setPreviousColor()));
connect(m_ui->previousColor, SIGNAL(triggered(KoColorPatch*)), SLOT(slotSetColorFromPatch(KoColorPatch*)));
} else {
m_ui->currentColor->hide();
m_ui->previousColor->hide();
}
if (config.hexInput) {
m_d->sRGB.fromKoColor(m_d->currentColor);
m_d->hexColorInput = new KisHexColorInput(this, &m_d->sRGB);
m_d->hexColorInput->update();
connect(m_d->hexColorInput, SIGNAL(updated()), SLOT(slotSetColorFromHex()));
m_ui->rightPane->addWidget(m_d->hexColorInput);
m_d->hexColorInput->setToolTip(i18n("This is a hexcode input, for webcolors. It can only get colors in the sRGB space."));
}
connect(this, SIGNAL(signalForegroundColorChosen(KoColor)), this, SLOT(slotLockSelector()));
m_d->compressColorChanges = new KisSignalCompressor(100 /* ms */, KisSignalCompressor::POSTPONE, this);
connect(m_d->compressColorChanges, SIGNAL(timeout()), this, SLOT(endUpdateWithNewColor()));
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
KisDlgInternalColorSelector::~KisDlgInternalColorSelector()
{
delete m_ui;
//TODO: Does the scoped pointer also need to be deleted???
}
void KisDlgInternalColorSelector::slotColorUpdated(KoColor newColor)
{
//if the update did not come from this selector...
if (m_d->allowUpdates || QObject::sender() == this->parent()) {
if (m_d->lockUsedCS){
newColor.convertTo(m_d->currentColorSpace);
m_d->currentColor = newColor;
} else {
m_d->currentColor = newColor;
}
updateAllElements(QObject::sender());
}
}
void KisDlgInternalColorSelector::colorSpaceChanged(const KoColorSpace *cs)
{
if (cs == m_d->currentColorSpace) {
return;
}
m_d->currentColorSpace = KoColorSpaceRegistry::instance()->colorSpace(cs->colorModelId().id(), cs->colorDepthId().id(), cs->profile());
m_ui->spinboxselector->slotSetColorSpace(m_d->currentColorSpace);
m_ui->visualSelector->slotsetColorSpace(m_d->currentColorSpace);
}
void KisDlgInternalColorSelector::lockUsedColorSpace(const KoColorSpace *cs)
{
colorSpaceChanged(cs);
m_d->lockUsedCS = true;
}
void KisDlgInternalColorSelector::setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer)
{
if (displayRenderer) {
m_d->displayRenderer = displayRenderer;
m_ui->visualSelector->setDisplayRenderer(displayRenderer);
m_ui->currentColor->setDisplayRenderer(displayRenderer);
m_ui->previousColor->setDisplayRenderer(displayRenderer);
m_ui->paletteBox->setDisplayRenderer(displayRenderer);
} else {
m_d->displayRenderer = KoDumbColorDisplayRenderer::instance();
}
}
KoColor KisDlgInternalColorSelector::getModalColorDialog(const KoColor color, QWidget* parent, QString caption)
{
Config config = Config();
KisDlgInternalColorSelector dialog(parent, color, config, caption);
dialog.exec();
return dialog.getCurrentColor();
}
KoColor KisDlgInternalColorSelector::getCurrentColor()
{
return m_d->currentColor;
}
void KisDlgInternalColorSelector::chooseAlpha(bool chooseAlpha)
{
m_d->chooseAlpha = chooseAlpha;
}
void KisDlgInternalColorSelector::slotConfigurationChanged()
{
//m_d->canvas->displayColorConverter()->
//slotColorSpaceChanged(m_d->canvas->image()->colorSpace());
}
void KisDlgInternalColorSelector::slotLockSelector()
{
m_d->allowUpdates = false;
}
void KisDlgInternalColorSelector::setPreviousColor()
{
m_d->previousColor = m_d->currentColor;
KisConfig cfg;
if (m_ui->paletteBox->colorSet()) {
cfg.writeEntry("internal_selector_active_color_set", m_ui->paletteBox->colorSet()->name());
}
}
void KisDlgInternalColorSelector::updateAllElements(QObject *source)
{
//update everything!!!
if (source != m_ui->spinboxselector) {
m_ui->spinboxselector->slotSetColor(m_d->currentColor);
}
if (source != m_ui->visualSelector) {
m_ui->visualSelector->slotSetColor(m_d->currentColor);
}
if (source != m_d->hexColorInput) {
m_d->sRGB.fromKoColor(m_d->currentColor);
m_d->hexColorInput->update();
}
m_ui->previousColor->setColor(m_d->previousColor);
m_ui->currentColor->setColor(m_d->currentColor);
if (source != this->parent()) {
emit(signalForegroundColorChosen(m_d->currentColor));
m_d->compressColorChanges->start();
}
}
void KisDlgInternalColorSelector::endUpdateWithNewColor()
{
m_d->allowUpdates = true;
}
void KisDlgInternalColorSelector::focusInEvent(QFocusEvent *)
{
//setPreviousColor();
}
void KisDlgInternalColorSelector::slotSetColorFromPatch(KoColorPatch* patch)
{
slotColorUpdated(patch->color());
}
void KisDlgInternalColorSelector::slotSetColorFromHex()
{
slotColorUpdated(m_d->sRGB);
}
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.