当前位置: 首页>>代码示例>>Java>>正文


Java RoundedBitmapDrawable.setAntiAlias方法代码示例

本文整理汇总了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawable.setAntiAlias方法的典型用法代码示例。如果您正苦于以下问题:Java RoundedBitmapDrawable.setAntiAlias方法的具体用法?Java RoundedBitmapDrawable.setAntiAlias怎么用?Java RoundedBitmapDrawable.setAntiAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.graphics.drawable.RoundedBitmapDrawable的用法示例。


在下文中一共展示了RoundedBitmapDrawable.setAntiAlias方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initHalloweenTheme

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
private void initHalloweenTheme() {
    if (!isHalloween) {
        return;
    }

    Bitmap bmp = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ground);
    RoundedBitmapDrawable dr = RoundedBitmapDrawableFactory.create(getContext().getResources(), bmp);
    dr.setCornerRadius(dialogRadius);
    dr.setAntiAlias(true);

    ground.setBackgroundDrawable(dr);

    plane.setImageResource(R.drawable.witch);
    tomb.setImageResource(R.drawable.tomb_hw);
    moon.setVisibility(View.VISIBLE);
    ground.setVisibility(View.VISIBLE);
    pumpkin.setVisibility(View.VISIBLE);
    wifiOn.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
    mobileOn.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
    airplaneOff.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
}
 
开发者ID:appwise-labs,项目名称:NoInternetDialog,代码行数:22,代码来源:NoInternetDialog.java

示例2: onDraw

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
public void onDraw(Canvas canvas) {
    if (bitmap != null) {
        int size = Math.min(canvas.getWidth(), canvas.getHeight());
        if (size != this.size) {
            this.size = size;
            bitmap = ThumbnailUtils.extractThumbnail(bitmap, size, size);

            RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);

            roundedBitmapDrawable.setCornerRadius(size / 2);
            roundedBitmapDrawable.setAntiAlias(true);

            bitmap = ImageUtils.drawableToBitmap(roundedBitmapDrawable);
        }

        canvas.drawBitmap(bitmap, 0, 0, paint);
    }
}
 
开发者ID:TheAndroidMaster,项目名称:MediaNotification,代码行数:20,代码来源:CircleImageView.java

示例3: onLargeIconAvailable

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
public void onLargeIconAvailable(
        Bitmap icon, int fallbackColor, boolean isFallbackColorDefault) {
    if (icon == null) {
        mIconGenerator.setBackgroundColor(fallbackColor);
        icon = mIconGenerator.generateIconForUrl(mItem.getUrl());
        mItemView.setIcon(new BitmapDrawable(getResources(), icon));
        mItem.setTileType(isFallbackColorDefault ? MostVisitedTileType.ICON_DEFAULT
                                                 : MostVisitedTileType.ICON_COLOR);
    } else {
        RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
                getResources(), icon);
        int cornerRadius = Math.round(ICON_CORNER_RADIUS_DP
                * getResources().getDisplayMetrics().density * icon.getWidth()
                / mDesiredIconSize);
        roundedIcon.setCornerRadius(cornerRadius);
        roundedIcon.setAntiAlias(true);
        roundedIcon.setFilterBitmap(true);
        mItemView.setIcon(roundedIcon);
        mItem.setTileType(MostVisitedTileType.ICON_REAL);
    }
    mSnapshotMostVisitedChanged = true;
    if (mIsInitialLoad) loadTaskCompleted();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:25,代码来源:NewTabPageView.java

示例4: updateUi

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public void updateUi(Card card) {
    TextView extraText = (TextView) findViewById(R.id.extra_text);
    TextView primaryText = (TextView) findViewById(R.id.primary_text);
    final ImageView imageView = (ImageView) findViewById(R.id.main_image);

    extraText.setText(card.getExtraText());
    primaryText.setText(card.getTitle());

    // Create a rounded drawable.
    int resourceId = card.getLocalImageResourceId(getContext());
    Bitmap bitmap = BitmapFactory
            .decodeResource(getContext().getResources(), resourceId);
    RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(getContext().getResources(), bitmap);
    drawable.setAntiAlias(true);
    drawable.setCornerRadius(
            Math.max(bitmap.getWidth(), bitmap.getHeight()) / 2.0f);
    imageView.setImageDrawable(drawable);
}
 
开发者ID:googlesamples,项目名称:leanback-showcase,代码行数:19,代码来源:TextCardView.java

示例5: onBitmapLoaded

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
    // Updating icons from Java is not supported prior to API 11.
    if (!AppConstants.Versions.feature11Plus) {
        return;
    }

    final Drawable drawable;
    if (cornerRadius > 0) {
        final RoundedBitmapDrawable roundedBitmapDrawable;
        roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(resources, bitmap);
        roundedBitmapDrawable.setCornerRadius(cornerRadius);
        roundedBitmapDrawable.setAntiAlias(true);
        drawable = roundedBitmapDrawable;
    } else {
        drawable = new BitmapDrawable(resources, bitmap);
    }
    preference.setIcon(drawable);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:20,代码来源:PicassoPreferenceIconTarget.java

