1
原谅我,如果它是一个简单的问题,但我卡住了。 我试图将我的图像的位置设置在屏幕左侧一定距离(-150)。 它正常工作,但没有消极的。 我在画布上绘制它,因为我将在稍后将更多图像添加到结果位图(结果)中。 这里是我的代码在画布上定位位图
Bitmap image2=resizedbitmap;
result = Bitmap.createBitmap(image2.getWidth(), image2.getHeight(), ` `Bitmap.Config.ARGB_8888);
canvas = new Canvas(result);//Create the canvas to an image
srcRect = new Rect(-150, 0, result.getWidth(), result.getHeight());//does not work with negative numbers
destRect = new Rect(srcRect);
destRect.offset(0, 0);//if negative cuts the image
canvas.drawBitmap(image2, srcRect, destRect, null);
我这么想吗?任何帮助赞赏。 提前
是不是'新的矩形(0,0,宽,高)'左上角? – 2011-04-27 11:16:28
是的,但我想将它设置为新的矩形(-150,0)..与新的矩形(150,0)它将它设置在屏幕右侧,但不与-150 :( – Alanagh 2011-04-27 11:33:44
因此, 150它应该是150单位**外**左边的屏幕? – 2011-04-27 11:41:19