Open gkakasevski opened 10 years ago
Hi gkakasevski, You can use code below:
BitmapOutput output;
public void getBitmap(){ GaussianBlurFilter gauu = new GaussianBlurFilter(2.0f); gauu.addTarget(screen); pipeline.pauseRendering(); input.addTarget(gauu); pipeline.startRendering(); output = new BitmapOutput(new BitmapOutputCallback() {
@Override
public void bitmapCreated(Bitmap bitmap) {
// TODO Auto-generated method stub
// Bitmap will return in this.
saveFileShare(bitmap);
}
});
gauu.addTarget(output);
view.requestRender();
}
public void saveFileShare(Bitmap bm) { if (!PATH_SHARE.exists()) PATH_SHARE.mkdir(); Date dateNow = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss"); String datetime = dateFormat.format(dateNow); String imageName = datetime + ".png"; String fileImageShare = PATH_SHARE.getPath() + File.separator + imageName; FileOutputStream out = null; try { out = new FileOutputStream(fileImageShare); bm.compress(Bitmap.CompressFormat.JPEG, 80, out); } catch (Exception e) { e.printStackTrace(); } finally { try { out.close(); } catch (Throwable ignore) { } } }
Have a nice day!
Tnx a lot :)
Hi all, I need the filtered image as Bitmap object at the end. How can I do that?