Sub GetRoundBitmap(Bmp As Bitmap) As Bitmap
javacircleround.InitializeContext
Return javacircleround.RunMethod("getRoundBitmap",Array(Bmp))
End Sub
#If Java
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.provider.MediaStore.Video.Thumbnails;
import android.media.ThumbnailUtils;
public static Bitmap getRoundBitmap(Bitmap scaleBitmapImage) {
int targetWidth = 1000;
int targetHeight = 1000;
Bitmap targetBitmap = Bitmap.createBitmap(targetWidth, targetHeight,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(targetBitmap);
Path path = new Path();
path.addCircle(((float) targetWidth - 1) / 2,
((float) targetHeight - 1) / 2,
(Math.min(((float) targetWidth), ((float) targetHeight)) / 2),
Path.Direction.CCW);
canvas.clipPath(path);
Bitmap sourceBitmap = scaleBitmapImage;
canvas.drawBitmap(sourceBitmap, new Rect(0, 0, sourceBitmap.getWidth(),
sourceBitmap.getHeight()), new Rect(0, 0, targetWidth,
targetHeight), null);
return targetBitmap;
}
public static Drawable getRoundDrawable(Drawable d){
Bitmap b=getRoundBitmap(((BitmapDrawable) d).getBitmap());
return new BitmapDrawable(b);
}
public Bitmap getThumbnail(String path){
return ThumbnailUtils.createVideoThumbnail(path, Thumbnails.MINI_KIND);
}
#End If