CSC 220 - Object-Oriented Multimedia Programming, Fall 2022, Assignment 5.

Assignment 5 due by 11:59 PM on Thursday December 15 via D2L Assignment 5.

1. To get the assignment:

Go to course page and download and unzip zip file of the starting code.

You have very little coding to do. This is mostly practicing and the recording your performance of an improvised visual instrument.

There is some coding.

We will go over a demo of recording and playing back a performance on November 29. I will post the Zoom video.

2. Practicing

Unzip the handout code into your sketch directory. This sketch stores multiple PImages into memory at one time. You probably need to increase Processing available memory in its Preferences window.

Pref
          memory

My Processing is up to 8 Gigabytes, although you shouldn't need to go that high. Check the "Increase maximum available memory" box and at least double it to 512 MB. Make it bigger on a computer with more memory. If you get "out of memory" error messages, try making it bigger.

Practice according to my demo video of November 29.

3. Remove my photos and add yours (20%)

You must remove any image files in my handout and supply your own, at least one of which must be your portrait.

(Note added 11/29: I am not entirely satisfied with my photo selection and will change it. For example, PImage.blend() in ADD mode did not wash out composite images when using earlier geometric shapes, but my current photos do. To avoid problems with PImage.blend() light and dark options, try to have consecutive images that do not share light or dark regions in most of the same areas. Also, I want to do something different than "nature photos", something more geometric and new.)

After placing your PImage files into this sketch's directory, edit handout file CSC220Fall2022PaintingAssn5.txt with the names of your files, one per line. Make sure to remove my lines. Test with your photos. You can give the 1 command to the running sketch to advance through the photos. All commands must be terminated by hitting the Enter key. Here are the commands from the code comments.

/*  KEYBOARD COMMANDS
  All require a trailing \n to trigger interpretation:
 
  +MUTATOR for replacing a MUTATOR from set below to be the sole mutator
    of the worker-thread mutator queue. See MUTATOR commands below.
  - for removing any MUTATORs from the worker-thread queue.
 
  rANGLE rotate the previous canvas snapshot ANGLE degrees as the background
  sSCALE scale the previous canvas snapshot SCALE amount as the background
  RANGLE rotate the foreground image a fixed ANGLE in degrees
  SSCALE scale the foreground image a fixed SCALE
  Xpixels Move horizontally pixels per draw(), positive or negative
  Ypixels Move vertically pixels per draw(), positive or negative
  e[LOWER[,UPPER]] set loadImage etch threshold between LOWER and UPPER inclusive,
    when UPPER not given it is 0 trhough LOWER, when neither shut it off, i.e., both -1.
  f toggle foreground image painting
  b toggle background image painting
  F toggle drawForeground() foreground call
  B toggle drawBackground() background call
  c toggle clipping circle
  C toggle clipping square

  p toggles painting on/off, i.e., no background command in draw() when on
  e toggles echo on/off, i.e., take snapshot at end of draw() when on, display at start of draw()
  x toggles reflect on/off anything painted around the x axis (reflect via scale(1,-1)).
  y toggles reflect on/off anything painted around the y axis (reflect via scale(-1,1)).
  z toggles reflect x and y on/off, on reflects anything painted around the x and y axes
 
  0 resets translations, rotates, scales to their default values, eliminates mutation(s) in effect
  - eliminates mutation(s) in effect
  1 or 2 or ... Decimal String advances the imageQueue reading this many positions % imageLimit
  QQQ quits the program after flushing any pending key capture recording output
 
  MUTATORS:            IGNORE INT and FLOAT in these commands. To be implemented later.
                       For now they use default initialization values set in their constructors.
 
  +bINT                filter(BLUR,INT), TAKES 1 NUMERIC ARGUMENT FOR BLUR FILTER
  +fINT,FLOAT          fade [0, 255] = [transparent, opaque], TAKES 2 ARGS for int opacity & float opacityDecayRate
  +eFLOAT              etch with probability range [0.0, 1.0], TAKES 1 NUMERIC ARGUMENT FOR PROBABILITY OF ETCH
  +nFLOAT              nest with scale range (0.0, 1.0), TAKES 1 NUMERIC ARGUMENT FOR SCALE-DOWN OF AMOUNT
  +m                   mask image 0 with image 1
  +s                   blend SCREEN image 0 with image 1
  +tFLOAT              threshold etcher with initial threshold set to FLOAT
  +c                   etch in and out from an outer circle
  +q                   etch in and out from an outer square
  +s1                  Posterize Mutator
  +s2                  Erode Mutator
  +s3                  Dilate Mutator
  +s4                  Invisible Mutator hides foreground PImage
  -                    eliminates mutation(s) in effect
*/


