// Path: zen-android/src/main/java/zenproject/meditation/android/preferences/BrushOptionsPreferences.java
// public class BrushOptionsPreferences {
//     private static final float DARKENING_FACTOR = 1.4f;
//     private static final String PREF_NAME = "BrushPreferences";
//     private static final String PREF_BRUSH_COLOR = PREF_NAME + "Color";
//     private static final String PREF_BRUSH_SIZE = PREF_NAME + "Size";
//     private static final int DEFAULT_PERCENTAGE = 20;
//     private static final int LEAF_COLOR = Color.rgb(59, 158, 58);
//     private final SharedPreferences sharedPreferences;
// 
//     public static BrushOptionsPreferences newInstance() {
//         return new BrushOptionsPreferences(ContextRetriever.INSTANCE.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE));
//     }
// 
//     protected BrushOptionsPreferences(SharedPreferences sharedPreferences) {
//         this.sharedPreferences = sharedPreferences;
//     }
// 
//     public void applyBrushSizePercentage(int percentage) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_SIZE, percentage).apply();
//     }
// 
//     public int getBrushSizePercentage() {
//         return sharedPreferences.getInt(PREF_BRUSH_SIZE, DEFAULT_PERCENTAGE);
//     }
// 
//     public void applyBrushColor(BrushColor color) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_COLOR, color.color()).apply();
//     }
// 
//     public BrushColor getBrushColor() {
//         int defaultColor = BrushColor.DARK.color();
//         int color = sharedPreferences.getInt(PREF_BRUSH_COLOR, defaultColor);
//         return BrushColor.from(color);
//     }
// 
//     public int getBranchColor() {
//         int color = getBrushColor().color();
//         return Color.rgb((int) (Color.red(color) / DARKENING_FACTOR),
//                 (int) (Color.green(color) / DARKENING_FACTOR),
//                 (int) (Color.blue(color) / DARKENING_FACTOR));
//     }
// 
//     public int getLeafColor() {
//         return LEAF_COLOR;
//     }
// }


import com.juankysoriano.rainbow.utils.RainbowMath;
import zenproject.meditation.android.ContextRetriever;
import zenproject.meditation.android.R;
import zenproject.meditation.android.preferences.BrushOptionsPreferences;
package zenproject.meditation.android.sketch.painting.ink;



public class InkDropSizeLimiter {

    private static final float RADIUS_MIN = ContextRetriever.INSTANCE.getResources().getDimension(R.dimen.ink_drop_min_radius);
    private static final float RADIUS_MAX = ContextRetriever.INSTANCE.getResources().getDimension(R.dimen.ink_drop_max_radius);
    private static final float PERCENTAGE_MIN = 0;
    private static final float PERCENTAGE_MAX = 100;
    private static final float SCALE_FACTOR = 3;
    private final BrushOptionsPreferences brushOptionsPreferences;

    public static InkDropSizeLimiter newInstance(BrushOptionsPreferences brushOptionsPreferences) {
        return new InkDropSizeLimiter(brushOptionsPreferences);
    }

    InkDropSizeLimiter(BrushOptionsPreferences brushOptionsPreferences) {
        this.brushOptionsPreferences = brushOptionsPreferences;
    }

// Path: zen-android/src/main/java/zenproject/meditation/android/preferences/BrushOptionsPreferences.java
// public class BrushOptionsPreferences {
//     private static final float DARKENING_FACTOR = 1.4f;
//     private static final String PREF_NAME = "BrushPreferences";
//     private static final String PREF_BRUSH_COLOR = PREF_NAME + "Color";
//     private static final String PREF_BRUSH_SIZE = PREF_NAME + "Size";
//     private static final int DEFAULT_PERCENTAGE = 20;
//     private static final int LEAF_COLOR = Color.rgb(59, 158, 58);
//     private final SharedPreferences sharedPreferences;
// 
//     public static BrushOptionsPreferences newInstance() {
//         return new BrushOptionsPreferences(ContextRetriever.INSTANCE.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE));
//     }
// 
//     protected BrushOptionsPreferences(SharedPreferences sharedPreferences) {
//         this.sharedPreferences = sharedPreferences;
//     }
// 
//     public void applyBrushSizePercentage(int percentage) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_SIZE, percentage).apply();
//     }
// 
//     public int getBrushSizePercentage() {
//         return sharedPreferences.getInt(PREF_BRUSH_SIZE, DEFAULT_PERCENTAGE);
//     }
// 
//     public void applyBrushColor(BrushColor color) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_COLOR, color.color()).apply();
//     }
// 
//     public BrushColor getBrushColor() {
//         int defaultColor = BrushColor.DARK.color();
//         int color = sharedPreferences.getInt(PREF_BRUSH_COLOR, defaultColor);
//         return BrushColor.from(color);
//     }
// 
//     public int getBranchColor() {
//         int color = getBrushColor().color();
//         return Color.rgb((int) (Color.red(color) / DARKENING_FACTOR),
//                 (int) (Color.green(color) / DARKENING_FACTOR),
//                 (int) (Color.blue(color) / DARKENING_FACTOR));
//     }
// 
//     public int getLeafColor() {
//         return LEAF_COLOR;
//     }
// }


// Path: zen-android/src/main/java/zenproject/meditation/android/sketch/painting/ink/InkDropSizeLimiter.java
import com.juankysoriano.rainbow.utils.RainbowMath;
import zenproject.meditation.android.ContextRetriever;
import zenproject.meditation.android.R;
import zenproject.meditation.android.preferences.BrushOptionsPreferences;

package zenproject.meditation.android.sketch.painting.ink;



public class InkDropSizeLimiter {

    private static final float RADIUS_MIN = ContextRetriever.INSTANCE.getResources().getDimension(R.dimen.ink_drop_min_radius);
    private static final float RADIUS_MAX = ContextRetriever.INSTANCE.getResources().getDimension(R.dimen.ink_drop_max_radius);
    private static final float PERCENTAGE_MIN = 0;
    private static final float PERCENTAGE_MAX = 100;
    private static final float SCALE_FACTOR = 3;
    private final BrushOptionsPreferences brushOptionsPreferences;

    public static InkDropSizeLimiter newInstance(BrushOptionsPreferences brushOptionsPreferences) {
        return new InkDropSizeLimiter(brushOptionsPreferences);
    }

    InkDropSizeLimiter(BrushOptionsPreferences brushOptionsPreferences) {
        this.brushOptionsPreferences = brushOptionsPreferences;
    }

    float getMinimumRadius() {