Added letter color treshold setting

This commit is contained in:
M66B
2019-10-14 10:51:58 +02:00
parent 0f74e3caeb
commit 2cb077da3b
5 changed files with 57 additions and 6 deletions

View File

@@ -124,6 +124,7 @@ class ImageHelper {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
float s = prefs.getInt("saturation", 100) / 100f;
float v = prefs.getInt("brightness", 100) / 100f;
float t = prefs.getInt("threshold", 50) / 100f;
int bg = Color.HSVToColor(new float[]{h, s, v});
double lum = ColorUtils.calculateLuminance(bg);
@@ -133,7 +134,7 @@ class ImageHelper {
canvas.drawColor(bg);
Paint paint = new Paint();
paint.setColor(lum < 0.5 ? Color.WHITE : Color.BLACK);
paint.setColor(lum < t ? Color.WHITE : Color.BLACK);
paint.setTextSize(size / 2f);
paint.setTypeface(Typeface.DEFAULT_BOLD);