Hi all,
any idea how I can convert the Python code snippets below to Pascal?

Code:
def linear_gradient(start_value, stop_value, start_offset=0.0, stop_offset=1.0):
    return lambda offset: (start_value + ((offset - start_offset) / (stop_offset - start_offset) * (stop_value - start_value))) / 255.0
Code:
def RADIAL(center_x, center_y):
    return lambda x, y: (x - center_x) ** 2 + (y - center_y) ** 2
Code:
def GAUSSIAN(sigma):
    def add_noise(r, g, b):
        d = random.gauss(0, sigma)
        return r + d, g + d, b + d
    return add_noise
Code:
def gradient(value_func, noise_func, DATA):
    def gradient_function(x, y):
        initial_offset = 0.0
        v = value_func(x, y)
        for offset, start, end in DATA:
            if v < offset:
                r = linear_gradient(start[0], end[0], initial_offset, offset)(v)
                g = linear_gradient(start[1], end[1], initial_offset, offset)(v)
                b = linear_gradient(start[2], end[2], initial_offset, offset)(v)
                return noise_func(r, g, b)
            initial_offset = offset
        return noise_func(end[0] / 255.0, end[1] / 255.0, end[2] / 255.0)
    return gradient_function
the gradient and GAUSSIAN routines are especially stumping me.

For example, GAUSSIAN is used by only calling the GAUSSIAN(<single parameter>) like so:

Code:
write_png("example11.png", 480, 100,
    gradient(RADIAL(0.5, 0.0), GAUSSIAN(0.01),
    [(0.8, (0x22, 0x22, 0x22), (0x00, 0x00, 0x00))]
))
so where do the r,g,b values come from internally when using that routine

The snippets come from here:
http://github.com/jtauber/web-graphi...eb_graphics.py

and is to do with this page:
http://eldarion.com/blog/2009/08/18/...-and-textures/

cheers,
Paul