title: AvoidXferMode to replace a color on canvas
body: <p>I'm trying to replace a color for something that is drawn on a Canvas using <a href="http://developer.android.com/reference/android/graphics/AvoidXfermode.html" rel="nofollow noreferrer">AvoidXferMode</a>.
  From the android docs it looks like it's exactly what I need:</p>
  
  <blockquote>
    <p>AvoidXfermode xfermode will draw the src everywhere except on top of the opColor or, depending on the Mode, draw only on top of the opColor.</p>
  </blockquote>
  
  <p>What I'm trying is something like this:  </p>
  
  <pre><code>Paint paint = new Paint();
  paint.setColor(Color.RED);
  canvas.drawPaint(paint); // actually drawing a bitmap here
  paint.setXferMode(new AvoidXferMode(Color.RED, 0, TARGET);
  paint.setColor(Color.GREEN);
  canvas.drawPaint(paint);
  </code></pre>
  
  <p>However, this just gives a red screen, not green as I would expect (replacing the red with green). I guess I'm missing the point some where...Any suggestions?</p>