Skip to content

Commit

Permalink
Add getBitmap method for use without downscaleFactor
Browse files Browse the repository at this point in the history
  • Loading branch information
emersoncloud committed Nov 1, 2018
1 parent 1a976cb commit e8d07d0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion blurkit/src/main/java/io/alterac/blurkit/BlurKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public Bitmap blur(Bitmap src, int radius) {
}

public Bitmap blur(View src, int radius) {
Bitmap bitmap = getBitmapForView(src, FULL_SCALE);
Bitmap bitmap = getBitmapForView(src);
return blur(bitmap, radius);
}

Expand All @@ -64,6 +64,19 @@ private Bitmap getBitmapForView(View src, float downscaleFactor) {
return bitmap;
}

private Bitmap getBitmapForView(View src) {
Bitmap bitmap = Bitmap.createBitmap(
src.getWidth(),
src.getHeight(),
Bitmap.Config.ARGB_8888
);

Canvas canvas = new Canvas(bitmap);
src.draw(canvas);

return bitmap;
}

public static BlurKit getInstance() {
if (instance == null) {
throw new RuntimeException("BlurKit not initialized!");
Expand Down

0 comments on commit e8d07d0

Please sign in to comment.