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


Java ImageBlurrer类代码示例

本文整理汇总了Java中com.google.android.apps.muzei.util.ImageBlurrer的典型用法代码示例。如果您正苦于以下问题:Java ImageBlurrer类的具体用法?Java ImageBlurrer怎么用?Java ImageBlurrer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImageBlurrer类属于com.google.android.apps.muzei.util包,在下文中一共展示了ImageBlurrer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBitmapLoaded

import com.google.android.apps.muzei.util.ImageBlurrer; //导入依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
    if (!mDemoFocus) {
        // Blur
        ImageBlurrer blurrer = new ImageBlurrer(getActivity());
        Bitmap blurred = blurrer.blurBitmap(bitmap,
                ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS, 0);

        // Dim
        Canvas c = new Canvas(blurred);
        c.drawColor(Color.argb(255 - MuzeiBlurRenderer.DEFAULT_MAX_DIM,
                0, 0, 0));

        bitmap = blurred;
    }

    mSimpleDemoModeImageView.setImageBitmap(bitmap);
}
 
开发者ID:chrislacy,项目名称:AndroidLiveWallpaperHelloWorld,代码行数:19,代码来源:MuzeiRendererFragment.java

示例2: onBitmapLoaded

import com.google.android.apps.muzei.util.ImageBlurrer; //导入依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
    if (!mDemoFocus) {
        // Blur
        ImageBlurrer blurrer = new ImageBlurrer(getContext(), bitmap);
        Bitmap blurred = blurrer.blurBitmap(ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS, 0);
        blurrer.destroy();

        // Dim
        Canvas c = new Canvas(blurred);
        c.drawColor(Color.argb(255 - MuzeiBlurRenderer.DEFAULT_MAX_DIM,
                0, 0, 0));

        bitmap = blurred;
    }

    mSimpleDemoModeImageView.setImageBitmap(bitmap);
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:19,代码来源:MuzeiRendererFragment.java

示例3: recomputeMaxPrescaledBlurPixels

import com.google.android.apps.muzei.util.ImageBlurrer; //导入依赖的package包/类
public void recomputeMaxPrescaledBlurPixels() {
    // Compute blur sizes
    float maxBlurRadiusOverScreenHeight = PreferenceManager
            .getDefaultSharedPreferences(mContext).getInt(Prefs.PREF_BLUR_AMOUNT, DEFAULT_BLUR)
            * 0.0001f;
    DisplayMetrics dm = mContext.getResources().getDisplayMetrics();
    int maxBlurPx = (int) (dm.heightPixels * maxBlurRadiusOverScreenHeight);
    mBlurredSampleSize = 4;
    while (maxBlurPx / mBlurredSampleSize > ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS) {
        mBlurredSampleSize <<= 1;
    }
    mMaxPrescaledBlurPixels = maxBlurPx / mBlurredSampleSize;
}
 
开发者ID:chrislacy,项目名称:AndroidLiveWallpaperHelloWorld,代码行数:14,代码来源:MuzeiBlurRenderer.java

示例4: onCreateView

import com.google.android.apps.muzei.util.ImageBlurrer; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.KITKAT)
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    boolean simpleDemoMode = false;
    if (mDemoMode && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        ActivityManager activityManager = (ActivityManager)
                getActivity().getSystemService(Context.ACTIVITY_SERVICE);
        if (activityManager.isLowRamDevice()) {
            simpleDemoMode = true;
        }
    }

    if (simpleDemoMode) {
        DisplayMetrics dm = getResources().getDisplayMetrics();
        int targetWidth = dm.widthPixels;
        int targetHeight = dm.heightPixels;
        if (!mDemoFocus) {
            targetHeight = MathUtil.roundMult4(ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS
                    * 10000 / MuzeiBlurRenderer.DEFAULT_BLUR);
            targetWidth = MathUtil.roundMult4(
                    (int) (dm.widthPixels * 1f / dm.heightPixels * targetHeight));
        }

        mSimpleDemoModeImageView = new ImageView(container.getContext());
        mSimpleDemoModeImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        Picasso.with(getActivity())
                .load("file:///android_asset/starrynight.jpg")
                .resize(targetWidth, targetHeight)
                .centerCrop()
                .into(mSimpleDemoModeLoadedTarget);
        return mSimpleDemoModeImageView;
    } else {
        mView = new MuzeiView(getActivity());
        mView.setPreserveEGLContextOnPause(true);
        return mView;
    }
}
 
开发者ID:chrislacy,项目名称:AndroidLiveWallpaperHelloWorld,代码行数:39,代码来源:MuzeiRendererFragment.java

示例5: recomputeMaxPrescaledBlurPixels

import com.google.android.apps.muzei.util.ImageBlurrer; //导入依赖的package包/类
public void recomputeMaxPrescaledBlurPixels() {
    // Compute blur sizes
    int blurAmount = mDemoMode
            ? DEMO_BLUR
            : Prefs.getSharedPreferences(mContext)
            .getInt(Prefs.PREF_BLUR_AMOUNT, DEFAULT_BLUR);
    float maxBlurRadiusOverScreenHeight = blurAmount * 0.0001f;
    DisplayMetrics dm = mContext.getResources().getDisplayMetrics();
    int maxBlurPx = (int) (dm.heightPixels * maxBlurRadiusOverScreenHeight);
    mBlurredSampleSize = 4;
    while (maxBlurPx / mBlurredSampleSize > ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS) {
        mBlurredSampleSize <<= 1;
    }
    mMaxPrescaledBlurPixels = maxBlurPx / mBlurredSampleSize;
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:16,代码来源:MuzeiBlurRenderer.java

示例6: onCreateView

import com.google.android.apps.muzei.util.ImageBlurrer; //导入依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
        Bundle savedInstanceState) {
    ActivityManager activityManager = (ActivityManager)
            getContext().getSystemService(Context.ACTIVITY_SERVICE);

    if (mDemoMode && activityManager.isLowRamDevice()) {
        DisplayMetrics dm = getResources().getDisplayMetrics();
        int targetWidth = dm.widthPixels;
        int targetHeight = dm.heightPixels;
        if (!mDemoFocus) {
            targetHeight = MathUtil.roundMult4(ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS
                    * 10000 / MuzeiBlurRenderer.DEFAULT_BLUR);
            targetWidth = MathUtil.roundMult4(
                    (int) (dm.widthPixels * 1f / dm.heightPixels * targetHeight));
        }

        mSimpleDemoModeImageView = new ImageView(getContext());
        mSimpleDemoModeImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        Picasso.with(getContext())
                .load("file:///android_asset/starrynight.jpg")
                .resize(targetWidth, targetHeight)
                .centerCrop()
                .into(mSimpleDemoModeLoadedTarget);
        return mSimpleDemoModeImageView;
    } else {
        mView = new MuzeiView(getContext());
        mView.setPreserveEGLContextOnPause(true);
        return mView;
    }
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:32,代码来源:MuzeiRendererFragment.java


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