标签:android style color ar os java sp on art
============问题描述============
//画笔,定义绘制属性 private Paint myPaint; private Paint mBitmapPaint; // 绘制路径 private Path myPath; // 画布及其底层位图 private Bitmap myBitmap0; private Bitmap myBitmap1; private Canvas myCanvas; public MyPaintView(Context context, AttributeSet attrs){ super(context, attrs); myBitmap0 = BitmapFactory.decodeFile("/storage/sdcard/a.png").copy(Bitmap.Config.ARGB_8888, true); myBitmap1 = Bitmap.createBitmap(myBitmap0); if(i == 0){ initialize(); }else if(i == 1){ initWhite(); } // 开启线程 new Thread(this).start(); } public void initialize(){ // 绘制自由曲线用的画笔 myPaint = new Paint(); myPaint.setAntiAlias(true); myPaint.setDither(true); myPaint.setColor(RGBColor.getColor()); myPaint.setStyle(Paint.Style.STROKE); myPaint.setStrokeJoin(Paint.Join.ROUND); myPaint.setStrokeCap(Paint.Cap.ROUND); myPaint.setStrokeWidth(RGBColor.getFontSize()); myPath = new Path(); mBitmapPaint = new Paint(Paint.DITHER_FLAG); } @Override protected void onDraw(Canvas canvas){ super.onDraw(canvas); // 背景颜色 canvas.drawColor(R.color.white); canvas.drawBitmap(myBitmap1, 0, 0, mBitmapPaint); canvas.drawPath(myPath, myPaint); myCanvas = new Canvas(myBitmap1); } /** * 图片旋转 * */ public void picPost(int nPostExtent){ matrix.reset(); matrix.postScale(Scale, Scale); matrix.postRotate(nPostExtent); // 下面这句话如果把myBitmap1都改为myBitmap0的话顺时针和逆时针旋转都没有问题,现在需要用myBitmap1,是因为在这个位图上面先涂鸦了再旋转的话就会清空以前涂鸦内容,所以选用myBitmap1,但是用它的话只能朝着一个方向旋转,先顺时针完了,逆时针就回不来了 myBitmap1 = Bitmap.createBitmap(myBitmap1, 0, 0, myBitmap1.getWidth(), myBitmap1.getHeight(), matrix, true); }
============解决方案1============
标签:android style color ar os java sp on art
原文地址:http://www.cnblogs.com/lmyangbk/p/4089240.html