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