Transform color of Image?
-
Hello fellow QT Developers.
I'm new to QML/QT dev. I've been poring over the docs trying to find a way to do color changes on an existing image file.
Something like the color: Qt.tint() function for shapes and text, but that is usable on the Image{} Type. Or even better an HSB shift, or RGBA levels.
Right now we are using multiple versions of the same bitmap for different colors. It seems like it would be much more efficient (and flexible) to use one image file, and modify the color in code.
QPainter seems too low level... I don't need to draw the image. just modify its color... is there a way to do this in QML/QT?
Any guidance or suggestions would be most welcome....
-
Further to my own question...
It looks like the QGraphicsEffect Class, would be what I need to implement.
http://developer.qt.nokia.com/doc/qt-4.8/qgraphicseffect.htmlAssuming that is the case, is there a resource for learning how to use the class files in my QML project? I've gone as far as adding
#include <QGraphicsEffect> to my main.cpp
beyond that... ?
-
Seems like QGraphicsEffect is a base class for all other cool effects - QGraphicsBlurEffect, QGraphicsColorizeEffect, QGraphicsDropShadowEffect, and QGraphicsOpacityEffect. So you basically have to include one of those. After that you can implement a method where you apply the effect onto your image.
-
Andre {
I will be using quick 2.0, I just need to set up an ubuntu install (hopefully this week) before I can switch over to it.How would you set up a shader? are there qml tags for it?
}Strekazoid{
Yes QGraphicsEffects is the base class of many cool filters which I'd like to take advantage of. What I'm grasping at is how to implement the classes. I'm comfortable with qml and javascript but it looks like using these classes requires some C++ which I'm up for if I can learn how to get it working.
} -
try "coloroverlay":http://qt-project.org/doc/qt-5/qml-qtgraphicaleffects-coloroverlay.html