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. Invalidating / alpha smoothing
Forum Updated to NodeBB v4.3 + New Features

Invalidating / alpha smoothing

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 719 Views 1 Watching
  • 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.
  • W Offline
    W Offline
    woolfman007
    wrote on last edited by
    #1

    hey guys, I have the following problem: I made a component (using pure QML, no C++), which draws it's contents using Canvas. It consists mostly of an arc, which is drawn with smoothed edges, while the rest of the component has to be transparent.

    So far so good. But: if the component redraws, it paints itself over and over again, which gradually corrupts the semi-transparent pixels at the arc's edges. If a 50% transparent pixel is applied ontop of itself (having been applied to some background previously), the result will be 25% transparency, instead of 50%.

    In other words: if you have a component that's not fully opaque, it is crucial to invalidate the covered background before repeatedly drawing the actual graphics of the component, otherwise alpha-blended smoothed edges will not work.

    How is this supposed to work out? I found no way to invalidate a certain region covered by a component...

    thanks a lot,
    Wolfgang

    1 Reply Last reply
    0
    • slettaS Offline
      slettaS Offline
      sletta
      wrote on last edited by
      #2

      Hi Wolfgang,

      The function you are looking for is clearRect: http://qt-project.org/doc/qt-5/qml-qtquick-context2d.html#clearRect-method.

      1 Reply Last reply
      0
      • W Offline
        W Offline
        woolfman007
        wrote on last edited by
        #3

        Thanks a lot! That's exactly what I need.

        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