コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 // switch eraser/paint
 public void Eraser() {
   showCustomToast("切换为橡皮");
   IsPaint = false;
   Init_Eraser(UserInfo.EraserWidth);
 }
コード例 #4
0
 // 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);
 }