INNER CODE UNIT · Python
compose
utopia-rise/godot-jvm · logo/export.py:253
def compose(logo, head_center, rows, text_width, name):
"""Mascot on the left, a column of centered rows on the right, the pair centered on the canvas.
`rows` holds (gap above, layer) pairs; `text_width` is the column width, shared between images
so the mascot lands at the same spot in each."""
text_height = sum(gap + layer.height for gap, layer in rows)
logo_width = int(logo.width * LOGO_HEIGHT / logo.height)
start = (CANVAS_W - (logo_width + LOGO_TEXT_GAP + text_width)) // 2
logo_x = start + logo_width // 2
bg = background(logo_x, HEAD_Y)
paste_logo(bg, logo, head_center, logo_x, HEAD_Y)
text_x = start + logo_width + LOGO_TEXT_GAP + text_width // 2
y = CANVAS_H // 2 - text_height // 2 + TEXT_Y
for gap, layer in rows:
y += gap
bg.alpha_composite(layer, (text_x - layer.width // 2, y))
y += layer.height
rgb = bg.convert('RGB')