【问题标题】:Is there a way to set the linear gradient stepwith in QML有没有办法在 QML 中设置线性渐变 stepwith
【发布时间】:2018-12-21 09:45:34
【问题描述】:

我使用线性渐变为矩形着色。在我的显示器(480px,EGLFS)上,我可以清楚地看到 16 个色阶(见图)。有没有办法增加步数以获得更流畅的梯度。

不好的渐变

Rectangle {
    width: 800
    height: 480
    gradient: Gradient{
        GradientStop{position: 1.0; color: "#404040"}
        GradientStop{position: 0.0; color: "black"}
    }
}

【问题讨论】:

标签: qt qml gradient linear-gradients qt5.6


【解决方案1】:

问题在于,渐变的颜色多于显示器所能显示的颜色(256 为 850)。这称为色带 (https://en.wikipedia.org/wiki/Colour_banding)。 通过使用指示的 .png 而不是渐变来减少颜色后,它看起来没问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-15
    • 1970-01-01
    • 2010-10-14
    • 1970-01-01
    • 2013-06-29
    • 2019-12-29
    • 1970-01-01
    相关资源
    最近更新 更多