Skip to content

Commit

Permalink
Improve bitmap utils
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Feb 23, 2018
1 parent 569bf66 commit 9ac616f
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ public class DynamicBitmapUtils {
Matrix scaleMatrix = new Matrix();
scaleMatrix.setScale(scaleX, scaleY, pivotX, pivotY);

Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setFilterBitmap(true);

Canvas canvas = new Canvas(resizedBitmap);
canvas.setMatrix(scaleMatrix);
canvas.drawBitmap(bitmap, 0, 0, new Paint(Paint.FILTER_BITMAP_FLAG));
canvas.drawBitmap(bitmap, 0, 0, paint);

return resizedBitmap;
}
Expand All @@ -99,8 +102,10 @@ public class DynamicBitmapUtils {
@NonNull ColorFilter colorFilter) {
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColorFilter(colorFilter);
Canvas canvas1 = new Canvas(bitmap);
canvas1.drawBitmap(bitmap, 0, 0, paint);
paint.setFilterBitmap(true);

Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(bitmap, 0, 0, paint);

return bitmap;
}
Expand Down

0 comments on commit 9ac616f

Please sign in to comment.