Android Drawable to Bitmap Convert from(Drawable drawable)

Here you can find the source of from(Drawable drawable)

Description

from

License

Apache License

Declaration

public static Bitmap from(Drawable drawable) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;

public class Main {
    public static Drawable from(Bitmap bitmap) {
        BitmapDrawable bitDrawable = new BitmapDrawable(bitmap);
        return bitDrawable;
    }/*  w  w w  .j a  va 2  s  . com*/

    public static Bitmap from(Drawable drawable) {
        BitmapDrawable bitDrawable = (BitmapDrawable) drawable;
        return bitDrawable.getBitmap();
    }
}

Related

  1. drawable2Bitmap(Drawable drawable)
  2. drawableToBitmap(Drawable drawable)
  3. drawableToBitmap(Drawable drawable, int width, int height)
  4. getBitmap(Resources resources, int drawableResourceId)
  5. getBitmapDrawable(Context context, int resId)
  6. drawableToBitmap(Drawable drawable)
  7. drawableToBitmap(Drawable drawable)
  8. drawableToBitmap(Drawable drawable)
  9. drawableToBitmap(Drawable drawable)