Quote (Minkomonster @ Mar 18 2014 09:10pm)
I dont know what methods the Picture class or the Pixel class have. I took an educated guess with the getColor() method on the Pixel class and the setColor method on the Pixel class.
I will work with it, thanks. Would you be willing to help me with the second part of this assignment?
Part B:
Movies are essentially sequences of pictures that are typically displayed at 24 “frames” per second, each frame being a single picture. To create the effect of fading through a solid colour (fade out from one image and then fade in to another) as seen in videos and commercials, we would need to produce many more images and then play them in rapid succession, thus creating a video in which one image fades through a solid colour and then into the other. You will make use of the FrameSequencer and MoviePlayer classes provided with our textbook in order to create and display a movie. The FrameSequencer class has methods that will take a sequence of pictures and store them in a directory; the pictures can then be displayed in rapid succession, thereby creating a “movie”. The MoviePlayer class has methods to play back a sequence of pictures already created (e.g. by FrameSequencer).
Here is sample code to create a FrameSequencer object that will store the movie frames in the directory referenced by a String variable directoryName, created from an array of pictures referenced by a Picture[] variable pictureSequence: FrameSequencer frameSequencer = new FrameSequencer(directoryName); for (int i = 0; i < pictureSequence.length; i++) { frameSequencer.addFrame(pictureSequence[i]); }
Once a movie has been made with FrameSequencer, we can use the MoviePlayer class to show the movie.
The MoviePlayer class
A MoviePlayer object plays an existing movie. Here are the important details about this class:
• The constructor for a MoviePlayer object takes as a parameter a String that is the name of a directory containing the images to be displayed in the movie
• The playMovie() method opens a window in which it then displays the movie. If the playMovie() method is called without a parameter, it plays the movie at high speed. It can also accept an int parameter that specifies the number of frames to be displayed per second. So to play a movie, we create a MoviePlayer object and invoke the playMovie() method on it as we see in the code here: MoviePlayer movie = new MoviePlayer(directoryName); movie.playMovie();
Functional Specifications for Part B
1. You will create and play your movies in a Java program with the class name FadingMovie that will be saved in a file named FadingMovie.java. This class will consist primarily of a main method whose algorithm is given below.
2. The algorithmic specifications for the main method are:
• Get the starting picture and ending picture for the fading, using FileChooser to get the file names. If the starting picture and ending picture are not the same size, print an error message and do not proceed with the rest of the program. (Use the showInformation() method of the SimpleOutput class for your error message. )
• Get the number of intermediate stages for both fades from the user (using the SimpleInput class).
• Have a colour to fade through hard coded into your program using a constant.
• Input the name of the directory in which to store the movie (using the SimpleInput class). Note: that the directory name that you enter should end with a slash, for example Z:/Movie1/
• Create an array of Picture objects that will hold the sequence of pictures for the fading (Note: its length should include both the fade out of one image and the fade in of the other. There should only be ONE frame of solid colour in the “center” of the array)
• Store the starting and ending pictures in the array.
• Create intermediate pictures in the array, using loops and the fadeOut() and fadeIn() methods
from Part A. Each image must also be the same size as the start/end images.
• Create a movie from the array of pictures you have completed using a FrameSequencer object (see above).
• Play the movie using a MoviePlayer object and playMovie().
• Now create the second movie (which fades from the starting picture to the ending picture and back again to the starting picture). You can do this in either of two ways:
i. Add the “backwards” fading sequence to the same directory ( in which case you no longer will be able to play your first movie)
ii. Use a new directory for all the frames of the second movie. You would then input the directory name for this movie from the user.
• Play the second movie.
I will pay for your help, if that's any incentive.