Use vector icons for nearby-map markers (#786)

This commit is contained in:
Mikel 2017-07-22 02:01:08 +01:00 committed by Yusuke Matsubara
parent e022e3d089
commit e9d77a0716
5 changed files with 56 additions and 6 deletions

View file

@ -0,0 +1,22 @@
package fr.free.nrw.commons.utils;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.support.graphics.drawable.VectorDrawableCompat;
public class UiUtils {
/**
* Draws a vectorial image onto a bitmap.
* @param vectorDrawable vectorial image
* @return bitmap representation of the vectorial image
*/
public static Bitmap getBitmap(VectorDrawableCompat vectorDrawable) {
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
vectorDrawable.draw(canvas);
return bitmap;
}
}