Transform color of Image?
-
wrote on 10 Jan 2012, 15:26 last edited by
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....
-
wrote on 10 Jan 2012, 16:55 last edited by
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... ?
-
wrote on 11 Jan 2012, 08:38 last edited by
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.
-
wrote on 11 Jan 2012, 08:41 last edited by
What version of Quick are you playing with? In Quick 2, you could use a shader program to colorize your images blazingly fast...
-
wrote on 11 Jan 2012, 14:45 last edited by
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.
} -
wrote on 13 Aug 2014, 12:41 last edited by
try "coloroverlay":http://qt-project.org/doc/qt-5/qml-qtgraphicaleffects-coloroverlay.html