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

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,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,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.");
    }
}
项目:ClassicF1    文件ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource,Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);
}
项目:tilt-game-android    文件ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource,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 pColorSwapColor,final TextureSourceDecoratorOptions pTextureSourceDecoratorOptions) {
    super(pTextureSource,pTextureSourceDecoratorShape,pTextureSourceDecoratorOptions);
    this.mColorKeyColor = pColorKeyColor;
    this.mTolerance = pTolerance;
    this.mColorSwapColor = pColorSwapColor;
    this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColor,Mode.TARGET));
    this.mPaint.setColor(pColorSwapColor);
}
项目:30-android-libraries-in-30-days    文件ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource,Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);
}
项目:Killbots    文件ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource,Mode.TARGET));
    this.mPaint.setColor(pColorSwapColorARGBPackedInt);
}
项目:NationSoccer    文件ColorSwapBitmapTextureAtlasSourceDecorator.java   
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource,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),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);

    // draw the rounded corners around the image rect. clockwise,starting
    // in upper left.
    canvas.drawCircle(upperLeft,upperLeft,paint);
    canvas.drawCircle(width - 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,width - upperRight,height / 2);
    final RectF rectR = new RectF(width / 2,width,height
            - lowerRight);
    final RectF rectB = new RectF(lowerLeft,height / 2,width - lowerRight,height);
    final RectF rectL = new RectF(0,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,height);

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

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

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

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