Android播放器中我喜欢的一个地方-----高斯模糊效果

这篇博客主要介绍了在Android播放器中实现背景高斯模糊效果的过程。作者原本打算使用RenderScript,但由于遇到问题,转而采用了一种能快速实现高斯模糊的方法。虽然代码理解困难,但作者分享了对这种模糊效果的使用方法,并建议读者自行搜索不同的实现方式。最后,作者提供了实现效果的截图链接。
摘要由CSDN通过智能技术生成

整个这个写的mp3中我最喜欢的就是这一点了,背景高斯模糊化。不废话,依旧看代码

package com.verzqli.utils;

import android.graphics.Bitmap;

/**
 * Created by paveld on 3/6/14.
 */
public class FastBlur {
   

    public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) {

        // Stack Blur v1.0 from
        // http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
        //
        // Java Author: Mario Klingemann <mario at quasimondo.com>
        // http://incubator.quasimondo.com
        // created Feburary 29, 2004
        // Android port : Yahel Bouaziz <yahel at kayenko.com>
        // http://www.kayenko.com
        // ported april 5th, 2012

        // This is a compromise between Gaussian Blur and Box blur
        // 这是一个妥协于高斯模糊和方形模糊的产物
        // It creates much better looking blurs than Box Blur, but is
        // 他不但看上去的模糊效果比方形模糊更好,而且实现速度比高斯模糊要快
        // 7x faster than my Gaussian Blur implementation.
        // I called it Stack Blur because this describes best how this
        // 我叫他堆栈模糊,因为他很好的阐述了过滤器是如何在内存中工作的。
        // filter works internally: it creates a kind of moving stack
        // of colors whilst scanning through the image. Thereby it
        //  他实现了在移动颜色的栈的同时对图片进行扫描。
        // just has to add one new block of color to the right side
        // 其实它只是在栈的右边添加了一个新的颜色块,然后移除了最左边的颜色。
        // of the stack and remove the leftmost color. The remaining
        // 在栈最上层模块的剩余颜色块由他们所处的区域是属于栈右边还是左边来决定是增加还是删除
        // colors on the topmost layer of the stack are either added on
        // or reduced by one, depending on if they are on the right or
        // on the left side of the stack.
        //
        // If you are using this algorithm in your code please add
        // the following line:
        // 如果你在你的代码中使用这个算法,请添加下面这行
        // Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com>
        // 堆栈模糊算法由Mario Klingemann <mario@quasimondo.com>所创作
        // 翻译:verzqli,好吧,翻译的就像一坨(ˇˍˇ),英语好的自己理解下

        Bitmap bitmap;
        if (canReuseInBitmap) {
            bitmap = sentBitmap;
        } else {
            //决定图片像素点的存储,即用图片查看器看图片属性时候的位深参数。
            bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
        }

        if
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值