當前位置: 首頁>>代碼示例>>Java>>正文


Java RoundedBitmapDrawable.setBounds方法代碼示例

本文整理匯總了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawable.setBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java RoundedBitmapDrawable.setBounds方法的具體用法?Java RoundedBitmapDrawable.setBounds怎麽用?Java RoundedBitmapDrawable.setBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.graphics.drawable.RoundedBitmapDrawable的用法示例。


在下文中一共展示了RoundedBitmapDrawable.setBounds方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: transform

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
private Bitmap transform(Bitmap source, int size) {
  if (source != null) {
    RoundedBitmapDrawable drawable =
        RoundedBitmapDrawableFactory.create(getResources(), source);
    drawable.setCornerRadius(100);
    Bitmap.Config config = source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
    Bitmap output = Bitmap.createBitmap(size, size, config);
    Canvas canvas = new Canvas(output);
    drawable.setAntiAlias(true);
    drawable.setBounds(0, 0, size, size);
    drawable.draw(canvas);
    if (!source.equals(output)) {
      source.recycle();
    }
    return output;
  }
  return null;
}
 
開發者ID:alorma,項目名稱:TimelineView,代碼行數:19,代碼來源:RoundTimelineView.java

示例2: clipToRound

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
/**
 * 把 Bitmap 變圓。
 *
 * @param context Context
 * @param bitmap 要處理的 Bitmap
 * @return 圓形的 Bitmap
 */
public static Bitmap clipToRound(Context context, Bitmap bitmap) {
    final RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(context.getResources(), bitmap);
    drawable.setAntiAlias(true);
    drawable.setCircular(true);
    drawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());

    bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    drawable.draw(canvas);

    return bitmap;
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:20,代碼來源:ChatIcon.java

示例3: TransformToRounded

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
public static Bitmap TransformToRounded(Bitmap source, Context mContext, int width, int heigth) {
    // Create the RoundedBitmapDrawable.
    RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(mContext.getResources(), source);
    drawable.setCircular(true);
    //drawable.setCornerRadius(mContext.getCornerRadius(source));
    Bitmap output = Bitmap.createBitmap(width, heigth, source.getConfig());
    Canvas canvas = new Canvas(output);
    drawable.setAntiAlias(true);
    drawable.setBounds(0, 0, width, heigth);
    drawable.draw(canvas);
    if (source != output) {
        source.recycle();
    }
    return output;
}
 
開發者ID:malah-code,項目名稱:Open-Quran-Radio,代碼行數:16,代碼來源:ImageHelper.java

示例4: transform

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public Bitmap transform(Bitmap source) {
    RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(res, source);
    drawable.setCornerRadius(getCornerRadius(source));
    Bitmap output = Bitmap.createBitmap(source.getWidth(), source.getHeight(), source.getConfig());
    Canvas canvas = new Canvas(output);
    drawable.setAntiAlias(true);
    drawable.setBounds(0, 0, source.getWidth(), source.getHeight());
    drawable.draw(canvas);
    if (source != output) {
        source.recycle();
    }
    return output;
}
 
開發者ID:Ticketmaster,項目名稱:servos,代碼行數:15,代碼來源:RoundedBitmapTransform.java


注:本文中的android.support.v4.graphics.drawable.RoundedBitmapDrawable.setBounds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。