'''
Created on Mar 15, 2011

@author: alexandrudutu
'''

'''
Image PIL package should be imported 
'''
import Image

def apply_filter(image, filter):
    '''
    input_image represents the image store as an Image object
    filter is the function that represents the image filter
    This function should:
        - get a list of all the pixels in image
        - call the filter function for every pixel
        - save the transformed pixel as a tuple in a new list
        - place the list of transformed pixels into image 
    '''
    # TODO: students fill this in.
    pass

def show_image_transformed(image_filename, filter):
    '''
    image_filename represents the filename of the input image
    filter is the function that represents the image filter
    This function should:
        - get a list of all the pixels in image
        - call the filter function for every pixel
        - save the transformed pixel as a tuple in a new list
        - place the list of transformed pixels into image
        - open a new window with the transformed image
    '''
    # TODO: students fill this in.
    pass

def save_image_transformed(in_img_filename, filter, out_img_filename):
    '''
    in_img_filename represents the filename of the input image
    filter is the function that represents the image filter
    out_img_filename represents the filename of the transformed 
                                    image that we what to store
    This function should:
        - open in_img_filename image 
        - get a list of all the pixels in image
        - call the filter function for every pixel
        - save the transformed pixel as a tuple in a new list
        - place the list of transformed pixels into image
        - save the newly created image in out_img_filename
    '''
    # TODO: students fill this in.
    pass

'''
During this lab a pixel is a tuple of 4 values (R, G, B, a)
The filter functions:
    - take one pixel as an argument,
    - modify the components of the pixel and 
    - return the transformed pixel
'''

def remove_blue(pixel):
    '''
    this filter function takes a pixel and removes the blue component (sets it to 0)
    '''
    return (0, 0, 0, 0)

def remove_green(pixel):
    '''
    this filter function takes a pixel and removes the green component (sets it to 0)
    '''
    return (0, 0, 0, 0)

def invert(pixel):
    '''
    this filter function should set every pixel component 255 minus its value
    '''
    # TODO: students fill this in.
    return (0, 0, 0, 0)

def gray_scale(pixel):
    '''
    this filter function should set every component to the arithmetic mean of all the components 
    '''
    # TODO: students fill this in.
    return (0, 0, 0, 0)

def no_background(pixel):
    '''
    this filter function should set all the components (red, green and blue) to 0 if 
    all of them are above 160 (the pixel is closer to white)
    '''
    # TODO: students fill this in.
    return (0, 0, 0, 0)

def darken(pix):
    """
    Given a pixel, returns a pixel whose red, green, and blue values are all 90% of the originals.
    """
    # TODO: students fill this in.
    return (0,0,0,0)
 
def brighten(pix):
    """
    Given a pixel, returns a pixel whose red, green, and blue values are all 110% of the originals,
    but not over 255 (the maximum value).
    """
    # TODO: students fill this in.
    return (0,0,0,0)
 
def solarize(pix):
    """
    Given a pixel, returns a pixel whose red, green, and blue values are all changed in
    the following way:
     - if the value is less than 128, set it to 255 - the original value.
     - if the value is 128 or greater, don't change it.
    """
    # TODO: students fill this in.
    return (0,0,0,0)

if __name__ == '__main__':
    '''
    The main function should take into consideration input files, various filters function and various output files
    '''