Files
session-android/src/org/thoughtcrime/securesms/imageeditor/EditSession.java
Alan Evans bf759711ef Image Editor - Keep image within crop bounds.
* 4% of original pixels must be visible.
* The entire crop must be within the image.
* On release, try to scale crop area and image to fit if the crop is invalid.
* Undo to last valid position if that didn't work.
* Additionally, center thumbs now do not respect aspect ratio lock.
2019-05-16 15:52:15 -07:00

32 lines
952 B
Java

package org.thoughtcrime.securesms.imageeditor;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.support.annotation.NonNull;
import org.thoughtcrime.securesms.imageeditor.model.EditorElement;
/**
* Represents an underway edit of the image.
* <p>
* Accepts new touch positions, new touch points, released touch points and when complete can commit the edit.
* <p>
* Examples of edit session implementations are, Drag, Draw, Resize:
* <p>
* {@link ElementDragEditSession} for dragging with a single finger.
* {@link ElementScaleEditSession} for resize/dragging with two fingers.
* {@link DrawingSession} for drawing with a single finger.
*/
interface EditSession {
void movePoint(int p, @NonNull PointF point);
EditorElement getSelected();
EditSession newPoint(@NonNull Matrix newInverse, @NonNull PointF point, int p);
EditSession removePoint(@NonNull Matrix newInverse, int p);
void commit();
}