android与j2me移植之clipRect
j2me移动到android时,你可能需要用到clipRect这个方法,我们用它来截取一定区域,让来看看j2me和android有什么不同吧 Android code: canvas.save(); //保存当前状态 canvas.clipRect(x,y, x+width, y+height) canvas.restore(); //释放当前状态 canvas.save();//保存当前状态 canvas.clipRect(x,y, x+width, y+height) cavnas.resave();//释放当前状态 J2ME code: int clipX = g.getClipX(); int clipY = g.getClipY(); int clipWidth = g.getClipWidth(); int clipHeight = g.getClipHeight(); g.clipRect(x, y, width, height); g.setClip(clipX, clipY, clipWidth, clipHeight); //释放当前状态 int clipX = g.getClipX(); int clipY = g.getClipY(); int clipWidth = g.getClipWidth(); int clipHeight = g