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

SVG rasterization issue in QML Canvas

    XMLWordPrintable

Details

    • 7d426b622 (dev)

    Description

      Hi, I'm struggling to properly render SVG icons into a Canvas item.
      Since icons are small (for me typically 48x48px), I always use the sourceSize property to force a specific rendering size.
      On a Canvas though, it seems the drawImage call completely ignores the rasterization size and somehow scale the original SVG size to the requested one (dw, dh), producing an ugly aliasing effect which makes the usage of the SVG format totally useless.

      Attached a self contained example to reproduce the issue and a screenshot of the result.
      From the left:

      • the original SVG icon as Image item (correct)
      • the same Image item rendered by drawImage (to be honest I expected this to be correct as well, since rasterized data should be provided by Image)
      • the SVG icon loaded with the procedure explained in the documentation, with loadImage and onImageLoaded

      Is there any trick to solve this that I'm not aware of or is there something wrong in the internals ?

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            mcallegari79 Massimo Callegari
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes