diff --git a/src/phigros.py b/src/phigros.py index 7163718..2fceddd 100644 --- a/src/phigros.py +++ b/src/phigros.py @@ -356,8 +356,6 @@ def Load_Resource(): for index, avatar in enumerate(assetConfig["avatars"]): respacker.reg_img(open(f"./phigros_assets/{avatar}", "rb").read(), f"avatar_{index}") - ... # respacker.reg_img(Image.open(f"./phigros_assets/{getUserData("userdata-userBackground")}"), "userBackground") - with open("./resources/font.ttf", "rb") as f: root.reg_res(f.read(), "PhigrosFont") respacker.load(*respacker.pack()) @@ -1644,7 +1642,7 @@ def updatebg(): ubgjsname = root.get_img_jsvarname("userBackground") root.run_js_code(f"delete {ubgjsname};") bgimname = f"background_{assetConfig["backgrounds"].index(getUserData("userdata-userBackground"))}" - root.run_js_code(f"{ubgjsname} = {root.get_img_jsvarname(bgimname)};") + root.run_js_code(f"{ubgjsname} = blurImg({root.get_img_jsvarname(bgimname)}, {(w + h) / 125});") def unregEvents(): eventManager.unregEvent(clickBackButtonEvent) diff --git a/src/web_canvas.html b/src/web_canvas.html index aa950a7..f4924c0 100644 --- a/src/web_canvas.html +++ b/src/web_canvas.html @@ -201,6 +201,16 @@ return imnames; } + function blurImg(im, r) { + let cv = document.createElement("canvas"); + cv.width = im.width; + cv.height = im.height; + let ctx = cv.getContext("2d"); + ctx.filter = `blur(${r}px)`; + ctx.drawImage(im, 0, 0); + return cv; + } + function splitText(x0, y0, x1, y1, text, cv) { texts = []; function _splitTexts (element) {