This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Can another app get info from Krita? (eg: current HSV/RGB)

Tags: None
(comma "," separated)
User avatar
zortporfman
Registered Member
Posts
13
Karma
0
OS
Hi all. I'm writing some middleware to map midi controllers to Krita shortcuts, so that turning a knob or pressing a button on the midi controller will send shortcut keypresses to Krita. For example, you could have a bank of rotary encoders that pan/zoom/rotate the canvas, or change the RGB, opacity, hue, etc. of the current color. ...buttons that show and hide color pickers, dockers, activate fullscreen, etc.

My question is this: Is there any way to get information out of Krita like what the currently selected foreground color is (RGB/HSV values), current opacity, etc? Is erase mode currently active? etc. In other words, is there any way I can figure out the current value of the Krita properties affected by the keyboard shortcuts I'll be using?

I imagine there's nothing in place now to allow direct queries of Krita for these values, but is there any way krita can be made to output these values to a log file or something else that I could read from my program?

...and while I'm at it, assuming direct queries aren't possible now, could this be easily added to krita in the future?

####################

I'll be using a Behringer CMD DV-1 (http://www.bhphotovideo.com/c/product/9 ... oller.html), but I plan on making the thing generic enough that mapping other controllers will be easy. The DV1 has a bunch of encoders with great LED position markers that I'd like to be able to use. Problem is, the communication with Krita will be one-way, unless there's some way I can get info out of Krita - so, it'll be difficult to know, for example, what the current RGB values are so that I can light up the right encoder position marker LEDs.

Positions for zoom and rotate should be easy enough to manage - I could just have a "sync" button mapped on my controller that resets the Krita view to no-rotation/100% zoom, and then just do the math in the middleware script to track rotation and zoom actions on the controller, and as long as the user only uses the controller to zoom/rotate, then I'll have a pretty good idea of what value to use for the controller encoder marker. User could re-sync easily as necessary.

I could do something similar for color values - send a bunch of lower-R/lower-G/lower-B shortcuts until I know that the current color must be black and then work from there, but that wouldn't be very good workflow wise, and would probably get out of sync quickly since the user would want to use the eyedropper, switch back to previously used colors, etc.

Any thoughts on how I might get color info out of Krita?

Not the end of the world if I can't get this info, since there will be visual feedback in the krita window anyway, but the controller would look fancier if it had LED feedback.
User avatar
timotimo
Registered Member
Posts
72
Karma
1
OS
Hi,

I've been thinking about making the same kind of thing, but my code would be a direct plugin into krita.

That way it doesn't have to get data "out of krita", and it wouldn't be limited to things shortcuttable.

I'm calling my project OMG-Input (for OSC, MIDI, Gamecontroller), but so far I have only invested time in planning and idea collection. I've spent about three hours trying to get my code actually compiled and used by krita, but it's not working yet :\

Maybe we can put our heads together?


Edit: here's my phabricator task where i've collected a bunch of stuff: https://phabricator.kde.org/T1132
User avatar
zortporfman
Registered Member
Posts
13
Karma
0
OS
Cool... I was looking at possibly doing this as a plugin, but I figured the complexity would increase a lot... It would be a lot more useful as a plugin though - Krita really could benefit from MIDI/OSC support. And once it's implemented, I think people would really see just how useful it could be and a lot of new input/usability features would probably come out of that.

Check out this thread (if you haven't read it yet) for one idea I had a while ago that could make good use of a MIDI/OSC input plugin: viewtopic.php?f=156&t=127742

But I'm not particularly great with C++, and don't have any experience developing for Calligra/Krita. I was going to write my middleware in python - it'll be very easy to put together. If you think I'd be of any use, I'd be happy to follow your progress and help however I can though. I'll definitely be interested to follow along and learn how this would be internally implemented as a plugin at the very least...

As far as thoughts on how MIDI input could be handled from a UI perspective, if "configure krita -> configure shortcuts" had a third column that accepted midi input and mapped whatever control was pressed/turned to the selected shortcut, that would be a great starting point (even a textfile config mapping midinotes and CCs to shortcut names would be fine - probably would be easier that way than mapping each shortcut individually in a GUI). I realize it's very easy to say that, and a little more complicated to implement, but so it goes. haha.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]