Create a movie that has the frames slowly becoming sepia-toned. The following is in the Picture class in the directory bookClassesFinal.
What will be an ideal response?
```
/? ?
? Modify t h e c u r r e n t p i c t u r e b a s e d on t h e d i s t a n c e t o t h e
? f i n a l p i c t u r e , t h e c u r r e n t i n d e x , and t h e t o t a l d i s t a n c e
? @param f i n a l P i c t t h e d e s i r e d f i n a l p i c t u r e
? @param i n d e x t h e c u r r e n t i n d e x
? @param d i s t t h e t o t a l d i s t a n c e t o t h e f i n a l p i c t u r e
?/
public void modifyTowards ( P i c t u r e f i n a l P i c t , in t index , double d i s t )
{
Pixel [ ] pixelArray = this . g e t P i x e l s ( ) ;
Pixel [ ] finalPixelArray = finalPict . getPixels ( ) ;
P i x e l c u r r P i x e l = null ;
P i x e l f i n a l P i x e l = null ;
double r e d D i s t , b l u e D i s t , g r e e n D i s t ;
C o l o r p i c t C o l o r = null ;
// l o o p t h r o u g h t h e a r r a y o f p i x e l s
f o r ( i n t i = 0 ; i < p i x e l A r r a y . l e n g t h ; i ++)
{
currPixel = pixelArray [ i ] ;
finalPixel = finalPixelArray [ i ] ;
r e d D i s t = f i n a l P i x e l . getRed ( ) ? c u r r P i x e l . getRed ( ) ;
blueDist = f i n a l P i x e l . getBlue () ? currPixel . getBlue ( ) ;
g r e e n D i s t = f i n a l P i x e l . getGreen ( ) ? c u r r P i x e l . getGreen ( ) ;
p i c t C o l o r = new C o l o r ( ( in t ) ( i n d e x / d i s t ? r e d D i s t + c u r r P i x e l . getRed ( ) ) ,
( in t ) ( i n d e x / d i s t ? g r e e n D i s t + c u r r P i x e l . getGreen ( ) ) ,
( in t ) ( i n d e x / d i s t ? b l u e D i s t + c u r r P i x e l . g e t B l u e ( ) ) ) ;
currPixel . setColor ( pictColor ) ;
}
}
```
The following is from the MovieMaker class in the directory bookClassesFinal.
```
/? ?
? Method t o c r e a t e a s e p i a ?t o n e d movie
? @param p t h e p i c t u r e t o u s e i n t h e movie
? @param d i r e c t o r y t h e d i r e c t o r y t o s t o r e t h e frame s i n
?/
public void makeSepiaMovie ( P i c t u r e p , S t r i n g d i r e c t o r y )
{
// make a copy o f t h e p i c t u r e
P i c t u r e c o p y P i c t = null ;
P i c t u r e o r i g P i c t = new P i c t u r e ( p ) ;
// make a s e p i a ?t o n e d p i c t u r e
p . sepiaTint ( ) ;
// d e c l a r e o t h e r v a r i a b l e s
FrameSequencer f r a m e S e q u e n c e r =
new FrameSequencer ( d i r e c t o r y ) ;
int framesPerSec = 3 0 ;
// l o o p c r e a t i n g t h e frames
f o r ( i n t i = 0 ; i < f r a m e s P e r S e c ; i ++)
{
c o p y P i c t = new P i c t u r e ( o r i g P i c t ) ;
c o p y P i c t . modifyTowards ( p , i , f r a m e s P e r S e c ) ;
f r a m e S e q u e n c e r . addFrame ( c o p y P i c t ) ;
}
// p l a y t h e movie
frameSequencer . play ( framesPerSec ) ;
}
```
You might also like to view...
The IP address 192.168.1 .2 is a class C address
Indicate whether the statement is true or false
The Whois tools help to determine who, where, and when a domain or site was registered—and the information about those who support it now.
a. true b. false