Simple Map

Swyddfa Developers

30 Oct 2020 1080 x 1080 1 revisions 33 sloc v0.11.0

..

import arlunio.image as image
import arlunio.mask as mask
import arlunio.shape as shape

import numpy as np

top = shape.Rectangle(size=0.2, yc=1, ratio=50)
left = shape.Rectangle(size=0.2, xc=-1, ratio=1/50)
right = shape.Rectangle(size=0.2, xc=1, ratio=1/50)
bottom = shape.Rectangle(size=0.2, yc=-1, ratio=50)

legend = {
    "tt": top,
    "bb": bottom,
    "ll": left,
    "rr": right,
    "tl": top + left,
    "tr": top + right,
    "bl": bottom + left,
    "br": bottom + right
}

layout = np.array([
    ["tt", "tt", "tt", "tt", "tr"],
    [  "", "tl", "tt", "tr", "rr"],
    [  "", "ll", "bl", "br", "rr"],
    [  "", "bl", "bb", "bb", "br"],
    [  "",   "",   "",   "",   ""]
])

map_ = mask.Map(legend=legend, layout=layout)
img = image.fill(
    map_(width=1080, height=1080), foreground="blue", background="white"
)