微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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),paint);
            bmp.recycle();
        } else {
            c.drawRect(new Rect(x,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);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。