mp_stickers

Shocking Stickers

Due: Feb 07, 23:59 PM

Setting Up For CS 225

Before you can begin working on assignments, you will need to set up your git repository, your code base you will use to receive mps and labs/submit them for grading.

Setup Your Git Repository

Checking Out the Code

From your CS 225 git directory, run the following on EWS:

git fetch release
git merge release/mp_stickers -m "Merging initial mp_stickers files"

If you’re on your own machine, you may need to run:

git fetch release
git merge --allow-unrelated-histories release/mp_stickers -m "Merging initial mp_stickers files"

Upon a successful merge, your mp_stickers files are now in your mp_stickers directory.

If you are working on an EWS machine…

Everytime you open a new terminal or ssh session to EWS, you will need to run the following:

module load llvm/6.0.1

If you want to save some hassles of running the above command frequently, you can write it in your .bashrc file. All commands in the .bashrc file will be automatically loaded after opening a new termial. The command below helps you write the “module load llvm/6.0.1” into your .bashrc file in your home directory.

echo 'module load llvm/6.0.1' >> ~/.bashrc

or setup your computer locally

Part 1 (Curated): The Image Class

An Image object is a subclass of the PNG class. This means it inherits all the member functions of the PNG class; so anything you could do with a PNG, you can also do with an Image.

After creating the Image class, implement the methods of the Image class:

Testing

When you’ve finished this part, you can make and run Part 1 by running:

make testimage
./testimage

If execution goes smoothly, images named lighten.png, saturate.png, and scale2x.png will be created in your working directory.

  • The files expected-lighten.png and expected-saturate.png are provided and can be diffed with your output.
  • The file expected-scale2x.png is somewhat misnamed, as there are many correct solutions when you scale an image. It is not necessary to have it diff to the same image. So long as your scaling algorithm creates a reasonable scale of the original image, our autograder will see it as a reasonable scaling of the image. You can verify this by running the automated tests on Part 1.

Automated Testing

To test your code using Catch, run the following:

make test
./test

Part 2 (Curated): The StickerSheet Class

Let’s add stickers on top of an image!

Your goal in this part of the MP is to make a StickerSheet composed of a collection of Images. To do so, you will create a class StickerSheet that will maintain an array of pointers to Image objects. Each Image in the StickerSheet will have an index, an -coordinate, and a -coordinate. The member functions described below will support creating, modifying, and drawing the collection of Image stickers in the StickerSheet.

To implement the StickerSheet class, you will write a header file that contains a declaration of the StickerSheet class (StickerSheet.h) and a source file that contains the implementation of the StickerSheet class (StickerSheet.cpp).

There are two considerations that you should keep in mind while working on the StickerSheet class. Unless you are told otherwise you are welcome to use anything in the STL or Standard Template Library. This is the standard library for the C++ language.

The second consideration is that our assignments are quite specific about what you are required to do. In this case you should consider very carfully what you are actually being asked to store. For example if you carefuly read the specification you will see that in the description of the StickerSheet class we specify that you store a pointer to an Image not an Image. Taking advantage of this specification should greatly simplify your implementation.

To see all the required functions, check out the Doxygen:

Part 3 (Creative): Create an image with stickers!

For the last part of this MP, in the main function in main.cpp create a StickerSheet that contains an image and at least three stickers. Before exiting main, save your creation to disk as myImage.png.

We’ll take a look at your photo filled of stickers! Keep it clean and something you’re okay being shared with the class so we can show the best ones off to the whole class! :)

To generate your creative StickerSheet, you can use the following commands.

make
./stickers

Testing

When you’ve finished Part 2 and Part 3, you can make the full MP by running:

make test
./test

Handing in your code

You must submit your work to git for grading. We will use the following files for grading:

  • Image.cpp
  • Image.h
  • StickerSheet.cpp
  • StickerSheet.h
  • main.cpp
  • myImage.png

All other flies (and files) will be ignored in grading.