Thursday, March 27, 2014

Krita: new extended tablet support!

Traditionally Krita supported various types of tablets on Linux, but this support was limited to the tablets handled by wacom driver. The list of the supported hardware included (obviously) all the Wacom-branded tablets and some rare species that were trying to resemble the branded devices. It was the best that one could get form the Qt's tablet code. From now on Krita can also work with all the devices which are handled by the evdev X11 driver!



The list of the devices supported by evdev is really vast. It includes such not-very-expensive brands like Monoprice, Bosto, Huion and Genius. By the moment we tested Krita on two devices: Bosto 19MA [0] and Genius G-Pen 560. Both work fine with Krita and have really nice pressure support! Right now we are also working on support for the Huion tablet supplied by huiontablet.com to the Krita project as well!

Bosto kingtee 19MA now works with Krita!
So if you have a tablet device which used to refuse to work with Krita on Linux, test it now!

I also did a small cross-test of my old Wacom Graphire2 device and Genius G-Pen 560. What I noticed is that the lines generated by the Wacom tablet are more stable and smooth, whereas the lines by the Genius tablet are a bit dizzy. I don't know what is the exact reason for it, but I have a feeling that Wacom does some internal filtering of the coordinates generated by the hardware, which gives us better lines. Anyway, even if you own this Genius device, Krita allows you to workaround the issue. Just enable Weighted Smoothing painting algorithm and it will produce the results just like Wacom does!

And if you would like to know the technical details about why Qt's tablet code supports wacom-driver-based tablets only...

Qt's code doesn't fully support the interface of the XDeviceMotionEvent. Qt expects that the values of all six axes of the tablet will be sent to the client in each event. This is true for wacom driver, but it is not guaranteed to be true for other XInput devices. The motion event can also send the values that changed since the last event only. It even has special fields for that:

typedef struct
    {
    /* ... skipped ... */
    unsigned char axes_count;
    unsigned char first_axis;
    int           axis_data[6];
    } XDeviceMotionEvent;

axes_count field tells us how many axes are really delivered to the client and first_axis tells to what absolute axis the first element of axis_data corresponds to.

Now Krita can handle that effectively, as well as recognize to what sensor each axis is assigned to! [1]


[0] - https://groups.google.com/forum/#!topic/bosto-user-group/sL_O4VoopVk
[1] - unlike Gimp's way, where the user must manually investigate to which sensor each axis is connected to ;P

12 comments:

  1. Have you considered fixing the bug in Qt where it should be fixed? This sounds like a work-around downstream. Thanks for your work on Krita!

    ReplyDelete
    Replies
    1. Well, there will be no major release of Qt 4.X branch anymore, so our users will just not get these changes :) And the status of the tablet support in Qt5 is still in a bit undefined state. And we are still only in the beginning of the process of porting Calligra to Qt5 which is, obviously, not a trivial task.

      And what worries me the most is that we need a bit "drastic" change to QTabletEvent API. We need it to store tablet button information in it. Current Qt's approach with "ignore tablet event to get a re-sent mouse event to get a button information" will simply *not* work for us, as well as for any painting application, because ignoring a tablet event in Qt on X11 means *dropping* all the consecutive tablet events to the trash, significantly lowering precision of the line and making it "bend". We were fighting with this problem for several years until found out why it happens.

      If someone volunteers to be a deputy in communications with Qt and push this change to QTabletEvent API, then we will surely help Qt to adopt our fixes. Until then we cannot do it. We just don't have spare hands for this communication/porting work. So, yes, until then "workaround downstream".

      Delete
    2. Qt 4.8.6 is in the process of being released, but I will accept your concern about Qt 4 and bigger changes. For Qt 5, let's get it fixed indeed :)
      I'll happily help getting this sorted out with people in the Qt community and inside Digia.
      Cheers,
      Frederik Gladhorn
      (it should be easy enough to reach me via mail/irc/codereview)

      Delete
    3. I am sure I am missing something, so can you please explain why supporting tablet buttons in QTabletEvent requires a "drastic" change? Adding another field with the button state to QTabletEvent seems trivial to me. It also looks non-controversial enough to me to be easily accepted by the Qt maintainers.

      Delete
  2. I'd be interested to know which of the budget-value tablets are the best value for the money, as I want a tablet to play with in Krita but don't want to spend a lot of money.

    In any case, thank you for your work!

    ReplyDelete
    Replies
    1. Well, a used Wacom Graphire{2,3,4} is a good choice for the beginning. Here in Moscow one can buy a used one starting form 10 euro, but you have to sacrifice support for Windows 8. If you want Win8 support, take any Bamboo Pen device.

      One of our users tested Krita on Bosto 19MA, which is a budget tablet+monitor solution. His review was very positive.

      I wouldn't recommend you buying a Genius G-Pen 560, since the lines it generates are a bit dizzy. For unknown reason.

      Delete
  3. Another question... when Wayland comes around, will these X-based tricks work anymore?

    ReplyDelete
    Replies
    1. Don't know. This uses XInput framework. If it is available, then yes. If not --- not.

      Delete
  4. Genius Mousepen 6*8 Now works with pressure sensitivity using the latest krita-testing version.
    Thanks a lot, its great.

    ReplyDelete
  5. I think the Wacom tablet are more steady and smooth, inasmuch as the lines by the Genius tablet are a bit bleary eyed. I don't comprehend what is the careful explanation behind it, yet I have an inclination that Wacom does some inward sifting of the directions created by the fittings, which provides for us better lines. At any rate, regardless of the possibility that you claim this Genius gadget, Krita permits you to workaround the issue. It's very informative post.
    Android Watch Phone

    ReplyDelete
  6. Hi,
    Does all the above still apply to Krita 3+ ?
    I refer you to my bug report. https://bugs.kde.org/show_bug.cgi?id=371827

    My Bosto 22HD, using my driver: https://github.com/aidyw/bosto-2g-linux-kernel-module does not have pressure anymore. 2.9.7 works, but I'm aware a major change in krita to Qt5 and its stopped working since then.
    Regards
    Aidan

    ReplyDelete
  7. Its battery is pretty good and therefore the Intuos will hook up with mackintosh or computer
    and can run with any code program. One disadvantage is that its wireless accessories ar sold one by one. I’d powerfully advocate this as a perfect pill for any creator who’s longing for a inexpensive sort.
    drawing tablet

    Huion H610

    I think the Wacom tablet more, The Huion H610 professional is nice for artists on a budget - a comparable Wacom product prices
    fourfold additional digitalarts.

    ReplyDelete

Followers