Code example for AvoidXfermode

0
    public static final int ZX1 = 1;  //red
    public static final int ZX2 = 2;  //cyan
    public static final int ZX3 = 3;  //blue
    public static final int ZX4 = 4;  //yellow
    public static final int zxColors[] = {0xFF800000, 0xFF008080, 0xFF000080, 0xFF808000};
    private AvoidXfermode zxXfermode = new AvoidXfermode(0xFF808080, 0, AvoidXfermode.Mode.TARGET);
	private Paint zxPaint = new Paint();
	public void blitZX(final FFNGSurface surface, int x, int y, int zx, int countHeight, int stripeHeight) {
		if (canvas == null || !bitmap.isMutable()) {
			convertBitmapToMutable(); 
		} 
		 
		int width = surface.getWidth(),
     	    height = surface.getHeight();
 
        canvas.drawBitmap(surface.getBitmap(), x, y, null);
        zxPaint.setXfermode(zxXfermode);
         
	    for (int py = 0; py < height; ++py) {
	        countHeight++;