Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add a flip photo #785

Open
alirezabashi98 opened this issue Oct 6, 2021 · 2 comments
Open

Please add a flip photo #785

alirezabashi98 opened this issue Oct 6, 2021 · 2 comments

Comments

@alirezabashi98
Copy link

No description provided.

@HuuNguyen312
Copy link

I added flip feature.
You can try it at https://github.com/HuuNguyen312/uCrop

@SweetD3v
Copy link

@HuuNguyen312 Thanks for the feature implementation, but is has a bug.
Image don't flip when you don't rotate it and just flip it directly and then save.

Here is what you need to do,

Just put this line in shouldCrop() method located in BitmapCropTask.Java.

if (flipHorizontally) return true;

The complete code would be:

private boolean shouldCrop(int width, int height) {
        int pixelError = 1;
        pixelError += Math.round(Math.max(width, height) / 1000f);
        if (flipHorizontally) return true;
        return (mMaxResultImageSizeX > 0 && mMaxResultImageSizeY > 0)
                || Math.abs(mCropRect.left - mCurrentImageRect.left) > pixelError
                || Math.abs(mCropRect.top - mCurrentImageRect.top) > pixelError
                || Math.abs(mCropRect.bottom - mCurrentImageRect.bottom) > pixelError
                || Math.abs(mCropRect.right - mCurrentImageRect.right) > pixelError
                || mCurrentAngle != 0;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants