Java 类android.graphics.PixelXorXfermode 实例源码

项目:appcan-plugin-pdfreader-android    文件:Image.java   
@Override
public float render(final Canvas c, final int y, final int x, final float additionalWidth, final float left,
        final float right, final int nightmode) {
    if (left < x + width && x < right) {
        final Bitmap bmp = data.getBitmap();

        paint.setXfermode(null);
        if (nightmode != 0) {
            paint.setXfermode(new PixelXorXfermode(-1));
            c.drawRect(x, y - height, (int) (x + width), y, paint);
        }

        if (bmp != null) {
            c.drawBitmap(bmp, null, new Rect(x, y - height, (int) (x + width), y), paint);
            bmp.recycle();
        } else {
            c.drawRect(new Rect(x, y - height, (int) (x + width), y), paint);
        }
    }
    return width;
}
项目:AndroidPrefuse    文件:AndroidGraphics2D.java   
@Override
public void setXORMode(Color color)
{
    if (currentPaint == null)
    {
        currentPaint = new Paint();
    }
    currentPaint.setXfermode(new PixelXorXfermode(color.getRGB()));
}
项目: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);
    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);
}