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


Java BitmapDrawable.getPaint方法代碼示例

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


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

示例1: applyLeafRounding

import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
/**
 * Rounds the given drawable with a {@link RoundedBitmapDrawable} or {@link RoundedColorDrawable}.
 *
 * <p> If the given drawable is not a {@link BitmapDrawable} or a {@link ColorDrawable}, it is
 * returned without being rounded.
 *
 * @return the rounded drawable, or the original drawable if rounding didn't take place
 */
private static Drawable applyLeafRounding(
    Drawable drawable,
    RoundingParams roundingParams,
    Resources resources) {
  if (drawable instanceof BitmapDrawable) {
    final BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
    RoundedBitmapDrawable roundedBitmapDrawable =
        new RoundedBitmapDrawable(
            resources,
            bitmapDrawable.getBitmap(),
            bitmapDrawable.getPaint());
    applyRoundingParams(roundedBitmapDrawable, roundingParams);
    return roundedBitmapDrawable;
  }
  if (drawable instanceof ColorDrawable &&
      Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    RoundedColorDrawable roundedColorDrawable =
        RoundedColorDrawable.fromColorDrawable((ColorDrawable) drawable);
    applyRoundingParams(roundedColorDrawable, roundingParams);
    return roundedColorDrawable;
  }
  return drawable;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:32,代碼來源:WrappingUtils.java

示例2: fromBitmapDrawable

import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
/**
 * Creates a new RoundedBitmapDrawable from the given BitmapDrawable.
 * @param res resources to use for this drawable
 * @param bitmapDrawable bitmap drawable containing the bitmap to be used for this drawable
 * @return the RoundedBitmapDrawable that is created
 */
public static RoundedBitmapDrawable fromBitmapDrawable(
    Resources res,
    BitmapDrawable bitmapDrawable) {
  return new RoundedBitmapDrawable(res, bitmapDrawable.getBitmap(), bitmapDrawable.getPaint());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:RoundedBitmapDrawable.java


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