uCrop icon indicating copy to clipboard operation
uCrop copied to clipboard

Please add a flip photo

Open alirezabashi98 opened this issue 2 years ago • 2 comments

alirezabashi98 avatar Oct 06 '21 08:10 alirezabashi98

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

HuuNguyen312 avatar Dec 21 '21 09:12 HuuNguyen312

@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;
    }

SweetD3v avatar Jul 25 '23 06:07 SweetD3v