package com.example.demotest;

import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuffXfermode;
import android.graphics.PorterDuff;
import android.graphics.Rect;
public class GridViewLayer extends FrameLayout {

private Paint mErasePaint;

public GridViewLayer(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
mErasePaint = new Paint();
mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
mErasePaint.setColor(0xFFFFFF);
mErasePaint.setAlpha(0);

}

@Override
protected void dispatchDraw(Canvas canvas) {
// TODO Auto-generated method stub
Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);

c.drawColor(0x99000000);
c.drawCircle(100, 100, 100.0f, mErasePaint);

c.setBitmap(null);
b = null;
super.dispatchDraw(canvas);
}
}

 

posted on 2016-11-06 16:52  yameteh  阅读(165)  评论(0编辑  收藏  举报