Beispiel #1
0
def draw_square_width_height(request, width, height, color):
    #check if is a square (two sides equal)
    if not height:
        height = width

    if not color:
        color = utils.random_color()
    #Create the image
    width, height = int(width), int(height)

    s = Square(width, height, color)
    return draw_factory(s)
Beispiel #2
0
 def test_random_color(self):
     self.assertTrue(utils.color_hex_to_dec(utils.random_color()) <\
                          settings.RGB_COMBS)
Beispiel #3
0
def draw_circle_width_height(request, radius):
    #Create the image
    radius = int(radius)
    color = utils.random_color()
    s = Circle(radius, color)
    return draw_factory(s)