A colorful world

This commit is contained in:
M66B 2019-10-10 15:47:29 +02:00
parent 5dbfd2bc8f
commit bd6f0c4715
1 changed files with 2 additions and 6 deletions

View File

@ -61,16 +61,13 @@ import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
class ImageHelper {
private static final float MIN_LUMINANCE = 0.33f;
private static final ExecutorService executor =
Helper.getBackgroundExecutor(1, "image");
static Bitmap generateIdenticon(@NonNull String email, int size, int pixels, boolean dark) {
byte[] hash = getHash(email);
int c = email.hashCode() & 0xffffff | 0xff000000;
int color = Helper.adjustLuminance(c, dark, MIN_LUMINANCE);
int color = Color.HSVToColor(new float[]{Math.abs(email.hashCode()) % 360, 0.5f, 1});
Paint paint = new Paint();
paint.setColor(color);
@ -106,8 +103,7 @@ class ImageHelper {
if (text == null)
return null;
int c = email.hashCode() & 0xffffff | 0xff000000;
int color = Helper.adjustLuminance(c, dark, MIN_LUMINANCE);
int color = Color.HSVToColor(new float[]{Math.abs(email.hashCode()) % 360, 0.5f, 1});
Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);