// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/TrailOptions.java
// @Getter
// public class TrailOptions {
//   @Getter(AccessLevel.NONE)
//   private DrawingTools drawingTools;
//   @Getter(AccessLevel.NONE)
//   private AndroidMetrics metrics;
// 
//   @Setter
//   private int color = DefaultDrawerConf.TRAIL_COLOR;
//   @Setter
//   private int shadowColor;
// 
//   private QuillParameters quillParameters;
// 
//   private boolean shadowEnabled;
//   private int shadowOffsetPixels;
//   private int widthPixels;
// 
//   public TrailOptions(AndroidMetrics metrics, DrawingTools drawingTools) {
//     init(metrics, drawingTools);
//   }
// 
//   private void init(AndroidMetrics metrics, DrawingTools drawingTools) {
//     this.metrics = metrics;
//     this.drawingTools = drawingTools;
//     quillParameters = new QuillParameters(metrics);
//     setTrailWidthMicrometers(DefaultDrawerConf.TRAIL_WIDTH_UM);
//   }
// 
//   public void setTrailWidthMicrometers(int micrometers) {
//     widthPixels  = metrics.micrometersToPixels(micrometers);
//     shadowOffsetPixels = (int) (widthPixels * DefaultDrawerConf.SHADOW_OFFSET_FACTOR);
//   }
// 
//   public boolean isShadowAvailable() {
//     return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
//   }
// 
//   public void setShadowEnabled(boolean shadowEnabled) {
//     this.shadowEnabled = shadowEnabled && isShadowAvailable();
//   }
// 
//   public void selectMarkerPen() {
//     drawingTools.selectMarkerPen();
//   }
// 
//   public void selectQuillPen() {
//     drawingTools.selectQuillPen();
//   }
// }
// 
// Path: src/main/java/com/orange/dgil/trail/android/animation/AnimManager.java
// public class AnimManager {
// 
//   private final AnimRunnable animRunnable;
//   private final AnimParameters animParameters = new AnimParameters();
// 
//   public AnimManager(IAnimDrawer drawer) {
//     animRunnable = new AnimRunnable(drawer, animParameters);
//   }
// 
//   public void start() {
//     animRunnable.start();
//   }
// 
//   public int getAnimColor() {
//     int startColor = animParameters.getStartColor();
//     int endColor = animParameters.getEndColor();
//     return getInterpolatedColor(startColor, endColor, animRunnable.getFactor());
//   }
// 
//   public int getAnimShadowColor() {
//     int startColor = animParameters.getShadowStartColor();
//     int endColor = animParameters.getShadowEndColor();
//     return getInterpolatedColor(startColor, endColor, animRunnable.getFactor());
//   }
// 
//   private int getInterpolatedColor(int startColor, int endColor, float factor) {
//     return Color.argb(
//         getInterp(Color.alpha(startColor), Color.alpha(endColor), factor),
//         getInterp(Color.red  (startColor), Color.red  (endColor), factor),
//         getInterp(Color.green(startColor), Color.green(endColor), factor),
//         getInterp(Color.blue (startColor), Color.blue (endColor), factor));
//   }
//   private int getInterp(int start, int end, float factor) {
//     return (int) (start * factor + end * (1 - factor));
//   }
// 
// 
//   public float getFactor() {
//     return animRunnable.getFactor();
//   }
// 
//   /**
//    * The width factor is made to dilate the trail during fading
//    * @return the width factor
//    */
//   public float getWidthFactor() {
//     float factor = getFactor();
//     return 1 + animParameters.getWidthDilatationFactor() * (1-factor);
//   }
// 
//   public void reset() {
//     animRunnable.reset();
//   }
// 
//   public AnimParameters getAnimationParameters() {
//     return animParameters;
//   }
// 
//   public boolean isRunning() {
//     return animRunnable.isRunning();
//   }
// 
//   public boolean isAlphaAnimationRunning() {
//     return isRunning() && animParameters.areStartEndColorsRgbEqual();
//   }
// }


