Java 类android.graphics.AvoidXfermode 实例源码

项目:starcor.xul    文件:XulGIFDecoder.java   
public static GIFAnimationRender createAnimationRenderer(GIFFrame[] gifFrames, boolean noLoop, boolean noTransparent) {
    GIFAnimationRender render = new GIFAnimationRender();
    GIFFrame gifFrame0 = gifFrames[0];
    render._frameImage = BitmapTools.createBitmapFromRecycledBitmaps(gifFrame0._screenW, gifFrame0._screenH, Bitmap.Config.ARGB_8888);
    render._gifFrames = gifFrames;
    render._isCurrentFrameDecoded = false;
    render._currentFrame = 0;
    render._noLoop = noLoop;
    if (noTransparent || gifFrame0._backgroundColor == 0xFFFFFF) {
        render._colorKeyXferMode = null;
    } else {
        render._colorKeyXferMode = new AvoidXfermode(gifFrame0._backgroundColor, 0, AvoidXfermode.Mode.AVOID);
    }
    //render._colorKeyXferMode = new PixelXorXfermode(gifFrame0._backgroundColor);
    return render;
}
项目:AyoSunny    文件:XfermodeAvoidImageView.java   
/**
 * 初始化画笔
 */
private void initPaint() {
    // 实例化画笔
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    /*
     * 当画布中有跟0XFFFFFFFF色不一样的地方时候才“染”色
     */
    avoidXfermode = new AvoidXfermode(0XFFFFFFFF, 0, AvoidXfermode.Mode.TARGET);
}
项目:AyoSunny    文件:CustomView.java   
/**
 * 初始化画笔
 */
private void initPaint() {
    // 实例化画笔
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    /*
     * 当画布中有跟0XFFFFFFFF色不一样的地方时候才“染”色
     */
    avoidXfermode = new AvoidXfermode(0XFFFFFFFF, 255, AvoidXfermode.Mode.AVOID);
}
项目:AndroidCourses    文件:ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
    super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

    this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
    this.mTolerance = pTolerance;
    this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);

    if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
        Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
    }
}
项目:AndroidCourses    文件:ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
    super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

    this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
    this.mTolerance = pTolerance;
    this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);

    if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
        Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
    }
}
项目:ClassicF1    文件:ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
    super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

    this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
    this.mTolerance = pTolerance;
    this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);
}
项目:tilt-game-android    文件:ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
    super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

    this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
    this.mTolerance = pTolerance;
    this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);

    if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
        Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
    }
}
项目:binea_project_for_android    文件:XfermodeActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.xfermode_layout);
    ButterKnife.inject(this);

    avoid_mode_target.setAvoidXfermode(AvoidXfermode.Mode.TARGET);
    avoid_mode_avoid.setAvoidXfermode(AvoidXfermode.Mode.AVOID);
}
项目:itmarry    文件:ColorSwapTextureSourceDecorator.java   
public ColorSwapTextureSourceDecorator(final ITextureSource pTextureSource, final ITextureSourceDecoratorShape pTextureSourceDecoratorShape, final int pColorKeyColor, final int pTolerance, final int pColorSwapColor, final TextureSourceDecoratorOptions pTextureSourceDecoratorOptions) {
    super(pTextureSource, pTextureSourceDecoratorShape, pTextureSourceDecoratorOptions);
    this.mColorKeyColor = pColorKeyColor;
    this.mTolerance = pTolerance;
    this.mColorSwapColor = pColorSwapColor;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColor, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColor);
}
项目:30-android-libraries-in-30-days    文件:ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
    super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

    this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
    this.mTolerance = pTolerance;
    this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);
}
项目:Killbots    文件:ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
    super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

    this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
    this.mTolerance = pTolerance;
    this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);
}
项目:NationSoccer    文件:ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
    super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);

    this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
    this.mTolerance = pTolerance;
    this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);

    if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
        Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
    }
}
项目:AppBajarLIB    文件:RoundedCornerBitmap.java   
public static Bitmap getRoundedCornerBitmap(Context context, Bitmap bitmap,
                                            float upperLeft, float upperRight, float lowerRight,
                                            float lowerLeft, int endWidth, int endHeight) {
    final float densityMultiplier = context.getResources()
            .getDisplayMetrics().density;

    // scale incoming bitmap to appropriate px size given arguments and
    // display dpi
    bitmap = Bitmap.createScaledBitmap(bitmap,
            Math.round(endWidth * densityMultiplier),
            Math.round(endHeight * densityMultiplier), true);

    // create empty bitmap for drawing
    final Bitmap output = Bitmap.createBitmap(
            Math.round(endWidth * densityMultiplier),
            Math.round(endHeight * densityMultiplier), Config.ARGB_8888);

    // get canvas for empty bitmap
    final Canvas canvas = new Canvas(output);
    final int width = canvas.getWidth();
    final int height = canvas.getHeight();

    // scale the rounded corners appropriately given dpi
    upperLeft *= densityMultiplier;
    upperRight *= densityMultiplier;
    lowerRight *= densityMultiplier;
    lowerLeft *= densityMultiplier;

    final Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setColor(Color.WHITE);

    // fill the canvas with transparency
    canvas.drawARGB(0, 0, 0, 0);

    // draw the rounded corners around the image rect. clockwise, starting
    // in upper left.
    canvas.drawCircle(upperLeft, upperLeft, upperLeft, paint);
    canvas.drawCircle(width - upperRight, upperRight, upperRight, paint);
    canvas.drawCircle(width - lowerRight, height - lowerRight, lowerRight,
            paint);
    canvas.drawCircle(lowerLeft, height - lowerLeft, lowerLeft, paint);

    // fill in all the gaps between circles. clockwise, starting at top.
    final RectF rectT = new RectF(upperLeft, 0, width - upperRight,
            height / 2);
    final RectF rectR = new RectF(width / 2, upperRight, width, height
            - lowerRight);
    final RectF rectB = new RectF(lowerLeft, height / 2,
            width - lowerRight, height);
    final RectF rectL = new RectF(0, upperLeft, width / 2, height
            - lowerLeft);

    canvas.drawRect(rectT, paint);
    canvas.drawRect(rectR, paint);
    canvas.drawRect(rectB, paint);
    canvas.drawRect(rectL, paint);

    // set up the rect for the image
    final Rect imageRect = new Rect(0, 0, width, height);

    // set up paint object such that it only paints on Color.WHITE
    paint.setXfermode(new AvoidXfermode(Color.WHITE, 255,
            AvoidXfermode.Mode.TARGET));

    // draw resized bitmap onto imageRect in canvas, using paint as
    // configured above
    canvas.drawBitmap(bitmap, imageRect, imageRect, paint);

    return output;
}
项目:binea_project_for_android    文件:CustomBitmapView.java   
public void setAvoidXfermode(AvoidXfermode.Mode mode){
    avoidXfermode = new AvoidXfermode(0XFFFFFFFF, 0, mode);
}