Any way to smooth Gradients?
-
All the gradients look great when I run them on my desktop QML Viewer but as soon as I look at them on my linux touch screen display they look very choppy (squares). I know the smooth:true attribute helped clean the edges of shapes, but how can I clean gradients. ?
-
Are these gradients in pixmaps, or the gradient support of Rectangle? Rectangle uses standard Qt gradient drawing for this, so there shouldn't be anything special you need to set (that I'm aware). If in a pixmap, the issue might be related to the bit-depth of the screen (e.g. if your image was 32bit and you were displaying it on a 16bit screen)?
-
It is just the normal QML rectangle gradient. I wonder though if the 16bit / 8bit display isn't making the difference. Any way to know?
-
I thought QML would always be quicker than loading a png file. Good to know.
-
[quote author="kyleplattner" date="1293027447"]I thought QML would always be quicker than loading a png file. Good to know. [/quote]
In general, QML will always try to draw things the fastest way. Often this means that we internally cache things to a pixmap (for example, for 4.7.0 all Text is internally cached to a pixmap, though in 4.7.2 we will switch to using a QStaticText-like solution, which retains good performance and uses less memory). In terms of drawing a vertical linear gradient in a plain rectangle, that can be optimized quite well without caching, so we don't cache to a pixmap. (A gradient in a rounded rect, or bordered rect, however, is not well optimized)
There are certainly cases when using your own pre-composed image is the best way to go, see for example http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeperformance.html#image-resources-over-composition.
Regards,
Michael -
[quote author="kyleplattner" date="1292939771"]It is just the normal QML rectangle gradient. I wonder though if the 16bit / 8bit display isn't making the difference. Any way to know?[/quote]
It's certainly worth trying an image, and comparing the results.
Regards,
Michael -
[quote author="mbrasser" date="1293060738"]In general, QML will always try to draw things the fastest way. Often this means that we internally cache things to a pixmap (for example, for 4.7.0 all Text is internally cached to a pixmap, though in 4.7.2 we will switch to using a QStaticText-like solution, which retains good performance and uses less memory). In terms of drawing a vertical linear gradient in a plain rectangle, that can be optimized quite well without caching, so we don't cache to a pixmap. (A gradient in a rounded rect, or bordered rect, however, is not well optimized)
There are certainly cases when using your own pre-composed image is the best way to go, see for example http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeperformance.html#image-resources-over-composition.
[/quote]Thanks for the explanation! Interesting that it seems to contradict the advice given at the Dev Days on this, but perhaps I just misunderstood. Still, I am very glad that there is constant work being done to improve performance. I guess in the end, there is no substitute for just measuring what performs better for your own specific case.