// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/DrawingToolsContext.java
// @RequiredArgsConstructor
// @Getter
// public class DrawingToolsContext {
//   private final View view;
//   private final AnimManager animManager;
//   private final AndroidMetrics androidMetrics;
//   private final TrailOptions trailOptions;
// }
// 
// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/IDrawingTool.java
// public interface IDrawingTool {
//   void reset();
// 
//   void touchDown(int x, int y);
//   void touchMove(int x, int y);
//   void touchUp();
// 
//   void draw(Canvas c);
// 
//   void invalidateAreaOnMove();
//   void invalidatePath();
// 
//   void forceRedrawForAnimation(boolean eraseBitmap);
// 
//   void trimMemory();
// }
// 
// Path: src/main/java/com/orange/dgil/trail/core/common/TrailPoint.java
// @Getter
// @NoArgsConstructor
// public class TrailPoint {
//   private int x = -1;
//   private int y = -1;
// 
//   public TrailPoint(int x, int y) {
//     set(x, y);
//   }
// 
//   public void set(int x, int y) {
//     this.x = x;
//     this.y = y;
//   }
// 
//   public boolean isSameAs(TrailPoint point) {
//     return x == point.x && y == point.y;
//   }
// 
//   public double getDistanceTo(TrailPoint point) {
//     int dx = x - point.getX();
//     int dy = y - point.getY();
//     return Math.sqrt(dx * dx + dy * dy);
//   }
// 
//   public void deepCopy(TrailPoint point) {
//     x = point.x;
//     y = point.y;
//   }
// }


import android.graphics.Canvas;
import android.graphics.Color;
import android.view.View;
import com.orange.dgil.trail.android.drawingtool.DrawingToolsContext;
import com.orange.dgil.trail.android.drawingtool.IDrawingTool;
import com.orange.dgil.trail.core.common.TrailPoint;
import com.orange.dgil.trail.core.quad.QuadCurveArray;
    this.quadCurveArray = quadCurveArray;
    this.bitmapDrawer = bitmapDrawer;

    quillBitmap = new QuillBitmap(view);
    trailBounds = new TrailBounds(drawingToolsContext.getTrailOptions().getQuillParameters(), quadCurveArray.getTrailRect());
  }

  @Override
  public void reset() {
  }

  @Override
  public void trimMemory() {
    quillBitmap.releaseBitmap();
  }

  @Override
  public void touchDown(int x, int y) {
    inGesture = true;
    readIndex = 0;
    trailBounds.updateTrailBoundsOnTouchDown(x, y);
  }

  @Override
  public void touchMove(int x, int y) {
    updateTrailBounds();
  }

  private void updateTrailBounds() {
    if (quadCurveArray.isNotEmpty()) {
// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/DrawingToolsContext.java
// @RequiredArgsConstructor
// @Getter
// public class DrawingToolsContext {
//   private final View view;
//   private final AnimManager animManager;
//   private final AndroidMetrics androidMetrics;
//   private final TrailOptions trailOptions;
// }
// 
// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/IDrawingTool.java
// public interface IDrawingTool {
//   void reset();
// 
//   void touchDown(int x, int y);
//   void touchMove(int x, int y);
//   void touchUp();
// 
//   void draw(Canvas c);
// 
//   void invalidateAreaOnMove();
//   void invalidatePath();
// 
//   void forceRedrawForAnimation(boolean eraseBitmap);
// 
//   void trimMemory();
// }
// 
// Path: src/main/java/com/orange/dgil/trail/core/common/TrailPoint.java
// @Getter
// @NoArgsConstructor
// public class TrailPoint {
//   private int x = -1;
//   private int y = -1;
// 
//   public TrailPoint(int x, int y) {
//     set(x, y);
//   }
// 
//   public void set(int x, int y) {
//     this.x = x;
//     this.y = y;
//   }
// 
//   public boolean isSameAs(TrailPoint point) {
//     return x == point.x && y == point.y;
//   }
// 
//   public double getDistanceTo(TrailPoint point) {
//     int dx = x - point.getX();
//     int dy = y - point.getY();
//     return Math.sqrt(dx * dx + dy * dy);
//   }
// 
//   public void deepCopy(TrailPoint point) {
//     x = point.x;
//     y = point.y;
//   }
// }


// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/quillpen/QuillTrailBitmapEnd.java
import android.graphics.Canvas;
import android.graphics.Color;
import android.view.View;
import com.orange.dgil.trail.android.drawingtool.DrawingToolsContext;
import com.orange.dgil.trail.android.drawingtool.IDrawingTool;
import com.orange.dgil.trail.core.common.TrailPoint;
import com.orange.dgil.trail.core.quad.QuadCurveArray;

    this.quadCurveArray = quadCurveArray;
    this.bitmapDrawer = bitmapDrawer;

    quillBitmap = new QuillBitmap(view);
    trailBounds = new TrailBounds(drawingToolsContext.getTrailOptions().getQuillParameters(), quadCurveArray.getTrailRect());
  }

  @Override
  public void reset() {
  }

  @Override
  public void trimMemory() {
    quillBitmap.releaseBitmap();
  }

  @Override
  public void touchDown(int x, int y) {
    inGesture = true;
    readIndex = 0;
    trailBounds.updateTrailBoundsOnTouchDown(x, y);
  }

  @Override
  public void touchMove(int x, int y) {
    updateTrailBounds();
  }

  private void updateTrailBounds() {
    if (quadCurveArray.isNotEmpty()) {
      TrailPoint lastPoint = quadCurveArray.getLastPoint();