Assignment 2: Image Modification

This assignment is intended to introduce you to how to work with pixel
data. We will provide you with the source code to a program which can
load and save targa images, and you will be expected to write a
function which modifies the image in some way.

The TargaImage class has member variables called
height, width, and data. The image data,
stored in the data member, is an array of unsigned characters,
with groups of four characters representing each pixel. Within those
four bytes, the first represents the red channel, the second green, the
third blue, and the fourth alpha. (The alpha channel contains information
about the transparency of a pixel, which is used in compositing. For now,
treat it just like you would red, green or blue.) So, to access the
blue channel of the 7th pixel, one might write:

Rows of image pixels are stored sequentially in the array, so to access
pixels in rows after the first, you must add 4 (bytes per pixel), times
the width of a row, times the row number you wish to access. To access
the green channel of the 33rd pixel on the 19th image row, one might
write:

When setting image data bytes, be sure to remember that unsigned
characters have a range of 0 to 255.

The TargaImage class also has a method called Modify
which you are to implement. It will be called by the GUI when the
"Modify Image" button is pressed, and is to make some change to the
image of your own design. You might resize (and resample) the image,
invert it, add a gradient to the image, rotate it, flip it, or do
anything else to it you can imagine (and figure out an algorithm for).

It would be a good idea to read over and understand all the code
provided to you in the project. Be sure to take note of how the GUI
buttons interact with the rest of the program.