title: Invert paint color based on background
body: <p>I am writing a custom progress bar. I would like to create an effect similar to </p>
  
  <p><img src="https://i.stack.imgur.com/MTozE.png" alt="enter image description here"></p>
  
  <p>where the "50%" text color changes dynamically to white while the black bar progresses right. Is that possible using "simple" solutions? I looked up PorterDuff, ColorFilters, xFermodes, nothing seems to work. Any ideas? ATM my code looks sth like this:</p>
  
  <pre><code>    Rect r = new Rect(1, 1, m_width-1, m_height-1);
      canvas.drawRect(r, pWhiteFill);
      r = new Rect(1, 1, progressWidth, m_height-1);
      canvas.drawRect(r, pBlackFill);     
      canvas.drawText(String.valueOf(progress)+"%", m_width/2, m_height/2, pBlackTxtM);
  </code></pre>
  
  <p>Is there a way to modify <code>pBlackTxtM</code> paint to change color based on whats drawn below it 'on the canvas'?</p>