For this project, the goal was to control entire images within a canvas, moving them around and providing different pieces of information about them such as which filter to use and whether or not the background should be there. Using various functions to manipulate image placement and other factors, we were able to make collages.
!Screen Shot 2015-10-19 at 9.40.11 PM.png|width=300! Task 1 consisted of making a function for getting information for each index in the collage image list and testing it for feedback. This meant that first, a list of images was made, and within the lists in that, we had a list of parameters for the image: filename, x offset, y offset, filter, alpha blend, background visibility (added later), and the pixmap file itself. Initially, each such index was given a value representing its index so that later, we could simply change the value of the parameters without having to change every instance of the parameter itself. I tested the function using the provided "testbuildcollage.py", which inputs a set of parameters and prints the values so we know that build collage is storing the correct data.
Task 5 was essentially the same, except this time, user input was required. The only difference was the images and their locations and the first item in the collage image list having the input filename be assigned to it. The program would require the name of a .ppm-format image, retrieved from the sys.argv list. The resulting image is shown below.
I also did extensions 2 and 5. For extension 2, I needed to make some kind of way for the program to tell if the background color was blue or green so it could remove it using the placePixmapNoBkg function. This required, first, a new index to be added to the lists, and also, the buildCollage function to be altered; if no background was requested and the green background variable was given (set if the swapRedBlue filter was not applied), then green would be taken out, and the same was done for blue, except it would mean that the red-blue switch filter was applied. In the placePixmapNoBkg function, I also simply swapped around the values of red and blue to change which color was to be specified as the background. The result is shown below: Image Added
For extension 5, I made it so however many images given in the command line would be assembled to make a collage according to a preset list with the coordinates, filters, and everything except for the image file. The code is displayed below; I mostly used if statements to achieve my goal.