Assignment 07 Nested looping control structures

Original price was: $35.00.Current price is: $30.00.

Rate this product

COMP 1405 A/B/C − “Introduction to Computer Science I”
Specification for Assignment 07
To further practice with nested looping control structures, for this assignment you will design and
implement a program that performs a very elementary photomanipulation.
In order to complete this task, you will need to:
• read about pygame’s “image.load”
1, “mouse.get_pressed”, and “mouse.get_pos” functions2
• read about the pygame Surface methods “get_size”, “blit”, “get_at”, and “set_at”
• choose whether you would like to implement a simple “negation” effect (below left)…
…or if you would prefer something more impressive, like “blur”, “sharpen”, or “edge detect”4
Your submission for this assignment:
• must be a source code file with filename ‘’
• must initialize pygame, load an image, and use get_size to find the loaded image’s dimensions
• must create a window that is the correct size and then “blit” the loaded image
• must use the loop (below right)to repeatedly get input, apply the effect, and update the display
• must permit the user to use the mouse to specify a region of the image (i.e., by clicking)
• must use nested loops, “get_at”, and “set_at” to apply an effect to the region the user selected
the difference between the maximum
colour component value (i.e., 255) and
the red, green, and blue component
values of a colour, can be used to get the
the negated (or inverted) colour
(200, 100, 50)
(55, 155, 205)
exit_flag = False
while not exit_flag:
# loop body goes here
for e in pygame.event.get():
if e.type == pygame.QUIT:
exit_flag = True
1 At the time of creating this document, this function is detailed at
2 At the time of creating this document, these functions are detailed at
3 At the time of creating this document, these methods are detailed at
4 More complex effects can be accomplished using “kernels”:


There are no reviews yet.

Be the first to review “Assignment 07 Nested looping control structures”

Your email address will not be published. Required fields are marked *

Scroll to Top