public PaintView(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; mPaint = new Paint(); mEraserPaint = new Paint(); Init_Paint(UserInfo.PaintColor, UserInfo.PaintWidth); Init_Eraser(UserInfo.EraserWidth); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); width = manager.getDefaultDisplay().getWidth(); height = manager.getDefaultDisplay().getHeight(); mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); mCanvas = new Canvas(mBitmap); mPath = new Path(); mBitmapPaint = new Paint(Paint.DITHER_FLAG); }
public PaintView(Context context) { super(context); this.context = context; mPaint = new Paint(); mEraserPaint = new Paint(); Init_Paint(UserInfo.PaintColor, UserInfo.PaintWidth); Init_Eraser(UserInfo.EraserWidth); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); width = manager.getDefaultDisplay().getWidth(); height = manager.getDefaultDisplay().getHeight(); // mBitmap = BitmapFactory.decodeResource(context.getResources(), mBitmapBackGround). // copy(Bitmap.Config.ARGB_8888, false); // mBitmap = Bitmap.createScaledBitmap(mBitmap,width,height,false); mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); mCanvas = new Canvas(mBitmap); mPath = new Path(); mBitmapPaint = new Paint(Paint.DITHER_FLAG); }
public void Paint() { showCustomToast("切换为铅笔"); IsPaint = true; Init_Paint(UserInfo.PaintColor, UserInfo.PaintWidth); }
// while size is changed @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (IsPaint) Init_Paint(UserInfo.PaintColor, UserInfo.PaintWidth); else Init_Eraser(UserInfo.EraserWidth); }