【问题标题】:Qml Image mipmapQml 图像 mipmap
【发布时间】:2015-07-06 21:04:07
【问题描述】:

我目前正在使用 QML 和 android,我正在尝试添加多尺寸图像作为资源 (.qrc) 并使用 Image 加载它。我发现Image 有一个名为mipmap 的属性来实现这一点,但我不明白如何使用它。我用.ico 文件试了一下——没有成功。任何建议如何做到这一点?我找不到任何关于它的信息。

这是我的代码 - 虽然很简单:

Image {
    id: btnImg
    source: "qrc:/icons/btnImg.png"  //Tried an multi-sized .ico file
    mipmap: true
    ...
}

【问题讨论】:

    标签: android image qt qml mipmaps


    【解决方案1】:

    mipmap 用于具有更好的视觉质量,但它没有说明多尺寸图像。可能您需要根据需要实现自定义 Image 组件。

    【讨论】:

      【解决方案2】:

      Mipmap 过滤在缩小时提供更好的视觉质量。

      我认为 QML Image 的来源在图像尺寸较大时是可以切换的。

      Image {
          id: btnImg
          // if width is larger than 500, use the large scale image
          source: width > 500 ? "largeBtnImg.png" : "smallBtnImg.png"
          mipmap: true
          ...
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-10-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-05-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多