Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
qaqFei committed Oct 27, 2024
1 parent ad96302 commit 12771bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/phigros.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/web_canvas.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 12771bd

Please sign in to comment.