示例6: 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

示例7: 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

示例8: getRoundBitmap

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
private Bitmap getRoundBitmap(@DrawableRes int drawable, int size) {
    Bitmap bitmap = ImageUtils.drawableToBitmap(ContextCompat.getDrawable(getContext(), drawable));
    bitmap = Bitmap.createBitmap(bitmap, bitmap.getWidth() / 6, bitmap.getHeight() / 6, (int) (0.666 * bitmap.getWidth()), (int) (0.666 * bitmap.getHeight()));
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, size, size);

    RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);

    roundedBitmapDrawable.setCornerRadius(size / 2);
    roundedBitmapDrawable.setAntiAlias(true);

    return ImageUtils.drawableToBitmap(roundedBitmapDrawable);
}
 
开发者ID:TheAndroidMaster,项目名称:MediaNotification,代码行数:13,代码来源:AppIconView.java

示例9: getCircleDrawable

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public static RoundedBitmapDrawable getCircleDrawable(Context context, Bitmap bitmap) {
    RoundedBitmapDrawable circleDrawable = RoundedBitmapDrawableFactory.create(context
            .getResources(), bitmap);
    circleDrawable.setAntiAlias(true);
    circleDrawable.setCornerRadius(((float) Math.min(bitmap.getWidth(), bitmap.getHeight()))
            / 2.0f);
    return circleDrawable;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:MQImageView.java

示例10: getRoundedDrawable

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public static RoundedBitmapDrawable getRoundedDrawable(Context context, Bitmap bitmap, float
        cornerRadius) {
    RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(context
            .getResources(), bitmap);
    roundedBitmapDrawable.setAntiAlias(true);
    roundedBitmapDrawable.setCornerRadius(cornerRadius);
    return roundedBitmapDrawable;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:MQImageView.java

示例11: getRoundedCornerDrawable

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
public static Drawable getRoundedCornerDrawable(Resources resources, Bitmap bitmap, float scale) {
    if (resources == null || bitmap == null)
        return null;
    RoundedBitmapDrawable round = RoundedBitmapDrawableFactory.create(resources, bitmap);
    round.setCornerRadius(round.getIntrinsicWidth() / scale);
    round.setAntiAlias(true);

    return round;
}
 
开发者ID:Q115,项目名称:Goalie_Android,代码行数:10,代码来源:ImageHelper.java

示例12: 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

示例13: getRoundedBitmap

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
/**
 * Return a rounded bitmap version of the given bitmap
 *
 * @param res       the context resources
 * @param srcBitmap the bitmap with the image
 * @return the RoundedBitmapDrawable with the rounded bitmap
 */
public static RoundedBitmapDrawable getRoundedBitmap(Resources res, Bitmap srcBitmap) {
    RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(res, srcBitmap);

    int radius = Math.min(srcBitmap.getWidth(), srcBitmap.getHeight());
    bitmapDrawable.setCornerRadius(radius);
    bitmapDrawable.setAntiAlias(true);

    return bitmapDrawable;
}
 
开发者ID:abicelis,项目名称:CreditCardExpenseManager,代码行数:17,代码来源:ImageUtils.java

示例14: onDraw

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
public void onDraw(Canvas canvas) {
    Bitmap image = ImageUtils.drawableToBitmap(getDrawable());
    if (image != null) {
        int size = Math.min(getWidth(), getHeight());
        image = ThumbnailUtils.extractThumbnail(image, size, size);

        RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), image);

        roundedBitmapDrawable.setCornerRadius(size / 2);
        roundedBitmapDrawable.setAntiAlias(true);

        canvas.drawBitmap(ImageUtils.drawableToBitmap(roundedBitmapDrawable), 0, 0, paint);
    }
}
 
开发者ID:TheAndroidMaster,项目名称:Paper-Tales,代码行数:16,代码来源:CircleImageView.java

示例15: onDraw

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入方法依赖的package包/类
@Override
public void onDraw(Canvas canvas) {
    Bitmap image = Utils.drawableToBitmap(getDrawable());
    if (image != null) {
        int size = Math.min(getWidth(), getHeight());
        image = ThumbnailUtils.extractThumbnail(image, size, size);

        RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), image);

        roundedBitmapDrawable.setCornerRadius(size / 2);
        roundedBitmapDrawable.setAntiAlias(true);

        canvas.drawBitmap(Utils.drawableToBitmap(roundedBitmapDrawable), 0, 0, paint);
    }
}
 
开发者ID:TheAndroidMaster,项目名称:Wallpapers,代码行数:16,代码来源:CircleImageView.java


注:本文中的android.support.v4.graphics.drawable.RoundedBitmapDrawable.setAntiAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。