Optional favicon white background

This commit is contained in:
M66B
2022-02-18 13:40:32 +01:00
parent 4708d86204
commit b95225fc2e
4 changed files with 34 additions and 11 deletions

View File

@@ -912,6 +912,23 @@ class ImageHelper {
}
}
static float getLuminance(Bitmap bitmap) {
int n = 0;
float lum = 0;
int w = bitmap.getWidth();
int h = bitmap.getHeight();
for (int y = 0; y < h; y++)
for (int x = 0; x < w; x++) {
int color = bitmap.getPixel(x, y);
if (color != Color.TRANSPARENT) {
n++;
lum += ColorUtils.calculateLuminance(color);
}
}
return (lum / n);
}
static class AnnotatedSource {
private String source;
private int width = 0;