Color Picker Blending Feature: Advice Needed!

Emmet O'Neill emmetoneill.pdx at gmail.com
Sat Mar 31 23:54:41 UTC 2018


Hi there, Krita community! I'm Emmet and I've been working on a small Krita
feature patch together with my brother Eoin (pronounced Owen).

Essentially, we've come up with (and mostly implemented) a new feature for
Krita's color picker that allows for mixing the newly picked color with the
current color of the user's bush.
This is a relatively small and simple change that we think makes a massive
difference when it comes to painting and color mixing workflow, as it
significantly reduces the need for on-canvas color blending techniques that
have been the standard for digital painters.
A great analogy and part of the inspiration for this idea is traditional
painting, especially water-based painting. In watercolor or gouache, for
example, if you dip your brush into a red puddle and then a blue puddle,
your brush stroke will be some shade of purple on the page - the colors mix
in the brush. The same thing happens to some degree in most forms of
painting, and controlling this is a powerful tool for the traditional
painter. So, what we're working on is a feature that adds configurable
"blending" to Krita's color picker: when "blending" is set to full the
color picker works as it always has by replacing your previous brush color
with the newly picked color. However, when blending is set to a lower value
(~1-99%) your previous brush color is partially mixed with the newly picked
color, with each separate click of the color picker mixing in a little bit
more. Obviously I'm a bit biased, but I think mixing colors this way feels
amazing and very intuitive, much like dipping a brush into paint!

As of right now, we have this feature working while using the dedicated
color picker tool (kis_tool_colorpicker) and we've added a small slider to
control the blending amount to the color picker gui (wdgcolorpicker.ui).
But color picker blending currently isn't working when using the "global"
color picker that pops up when you press 'ctrl' while another tool is
selected. This is where we're hoping that somebody who is more familiar
with the Krita codebase can provide some advice with how to proceed! I
think we've tracked down the relevant code for the 'ctrl-picker' over in
"kis_tool_utils" and "kis_color_picker_stroke_strategy", and while the code
is pretty similar to the other dedicated color picker code, we've run into
an issue: in "kis_tool_colorpicker.cc" we were able to easily get the
previous brush color by calling
"canvas()->resourceManager()->foregroundColor()" before mixing it with the
picked color, but we're not sure how to access the foreground color from
within "kis_color_picker_stroke_strategy.cc". Does anybody have any idea
about the proper way of getting access to foregroundColor() from within the
color picker stroke strategy code or alternatively passing it into that
code at some other point?

It probably goes without saying that we're both new to the Krita codebase
and contributing to open source projects in general! We'll gladly accept
any guidance or suggestions, and if anybody wants to try out "color picker
blending" for themselves I'd be happy to try to send a little patch over so
you can see what we have so far.

Thanks, Emmet.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kimageshop/attachments/20180331/8d0746c3/attachment.html>


More information about the kimageshop mailing list