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

Can't always get a non-blurry image in all cases using QML Image

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.0.0
    • None
    • All

    Description

      Requirements:
      1. Render images to specified size. Assumption is 100x100
      2. Must ensure the image no blurry, then the render pixel size is less than the image pixel size
      3. If the image source size is less than the specified size(100x100), should using the image source pixel size
      4. If the image can lossless scale(svg), should scale to the specified size

      For those requirements.

      My first mean is set sourceSize property of Image.

      Image {
          source: "..."
          sourceSize: Qt.size(100, 100)
      }
      

      But it isn't accord with the rule 3, because I can't know the image file pixel size(because the sourceSize property of Image is set). and it isn't accord with the rule 2, because if the Window devicePixelRatio is greater then 1.0, and the image file can't lossless scale, and no "@2x" files, the image will blurry.

      My second mean is only set width and height properties of Image.

      Image {
          source: "..."
          width: Math.min(100, sourceSize.width)
          height: Math.min(100, sourceSize.height)
          fillMode: PreserveAspectFit
      }
      

      But is isn't accord with the rule 4, because the sourceSize of lossless svg file is the default size, should always render the svg image to 100x100. and not set the sourceSize, maybe this can lead to unnecessary waste of memory.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              zccrs JiDe Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes