mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-03 15:05:24 +00:00
46 lines
1.4 KiB
Java
46 lines
1.4 KiB
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;
|
||
|
import org.thoughtcrime.securesms.imageeditor.renderers.BezierDrawingRenderer;
|
||
|
|
||
|
/**
|
||
|
* Passes touch events into a {@link BezierDrawingRenderer}.
|
||
|
*/
|
||
|
class DrawingSession extends ElementEditSession {
|
||
|
|
||
|
private final BezierDrawingRenderer renderer;
|
||
|
|
||
|
private DrawingSession(@NonNull EditorElement selected, @NonNull Matrix inverseMatrix, @NonNull BezierDrawingRenderer renderer) {
|
||
|
super(selected, inverseMatrix);
|
||
|
this.renderer = renderer;
|
||
|
}
|
||
|
|
||
|
public static EditSession start(EditorElement element, BezierDrawingRenderer renderer, Matrix inverseMatrix, PointF point) {
|
||
|
DrawingSession drawingSession = new DrawingSession(element, inverseMatrix, renderer);
|
||
|
drawingSession.setScreenStartPoint(0, point);
|
||
|
renderer.setFirstPoint(drawingSession.startPointElement[0]);
|
||
|
return drawingSession;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void movePoint(int p, @NonNull PointF point) {
|
||
|
if (p != 0) return;
|
||
|
setScreenEndPoint(p, point);
|
||
|
renderer.addNewPoint(endPointElement[0]);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public EditSession newPoint(Matrix newInverse, PointF point, int p) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public EditSession removePoint(Matrix newInverse, int p) {
|
||
|
return this;
|
||
|
}
|
||
|
}
|