本文整理汇总了Java中android.graphics.AvoidXfermode类的典型用法代码示例。如果您正苦于以下问题:Java AvoidXfermode类的具体用法?Java AvoidXfermode怎么用?Java AvoidXfermode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AvoidXfermode类属于android.graphics包,在下文中一共展示了AvoidXfermode类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAnimationRenderer
import android.graphics.AvoidXfermode; //导入依赖的package包/类
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;
}
示例2: initPaint
import android.graphics.AvoidXfermode; //导入依赖的package包/类
/**
* 初始化画笔
*/
private void initPaint() {
// 实例化画笔
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
/*
* 当画布中有跟0XFFFFFFFF色不一样的地方时候才“染”色
*/
avoidXfermode = new AvoidXfermode(0XFFFFFFFF, 0, AvoidXfermode.Mode.TARGET);
}
示例3: initPaint
import android.graphics.AvoidXfermode; //导入依赖的package包/类
/**
* 初始化画笔
*/
private void initPaint() {
// 实例化画笔
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
/*
* 当画布中有跟0XFFFFFFFF色不一样的地方时候才“染”色
*/
avoidXfermode = new AvoidXfermode(0XFFFFFFFF, 255, AvoidXfermode.Mode.AVOID);
}
示例4: ColorSwapBitmapTextureAtlasSourceDecorator
import android.graphics.AvoidXfermode; //导入依赖的package包/类
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.");
}
}
示例5: ColorSwapBitmapTextureAtlasSourceDecorator
import android.graphics.AvoidXfermode; //导入依赖的package包/类
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);
}
示例6: onCreate
import android.graphics.AvoidXfermode; //导入依赖的package包/类
@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);
}
示例7: ColorSwapTextureSourceDecorator
import android.graphics.AvoidXfermode; //导入依赖的package包/类
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);
}
示例8: getRoundedCornerBitmap
import android.graphics.AvoidXfermode; //导入依赖的package包/类
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;
}
示例9: setAvoidXfermode
import android.graphics.AvoidXfermode; //导入依赖的package包/类
public void setAvoidXfermode(AvoidXfermode.Mode mode){
avoidXfermode = new AvoidXfermode(0XFFFFFFFF, 0, mode);
}