查看: 5053|回复: 2

[有事请教] 開啟選單時,怎麼修改視窗後背景的模糊程度?

[复制链接]
梦石
0
星屑
2638
在线时间
365 小时
注册时间
2015-12-8
回帖
77
发表于 2020-4-9 23:22:07 | 显示全部楼层 |阅读模式
悬赏40星屑未解决
本帖最后由 冰冷水藍 于 2020-5-5 14:33 编辑

我們知道預設遊戲叫出選單時
背景的地圖畫面會自帶一點模糊效果

想知道該怎麼去調整該模糊程度的數值?
我想要調強一些,而不是刪掉
謝謝

梦石
0
星屑
2638
在线时间
365 小时
注册时间
2015-12-8
回帖
77
 楼主| 发表于 2020-5-5 14:30:27 | 显示全部楼层
           
提高懸賞自推一下
回复

使用道具 举报

梦石
0
星屑
2827
在线时间
136 小时
注册时间
2011-8-7
回帖
72
发表于 2020-8-20 01:47:47 | 显示全部楼层
SceneManager.snapForBackground = function() {
    this._backgroundBitmap = this.snap();
    this._backgroundBitmap.blur();
};
这里的: this._backgroundBitmap.blur();

这个对应的是一个bitmap。。
所以对应下面这里。
Bitmap.prototype.blur = function() {
    for (var i = 0; i < 2; i++) {
        var w = this.width;
        var h = this.height;
        var canvas = this._canvas;
        var context = this._context;
        var tempCanvas = document.createElement('canvas');
        var tempContext = tempCanvas.getContext('2d');
        tempCanvas.width = w + 2;
        tempCanvas.height = h + 2;
        tempContext.drawImage(canvas, 0, 0, w, h, 1, 1, w, h);
        tempContext.drawImage(canvas, 0, 0, w, 1, 1, 0, w, 1);
        tempContext.drawImage(canvas, 0, 0, 1, h, 0, 1, 1, h);
        tempContext.drawImage(canvas, 0, h - 1, w, 1, 1, h + 1, w, 1);
        tempContext.drawImage(canvas, w - 1, 0, 1, h, w + 1, 1, 1, h);
        context.save();
        context.fillStyle = 'black';
        context.fillRect(0, 0, w, h);
        context.globalCompositeOperation = 'lighter';
        context.globalAlpha = 1 / 9;
        for (var y = 0; y < 3; y++) {
            for (var x = 0; x < 3; x++) {
                context.drawImage(tempCanvas, x, y, w, h, 0, 0, w, h);
            }
        }
        context.restore();
    }
    this._setDirty();
};
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部