mirror of
https://gitea.mayex.net/mayekkuzu/Audinaut.git
synced 2025-01-23 23:44:55 +03:00
Update blurred album cover
This commit is contained in:
parent
70f6e22be7
commit
e4febf7260
@ -2,6 +2,11 @@ package net.nullsum.audinaut.util;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.ColorMatrix;
|
||||||
|
import android.graphics.ColorMatrixColorFilter;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.renderscript.Allocation;
|
import android.renderscript.Allocation;
|
||||||
import android.renderscript.Element;
|
import android.renderscript.Element;
|
||||||
import android.renderscript.RenderScript;
|
import android.renderscript.RenderScript;
|
||||||
@ -16,6 +21,7 @@ class BlurBuilder {
|
|||||||
for(int i = 0; i<3; i++) {
|
for(int i = 0; i<3; i++) {
|
||||||
newImage = blur_real(context, newImage);
|
newImage = blur_real(context, newImage);
|
||||||
}
|
}
|
||||||
|
newImage = changeBitmapContrastBrightness(newImage, 0.5f, 48);
|
||||||
return newImage;
|
return newImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,4 +43,25 @@ class BlurBuilder {
|
|||||||
|
|
||||||
return outputBitmap;
|
return outputBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Bitmap changeBitmapContrastBrightness(Bitmap bmp, float contrast, float brightness)
|
||||||
|
{
|
||||||
|
ColorMatrix cm = new ColorMatrix(new float[]
|
||||||
|
{
|
||||||
|
contrast, 0, 0, 0, brightness,
|
||||||
|
0, contrast, 0, 0, brightness,
|
||||||
|
0, 0, contrast, 0, brightness,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
});
|
||||||
|
|
||||||
|
Bitmap ret = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), bmp.getConfig());
|
||||||
|
|
||||||
|
Canvas canvas = new Canvas(ret);
|
||||||
|
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColorFilter(new ColorMatrixColorFilter(cm));
|
||||||
|
canvas.drawBitmap(bmp, 0, 0, paint);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
<shape>
|
<shape>
|
||||||
<gradient
|
<gradient
|
||||||
android:angle="270"
|
android:angle="270"
|
||||||
android:startColor="#00000000"
|
android:startColor="#11111111"
|
||||||
android:centerColor="#00000000"
|
android:centerColor="#44111111"
|
||||||
android:endColor="#bb000000"
|
android:endColor="#bb111111"
|
||||||
android:type="linear"/>
|
android:type="linear"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user