import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import com.orange.dgil.trail.android.drawingtool.TrailOptions;
import com.orange.dgil.trail.android.animation.AnimManager;
    if (animManager.isRunning()) {
      return animManager.getAnimationParameters().isShadowEnabled();
    } else {
      return trailOptions.isShadowEnabled();
    }
  }

  private void drawShadowPath(Canvas c, Path path) {
    int offset = trailOptions.getShadowOffsetPixels();
    shadowPath.set(path);
    shadowPath.offset(offset, offset);
    c.drawPath(shadowPath, shadowPainter);
  }

  private void updateColors() {
    painter.setColor(getColor());
    if (trailOptions.isShadowEnabled()) {
      shadowPainter.setColor(getShadowColor());
    }
  }
  private int getColor() {
    return animManager.isRunning() ? animManager.getAnimColor() : trailOptions.getColor();
  }
  private int getShadowColor() {
    return animManager.isRunning() ? animManager.getAnimShadowColor() : trailOptions.getShadowColor();
  }

  private void updateWidth() {
    float width = trailOptions.getWidthPixels() * animManager.getWidthFactor();
    painter.setStrokeWidth(width);
// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/TrailOptions.java
// @Getter
// public class TrailOptions {
//   @Getter(AccessLevel.NONE)
//   private DrawingTools drawingTools;
//   @Getter(AccessLevel.NONE)
//   private AndroidMetrics metrics;
// 
//   @Setter
//   private int color = DefaultDrawerConf.TRAIL_COLOR;
//   @Setter
//   private int shadowColor;
// 
//   private QuillParameters quillParameters;
// 
//   private boolean shadowEnabled;
//   private int shadowOffsetPixels;
//   private int widthPixels;
// 
//   public TrailOptions(AndroidMetrics metrics, DrawingTools drawingTools) {
//     init(metrics, drawingTools);
//   }
// 
//   private void init(AndroidMetrics metrics, DrawingTools drawingTools) {
//     this.metrics = metrics;
//     this.drawingTools = drawingTools;
//     quillParameters = new QuillParameters(metrics);
//     setTrailWidthMicrometers(DefaultDrawerConf.TRAIL_WIDTH_UM);
//   }
// 
//   public void setTrailWidthMicrometers(int micrometers) {
//     widthPixels  = metrics.micrometersToPixels(micrometers);
//     shadowOffsetPixels = (int) (widthPixels * DefaultDrawerConf.SHADOW_OFFSET_FACTOR);
//   }
// 
//   public boolean isShadowAvailable() {
//     return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
//   }
// 
//   public void setShadowEnabled(boolean shadowEnabled) {
//     this.shadowEnabled = shadowEnabled && isShadowAvailable();
//   }
// 
//   public void selectMarkerPen() {
//     drawingTools.selectMarkerPen();
//   }
// 
//   public void selectQuillPen() {
//     drawingTools.selectQuillPen();
//   }
// }
// 
// Path: src/main/java/com/orange/dgil/trail/android/animation/AnimManager.java
// public class AnimManager {
// 
//   private final AnimRunnable animRunnable;
//   private final AnimParameters animParameters = new AnimParameters();
// 
//   public AnimManager(IAnimDrawer drawer) {
//     animRunnable = new AnimRunnable(drawer, animParameters);
//   }
// 
//   public void start() {
//     animRunnable.start();
//   }
// 
//   public int getAnimColor() {
//     int startColor = animParameters.getStartColor();
//     int endColor = animParameters.getEndColor();
//     return getInterpolatedColor(startColor, endColor, animRunnable.getFactor());
//   }
// 
//   public int getAnimShadowColor() {
//     int startColor = animParameters.getShadowStartColor();
//     int endColor = animParameters.getShadowEndColor();
//     return getInterpolatedColor(startColor, endColor, animRunnable.getFactor());
//   }
// 
//   private int getInterpolatedColor(int startColor, int endColor, float factor) {
//     return Color.argb(
//         getInterp(Color.alpha(startColor), Color.alpha(endColor), factor),
//         getInterp(Color.red  (startColor), Color.red  (endColor), factor),
//         getInterp(Color.green(startColor), Color.green(endColor), factor),
//         getInterp(Color.blue (startColor), Color.blue (endColor), factor));
//   }
//   private int getInterp(int start, int end, float factor) {
//     return (int) (start * factor + end * (1 - factor));
//   }
// 
// 
//   public float getFactor() {
//     return animRunnable.getFactor();
//   }
// 
//   /**
//    * The width factor is made to dilate the trail during fading
//    * @return the width factor
//    */
//   public float getWidthFactor() {
//     float factor = getFactor();
//     return 1 + animParameters.getWidthDilatationFactor() * (1-factor);
//   }
// 
//   public void reset() {
//     animRunnable.reset();
//   }
// 
//   public AnimParameters getAnimationParameters() {
//     return animParameters;
//   }
// 
//   public boolean isRunning() {
//     return animRunnable.isRunning();
//   }
// 
//   public boolean isAlphaAnimationRunning() {
//     return isRunning() && animParameters.areStartEndColorsRgbEqual();
//   }
// }


// Path: src/main/java/com/orange/dgil/trail/android/drawingtool/markerpen/Painters.java
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import com.orange.dgil.trail.android.drawingtool.TrailOptions;
import com.orange.dgil.trail.android.animation.AnimManager;

    if (animManager.isRunning()) {
      return animManager.getAnimationParameters().isShadowEnabled();
    } else {
      return trailOptions.isShadowEnabled();
    }
  }

  private void drawShadowPath(Canvas c, Path path) {
    int offset = trailOptions.getShadowOffsetPixels();
    shadowPath.set(path);
    shadowPath.offset(offset, offset);
    c.drawPath(shadowPath, shadowPainter);
  }

  private void updateColors() {
    painter.setColor(getColor());
    if (trailOptions.isShadowEnabled()) {
      shadowPainter.setColor(getShadowColor());
    }
  }
  private int getColor() {
    return animManager.isRunning() ? animManager.getAnimColor() : trailOptions.getColor();
  }
  private int getShadowColor() {
    return animManager.isRunning() ? animManager.getAnimShadowColor() : trailOptions.getShadowColor();
  }

  private void updateWidth() {
    float width = trailOptions.getWidthPixels() * animManager.getWidthFactor();
    painter.setStrokeWidth(width);
    if (trailOptions.isShadowEnabled()) {