Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Blog
  4. Qt Canvas Painter blog post series

Qt Canvas Painter blog post series

Scheduled Pinned Locked Moved Unsolved Blog
15 Posts 8 Posters 1.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • GrecKoG Offline
    GrecKoG Offline
    GrecKo
    Qt Champions 2018
    wrote on last edited by
    #5

    Nice to have an efficient alternative to QQuickPainterItem!
    Too bad about the no LPGL but I understand it.

    Will it be a potential new backend for the QML Canvas? Will a new type be introduced for that?
    Or does that not make too much sense and will lose the performance improvements it brins?

    K 1 Reply Last reply
    0
    • GrecKoG GrecKo

      Nice to have an efficient alternative to QQuickPainterItem!
      Too bad about the no LPGL but I understand it.

      Will it be a potential new backend for the QML Canvas? Will a new type be introduced for that?
      Or does that not make too much sense and will lose the performance improvements it brins?

      K Offline
      K Offline
      Kaj Gronholm
      wrote on last edited by
      #6

      @GrecKo: Thanks! Yes, the plan is to have a new Quick Canvas implemented with the Qt Canvas Painter. And current plan is that it would be a new element and not just a backend for the existing Canvas element. There are many reasons for this, for example, we can then remove the deprecated code & features ( https://doc.qt.io/qt-6/qml-qtquick-canvas-obsolete.html ) and make the API & features match the Canvas Painter C++ API. PoC shows that performance improvement to the current Canvas element is very notable πŸ™‚

      Any suggestions for the element name? One of my ideas was "Canvas2D", but not sure about that yet... πŸ€”

      JKSHJ 1 Reply Last reply
      1
      • K Kaj Gronholm

        @GrecKo: Thanks! Yes, the plan is to have a new Quick Canvas implemented with the Qt Canvas Painter. And current plan is that it would be a new element and not just a backend for the existing Canvas element. There are many reasons for this, for example, we can then remove the deprecated code & features ( https://doc.qt.io/qt-6/qml-qtquick-canvas-obsolete.html ) and make the API & features match the Canvas Painter C++ API. PoC shows that performance improvement to the current Canvas element is very notable πŸ™‚

        Any suggestions for the element name? One of my ideas was "Canvas2D", but not sure about that yet... πŸ€”

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #7

        @Kaj-Gronholm said in Qt Canvas Painter blog post series:

        Any suggestions for the element name? One of my ideas was "Canvas2D", but not sure about that yet... πŸ€”

        I think Canvas2D works well. It offers a clear link to the 2D HTML Canvas API, while making it clear that it's not the same as Canvas (https://doc.qt.io/qt-6/qml-qtquick-canvas.html) or Canvas3D (https://doc.qt.io/archives/qt-5.12/qml-qtcanvas3d-canvas3d.html)

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        K 1 Reply Last reply
        0
        • JKSHJ JKSH

          @Kaj-Gronholm said in Qt Canvas Painter blog post series:

          Any suggestions for the element name? One of my ideas was "Canvas2D", but not sure about that yet... πŸ€”

          I think Canvas2D works well. It offers a clear link to the 2D HTML Canvas API, while making it clear that it's not the same as Canvas (https://doc.qt.io/qt-6/qml-qtquick-canvas.html) or Canvas3D (https://doc.qt.io/archives/qt-5.12/qml-qtcanvas3d-canvas3d.html)

          K Offline
          K Offline
          Kaj Gronholm
          wrote on last edited by
          #8

          @JKSH Thanks! So Canvas2D it might be then πŸ™‚

          1 Reply Last reply
          0
          • K Kaj Gronholm

            @Adam-Jensen Thanks! Yes, GPL/commercial license can hinder some of the adaptation, but hopefully it will be applicable for those to whom the license suits.

            B Offline
            B Offline
            beeka
            wrote last edited by
            #9

            @Kaj-Gronholm There are many cases where GPL is problematic but LGPL would work. While I understand the commercial imperative, it is depressing that nothing new is being contributed to the core Qt (I appreciate there are bug fixes). It doesn't feel like a "difficult decision" but instead what is now normal. It is also frustrating that the commercial license is too expensive for me to justify to management (together with the clause preventing switching part-way through development). I still had hope that small features or performance-focused improvements might still find a home under the LGPL, but that does not look likely now.

            K 1 Reply Last reply
            0
            • B beeka

              @Kaj-Gronholm There are many cases where GPL is problematic but LGPL would work. While I understand the commercial imperative, it is depressing that nothing new is being contributed to the core Qt (I appreciate there are bug fixes). It doesn't feel like a "difficult decision" but instead what is now normal. It is also frustrating that the commercial license is too expensive for me to justify to management (together with the clause preventing switching part-way through development). I still had hope that small features or performance-focused improvements might still find a home under the LGPL, but that does not look likely now.

              K Offline
              K Offline
              Kaj Gronholm
              wrote last edited by
              #10

              @beeka I'm confident the licensing feedback will be monitored and adjusted if needed. Also, I'm sure there are ways to avoid the part-way through development issue. If in doubt, please get your management in touch with our sales representatives.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                Kaj Gronholm
                wrote last edited by
                #11

                The third post of the trilogy is out now: https://www.qt.io/blog/accelerated-2d-canvas-benchmarks

                TL;DR: Canvas Painter can be up to 10 times faster than QPainter with the OpenGL backend. Please read the blog post for details and comment here with your own results!

                1 Reply Last reply
                0
                • kkoehneK Offline
                  kkoehneK Offline
                  kkoehne
                  Moderators
                  wrote last edited by kkoehne
                  #12

                  While I understand the commercial imperative, it is depressing that nothing new is being contributed to the core Qt (I appreciate
                  there are bug fixes). It doesn't feel like a "difficult decision" but instead what is now normal.

                  I can understand the frustration, but it's simply not true that everything 'new' in Qt is released only under Qt Commercial + GPL3 licenses. Actually the other three new modules in Qt 6.11 - Qt TaskTree, Qt OpenAPI and Qt Labs StyleKit - are made available under Qt Commercial + LGPLv3! And there are also new features in a lot of established Qt modules ...

                  This obviously doesn't help you though if you are interested primarily on Qt CanvasPainter.

                  Director R&D, The Qt Company

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    Dyami Caliri
                    wrote last edited by
                    #13

                    This is really cool, and something I've been waiting for to be able to transition our software from OpenGL to QRhi.

                    However, in my first attempts to use it, I can't seem to do what I want to do: use QCanvasPainter to draw OVER other content I've already drawn within a QRhi render pass. It seems to insist on clearing the contents. I want to draw grids, masking marks, and text over 2D composited images I've already drawn.

                    Is this possible?

                    A 1 Reply Last reply
                    0
                    • D Dyami Caliri

                      This is really cool, and something I've been waiting for to be able to transition our software from OpenGL to QRhi.

                      However, in my first attempts to use it, I can't seem to do what I want to do: use QCanvasPainter to draw OVER other content I've already drawn within a QRhi render pass. It seems to insist on clearing the contents. I want to draw grids, masking marks, and text over 2D composited images I've already drawn.

                      Is this possible?

                      A Offline
                      A Offline
                      agocs
                      wrote last edited by
                      #14

                      @Dyami-Caliri said in Qt Canvas Painter blog post series:

                      This is really cool, and something I've been waiting for to be able to transition our software from OpenGL to QRhi.

                      However, in my first attempts to use it, I can't seem to do what I want to do: use QCanvasPainter to draw OVER other content I've already drawn within a QRhi render pass. It seems to insist on clearing the contents. I want to draw grids, masking marks, and text over 2D composited images I've already drawn.

                      Is this possible?

                      Yes. See https://doc-snapshots.qt.io/qt6-dev/qcanvasrhipaintdriver.html#endPaint (esp. the second snippet with the DoNotRecordRenderPass flag)

                      This can be seen in action in the hellorhi2 manual test that renders a triangle with QRhi and then some QCanvasPainter-based rendering within the same pass within a QRhiWidget: https://code.qt.io/cgit/qt/qtcanvaspainter.git/tree/tests/manual/hellorhi2/hellorhi2.cpp?h=6.11#n97
                      (there is no public example for this kind of low-level usage currently, perhaps it is something we should consider, since this is definitely a valid and important use case for QCanvasPainter)

                      D 1 Reply Last reply
                      1
                      • A agocs

                        @Dyami-Caliri said in Qt Canvas Painter blog post series:

                        This is really cool, and something I've been waiting for to be able to transition our software from OpenGL to QRhi.

                        However, in my first attempts to use it, I can't seem to do what I want to do: use QCanvasPainter to draw OVER other content I've already drawn within a QRhi render pass. It seems to insist on clearing the contents. I want to draw grids, masking marks, and text over 2D composited images I've already drawn.

                        Is this possible?

                        Yes. See https://doc-snapshots.qt.io/qt6-dev/qcanvasrhipaintdriver.html#endPaint (esp. the second snippet with the DoNotRecordRenderPass flag)

                        This can be seen in action in the hellorhi2 manual test that renders a triangle with QRhi and then some QCanvasPainter-based rendering within the same pass within a QRhiWidget: https://code.qt.io/cgit/qt/qtcanvaspainter.git/tree/tests/manual/hellorhi2/hellorhi2.cpp?h=6.11#n97
                        (there is no public example for this kind of low-level usage currently, perhaps it is something we should consider, since this is definitely a valid and important use case for QCanvasPainter)

                        D Offline
                        D Offline
                        Dyami Caliri
                        wrote last edited by
                        #15

                        @agocs That's brilliant. Thank you. I'm sorry I didn't read the documentation more thoroughly.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved