Skip to content

Commit

Permalink
im stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
imacrazyguylol committed May 5, 2023
1 parent 2e1b103 commit c6fa461
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions imagegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,21 @@ def __roundCorners(im, rad):
im.putalpha(alpha)
return im

# TODO: make mod icons box smaller, but just enough (why must the Image.reduce() function only take integers whyyyyyyyyyyyyyyyy)
def __modIcons(score: Score):
if score.mods.value == 0: return False

modlist = []
for mod in score.mods.decompose():
modlist.append(mod.long_name().lower())

totalWidth = (137 * len(modlist)) - 1
totalWidth = (91 * len(modlist)) - 1

im = Image.new('RGBA', (totalWidth, 132))
im = Image.new('RGBA', (totalWidth, 88))

i = 0
for modname in modlist:
modIcon = Image.open(f'src/Mods/selection-mod-{modname}@2x.png')
im.paste(modIcon, (i * 137, 0))
modIcon = Image.open(f'src/Mods/selection-mod-{modname}@2x.png').resize((90, 88))
im.paste(modIcon, (i * 91, 0))
i += 1 # python should have increment/decrement :(

return im
Expand Down Expand Up @@ -101,7 +100,7 @@ def imageGen(score: Score):
# Text
draw = ImageDraw.Draw(output)

# Might be worth saving the strings to another variable also to cut actions in half
# Might be worth saving the strings to another variable also to cut down on processing
tempFont = getFont(56)

# Artist - Title; centered towards the top
Expand Down Expand Up @@ -129,9 +128,9 @@ def imageGen(score: Score):
draw.text( ( (1920 - length)/2 + 256, 360 ), f'{score.user().username}', fill='white', font=tempFont, stroke_width=2, stroke_fill='black')

# #.##☆; sr
length = draw.textlength(f'{score.beatmap.difficulty_rating}☆', font=tempFont)
draw.text( ( (1920 - length)/2 + 256, 480 ), f'{score.beatmap.difficulty_rating}', fill='white', font=tempFont, stroke_width=2, stroke_fill='black')
length = draw.textlength(f'{score.beatmap.difficulty_rating}☆', font=tempFont) # accounts for star placement as well
draw.text( ( (1920 - length)/2 + 256, 480 ), f'{score.beatmap.difficulty_rating}', fill='white', font=tempFont, stroke_width=2, stroke_fill='black')

# ####x; combo
length = draw.textlength(f'{score.max_combo}x', font=tempFont)
draw.text( ( (1920 - length)/2 + 256, 600 ), f'{score.max_combo}x', fill='white', font=tempFont, stroke_width=2, stroke_fill='black')
Expand Down
Binary file added src/SRstar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c6fa461

Please sign in to comment.