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. Qml blend modes
QtWS25 Last Chance

Qml blend modes

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.8k 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.
  • N Offline
    N Offline
    NotAnUser
    wrote on last edited by
    #1

    I'm trying to create an gui that has an animated "dark" background.
    I would like to draw rectangles (with text) in front of this background, but instead of writing text ON the rectangles, i would like to substract the text FROM the rectangle, so that i "punch" the letters in the rectangle, and if you look at the letters, you'll see hints of the backgrounds through it.

    See this overly photoshopped mockup from the internet to get what i mean:
    http://i.ytimg.com/vi/o5ztBii2_wA/maxresdefault.jpg

    I tried using a OpacityMask to filter away the rectangle where the text would be, this doesnt work however, since i cant seem to get "the inverse" of the text, which would be needed for such an opacity mask.

    So in short, are there such things as blend modes in QML, where i can paint white text in "substraction" mode, leaving only transparency where i wrote the text?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dasRicardo
      wrote on last edited by
      #2

      Hmmm a way could be use a "ShaderEffectSource":http://qt-project.org/doc/qt-5/qml-qtquick-shadereffectsource.html to create a texture of the rectangle with your text and use this texture in a "ShaderEffect":http://qt-project.org/doc/qt-5/qml-qtquick-shadereffect.html. Use a fragmentshader to replace all pixel with the same color as the text and replace this pixel with transparent pixels.

      **Sorry for my english :)

      PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

      1 Reply Last reply
      0
      • N Offline
        N Offline
        NotAnUser
        wrote on last edited by
        #3

        Im not really familiar with OpenGL, so i have no idea what kind of fragmentshader is required by this solution.

        Is it time for me to dig into more opgenGL / glsl, or is there some site that offers a lot of default shaders which i could use?

        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