Test to make sure your PImages display correctly by repeatedly hitting the 1 key followed by Enter.

4. Coding (20%)

Rewrite the drawBackground() and drawForeground() functions to display more interesting graphics that work well with the e (echo) and s (scale echoed image) commands. You can test by running b to toggle the background photo not to display, then f to toggle the foreground PImage not to display, then both B and F to enable drawBackground() and drawForegound() respectively.

Fill in the comment block at the top of the main tab, making sure to answer this question:

/* Permission to share in Rohrbach Library and YouTube (YES or NO):

You are under no obligation to include your work in the video. I exhibit video artwork, but some pieces are just learning experiences. This is your decision & does not affect your grade.

Make sure to change this line in the code to use your name.

final String CREDIT = "Dr. Dale Parson, CSC220, Fall 2022";

Do not make other changes to functions. That may break the next step.

5. I will grant ten bonus points for anyone who re-implements the call() function of class InvisibleMutator in the Mutators tab to do something totally new to the sketch.

Right now it just makes the foreground image transparent, duplicating command f functionality. There are examples of using PImage.filter() and PImage.blend() in other mutators in that tab. You could do something new with one of those or come up with something completely new. You can test it by running +s4 followed by Enter. Do not change the name of the class. Add a comment at the top of the main tab letting me know if you go for the bonus points.

6. Recording and playing back your performance (60%)

After practicing the sketch performance, change this line of code:

final String KeyRecordingFile = null; // "Assn5KeyRecording.txt" ; // Make null to skip recording/playback

to this:

final String KeyRecordingFile = "Assn5KeyRecording.txt" ; // Make null to skip recording/playback

Running the sketch now will record all keystrokes into that file. A subsequent run without changing the name of the file or removing the file results in this error message:

ERROR, PLEASE REMOVE OR RENAME KEYPRESSED RECORDING FILE Assn5KeyRecording.txt BEFORE RECORDING.

There are a bunch of cryptic Processing error messages following this line, all in red. Scroll up to see it.

Terminate a sketch being recorded by typing the command QQQ (for quit) followed by Enter. This flushes keystroke output. You can just remove the recording file, or rename it to keep it, if you want to make multiple recordings. Make sure variable KeyRecordingFile  is set to the name of the file you want me to use to play back your favorite performance.

Once you are comfortable with the keyboard commands, change this line:

boolean IS_PRINTING_COMMAND = true ;

to this:

boolean IS_PRINTING_COMMAND = false;

To play back after recording a keystroke file, change this line of code:

boolean isRecording = true ;

to this:

boolean isRecording = false ;

7. Turning it in

Turn in all files in the sketch directory including the code TAB .pde files, the image files, CSC220Fall2022PaintingAssn5.txt with the names of your files, and your keystroke recording file with variable KeyRecordingFile set top its name and isRecording set to false so I can play back your performance. I will merge 30 to 60 seconds of your recording into the final video, depending on RaspberryPi memory constraints. Let me know if you have a favorite part to include by putting that into the comments at the top of the sketch.

The final exam periods of Tuesday 12/13 at 8 AM for the noon class and Thursday 12/15 at 8 AM for the 1:30 class will be work sessions with Q&A, in person or on Zoom as usual. You are welcome to attend both.

There is the usual 10% per day late charge and I cannot accept anything turned in after Saturday night, since I need to complete most grading on Sunday.