ScanLibrary is an android document scanning library built on top of OpenCV, using the app you will be able to select the exact edges and crop the document accordingly from the selected 4 edges and change the perspective transformation of the cropped image.
MIT License
1.07k
stars
472
forks
source link
Please some one help me to add bitmap center crop #151
Hello,
i am trying to add center crop in my code but i get issue please help me to solve this.
here is my current codes,
//set wallpaper on Home Screen
private void setWallpaperToHomeScreen() {
relativeLayoutLoadMore.setVisibility(View.VISIBLE);
Glide.with(this)
.asBitmap()
.load(Config.ADMIN_PANEL_URL+"/images/"+arrayList.get(currentPosition).getImage_url())
.into(new CustomTarget() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(WallpaperDetailsActivity.this);
try {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int height = metrics.heightPixels;
int width = metrics.widthPixels;
Bitmap bitmap = Bitmap.createScaledBitmap(resource,width,height, true);
wallpaperManager.getDesiredMinimumWidth();//returned 1280 on s3
wallpaperManager.getDesiredMinimumHeight();//also returned 1280 on s3
wallpaperManager.suggestDesiredDimensions(width, height);
wallpaperManager.setBitmap(bitmap,null, true, WallpaperManager.FLAG_SYSTEM);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Snackbar.make(rootLayout,"Wallpaper was set successfully",Snackbar.LENGTH_LONG).show();
relativeLayoutLoadMore.setVisibility(View.GONE);
showFullScreenAds();
}
}, Constant.DELAY_SET_WALLPAPER);
} catch (IOException e) {
e.printStackTrace();
relativeLayoutLoadMore.setVisibility(View.GONE);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
Code that i want add in my app
public static void setWallpaper(Context context, BitmapDrawable wallpaper) {
Hello, i am trying to add center crop in my code but i get issue please help me to solve this.
here is my current codes, //set wallpaper on Home Screen private void setWallpaperToHomeScreen() { relativeLayoutLoadMore.setVisibility(View.VISIBLE); Glide.with(this) .asBitmap() .load(Config.ADMIN_PANEL_URL+"/images/"+arrayList.get(currentPosition).getImage_url()) .into(new CustomTarget() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
Code that i want add in my app public static void setWallpaper(Context context, BitmapDrawable wallpaper) {
private static Bitmap centerCropWallpaper(Context context, Bitmap wallpaper, int desiredHeight){
please help me to add this my app