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

Imageview or Bitmap Rotate From Center Using replaceBitmap(mBitmap) #14

Closed
hardz opened this issue Jun 18, 2016 · 1 comment
Closed

Comments

@hardz
Copy link

hardz commented Jun 18, 2016

@jayrambhia
Hello,

Yes, it's work fine when you wants to rotate bitmap with setBitmap(rotateBitmap(mOrigBitmap)), but when you scale image then do rotate, it's reassign bitmap to CropperView, so i like to use replaceBitmap(rotatedBitmap) for avoiding reassign bitmap, then i figured out it wan't rotate from center point as it has to.

How to get rid of this strange rotate behavior ?

Flow for this.

  1. cropper.setImageBitmap(mOrigBitmap);
  2. scaling CropperView Image
  3. Bitmap rotatedBitmap= rotateBitmap(mOrigBitmap); -> Applying rotate using rotateBitmap?
  4. cropper.replaceBitmap(rotatedBitmap); -> it's assign bitmap like it's rotate from top-left corner !

Desire result is rotatedBitmap should be replace with reference to center points of scaled bitmap with latest matrix.

@jayrambhia
Copy link
Owner

jayrambhia commented Jun 18, 2016

  1. replaceBitmap is not possible for rotating non-square bitmaps.
  2. Rotate is not a feature that this cropper provides
  3. Cropper doesn't have any idea about skew or rotation of the image matrix. And cropper sometimes resets the matrix so manually setting it also won't be helpful.
  4. replaceBitmap is especially used if you just want to replace the bitmap after some processing. eg. brightness-contrast, etc. And is not intended to be used for rotation.

So when you use repalceBitmap, cropper assumes that nothing has changed about the bitmap (size, rotation, etc).

With that said, if you have any suggestions how to go about it (Make cropper aware of rotation of bitmap?), please let me know. PRs are much appreciated.

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

2 participants