您的位置:首页 > 编程语言 > Java开发

createBitmap — java.lang.IllegalArgumentException: x must be < bitmap.width()错误的解决

2016-10-15 20:24 731 查看
No, not 
x
must be < bitmap.width()
. It says 
x
+ width must be <= bitmap.width()
.

You are creating a 
Bitmap
 like
so:
Bitmap.createBitmap(source, 60, 0, 480, 260); // 320 - 60 = 260


Basically, you are drawing from 
x
= 60, y = 0
 to 
x
= 480 + 60, y = 260
 on a 
Bitmap
 which

d714
is only 480x320. Obviously, this is not possible, since your 
x
 coordinate
is off the 
Bitmap
.

It's hard to tell you how to fix this without knowing your exact use case. Basically, your 
source
image
has to fit within 
{
x1: x, x2: x + width, y1: y, y2: y + height }
.

原文
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