如何准确切图

alonepb 2012-03-09 01:03:59
如何准确的切出


、这个图并画出来
我切出来是



代码


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;
...全文
286 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

80,359

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