@@ -0,0 +1,1913 @@
+import colorsys%0Aimport png%0Afrom ..random import randomNoise2D%0A%0A# Configuration%0Awidth = 1000 # Width%0Aheight = 1000 # Height%0Axs = 700 # Filled width%0Ays = 700 # Filled height%0A%0Axo = int((width - xs) / 2) # X filled offset margins%0Ayo = int((height - ys) / 2) # Y filled offset margins%0A%0Ao = 10 # Point offset%0A%0A# Generate data%0Adef generateData():%0A    data = %5B%5D%0A%0A    for y in range(height):%0A        current = %5B%5D%0A%0A        for x in range(width):%0A            current.append(0.0)%0A            current.append(0.0)%0A            current.append(0.0)%0A%0A        data.append(current)%0A%0A    return data%0A%0A# Generate points%0Adef generatePoints():%0A    p = %5B%5D%0A%0A    for x in range(xo, xo + xs, o):%0A        pcol = %5B%5D%0A        p.append(pcol)%0A        for y in range(yo, yo + ys, o):%0A            pcol.append(%5Bx, y%5D)%0A%0A    return p%0A%0A# Put%0Adef put(x, y, c, data):%0A    x = int(x %25 width) * 3%0A    y = height - int(y %25 height) - 1%0A%0A    row = data%5By%5D%0A    row%5Bx%5D = c%5B0%5D%0A    row%5Bx + 1%5D = c%5B1%5D%0A    row%5Bx + 2%5D = c%5B2%5D%0A%0A# Put color%0Adef putColor(x, y, data, color1, color2, lums):%0A    x = int(x %25 width) * 3%0A    y = height - int(y %25 height) - 1%0A%0A    lum = lums.get((x, y))%0A%0A    if lum is None:%0A        lum = lums%5B(x, y)%5D = 0.1%0A    else:%0A        lum = lums%5B(x, y)%5D = lum + 0.1%0A%0A    if lum %3E 0.7:%0A        lum = 0.7%0A%0A    colorHue = (color2 - color1) * randomNoise2D(x / 500, y / 500) + color1%0A    (r, g, b) = colorsys.hls_to_rgb(colorHue, lum, 1.0)%0A%0A    row = data%5By%5D%0A    row%5Bx%5D = r * 255.0%0A    row%5Bx + 1%5D = g * 255.0%0A    row%5Bx + 2%5D = b * 255.0%0A%0A# Clear%0Adef putClear(x, y, data):%0A    put(x, y, (0.0, 0.0, 0.0), data)%0A%0A# Clear margins%0Adef clearMargins(data):%0A    for x in range(0, width):%0A        for y in range(0, height):%0A            if x %3C xo or x %3E= (xo + xs) or y %3C yo or y %3E= (yo + ys):%0A                putClear(x, y, data)%0A%0A# Write image%0Adef writeImage(data):%0A    f = open(%22art.png%22, %22wb%22)%0A    w = png.Writer(width, height)%0A    w.write(f, data)%0A    f.close()%0A

add graphics library