如何准确切图
如何准确的切出、这个图并画出来
我切出来是
代码
class myview extends View {
public myview(Context context) {
super(context);
}
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Bitmap bmp = CreatImage(context, R.drawable.poker);
canvas.drawColor(Color.WHITE);
Paint paint = new Paint();
cuteImage(canvas, paint, bmp, 13, 13, 85, 98, 1, 0);
}
}
public final void cuteImage(Canvas g, Paint paint, Bitmap imgBit, int x,
int y, int w, int h, int line, int row) {
g.clipRect(x, y, x + w , h + y);
g.drawBitmap(imgBit, x - line * w, y - row * h, paint);
g.restore();
}
public final Bitmap CreatImage(Context context, int bitAdress) {
Bitmap bitmaptemp = null;
bitmaptemp = BitmapFactory.decodeResource(context.getResources(),
bitAdress);
return bitmaptemp;
补充:移动开发 , Android