This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BitmapUtils { | |
/** | |
* scale source bitmap to specific width and height remaining the aspect ratio. | |
* If source bitmap aspect ratio is not the same with target ((float) dstWidth / dstHeight), | |
* then one dimension will scaled to the target value, and another will be filled with 0 alpha pixels | |
* | |
* @param src source bitmap | |
* @param dstWidth target width | |
* @param dstHeight target height |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImageSaveTask extends AsyncTask<String, Void, Void> { | |
private Context context; | |
public ImageSaveTask(Context context) { | |
this.context = context; | |
} | |
@Override | |
protected Void doInBackground(String... params) { | |
if (params == null || params.length < 2) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Bitmap blurBitmap(Bitmap bitmap){ | |
//Let's create an empty bitmap with the same size of the bitmap we want to blur | |
Bitmap outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); | |
//Instantiate a new Renderscript | |
RenderScript rs = RenderScript.create(getApplicationContext()); | |
//Create an Intrinsic Blur Script using the Renderscript | |
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); |