Open harshgaba opened 7 years ago
Any news on this issue?
hi, how's the issue
This is still occurring with version 1.0.2.
I'll handle this issue this weekend :)
On Tue, 16 Apr 2019 at 22:31, David Kennedy notifications@github.com wrote:
This is still occurring with version 1.0.2.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/adamstyrc/cookie-cutter/issues/5#issuecomment-483831690, or mute the thread https://github.com/notifications/unsubscribe-auth/AAO4B2FO52CDBZSPKBSUE2TPQYZRTANCNFSM4DDEBPWA .
I think the issue is in CookieCutterImageView.getCropTop().
It seems like whenever the picture is wider than it is tall, matrixParams.getY()
is nearly equal to circle.getTopBound()
but off by a few decimal places. However, since it's cast to an int, it's rounded down (or truncated, rather). In that case, circle.getTopBound() - translationY
is 1 instead of 0, like it probably should be. I'll try to illustrate:
private int getCropTop(MatrixParams matrixParams, Circle circle) {
int translationY = (int) matrixParams.getY(); // matrixParams.getY() = 419.99997, but because y is an int, it's truncated to 419
int y = circle.getTopBound() - translationY; // circle.getTopBound() = 420, so y = 1
y = Math.max(y, 0); // y = 1 still
y /= matrixParams.getScaleWidth(); // matrixParams.getScaleWidth() = 0.2857143, and 1 / 0.2857143 = 3.4999998, but because y is an int, it's truncated to 3
return y;
}
It might be sufficient to change translationY to a float, then cast the result of circle.getTopBound() - translationY
to an int. But I don't totally understand this code.
Yes, indeed that was the problem that occured for big bitmaps :) I have fixed that just yesterday but I have problem with uploading new version of the library. I ll solve it soon, it will be 1.0.3
@adamstyrc any progress on this? This is one of our top crashers :(
Hey, I'd love to help but I'm flooded with work now :( If you have any idea for solving the issue and ideally can reproduce feel invited to make a PR and I'll merge :)
On Tue, 29 Oct 2019 at 16:03, David Kennedy notifications@github.com wrote:
@adamstyrc https://github.com/adamstyrc any progress on this? This is one of our top crashers :(
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adamstyrc/cookie-cutter/issues/5?email_source=notifications&email_token=AAO4B2ATL7TEPIMAJVWLS2TQRBGCJA5CNFSM4DDEBPWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECQ2VFA#issuecomment-547465876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAO4B2ERYQQ4K77LKWZ2NLTQRBGCJANCNFSM4DDEBPWA .
Same here. I'll try to carve out some time for it.
Hi. Is there any progress??
This is still happening to me, folks! Any progress?
java.lang.IllegalArgumentException: y + height must be <= bitmap.height() at android.graphics.Bitmap.createBitmap(Bitmap.java:763) at android.graphics.Bitmap.createBitmap(Bitmap.java:727) at com.adamstyrc.cookiecutter.CookieCutterImageView.getCroppedBitmap(CookieCutterImageView.java:157) at com.harshgaba.imagecrop.MainActivity.onOptionsItemSelected(MainActivity.java:45) at android.app.Activity.onMenuItemSelected(Activity.java:3208) at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:408) at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195) at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113) at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:675) at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822) at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156) at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:969) at android.support.v7.view.menu.MenuPopup.onItemClick(MenuPopup.java:127) at android.widget.AdapterView.performItemClick(AdapterView.java:310) at android.widget.AbsListView.performItemClick(AbsListView.java:1155) at android.widget.AbsListView$PerformClick.run(AbsListView.java:3152) at android.widget.AbsListView$3.run(AbsListView.java:4067) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6123) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)