|
|
|
@ -33,12 +33,14 @@ import java.security.MessageDigest;
|
|
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
|
|
|
|
|
|
class Identicon {
|
|
|
|
|
private static final float MIN_LUMINANCE = 0.33f;
|
|
|
|
|
|
|
|
|
|
static Bitmap icon(@NonNull String email, int size, int pixels, boolean dark) {
|
|
|
|
|
byte[] hash = getHash(email);
|
|
|
|
|
|
|
|
|
|
int color = Color.argb(255, hash[0], hash[1], hash[2]);
|
|
|
|
|
color = ColorUtils.blendARGB(color,
|
|
|
|
|
dark ? Color.WHITE : Color.BLACK, Helper.MIN_LUMINANCE);
|
|
|
|
|
dark ? Color.WHITE : Color.BLACK, MIN_LUMINANCE);
|
|
|
|
|
|
|
|
|
|
Paint paint = new Paint();
|
|
|
|
|
paint.setColor(color);
|
|
|
|
@ -77,8 +79,7 @@ class Identicon {
|
|
|
|
|
byte[] hash = getHash(email);
|
|
|
|
|
|
|
|
|
|
int color = Color.argb(255, hash[0], hash[1], hash[2]);
|
|
|
|
|
color = ColorUtils.blendARGB(color,
|
|
|
|
|
dark ? Color.WHITE : Color.BLACK, Helper.MIN_LUMINANCE);
|
|
|
|
|
color = ColorUtils.blendARGB(color, dark ? Color.WHITE : Color.BLACK, MIN_LUMINANCE);
|
|
|
|
|
|
|
|
|
|
Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
|
|
|
|
Canvas canvas = new Canvas(bitmap);
|
|
|
|
|