当前位置: 首页>>代码示例>>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;未经允许,请勿转载。