CSC 161 Grinnell College Spring, 2015 Imperative Problem Solving and Data Structures

# CSC 161 Module on Grouping Data and Image Processing with the Scribbler 2

## Summary and Main Topics

This module introduces the customizable nature of self-written programs by using structs and 2-dimensional arrays, particularly emphasizing their uses with Myro Pictures.

1. Structs
2. Two Dimensional Arrays
3. Pixels
4. Pictures
5. Insertion Sort

## Day-by-day Details

Day Topic Preparation In-class Due Date Availability
for
Extra
Credit
Tuesday, March 10 Grouping Data: Introduction Examples
• King, Sections 16.1-16.2
• K&R 6.1 - 6.2, 6.7
lab exercise
Wednesday, March 11 Grouping Data: Structs Examples
• King, Sections 16.1-16.2
• K&R 6.1 - 6.2, 6.7
• Examples for this lab
lab exercise
Friday, March 13 Grouping Data: 2-dimensional arrays
lab exercise
Spring Break
Monday, March 30 Transforming an Image lab exercise   Monday, April 13
Tuesday, March 31 Insertion Sort lab exercise
Wednesday, April 1 Module Project   project Tuesday, April 7
Friday, April 3 Supplemental Problem 3   Supplemental Problem 3 (done individually) Friday, April 3

## Project: Picture Suite

For this project, you will write the following series of functions which modify a picture. For each function, the address of a picture is passed as a parameter, so the picture passed into the function (e.g., from main) will be changed.

• ### void pixelStrip (Picture * pic, char color)

This function should set the R, G, or B value of every pixel in the picture to 0 (depending on what char color is).
For example if parameter color is 'G', then this procedure should change the 'G' component of each pixel in the picture to 0; the 'R' and 'B' components would remain unchanged.

• ### void pictureRedder (Picture * pic)void pictureGreener (Picture * pic)void pictureBluer (Picture * pic)

These functions should increase the intensity of their respective colors (red, green, or blue). This increase should never go past 255. The color should increase less when it is already high than when it is low.

• ### void circleSelect (Picture * pic, int xCenter, int yCenter, int radius)

This function should select a circle from your picture and turn each pixel within that circle to the corresponding grayscale value.

• ### a creative function of your choosing

This function should do something interesting and creative to your picture. It should not just be a rehashing of a previous exercise or lab, and there should be a good amount of thought and effort placed into this function.

When turning in your project, be sure to include include tests and examples of pictures from each picture.