本文整理汇总了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;
}
示例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());
}