Flip and Scroll

Vertical Flip Filter: 5 points
Horizontal Scroll Filter: 6 points


Now, you will implement two slightly more complicated filters. Again, begin by making a copy of the image. Both of these functions require you to refer to the original picture’s values as you make the appropriate changes to your copy.

Vertical Flip Filter

This filter is the vertical flip filter you designed in the warmup, meaning that you can use an import warmupgram statement at the top of your file and call the function with dot notation.

Vertical Flip Filter

Reminder

Once your filter is complete, don’t forget to commit and push your changes!

Horizontal Scroll Filter

The horizontal scroll filter should ask the user to specify some number of pixels, and should then shift the image that many pixels to the right. Pixels that would fall off the edge of the image should wrap around to the other side. For example, if our picture is 400 by 400 pixels and the user asks to scroll by 20 pixels, then a pixel that was at (0,0) will now be at (20, 0) and a pixel that was at (390, 0) will now be at (10, 0). Modular arithmetic % may come in handy here.

ReadMe

To recieve full credit for this function, you will need to handle the case where a user inputs a value to scroll that is larger than the width of the canvas. So if our picture is 400 pixels wide, and the user asks us to scroll by 600 pixels, the pixel that was at (0,0) would now be at (200,0).

Horizontal Scroll Filter

Running and Testing Your Filters

Once you’ve implemented a function, update your placeholder for it in the looping menu. Make sure to test it both on its own and in combination with other filters!

Reminder

Once this is working don’t forget to commit and push your changes before moving on.