Ejemplo n.º 1
0
def test():
    '''function that demonstrates how to create and save a .png image'''
    width = 300
    height = 200
    image = PNGImage(width, height)
    for col in range(width):  # creates a loop that draws pizels
        for row in range(height):
            if weWantThisPixel(col, row) == True:
                image.plotPoint(col, row)
    image.saveFile()
Ejemplo n.º 2
0
def test():
    ''' a function to demonstrate how to create and save a png image '''
    width = 300
    height = 200
    image = PNGImage(width, height)
    # create a loop in order to draw some pixels
    for col in range(width):
        for row in range(height):
            if weWantThisPixel(col, row) == True:
                image.plotPoint(col, row)
    # we looped through every image pixel; we now write the file
    image.saveFile()
Ejemplo n.º 3
0
def mset():
    """ creates a 300x200 image of the Mandelbrot set
    """
    width = 300
    height = 200
    image = PNGImage(width, height)
    for col in range(width):
        for row in range(height):
            x = scale(col,width, -2, 1 )
            y = scale(row,height, -1, 1)
            if inMSet(x + y * 1j,25 ) == True:
                image.plotPoint(col, row)
    image.saveFile()
Ejemplo n.º 4
0
def mset():
    '''creates a 300x200 image of the Mandelbrot'''
    width = 300
    height = 200
    image = PNGImage(width, height)
    for col in range(width):  # creates a loop that draws pizels
        for row in range(height):
            x = scale(col, width, -2.0, 1.0)
            y = scale(row, height, -1.0, 1.0)
            c = x + y * 1j
            n = 25
            if inMSet(c, n) == True:
                image.plotPoint(col, row)
    image.saveFile()
Ejemplo n.º 5
0
def mset(n):
    '''Creates a 300x200 image of the Mandelbrot set, where
    the image is of the complex plane with x real [-2, 1] and y imaginary, [-i, i]'''
    width = 300
    height = 200
    image = PNGImage(width, height)

    for col in range(width):
        for row in range(height):
            x = scale(col, 300, -2, 1)
            y = scale(row, 200, -1, 1)
            c = x + y * 1j
            if inMSet(c, 25) == True:
                image.plotPoint(col, row)
    image.saveFile()
Ejemplo n.º 6
0
def mset(width, height):
    '''creates a width * height image of the Mandelbrot set'''
    image = PNGImage(width, height)
    # create a loop in order to draw some pixels
    for col in range(width):
        for row in range(height):
            # here is where you will need
            # to create the complex number, c!
            x = scale(col, width, -2.0, 1.0)
            y = scale(row, height, -1.0, 1.0)
            c = x + y * 1j
            if inMSet(c, 25) == True:
                image.plotPoint(col, row)
    # we looped through every image pixel; we now write the file
    image.saveFile()
Ejemplo n.º 7
0
def mset(n):
    '''Creates a 300x200 image of the Mandelbrot set, where
    the image is of the complex plane with x real [-2, 1] and y imaginary, [-i, i]'''
    width = 300
    height = 200
    image = PNGImage(width, height)

    for col in range(width):
        for row in range(height):
            y = scale(row, height, -1.0, 1.0)
            x = scale(col, width, -2.0, 1.0)
            c = y * 1j + x
            if inMSet(c, n):
                image.plotPoint(col, row)
    image.saveFile()
Ejemplo n.º 8
0
def mset(width, height):
    """creates a 300x200 image of the Mandelbrot set"""
    width = 300
    height = 200
    image = PNGImage(width, height)
    # create a loop in order to draw some pixels
    for col in range(width):
        for row in range(height):
            x = scale(col, 300, -2, 1)
            y = scale(row, 200, -1, 1)
            c= x + y*1j
            if inMSet(c,25) == True:
                image.plotPoint(col, row)
    # we looped through every image pixel; we now write the file
    image.saveFile()
Ejemplo n.º 9
0
def mset():
    """creates a 300x200 image of the Mandlebrot set
    """
    width = 300
    height = 200
    image = PNGImage(width, height)

    #create a loop in order to draw some pixels
    for col in range(width):
        for row in range(height):
            x = scale(col, 300, -2.0, 1.0)
            y = scale(row, 200, -1.0, 1.0)
            c = (x) + (y * 1j)
            if inMSet(c, n=25) == True:
                image.plotPoint(col, row)
    image.saveFile()
Ejemplo n.º 10
0
def mset():
    ''' Will generate images of width width and height height with that computes the set of points in the Mandelbrot set on the complex plane and creates a bitmap of them. '''
    width = 300
    height = 200
    x_Min = -2.0
    y_Min = -1.0
    x_Max = 1.0
    y_Max = 1.0
    image = PNGImage(width, height)
    # create a loop in order to draw some pixels
    for col in range(width):
        x = scale(col,width,x_Min,x_Max)
        for row in range(height):
            y = scale(row,height,y_Min,y_Max)
            if inMSet( x + y*1j,25 ) == True:
                image.plotPoint(col, row)
    # we looped through every image pixel; we now write the file
    image.saveFile()
Ejemplo n.º 11
0
def mset():
    """ creates a 300x200 image of the Mandelbrot set
    """
    width = 300
    height = 200
    image = PNGImage(width, height)
    
    # create a loop in order to draw some pixels
    
    for col in range(width):
        for row in range(height):
            # here is where you will need
            # to create the complex number, c!
            c = scale(col, width, -2.0, 1.0) + scale(row, height, -1.0, 1.0) * 1j
            if inMSet( c, 25 ) == True:
                image.plotPoint(col, row)
    # we looped through every image pixel; we now write the file
    image.saveFile()
def mset():
    """ creates a 300x200 image of the Mandelbrot set
    """
    width = 300
    height = 200
    image = PNGImage(width, height)
    x_Min = -2.0
    x_Max = 1.0
    y_Min = -1.0
    y_Max = 1.0
    # create a loop in order to draw some pixels
    for col in range(width):
        x = scale(col,width,x_Min,x_Max)
        for row in range(height):
            y = scale(row,height,y_Min,y_Max)
            if inMSet( x + y*1j,25 ) == True:
                image.plotPoint(col, row)
    # we looped through every image pixel; we now write the file
    image.saveFile()