Results 1 to 5 of 5
Thread: morphingMovie.java code---help
- 11-14-2012, 11:01 PM #1
Member
- Join Date
- Nov 2012
- Posts
- 2
- Rep Power
- 0
morphingMovie.java code---help
I'm writing a java assignment which is to make a movie of morphing pictures.
below is what I wrote,however, it didn't work out.
anybody could help me please?
Java Code:public class MorphingMovie { public static void main(String[] args) { //Get the starting picture and ending picture for the morphing String fileName1=FileChooser.pickAFile(); Picture startPicture=new Picture(fileName1); String fileName2=FileChooser.pickAFile(); Picture endPicture=new Picture(fileName2); /**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 */ if(!(startPicture.getWidth()==endPicture.getWidth()&&startPicture.getHeight()==endPicture.getHeight())) { SimpleOutput.showInformation("Error-The two pictures chosen are not in the same size, please choose two pictues in same size"); } else { //Input the number of intermediate stages for the morphing from the user int numStages=SimpleInput.getIntNumber("Enter integer number of intermediate stages to morph"); //Input the name of the directory in which to store the movie String directory=SimpleInput.getString("Enter the directory where to store the movie"); //Create an array of Picture objects that will hold the sequence of pictures for the morphing Picture[] pictureSequence=new Picture[numStages+2]; //Store the starting and ending pictures in the array. pictureSequence[0]=startPicture; pictureSequence[pictureSequence.length-1]=endPicture; //Create intermediate pictures in the array for(int k=1;k<pictureSequence.length-1;k++) { Picture intermediate=startPicture; intermediate.morphStage(startPicture,endPicture,numStages,k); pictureSequence[k]=intermediate; } //Create the first morphing movie FrameSequencer frameSequencer = new FrameSequencer(directory); for (int i = 0; i < pictureSequence.length; i++) { frameSequencer.addFrame(pictureSequence[i]); } //Play the movie MoviePlayer movie1=new MoviePlayer(directory); movie1.playMovie(numStages); } } }Last edited by quad64bit; 11-15-2012 at 07:45 PM.
- 11-14-2012, 11:04 PM #2
Re: morphingMovie.java code---help
Hello and welcome! Please use [code][/code] tags when posting code so we can easily read it!
Forum Rules
Guide For New Members
BB Code List - Java Programming Forum
- 11-14-2012, 11:04 PM #3
Re: morphingMovie.java code---help
P.S. You didn't tell us what the problem was!
- 11-14-2012, 11:07 PM #4
Member
- Join Date
- Nov 2012
- Posts
- 2
- Rep Power
- 0
Re: morphingMovie.java code---help
sorry i'm new here, don't know how to use tags; btw, the problem is the frame pictures are not pictureSequencer[k],but all startPicture.
- 11-15-2012, 07:49 PM #5
Re: morphingMovie.java code---help
Does morphStage() return something or is the return type void? If if returns something, then perhaps you just aren't saving it.
Also, Picture intermediate=startPicture;
If I understand this line, it means every single frame is morphed from the starting frame rather than the frame before? Wouldn't you start with the start frame, but then work from startFrame+1 and so on? No idea how that method works.
Similar Threads
-
I want the source code of DUK's Bank , the example code in Java EE 5 Tutorial 2010
By zahra in forum New To JavaReplies: 16Last Post: 01-31-2012, 08:36 PM -
Translate Vb.net code into Java code
By Radu in forum New To JavaReplies: 5Last Post: 04-12-2011, 09:27 AM -
C server code - Java CLient Code _ TCP Connection Problem
By rmd22 in forum NetworkingReplies: 0Last Post: 02-21-2011, 11:50 AM -
Convert java code to midlet code
By coldvoice05 in forum New To JavaReplies: 1Last Post: 08-12-2009, 11:14 AM -
Convert java code to midlet code
By coldvoice05 in forum Advanced JavaReplies: 1Last Post: 08-09-2009, 01:21 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks