Is there a way to set the linear gradient stepwith in QML

893 Views Asked by At

I use a linear gradient to colorize a rectangle. On my Display (480px, EGLFS) i can clearly see 16 color-steps (see picture). Is there a way to increase the number of steps to have a more fluid gradient.

bad gradient

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

There are 1 best solutions below

0
Mat On BEST ANSWER

The problem was, that the gradient has more colors than the display can show (850 for 256). This is called colour banding (https://en.wikipedia.org/wiki/Colour_banding). After reducing the colors by using an indicated .png instead of the gradient it looks ok.