Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-132764

make stylus "ink" useful in Qt Quick: drawing, saving, loading, rendering

    XMLWordPrintable

Details

    • make stylus "ink" useful in Qt Quick

    Description

      I've had this on the back burner for a very long time. There's potentially a lot to it, uncertain "demand" for it, and not much has been done except for a couple of hackathons. Of course some users roll their own implementations; we have so far limited ourselves to providing QTabletEvents from the hardware, shipping a couple of primitive examples, and leaving everything else up to the user.

      Notes from the 2025 hackathon:

      • Drawing tablets have been supported in Qt for ages
        • Wacom (the oldest), nTrig and clones
        • Microsoft Surface pens
        • Samsung S-pen
        • Apple Pencil
      • Usually widget apps; possible in QML with Canvas (the example we ship)
        • how to use Pointer Handlers for that?
        • how to do all the rendering on the GPU?
        • focus on technical use cases (artistic apps are all custom anyway)
      • 2019 hackathon: use Qt Quick Shapes to draw vector strokes
        • filled strokes only, and only MSAA
        • InkStrokingHandler and PathInkStroke (still not shipping)
      • But now we have antialiasing: strokes and fills
      • QQuadPath: bypass QPainterPath
      • Variable-width stroking (followup to cosmetic stroking)
        • both uniform and per-vertex width
      • Possible future work: save and load ink from various sources
        • QInkStroke, QInkStrokePoint, QAbstractInkReader, QAbstractInkWriter?
        • W3C InkML (xml, complex, links to MathML as if the implementation needs a math recognizer)
        • Microsoft ISF (binary)
        • Wacom WILL
        • SVG paths (but that's limiting; the VWS proposal was not accepted)
        • PDF annotations?

      The formats for saving and loading are a bit of a mess, every vendor for themselves, despite the existence of multiple standards. So I suppose we should try to support some of the standards (starting with low-hanging fruit), and provide API to standardize the Qt interface for readers and writers, just as we have things like QImageIOHandler and maybe ought to also have an abstract base class for QTextDocument readers and writers.

      Who uses this stuff... I'm not sure, I guess students use Microsoft OneNote or ipads with Apple Pencils? (They mostly didn't exist when I was a student, but Windows for Pen was around, and I didn't discover it until near the end of that time. Had to graduate and get a job before I could afford one: then I got a Daupin DTR-1 in about 1995, and was impressed with how well such a low-powered machine could do shape recogntion. But I didn't actually use it much either; it already seemed like a silo, a dead end, even then.) Various people use Remarkable tablets. These platforms are all siloed. So I'm not aware of a typical open-source stack, and I've always thought it's weird that there isn't one. Maybe KDE will get interested at some point.

      It remains to be seen whether it would be easy for at least QtPDF to provide support for scribbling margin notes, saving them into the PDF as annotations, and viewing them along with the PDF later. At least there the storage format is well-defined.

      Recognition of shapes, handwriting, and math would all be interesting, but we'd better walk before we run. Having a nice API to access the "ink" would be a good start, and apps can try to do more advanced things with that. This task is primarily concerned with the basics.

      Painterly stroking (emulating brushes and pencils and such) is probably out of scope inside Qt, IMO. But maybe the ability to map a texture onto a stroke could be one way to build on top of what we provide, if we ever get that far.

      I think variable stroke width is a must, though. The stylus provides pressure values, so it's sensible to do something with them.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-132764
          # Subject Branch Project Status CR V

          Activity

            People

              srutledg Shawn Rutledge
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: