Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Transform color of Image?
QtWS25 Last Chance

Transform color of Image?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 4 Posters 5.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark3
    wrote on last edited by
    #1

    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....

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mark3
      wrote on last edited by
      #2

      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.html

      Assuming 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... ?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        strekazoid
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          What version of Quick are you playing with? In Quick 2, you could use a shader program to colorize your images blazingly fast...

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mark3
            wrote on last edited by
            #5

            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.
            }

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fatinbrain
              wrote on last edited by
              #6

              try "coloroverlay":http://qt-project.org/doc/qt-5/qml-qtgraphicaleffects-coloroverlay.html

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved