我想从现有的位图中裁剪位图。
GestureImageView维度为:宽度:384高度:512 X:512.0 Y:236.0
tempBitmap位图宽度:1024位图高度:472
但是当我打电话时
Bitmap.createBitmap(tempBitmap, (int)gestureImageView.getImageX() + gestureImageView.getImageWidth(), 0, gestureImageView.getImageWidth(), gestureImageView.getHeight());
然后我得到例外。
请帮我解决这个问题。我在最近2天尝试这个但是无法解决这个问题。
07-06 16:30:21.438: E/AndroidRuntime(4417): FATAL EXCEPTION: main
07-06 16:30:21.438: E/AndroidRuntime(4417): java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.graphics.Bitmap.createBitmap(Bitmap.java:498)
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.graphics.Bitmap.createBitmap(Bitmap.java:471)
07-06 16:30:21.438: E/AndroidRuntime(4417): at com.amplimesh.PhotoGesture$1.onClick(PhotoGesture.java:75)
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.view.View.performClick(View.java:3558)
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.view.View$PerformClick.run(View.java:14152)
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.os.Handler.handleCallback(Handler.java:605)
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.os.Handler.dispatchMessage(Handler.java:92)
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.os.Looper.loop(Looper.java:137)
07-06 16:30:21.438: E/AndroidRuntime(4417): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-06 16:30:21.438: E/AndroidRuntime(4417): at java.lang.reflect.Method.invokeNative(Native Method)
07-06 16:30:21.438: E/AndroidRuntime(4417): at java.lang.reflect.Method.invoke(Method.java:511)
07-06 16:30:21.438: E/AndroidRuntime(4417): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-06 16:30:21.438: E/AndroidRuntime(4417): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-06 16:30:21.438: E/AndroidRuntime(4417): at dalvik.system.NativeStart.main(Native Method)
07-06 16:30:29.281: I/Process(4417): Sending signal. PID: 4417 SIG: 9