1. The following Xfermode subclass can change this behavior:
AvoidXfermode specifies a color and a tolerance, forcing Paint to avoid plotting on it (or drawing only on it ).
PixelXorXfermode applies a simple pixel XOR operation when the existing color is overwritten.
Porterduxfermode is a very powerful conversion mode. With this mode, you can use any of the 16 Porter-Duff rules for image synthesis to control how Paint interacts with existing Canvas images.
To apply the conversion mode, you can use the setXferMode method as follows:
AvoidXfermode avoid = new AvoidXfermode (Color. BLUE, 10, AvoidXfermode. Mode. AVOID); borderPen. setXfermode (avoid );
2. Porter-Duff:
3.16 Porter-Duff rules
1. PorterDuff. Mode. CLEAR
The drawn image is not submitted to the canvas.
2. PorterDuff. Mode. SRC
Show upper-layer picture
3. PorterDuff. Mode. DST
Show lower layer picture
4. PorterDuff. Mode. SRC_OVER
Normal painting display, stacked on the upper and lower layers.
5. PorterDuff. Mode. DST_OVER
The upper and lower layers are displayed. The lower layer is displayed on top.
6. PorterDuff. Mode. SRC_IN
Draw the intersection of two layers. The upper layer is displayed.
7. PorterDuff. Mode. DST_IN
Draw the intersection of two layers. The lower layer is displayed.
8. PorterDuff. Mode. SRC_OUT
Draw non-intersection parts from the upper layer.
9. PorterDuff. Mode. DST_OUT
Draws non-intersection parts from the lower layer.
10. PorterDuff. Mode. SRC_ATOP
Take the lower-layer non-intersection part and the upper-layer intersection part
11. PorterDuff. Mode. DST_ATOP
Take the non-intersection part of the upper layer and the intersection part of the lower layer
12. PorterDuff. Mode. XOR
13. PorterDuff. Mode. DARKEN
14. PorterDuff. Mode. LIGHTEN
15. PorterDuff. Mode. MULTIPLY
16. PorterDuff. Mode. SCREEN