Comments (7)
@rohanmahale this lines solved my rotation problem in CropView
` public void rotate(ROTATE rotation) {
transform.reset();
float degree = 0;
switch (rotation.getRotationCode()) {
case 0:
degree = 90f;
break;
case 1:
degree = -90f;
break;
}
transform.postRotate(getRotation() + degree);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), transform, true);
invalidate();
resetTouchManager();
}
public enum ROTATE {
RIGHT(0), LEFT(1);
private final int i;
ROTATE(int i) {
this.i = i;
}
public int getRotationCode() {
return i;
}
}`
from scissors.
@rohanmahale as you might have noticed crop
extension returns a Future
so you can implement your callbacks/notification mechanisms on top of it, in example we use rxjava to wrap it and get notified when it completes (you can see how on https://github.com/lyft/scissors/blob/master/scissors-sample/src/main/java/com/lyft/android/scissorssample/MainActivity.java#L83-L89). Rotate was not part of our requirements, I agree it could be useful for third parties.
For both enhancement requests we don't have plans at this point but PRs are welcome :)
from scissors.
Renaming this for rotation only, callbacks ticket is now #23
from scissors.
My two cents: I think it makes sense for rotation to live in the loader, not the crop view. For instance, a Picasso Transformation can be applied that will rotate the image as needed before the CropView receives it.
I think that is ideal since rotation within the crop view will complicate the actual cropping (mapping of coordinates) and isn't the aim of the library.
from scissors.
@rharter I would agree that reading EXIF orientation data should probably be handled by the loader, a Picasso Transformation is perfect for that, but that's not necessarily the only time you would want to rotate an image.
In this issue, @rohanmahale wasn't entirely clear what his goal was, but rotation could mean having three buttons on an interface, one for rotate left, one for rotate right, and one to crop, which would usually finalize the image editing. That's definitely a useful feature, and a common pattern, but whether it's inside the scope of this library is the real question.
It would be nice to have certain extension features, like rotating, as separate gradle packages that could be included to extend the core functionality of Scissors.
from scissors.
@nathanjones I think the use case you're describing could be easily accomplished by using the image loader's transformation apis.
For instance, you could have your Picasso loader configured like so
public void rotateLeft() {
rotation = (rotation - 90) % 360;
reloadImage();
}
public void rotateRight() {
rotation = (rotation + 90) % 360;
reloadImage();
}
public void reloadImage() {
cropView.extensions()
.using(new PicassoBitmapLoader(Picasso.with(getContext(), new RotateTransformation(rotation))
.load(url);
}
That being said, this doesn't allow for things like animating the rotation, so perhaps it does make sense to look at this if it's decided that it's in scope for the library. It might be as simple as applying a rotation or matrix to the canvas before drawing, and that might not be terrible considering the crop method draws with the same method onto a canvas.
from scissors.
Thank you for you contribution to this repository.
Closing this contribution as this repository is being archived.
from scissors.
Related Issues (20)
- Can I use scissors library to crop an image taken with my camera? <question> HOT 1
- How to use CropView with Fresco? HOT 1
- GlideBitmapLoader.createUsing uses cropView size
- GlideBitmapLoader.createUsing uses cropView's size while it might not be laid out HOT 1
- Question: How come CropViewExtensions pickUsing Fragment, is not using the support fragment? HOT 2
- Is it possible to remove scaling ?
- Library fails loading images when using Glide v4 and causes exception.
- Crop to File, cannot access CropViewExtensions HOT 6
- Can't import HOT 1
- Can I get the cropped offsets? HOT 5
- Fresco Integration HOT 1
- Scissors 2 is not available on maven HOT 1
- Extensions are not compatible in Kotlin HOT 1
- Scissors 2 not published, support for RxJava2 HOT 1
- Exception with glide HOT 1
- Exception with Picasso latest (2.71828) HOT 3
- Error using with Picasso 2.5.2 HOT 1
- AndroidX HOT 1
- How to check if image has been cropped/modified ? HOT 1
- Select image not load into crop view HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scissors.