Example usage for android.graphics PixelXorXfermode PixelXorXfermode

List of usage examples for android.graphics PixelXorXfermode PixelXorXfermode

Introduction

In this page you can find the example usage for android.graphics PixelXorXfermode PixelXorXfermode.

Prototype

public PixelXorXfermode(int opColor) 

Source Link

Usage

From source file:org.connectbot.TerminalView.java

public TerminalView(Context context, TerminalBridge bridge) {
    super(context);

    this.context = context;
    this.bridge = bridge;
    paint = new Paint();

    setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    setFocusable(true);/*from   ww w. ja v  a2s  .  c  o  m*/
    setFocusableInTouchMode(true);

    cursorPaint = new Paint();
    cursorPaint.setColor(bridge.color[bridge.defaultFg]);
    cursorPaint.setXfermode(new PixelXorXfermode(bridge.color[bridge.defaultBg]));
    cursorPaint.setAntiAlias(true);

    cursorStrokePaint = new Paint(cursorPaint);
    cursorStrokePaint.setStrokeWidth(0.1f);
    cursorStrokePaint.setStyle(Paint.Style.STROKE);

    /*
     * Set up our cursor indicators on a 1x1 Path object which we can later
     * transform to our character width and height
     */
    // TODO make this into a resource somehow
    shiftCursor = new Path();
    shiftCursor.lineTo(0.5f, 0.33f);
    shiftCursor.lineTo(1.0f, 0.0f);

    altCursor = new Path();
    altCursor.moveTo(0.0f, 1.0f);
    altCursor.lineTo(0.5f, 0.66f);
    altCursor.lineTo(1.0f, 1.0f);

    ctrlCursor = new Path();
    ctrlCursor.moveTo(0.0f, 0.25f);
    ctrlCursor.lineTo(1.0f, 0.5f);
    ctrlCursor.lineTo(0.0f, 0.75f);

    // For creating the transform when the terminal resizes
    tempSrc = new RectF();
    tempSrc.set(0.0f, 0.0f, 1.0f, 1.0f);
    tempDst = new RectF();
    scaleMatrix = new Matrix();

    bridge.addFontSizeChangedListener(this);

    // connect our view up to the bridge
    setOnKeyListener(bridge.getKeyHandler());

    mAccessibilityBuffer = new StringBuffer();

    // Enable accessibility features if a screen reader is active.
    new AccessibilityStateTester().execute((Void) null);
}