mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
Merge pull request #14025 from nextcloud/bugfix/bitmap-add-color-filter
BugFix - Software rendering doesn't support hardware bitmaps
This commit is contained in:
commit
2b021c5a54
1 changed files with 3 additions and 7 deletions
|
@ -60,13 +60,9 @@ public final class BitmapUtils {
|
|||
}
|
||||
|
||||
public static Bitmap addColorFilter(Bitmap originalBitmap, int filterColor, int opacity) {
|
||||
int width = originalBitmap.getWidth();
|
||||
int height = originalBitmap.getHeight();
|
||||
|
||||
Bitmap resultBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
Bitmap resultBitmap = originalBitmap.copy(Bitmap.Config.ARGB_8888, true);
|
||||
Canvas canvas = new Canvas(resultBitmap);
|
||||
|
||||
canvas.drawBitmap(originalBitmap, 0, 0, null);
|
||||
canvas.drawBitmap(resultBitmap, 0, 0, null);
|
||||
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(filterColor);
|
||||
|
@ -74,7 +70,7 @@ public final class BitmapUtils {
|
|||
paint.setAlpha(opacity);
|
||||
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
|
||||
canvas.drawRect(0, 0, width, height, paint);
|
||||
canvas.drawRect(0, 0, resultBitmap.getWidth(), resultBitmap.getHeight(), paint);
|
||||
|
||||
return resultBitmap;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue