Computer Graphic Lab Program Ms Word

85
LIST OF CONTENTS PROGRAMS S.NO PROGRAMS 1. Line Drawing Algorithms 1.1 DDA Line Drawing Algorithm 1.2 Bresenham's Line Drawing Algorithm 2.1 Mid Point Circle Drawing Algorithm 3. 2D Transformations 3.1 Rotation in 2D Line Rectangle Triangle 3.2 Translation in 2D Line Rectangle Triangle 3.3 Scaling in 2D Line Rectangle Triangle 4. Clipping Algorithms 4.1 Cohen Sutherland Line Clipping Algorithm 5. 3D Transformations 5.1 3D Projection Parallel

Transcript of Computer Graphic Lab Program Ms Word

Page 1: Computer Graphic Lab Program Ms Word

LIST OF CONTENTS

PROGRAMS

S.NO PROGRAMS1. Line Drawing Algorithms1.1 DDA Line Drawing Algorithm

1.2 Bresenham's Line Drawing Algorithm

2.1 Mid Point Circle Drawing Algorithm

3. 2D Transformations3.1 Rotation in 2D

Line Rectangle Triangle

3.2 Translation in 2D Line Rectangle Triangle

3.3 Scaling in 2D Line Rectangle Triangle

4. Clipping Algorithms4.1 Cohen Sutherland Line Clipping Algorithm

5. 3D Transformations

5.13D Projection

Parallel Perspective

Page 2: Computer Graphic Lab Program Ms Word

SOFTWARES

S.NO. DESCRIPTION

1. Introduction to Macromedia Flash

2. Maya

Page 3: Computer Graphic Lab Program Ms Word

// DDA Line Drawing Algorithm

# include <stdio.h># include <graphics.h># include <math.h>

void main(){ int gmode , gdrive = DETECT , errorcode , i ; float x1 , x2 , y1 , y2 , dy , dx ; float x , y , xinc , yinc , l ; initgraph ( &gdrive , &gmode ,"C:\\TC\\BGI" ) ; printf ( "DDA Line Drawing Algorithm \n" ) ; printf ( "Enter x1 : " ) ;

scanf ( "%f" , &x1 ) ; printf ( "Enter y1 : " ) ;

scanf ( "%f" , &y1 ) ; printf ( "Enter x2 : " );

scanf ( "%f" , &x2 ) ; printf ( "Enter y2 : " );

scanf ( "%f" , &y2 ) ; dy = y2 - y1 ; dx = x2 - x1 ;

if ( abs ( dy ) >= abs ( dx ) )l = abs ( dy ) ;

elsel = abs ( dx ) ;

xinc = dx / l ; yinc = dy / l ; x = x1 ; y = y1 ; for( i = 1 ; i < l ; i++ ) {

x = x + xinc ;y = y + yinc ;putpixel ( x , y , 6 ) ;

} getch ( ) ; closegraph ( ) ;}

Page 4: Computer Graphic Lab Program Ms Word

Output :

                                                                     DDA Line Drawing Algorithm

Enter x1 : 100Enter y1 : 100Enter x2 : 200Enter y2 : 200

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Page 5: Computer Graphic Lab Program Ms Word

// Bresenham Line Drawing Algorithm

# include <stdio.h># include <graphics.h># include <math.h>

void main(){ int gmode , gdrive = DETECT ; float x1 , x2 , y1 , y2 , dx , dy , temp , p ; float x , y , xend , yend ;

initgraph ( &gdrive , &gmode ,"C:\\TC\\BGI" ) ;

printf ( "Bresenham's Line Drawing Algorithm\n\n" ) ;

printf ( "Enter x1 : " ) ;scanf ( "%f" , &x1 ) ;

printf ( "Enter y1 : " ) ;scanf ( "%f" , &y1 ) ;

printf ( "Enter x2 : " ) ;scanf ( "%f" , &x2 ) ;

printf ( "Enter y2 : " ) ;scanf ( "%f" , &y2 ) ;

dx = abs ( x2 - x1 ) ; dy = abs ( y2 - y1 ) ;

if( dy > dx ) {

temp = dy ; dy = dx ; dx = temp ;

}

p = dx - ( 2 * dy ) ;

if ( x1 < x2 ) {

x = x1 ; y = y1 ; xend = x2 ;

}

else {

x = x2 ; y = y2 ; xend = x1 ;

}

while( x < xend )

Page 6: Computer Graphic Lab Program Ms Word

{ x++ ; if( p < 0 ) { p = p + 2 * dx - 2 * dy ; y++; }

else { p = p - 2 * dy ; putpixel ( ceil ( x ) , ceil ( y ) , 5 ) ;

} } getch ( ) ;}

Output :

                                                                     Bresenham’s Line Drawing Algorithm

Enter x1 : 100Enter y1 : 100Enter x2 : 200Enter y2 : 200

                                                                                                                                                                           

Page 7: Computer Graphic Lab Program Ms Word

// Bresenham Integer Line Drawing Algorithm

# include <stdio.h># include <graphics.h># include <math.h>

void main(){ int gmode , gdrive = DETECT ; int x1 = 0 , x2 = 0 , y1 = 0 , y2 = 0 , dx = 0 , dy = 0 , i = 0 ; float e = 0 , x = 0 , y = 0 ;

initgraph ( &gdrive , &gmode ,"C:\\TC\\bgi" ) ;

printf ( "Bresenham's Integer Line Drawing Algorithm\n\n" ) ;

printf ( "Enter x1 : " ) ;scanf ( "%d" , &x1 ) ;

printf ( "Enter y1 : " ) ;scanf ( "%d" , &y1 ) ;

printf ( "Enter x2 : " ) ;scanf ( "%d" , &x2 ) ;

printf ( "Enter y2 : " ) ;scanf ( "%ds" , &y2 ) ;

x = x1 ; y = y1 ; dx = x2 - x1 ; dy = y2 - y1 ; e = ( 2 * dy ) - dx ;

do {

putpixel ( x , y , 7 ) ;

while ( e > 0 ) { y = y + 1 ; e = e - ( 2 * dx ) ; } x = x + 1 ; e = e + ( 2 * dy ) ; i = i + 1 ;

} while ( i != dx ) ; getch ( ) ; closegraph ( ) ;}

Page 8: Computer Graphic Lab Program Ms Word

Output :

                                                                     Bresenham’s Integer Line Drawing Algorithm

Enter x1 : 100Enter y1 : 100Enter x2 : 200Enter y2 : 200

                                                                                                                                                                           

Page 9: Computer Graphic Lab Program Ms Word

// Midpoint Circle Generating Algorithm

#include<stdio.h>#include<graphics.h>#include<math.h>

void main(){ int gmode,gdrive=DETECT; int p , x , y , r ; int xcenter = 0 , ycenter = 0 ;

initgraph ( &gdrive , &gmode ,"C:\\TC\\bgi" ) ;

printf ( "Midpoint Circle Drawing Algorithm \n\n" ) ; printf("Enter the radius : ");

scanf ( "%d" , &r ) ; printf("Enter Center coordinates : ");

scanf ( "%d %d" , &xcenter , &ycenter ) ;

x = 0 ; y = r ; p = 1 - r ;

while ( x < y ) {

if ( p < 0 ) { x = x + 1 ; p = p + 2 * x + 1 ; }

else { x = x + 1 ; y = y - 1 ; p = p + 2 * ( x - y ) + 1 ; }

putpixel ( xcenter + x , ycenter + y ,6 ) ;putpixel ( xcenter - x , ycenter + y ,6 ) ;putpixel ( xcenter + x , ycenter - y ,6 ) ;putpixel ( xcenter - x , ycenter - y ,6 ) ;putpixel ( xcenter + y , ycenter + x ,6 ) ;putpixel ( xcenter - y , ycenter + x ,6 ) ;putpixel ( xcenter + y , ycenter - x ,6 ) ;putpixel ( xcenter - y , ycenter - x ,6 ) ;

} getch();}

Page 10: Computer Graphic Lab Program Ms Word

Output :

                                                                     Midpoint Circle Drawing Algorithm

Enter radius : 50

Enter Center coordinates : 200 200

                                                                                                                                                                           

Page 11: Computer Graphic Lab Program Ms Word

// Rotation of 2D

#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>#include <math.h>

float x1 , y1 , x2 , y2 , x3 , y3 , a ;int ch ;

void main ( ){ int gdriver = DETECT, gmode, errorcode; clrscr ( ) ; do { closegraph ( ) ; gotoxy ( 10 , 2 ) ; printf ( "Rotation of 2D\n" ) ; printf ( "\n1.Rotaton of line " ) ; printf ( "\n2.Rotaton of rectangle " ) ; printf ( "\n3.Rotation of Triangle " ) ; printf ( "\n4.Exit" ) ; printf ( "\n\nEnter your choice : " ) ;

scanf ( "%d" , &ch ) ;

initgraph ( &gdriver , &gmode , "C:\\TC\\BGI" ) ;

switch ( ch ) { case 1 : printf ( "Enter value of Line Coordinates \n\n" ) ;

printf ( "Enter x1 : " ) ;scanf ( "%f" , &x1 ) ;

printf ( "Enter y1 : " ) ;scanf ( "%f" , &y1 ) ;

printf ( "Enter x2 : " ) ;scanf ( "%f" , &x2 ) ;

printf ( "Enter y2 : " ) ;scanf ( "%f" , &y2 ) ;

printf ( "\n\nEnter angle of rotation : " ) ;scanf ( "%f" , &a ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

line ( x1 , y1 , x2 , y2 ) ; a = a * ( 3.14 / 180 ) ; x1 = ( x1 * cos ( a ) ) - ( y1 * sin ( a ) ) ; y1 = ( x1 * sin ( a ) ) + ( y1 * cos ( a ) ) ; x2 = ( x2 * cos ( a ) ) - ( y2 * sin ( a ) ) ;

Page 12: Computer Graphic Lab Program Ms Word

y2 = ( x2 * sin ( a ) ) + ( y2 * cos ( a ) ) ;

printf ( "Press any key to rotate .... " ) ;getch ( ) ;

setcolor ( 5 ) ; line ( x1 , y1 , x2 , y2 ) ; getch ( ) ; break ;

case 2 : printf ( "Enter value of Rectangle Coordinates \n\n" ) ; printf ( "\n\nEnter Top Left Coordinates \n" ) ; printf ( "Enter x1 : " ) ;

scanf ( "%f" , &x1 ) ; printf ( "Enter y1 : " ) ;

scanf ( "%f" , &y1 ) ;

printf ( "\n\nEnter Bottom Right Coordinates \n" ) ; printf ( "Enter x2 : " ) ;

scanf ( "%f" , &x2 ) ; printf ( "Enter y2 : " ) ;

scanf ( "%f" , &y2 ) ;

printf ( "\n\nEnter angle of rotation : " ) ;scanf ( "%f" , &a ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

rectangle ( x1 , y1 , x2 , y2 ) ;

a = ( a * 3.14 ) / 180 ; x1 = ( x1 * cos ( a ) ) - ( y1 * sin ( a ) ) ; y1 = ( x1 * sin ( a ) ) + ( y1 * cos ( a ) ) ; x2 = ( x2 * cos ( a ) ) - ( y2 * sin ( a ) ) ; y2 = ( x2 * sin ( a ) ) + ( y2 * cos ( a ) ) ;

printf ( "Press any key to rotate .... " ) ;getch ( ) ;

setcolor ( 5 ) ; rectangle ( x1 , y1 , x2 , y2 ) ; getch ( ) ; break ;

case 3 : printf ( "Enter value of Trinagle Coordinates \n\n" ) ; printf ( "\nEnter Coordinates of a side \n" ) ; printf ( "Enter x1 : " ) ;

scanf ( "%f" , &x1 ) ; printf ( "Enter y1 : " ) ;

scanf ( "%f" , &y1 ) ; printf ( "\nEnter x2 : " ) ;

scanf ( "%f" , &x2 ) ;

Page 13: Computer Graphic Lab Program Ms Word

printf ( "Enter y2 : " ) ;scanf ( "%f" , &y2 ) ;

printf ( "\n\nEnter Coordinates for third vertex \n" ) ; printf ( "Enter x3 : " ) ;

scanf ( "%f" , &x3 ) ; printf ( "Enter y3 : " ) ;

scanf ( "%f" , &y3 ) ;

printf ( "\n\nEnter angle of rotation : " ) ;scanf ( "%f" , &a ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

line ( x1 , y1 , x2 , y2 ) ; moveto ( x2 , y2 ) ; lineto ( x3 , y3 ) ; moveto ( x3 , y3 ) ; lineto ( x1 , y1 ) ;

a = a * ( 3.14 / 180 ) ; x1 = ( x1 * cos ( a ) ) - ( y1 * sin ( a ) ) ; y1 = ( x1 * sin ( a ) ) + ( y1 * cos ( a ) ) ; x2 = ( x2 * cos ( a ) ) - ( y2 * sin ( a ) ) ; y2 = ( x2 * sin ( a ) ) + ( y2 * cos ( a ) ) ; x3 = ( x3 * cos ( a ) ) - ( y3 * sin ( a ) ) ; y3 = ( x3 * sin ( a ) ) + ( y3 * cos ( a ) ) ;

printf ( "Press any key to rotate .... " ) ;getch ( ) ;

setcolor ( 5 ) ; moveto ( x1 , y1 ) ; lineto ( x2 , y2 ) ; moveto ( x2 , y2 ) ; lineto ( x3 , y3 ) ; moveto ( x3 , y3 ) ; lineto ( x1 , y1 ) ; getch ( ) ; break ;

case 4 : closegraph ( ) ; exit ( 1 ) ;

default : printf ( "\n\nWrong choice " ) ; break ;

} } while ( ch != 4 ) ;

getch ( ) ; closegraph ( ) ; }

Page 14: Computer Graphic Lab Program Ms Word

Output:

Rotation of 2D

1. Rotation of Line2. Rotation of Rectangle3. Rotation of Triangle 

Enter your choice : 1

Enter value of Line coordinates

Enter x1 : 50Enter y1 : 50Enter x2 : 200Enter y2 : 200

        Enter angle of rotation : 40

Press any key to rotate . . .                                               

Page 15: Computer Graphic Lab Program Ms Word

// Translation of 2D

#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>#include <math.h>

int x1 , y1 , x2 , y2 , x3 , y3 , ch , x , y ;

void main( ){ int gdriver = DETECT, gmode, errorcode; clrscr ( ) ; do { closegraph ( ) ; gotoxy ( 25 , 2 ) ; printf ( "Translation of 2D\n\n\n" ) ; printf ( "\n1.Translation of Line " ) ; printf ( "\n2.Translation of Rectangle " ) ; printf ( "\n3.Translation of Triangle " ) ; printf ( "\n4.Exit" ) ; printf ( "\n\nEnter your choice : " ) ;

scanf ( "%d" , &ch ) ;

initgraph ( &gdriver , &gmode , "C:\\TC\\BGI" ) ; cleardevice ( ) ;

switch ( ch ) { case 1 : printf ( "Enter value of Line Coordinates \n\n" ) ;

printf ( "Enter x1 : " ) ;scanf ( "%d" , &x1 ) ;

printf ( "Enter y1 : " ) ;scanf ( "%d" , &y1 ) ;

printf ( "Enter x2 : " ) ;scanf ( "%d" , &x2 ) ;

printf ( "Enter y2 : " ) ;scanf ( "%d" , &y2 ) ;

printf ( "\n\nEnter translation factor for X - Axis : " ) ;scanf ( "%d" , &x ) ;

printf ( "Enter translation factor for Y - Axis : " ) ;scanf ( "%d" , &y ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

line ( x1 , y1 , x2 , y2 ) ;

printf ( "Press any key to translate .... " ) ;

Page 16: Computer Graphic Lab Program Ms Word

getch ( ) ;

setcolor ( 5 ) ; line ( x1 + x , y1 + y , x2 + x , y2 + y ) ; getch ( ) ; break ;

case 2 : printf ( "Enter value of Rectangle Coordinates\n" ) ; printf ( "\nEnter Top Left Coordinates \n" ) ; printf ( "Enter x1 : " ) ;

scanf ( "%d" , &x1 ) ; printf ( "Enter y1 : " ) ;

scanf ( "%d" , &y1 ) ;

printf ( "\n\nEnter Bottom Right Coordinates\n" ) ; printf ( "Enter x2 : " ) ;

scanf ( "%d" , &x2 ) ; printf ( "Enter y2 : " ) ;

scanf ( "%d" , &y2 ) ;

printf ( "\n\nEnter translation factor for X - Axis " ) ;scanf ( "%d" , &x ) ;

printf ( "Enter translation factor for Y - Axis : " ) ;scanf ( "%d" , &y ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

rectangle ( x1 , y1 , x2 , y2 ) ;

printf ( "Press any key to translate .... " ) ;getch ( ) ;

setcolor ( 5 ) ; rectangle ( x1 + x , y1 + y , x2 + x , y2 + y ) ; getch ( ) ; break ;

case 3 : printf ( "Enter value of Trinagle Coordinates \n\n" ) ; printf ( "\nEnter Coordinates of a side \n" ) ; printf ( "Enter x1 : " ) ;

scanf ( "%d" , &x1 ) ; printf ( "Enter y1 : " ) ;

scanf ( "%d" , &y1 ) ; printf ( "\nEnter x2 : " ) ;

scanf ( "%d" , &x2 ) ; printf ( "Enter y2 : " ) ;

scanf ( "%d" , &y2 ) ;

printf ( "\n\nEnter Coordinates for third vertex \n" ) ; printf ( "Enter x3 : " ) ;

Page 17: Computer Graphic Lab Program Ms Word

scanf ( "%d" , &x3 ) ; printf ( "Enter y3 : " ) ;

scanf ( "%d" , &y3 ) ;

printf ( "\n\nEnter translation factor for X -Axis: " ) ;scanf ( "%d" , &x ) ;

printf ( "Enter translation factor for Y - Axis: " ) ;scanf ( "%d" , &y ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

line ( x1 , y1 , x2 , y2 ) ; moveto ( x2 , y2 ) ; lineto ( x3 , y3 ) ; moveto ( x3 , y3 ) ; lineto ( x1 , y1 ) ;

printf ( "Press any key to translate .... " ) ;getch ( ) ;

setcolor ( 5 ) ; moveto ( x1 + x , y1 + y ) ; lineto ( x2 + x , y2 + y ) ; moveto ( x2 + x , y2 + y ) ; lineto ( x3 + x , y3 + y ) ; moveto ( x3 + x , y3 + y ) ; lineto ( x1 + x , y1 + y ) ; getch ( ) ; break ;

case 4 : closegraph ( ) ; exit ( 1 ) ;

default : printf ( "\n\nWrong choice " ) ; break ;

} } while ( ch != 4 ) ;

getch ( ) ; closegraph ( ) ;}

Page 18: Computer Graphic Lab Program Ms Word

Output:

Translation of 2D

1. Translation of Line2. Translation of Rectangle3. Translation of Triangle 

Enter your choice : 1

Enter value of Line coordinates

Enter x1 : 50Enter y1 : 50Enter x2 : 200Enter y2 : 200

        Enter translation factor for X - Axis : 50

Enter translation factor for Y - Axis : 50

Press any key to translate ...

Page 19: Computer Graphic Lab Program Ms Word

// Scaling of 2D

#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>#include <math.h>

int x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 , ch , x , y ;

int main(void){ int gdriver = DETECT, gmode, errorcode; clrscr ( ) ; do { closegraph ( ) ; gotoxy ( 25 , 2 ) ; printf ( "Scaling of 2D\n\n\n" ) ; printf ( "\n1.Scaling of Line " ) ; printf ( "\n2.Scaling of Rectangle " ) ; printf ( "\n3.Scaling of Triangle " ) ; printf ( "\n4.Exit" ) ; printf ( "\n\nEnter your choice : " ) ;

scanf ( "%d" , &ch ) ;

initgraph ( &gdriver , &gmode , "c:\\tc-300\\bgi" ) ;

errorcode = graphresult(); if (errorcode != grOk) { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); }

cleardevice ( ) ; switch ( ch ) { case 1 : printf ( "Enter value of Line Coordinates \n\n" ) ;

printf ( "Enter x1 : " ) ;scanf ( "%d" , &x1 ) ;

printf ( "Enter y1 : " ) ;scanf ( "%d" , &y1 ) ;

printf ( "Enter x2 : " ) ;scanf ( "%d" , &x2 ) ;

printf ( "Enter y2 : " ) ;scanf ( "%d" , &y2 ) ;

printf ( "\n\nEnter scaling factor of X - Axis : " ) ;scanf ( "%d" , &x ) ;

Page 20: Computer Graphic Lab Program Ms Word

printf ( "Enter scaling factor of Y - Axis : " ) ;scanf ( "%d" , &y ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

printf ( "Press any key to Scale in X axis .... " ) ;getch ( ) ;

line ( x1 , y1 , x2 , y2 ) ;

setcolor ( 5 ) ; line ( x1 , y1 , x2 * x , y2 ) ;

printf ( "\nPress any key to Scale in Y axis .... " ) ;getch ( ) ;

setcolor ( 5 ) ; line ( x1 , y1 , x2 , y2 * y ) ; getch ( ) ; break ;

case 2 : printf ( "Enter value of Rectangle Coordinates \n\n" ) ; printf ( "\n\nEnter Top Left Coordinates \n" ) ; printf ( "Enter x1 : " ) ;

scanf ( "%d" , &x1 ) ; printf ( "Enter y1 : " ) ;

scanf ( "%d" , &y1 ) ;

printf ( "\n\nEnter Bottom Right Coordinates \n" ) ; printf ( "Enter x2 : " ) ;

scanf ( "%d" , &x2 ) ; printf ( "Enter y2 : " ) ;

scanf ( "%d" , &y2 ) ;

printf ( "\n\nEnter scaling factor of X - Axis: " ) ;scanf ( "%d" , &x ) ;

printf ( "\nEnter scaling of Y - Axis : " ) ;scanf ( "%d" , &y ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

rectangle ( x1 , y1 , x2 , y2 ) ; printf ( "Press any key to Scale in X axis ... " ) ;

getch ( ) ;

setcolor ( 5 ) ; rectangle ( x1 , y1 , x2 * x , y2 ) ;

printf ( "\nPress any key to Scale in Y axis ... " ) ; getch ( ) ;

Page 21: Computer Graphic Lab Program Ms Word

setcolor ( 5 ) ; rectangle ( x1 , y1 , x2 , y2 * y ) ;

getch ( ) ; break ;

case 3 : printf ( "Enter value of Trinagle Coordinates \n\n" ) ; printf ( "\n\nEnter Coordinates of a side \n" ) ; printf ( "Enter x1 : " ) ;

scanf ( "%d" , &x1 ) ; printf ( "Enter y1 : " ) ;

scanf ( "%d" , &y1 ) ; printf ( "\nEnter x2 : " ) ;

scanf ( "%d" , &x2 ) ; printf ( "Enter y2 : " ) ;

scanf ( "%d" , &y2 ) ;

printf ( "\n\nEnter Coordinates for third vertex \n" ) ; printf ( "Enter x3 : " ) ;

scanf ( "%d" , &x3 ) ; printf ( "Enter y3 : " ) ;

scanf ( "%d" , &y3 ) ;

printf ( "\n\nEnter scaling factor of X - Axis : " ) ;scanf ( "%d" , &x ) ;

printf ( "Enter scaling factor of Y - Axis : " ) ;scanf ( "%d" , &y ) ;

cleardevice ( ) ; setcolor ( 7 ) ;

line ( x1 , y1 , x2 , y2 ) ; moveto ( x2 , y2 ) ; lineto ( x3 , y3 ) ; moveto ( x3 , y3 ) ; lineto ( x1 , y1 ) ;

printf ( "Press any key to Scale in X axis .... " ) ;getch ( ) ;

setcolor ( 5 ) ; moveto ( x1 , y1 ) ; lineto ( x2 * x , y2 ) ; moveto ( x2 * x , y2 ) ; lineto ( x3 * x , y3 ) ; moveto ( x3 * x , y3 ) ; lineto ( x1 , y1 ) ; getch ( ) ;

printf ( "\nPress any key to Scale in Y axis .... " ) ;getch ( ) ;

Page 22: Computer Graphic Lab Program Ms Word

setcolor ( 5 ) ; moveto ( x1 , y1 ) ; lineto ( x2 , y2 * y ) ; moveto ( x2 , y2 * y ) ; lineto ( x3 , y3 * y ) ; moveto ( x3 , y3 * y ) ; lineto ( x1 , y1 ) ; getch ( ) ; break ;

case 4 : closegraph ( ) ; exit ( 1 ) ;

default : printf ( "\n\nWrong choice " ) ; break ;

} } while ( ch != 4 ) ;

getch ( ) ; closegraph ( ) ;}

Page 23: Computer Graphic Lab Program Ms Word

Output:

Scaling of 2D

1. Scaling of Line2. Scaling of Rectangle3. Scaling of Triangle 

Enter your choice : 1

Enter value of Line coordinates

Enter x1 : 2Enter y1 : 2Enter x2 : 100Enter y2 : 100

        Enter scaling factor for X - Axis : 2

Enter scaling factor for Y - Axis : 2

Press any key to Scale in X – axis . . . .

Press any key to Scale in Y - axis . . . .

Page 24: Computer Graphic Lab Program Ms Word

// Cohen Sutherland Line Clipping Algorithm

# include <stdio.h># include <conio.h># include <graphics.h># include <stdlib.h>

int xmax , ymax , xmin , ymin , code [ 2 ][ 4 ] ;char * msg ;

// Returns the intersection point of a line with clipping windowint intersect ( int x11 , int y11 , int x22 , int y22 , int ch ){ int val ; float m ; m = ( y22 - y11 ) / ( x22 - x11 ) ;

switch ( ch ) {

case 0 : val = y11 + ( m * ( xmin - x11 ) ) ; break ;

case 1 : val = x11 + ( ( ymin - y11 ) / m ) ; break ;

case 2 : val = y11 + ( m * ( xmax - x11 ) ) ; break ;

case 3 : val = x11 + ( ( ymax - x11 ) / m ) ; break ;

}

return ( val ) ;}

// Generates code Identity | left (0) | top (1) | right(2) | below (3)void ptCode ( int idx , int xx , int yy ){ code [idx][0] = code [idx][1] = code [idx][2] = code [idx][3] = 0 ;

if ( xx < xmin )code [idx][0] = 1 ;

if ( yy < ymin )code [idx][1] = 1 ;

if ( xx > xmax )code [idx][2] = 1 ;

if ( yy > ymax )code [idx][3] = 1 ;

}

void main ( )

Page 25: Computer Graphic Lab Program Ms Word

{ int gdriver = DETECT , gmode ; int x1 , y1 , x2 , y2 , xo1 , yo1 , xo2 , yo2 , i ; initgraph ( &gdriver , &gmode , "C:\\TC\\BGI" ) ;

printf ( "Cohen Sutherland Line Clipping Algorithm \n\n" ) ; printf ( "Enter Values for \nClipping WindowCoordinates\n" ) ; printf ( "Xwmin : " ) ;

scanf ( "%d" , &xmin ) ; printf ( "Ywmin : " ) ;

scanf ( "%d" , &ymin ) ; printf ( "Xwmax : " ) ;

scanf ( "%d" , &xmax ) ; printf ( "Ywmax : " ) ;

scanf ( "%d" , &ymax ) ;

printf ( "\n\nCoordinates of Line " ) ; printf ( "\nX1 : " ) ;

scanf ( "%d" , &x1 ) ; printf ( "Y1 : " ) ;

scanf ( "%d" , &y1 ) ; printf ( "X2 : " ) ;

scanf ( "%d" , &x2 ) ; printf ( "Y2 : " ) ;

scanf ( "%d" , &y2 ) ;

cleardevice ( ) ; setcolor ( getmaxcolor ( ) ) ;

line ( x1 , y1 , x2 , y2 ) ; rectangle ( xmax , ymax , xmin , ymin ) ; sprintf ( msg , "( %d , %d ) " , x1 , y1 ) ; outtextxy ( x1 , y1 , msg ) ; sprintf ( msg , "( %d , %d ) " , x2 , y2 ) ; outtextxy ( x2 , y2 , msg ) ; getch ( ) ;

ptCode ( 1 , x1 , y1 ) ; ptCode ( 2 , x2 , y2 ) ; printf ( "Left | Top | Right | Below\n" ) ; printf ( "Code of point ( %d , %d ) : " , x1 , y1 ) ; printf ( "%d%d%d%d\n" , code[1][0] , code[1][1] , code[1][2] , code[1][3] ) ; printf ( "Code of point ( %d , %d ) : " , x2 , y2 ) ; printf ( "%d%d%d%d\n" , code[2][0] , code[2][1] , code[2][2] , code[2][3] ) ;

getch ( ) ; gotoxy ( 10 , 10 ) ; printf ( "Press any key to continue .... " ) ; cleardevice ( ) ; rectangle ( xmax , ymax , xmin , ymin ) ;

Page 26: Computer Graphic Lab Program Ms Word

for ( i = 0 ; i < 4 ; i++ ) {

if ( code[1][i] == 1 && code[2][i] == 1 ){ printf ( "Line is outside clipping region " ) ; getch ( ) ; exit ( 1 ) ;}

}

xo1 = x1 ; xo2 = x2 ; yo1 = y1 ; yo2 = y2 ; for ( i = 0 ; i < 4 ; i++ ) {

if ( i % 2 == 0 ){ if ( code [1][i] == 1 ) {

yo1 = intersect ( x1 , y1 , x2 , y2 , i ) ;if ( i == 0 ) xo1 = xmin ;if ( i == 2 ) xo1 = xmax ;

}

if ( code [2][i] == 1 ) {

yo2 = intersect ( x2 , y2 , x1 , y1 , i ) ;if ( i == 0 ) xo2 = xmin ;if ( i == 2 ) xo2 = xmax ;

}}else{ if ( code [1][i] == 1 ) {

xo1 = intersect ( x1 , y1 , x2 , y2 , i ) ;if ( i == 1 ) yo1 = ymin ;if ( i == 3 ) yo1 = ymax ;

}

if ( code [2][i] == 1 ) {

xo2 = intersect ( x2 , y2 , x1 , y1 , i ) ;if ( i == 1 ) yo2 = ymin ;if ( i == 3 ) yo2 = ymax ;

Page 27: Computer Graphic Lab Program Ms Word

}}

}

line ( xo1 , yo1 , xo2 , yo2 ) ; sprintf ( msg , " ( %d , %d ) " , xo1 , yo1 ) ; outtextxy ( xo1 , yo1 , msg ) ; sprintf ( msg , " ( %d , %d ) " , xo2 , yo2 ) ; outtextxy ( xo2 , yo2 , msg ) ; getch ( ); closegraph ( ) ;}

Page 28: Computer Graphic Lab Program Ms Word

Output :

Cohen Sutherland Line Clipping Algorithm

Enter Values for

Clipping Window CoordinatesXwmin : 100Ywmin : 100Xwmax : 300Ywmax : 300

Clipping Window CoordinatesX1 : 50Y1 : 50X2 : 400Y2 : 400

( 50 , 50 )

Left | Top | Right | Below

Code of Point ( 50 , 50 ) : 1100Code of Point ( 400 , 400 ) : 0011

( 400 , 400 )

( 100 , 100 )

( 300 , 300 )

Page 29: Computer Graphic Lab Program Ms Word

// Digital Differential Analyzer Curve Generation Algorithm

# include <graphics.h># include <stdlib.h># include <stdio.h># include <conio.h># include <math.h>

void main ( ){ int gdriver = DETECT, gmode, errorcode; float xo , yo , xx , yy , x , y , i , a ; float temp , xarc , yarc , yinc , xinc , ainc ; char *msg ;

initgraph( &gdriver , &gmode , "C:\\TC\\BGI" ) ; printf ( "DDA Curve Generation Algorithm\n" ) ; printf ( "Enter Values “ ) ; printf ( "\nCenter of curvature ( Xo , Yo ) : " ) ;

scanf ( "%f %f" , &xo , &yo ) ; putpixel ( xo , yo , 7 ) ;

printf ( "Angle A : " ) ;scanf ( "%f" , &a ) ;

a = a * ( 3.145 / 180 ) ;

printf ( "Starting Pt. of Arc ( X , Y ) : " ) ;scanf ( "%f %f" , &x , &y ) ;

xx = x * cos ( a ) - y * sin ( a ) + xo - xo * cos ( a ) + yo * sin ( a ) ; yy = x * sin ( a ) - y * cos ( a ) + yo - xo * sin ( a ) - yo * cos ( a ) ;

putpixel ( xx , yy , 5 ) ; line ( xo , yo , xx , yy ) ; printf ( "%f %f" , xx , yy ) ;

xarc = x ; yarc = y ; putpixel ( xarc , yarc , 7 ) ; line ( xo , yo , x , y ) ; getch ( ) ;

if ( abs ( xx - x ) < abs ( yy - y ) )temp = abs ( yy - y ) ;

elsetemp = abs ( xx - x ) ;

ainc = ( a / temp ) ; i = ainc ;

Page 30: Computer Graphic Lab Program Ms Word

while ( ! ( xarc > xx && yarc > yy ) && i < a ) {

putpixel ( xarc , yarc , 7 ) ;

xarc = x * cos ( i ) - y * sin ( i ) + xo - xo * cos ( i ) + yo * sin ( i ) ;

yarc = x * sin ( i ) - y * cos ( i ) + yo - xo * sin ( i ) - yo * cos ( i ) ;

i = i + ainc ; }

sprintf ( msg , " ( %f , %f ) " , xo , yo ) ; outtextxy ( xo , yo , msg ) ; sprintf ( msg , " ( %f , %f ) " , xx , yy ) ; outtextxy ( xx , yy , msg ) ; sprintf ( msg , " ( %f , %f ) " , x , y ) ; outtextxy ( x , y , msg ) ;

getch ( ) ; closegraph ( ) ;}

Page 31: Computer Graphic Lab Program Ms Word

Output :

DDA Curve Generation Algorithm

Enter Values

Center of Curvature ( Xo , Yo ) : 200 300Angle A : 50

Starting Point of Arc ( X , Y ) : 300 100417.546783 240.295105

( 300.000 , 100.00 )

( 417.546 , 240.295 )

( 200.000 , 300.000 )

Page 32: Computer Graphic Lab Program Ms Word

// 3D Projection

# include <stdio.h># include <conio.h># include <graphics.h># include <stdlib.h># include <math.h>

int n ;float proj [ 50 ][ 3 ] ;

void main ( ){ int gdriver = DETECT , gmode , ch = 0 , i ; char msg [ 80 ] ; float xc = 0.0 , yc = 0.0 , zc = 0.0 ;

initgraph ( &gdriver , &gmode , "C:\\TC\\BGI" ) ; clrscr ( ) ;

printf ( "3D Projection \n" ) ; printf ( "Enter no of vertices : " ) ;

scanf ( "%d" , &n ) ;

for ( i = 0 ; i < n ; i++ ) {

printf ( "Enter value for ( X%d , Y%d , Z%d ) " , i + 1 , i + 1 , i + 1 ) ;

scanf ( "%f %f %f" , &proj[i][0] ,&proj[i][1],&proj[i][2] ) ; }

for ( i = 0 ; i < n ; i++ )printf ( "P%d ( %f , %f , %f )" , i , proj[i][0] , proj[i]

[1], proj[i][2] ) ;

clrscr ( ) ; cleardevice ( ) ;

printf ( "1.Parallel Projection \n2.Perspective Projection\n”) ; printf ( "Enter your choice : " ) ;

scanf ( "%d" , &ch ) ;

if ( ch == 1 ) {

printf ( "Enter coordinates for point of projection \n" ) ;printf ( "Xc : " ) ;

scanf ( "%f" , &xc ) ;printf ( "Yc : " ) ;

scanf ( "%f" , &yc ) ;printf ( "Zc : " ) ;

scanf ( "%f" , &zc ) ;

Page 33: Computer Graphic Lab Program Ms Word

for ( i = 0 ; i < n ; i++ ){ proj[i][0] = proj[i][0] - ( proj[i][2] * ( xc / zc ) ) ; proj[i][1] = proj[i][1] - ( proj[i][2] * ( yc / zc ) ) ; proj [i][2] = 0.0 ;}

for ( i = 0 ; i < n ; i++ ){ printf ( "P%d ( %f , %f , %f ) " , i+1 ,proj[i][0] ,

proj[i][1] , proj[i][2] ) ;}cleardevice ( ) ;

for ( i = 0 ; i < n ; i++ ){ putpixel ( proj[i][0] , proj[i][1] , 6 ) ; sprintf ( msg , "( %d , %d ) " , ( int ) proj [i][0] ,

( int ) proj [i][1] ) ; outtextxy ( proj [i][0] , proj [i][1] , msg ) ;}

}

if ( ch == 2 ) {

printf ( "Enter coordinates for center of projection \n" ) ;printf ( "Xc : " ) ;

scanf ( "%f" , &xc ) ;printf ( "Yc : " ) ;

scanf ( "%f" , &yc ) ;printf ( "Zc : " ) ;

scanf ( "%f" , &zc ) ;

for ( i = 0 ; i < n ; i++ ){ proj[i][0] = xc -( zc * proj[i][0] - xc )/( proj[i][2]

- zc ) ; proj [i][0] = yc - ( zc * proj[i][1] - yc ) / ( proj[i]

[2] - zc ) ; proj [i][2] = 0.0 ;}

for ( i = 0 ; i < n ; i++ ){ printf ( "P%d ( %f , %f , %f ) " , i+1 , proj [i][0] ,

proj[i][1] , proj[i][2] ) ;}cleardevice ( ) ;

for ( i = 0 ; i < n ; i++ ){ putpixel ( proj[i][0] , proj[i][1] , 6 ) ;

Page 34: Computer Graphic Lab Program Ms Word

sprintf ( msg , "( %d , %d ) " , ( int )proj [i][0] , ( int )proj [i][1] ) ;

outtextxy ( proj [i][0] , proj [i][1] , msg ) ;}

}

getch ( ) ; closegraph ( ) ;}                                                                                                                                                               Output :                                                             3D ProjectionEnter no. of vertices: 8

Enter Value for ( Xo , Yo , Zo ) : 50 50 50  Enter Value for ( X1 , Y1 , Z1 ) : 50 250 50            Enter Value for ( X2 , Y2 , Z2 ) : 250 250 50            Enter Value for ( X3 , Y3 , Z3 ) : 250 50 50            Enter Value for ( X4 , Y4 , Z4 ) : 30 30 100            Enter Value for ( X5 , Y5 , Z5 ) : 30 200 100            Enter Value for ( X6 , Y6 , Z6 ) : 200 200 50            Enter Value for ( X7 , Y7 , Z7 ) : 200 30 100

1. Parallel Projection2. Perspective Projection

Enter your choice : 1

Enter coordinates for point of projection : Xp : 100Yp : 200Zp : 300

( 17 , 3 ) ( 107 , 5 )

( 43 , 37 ) ( 243 , 37 )

( 17 , 175 ) ( 107 , 175 )

( 43 , 237 ) ( 243 , 237 )

Enter your choice: 2

Enter coordinates for center of projection:

Page 35: Computer Graphic Lab Program Ms Word

Xp: 100Yp: 400Zp: 800

( 46 , 26 ) ( 260 , 26 )

( 20 , 171 ) ( 214 , 171 )

( 46 , 240 ) ( 260 , 240 )

                                                                                                                                                                                                                                                                            

Page 36: Computer Graphic Lab Program Ms Word

                              

SOFTWARES

Page 37: Computer Graphic Lab Program Ms Word

CorelDRAW

CorelDRAW is a powerful vector–based drawing program that makes it easy to create professional artwork. It has been installed on the Managed Windows Service.

Corel Draw User InterfaceThe figure below illustrates the different areas of the Corel Draw User Interface.

Note that The Property bar changes for different selections in the Toolbox and

provides a means of changing the properties of the tools’ functionality. The docker area is very useful and can be used to “dock” various items.

These items are controlled using Window | Dockers. The one above shows what happens if Object Properties is chosen.

Documentation for Corel Draw is available via the Help menu. The toolbox items can be identified using the tool tips feature of Windows

by holding the cursor over a particular tool. Several of the tools have a small arrow at the bottom right pointing south–east. If this arrow is clicked, a fly–out with other tool icons appears which give different options. These fly–outs are all illustrated in the next part of this document.

The Toolbox

The CorelDRAW Toolbox contains tools for creating, filling, and modifying objects interactively. The drawing tools let you design a variety of objects for your drawing, and the shaping tools let you modify your drawing.Some of the tools in the Toolbox have a small arrow on their bottom right

Menu Bar

Property Bar

Toolbox

Drawing Page

Desktop

Colour Palette

Navigator

Status Bar

Title Bar

DocumentNavigator

Ruler

Docker(Object Properties)

Toolbar (Standard)

Page 38: Computer Graphic Lab Program Ms Word

corners. These are called flyouts. When the arrow is clicked, a group of multiple tools appear and one of these can be clicked.When you first start CorelDRAW, the toolbox appears down the left hand side and looks like the following:

Pick Tool

Shape Edit Flyout

Crop Flyout

Zoom Flyout

Curve Flyout

Smart Tools Flyout

Rectangle Flyout

Ellipse Flyout

Object Flyout

Perfect Shapes Flyout

Text Tool

Interactive Tool Flyout

Eyedropper Flyout

Outline Flyout

Fill Flyout

Interactive Fill Flyout

To create a blank document:

From the ‘File’ drop-down menu, select ‘New’.

To Add text

Click the text icon in the ‘Toolbox’ on the left of the screen. Click the required area of the page and begin typing. Information about the text will appear in the ‘Property Bar’. Highlight the text by dragging over it with the cursor and you can change the font - choose from the drop down font list. You can also choose the size of the text, text style, align-ment etc from the properties information area. For large areas of text, you can create a paragraph text box by selecting the ‘Text’ tool then clicking and dragging to the required size on the screen:

Zoom Tool

Page 39: Computer Graphic Lab Program Ms Word

Use the ‘Zoom’ tool on the Toolbox to get a closer view of detailed images. When this tool is selected, the Property Bar shows the different zoom options. For example, you can select a particular zoom size (such as 200%). Selecting ‘Zoom To Page’ will reveal the whole document on screen.

Moving around a document while using zoom

To move around the document without zooming out and then back in, use the ‘Hand’ tool. This shares a space on the Toolbox with the ‘Zoom’ tool. Click the black triangle on the ‘Zoom’ tool icon to view the ‘Hand’ tool, then click and drag on the document. Notice that you can ‘pull’ or ‘push’ the document around the screen.

Adding vector shapes to the screen

There are a number of ways to add vector shapes to the screen. If it is a simple or regular shape, such as a square or circle, select the appropriate tool on the Toolbox and click and drag on the screen. This will place a vector image on the document. You can easily resize and recolor the shape.

While the shape is selected, alter its properties using the ‘Property Bar’. For ex-ample, the x, y position of the object, width, height and rotation.

Individual shapes have their own options. On a square, for example, it is pos-sible to round the corners to a precise amount.

For more options, right click the shape and select ‘Options’. Another tool palette will appear - the ‘Object Properties’ palette.

Using the ‘Object Properties’ palette

There are tabs along the top of this palette for ‘Fill’, ‘Outline, ‘General’, ‘Detail’, ‘In-ternet’ and a final tab specific to that object.

To fill a vector shape with a solid colour

Using the ‘Object Properties’ palette, select the ‘Fill’ tab. Select ‘Uniform fill’. Select a colour from the ‘Color Palette’. The object is filled with the chosen colour.

To fill an object with a gradient

Under the ‘Fill’ tab, select ‘Fountain Fill’. Choose from the options available - for example, linear or radial fill Select the colour that the gradient will move 'From' and 'To'. On screen, the object will be filled with a gradient colour moving from the first col-our selected to the second. This is easily edited by changing the ‘Fountain Fill’ settings.

Outline

Under the ‘Outline’ tab, select the width of the line from the drop down list. Select the colour of the line. Select the style of the line - this may be solid or dashed or dotted, or a combina-tion. Choose from the drop-down list. Select whether or not the line will begin and or end with an arrowhead and choose the style of arrowhead from the available options. In CorelDRAW, the centre of the outline will map to the edge of the selected shape. This can alter the area of the ‘inner’ shape if the line is thick. To prevent this happening, select the ‘behind fill’ tick box.

Creating non-regular vector shapes

Page 40: Computer Graphic Lab Program Ms Word

Basic geometric shapes can be created by selecting the corresponding tool from the ‘Toolbox’, but for more complex vector shapes, it is necessary to use more complex tools, such as freehand pens and Bezier curve tools. These tools are located under the ‘Shape Tool’ and ‘Freehand Tool’ buttons on the 'Toolbox'.

Working in layers

When working with images, it is very useful to be able to work across a number of layers. The main reasons for this are:

the ability to rearrange the order of objects on the screen; that is, to have the ability to place one object behind another and change that order as necessary

the ability to organise images when working on complex documents. For example, if you are creating a structure diagram, each level of the diagram could be on a separate layer;

Thinking about layers

Think about each layer as being like a sheet of transparency. Traditional animators would paint each frame of animation onto a transparent surface. These layers could be built up so that, for example:

background layer = blue; layer 1 = clouds; layer 2 = ground (horizon); layer 3 = trees; layer 4 = bushes; and layer 5 = man.

To make the man walk, it would only be necessary to alter layer 5. Each layer can be moved at a different rate, and this gives the effect of parallax motion (giving depth to an animation). Al-though we are not producing animation, the ability to manipulate layers is valuable tool in graphic design.

How to add layers in CorelDRAW

Go to ‘Tools’ and click ‘Object Manager’. The layers palette will appear on the right of the screen. Notice that any effects that you have added to the object are also shown here.

Grouping objects

If you have several items on one layer that you wish to bring together as one object (that you can move around the screen as one object) then they should be grouped. Grouping and ungrouping objects allows you to edit small elements while dealing with larger issues such as placement.

Select an object or number of objects on the screen by selecting the white arrow (‘Pick Tool’) and left-clicking or holding shift and left-clicking the object(s).

From the ‘Arrange’ menu, select ‘Group’ or ‘Ungroup’. It is useful to remember the keyboard shortcuts for these. ‘Group’ is Ctrl and G pressed together and ‘Ungroup’ is Ctrl and U.

ApplicationTo create drop shadows in Corel DRAW. Drop shadows are not something you'd expect to be able to do in a vector based drawing program. Although the shadows created with this technique differ from those done with a paint program such as Photoshop they are, nevertheless, a pretty cool effect.

Procedure1. Open a new graphic. Choose the text tool and enter your text. Choose the pick tool to select the text. Use Text, Format Text to bring up the Format Text

Page 41: Computer Graphic Lab Program Ms Word

dialog box.

2. Choose a size and font for your text

3. Choose Edit, Copy then Edit, Paste. Move the top copy aside and use Edit, Paste to create a third copy. Move this one aside, as well

4.    With this last copy still selected choose a light grey color. This will change the last copy to light gray. Move one of the other copies over the light gray one so that it's a little above and to the left of the light gray copy. If you have to, use Arrange, Order, Forward one so that the black copy is above the light gray one .

5. Use the pick tool to select both the light grey and the black copies. Choose Effects, Blend to bring up the Blend menu. I left the default 20 steps and clicked Apply to .

6. Finally, use the pick tool to select the last copy and, with it selected, changes its color to the color you want the the text to be. Move it into place over theblended copies to arrive at something like in figure.

Macromedia Flash Flash 5.0 is a vector-based technology that supports animation, sound and interactivity. It evolved from a product “Splash” in the mid 90s and aims at delivering scalable and high quality web content over the Internet.Features of Flash 5Flash 5 features a user-friendly interface that provides a powerful development tool for creating

Page 42: Computer Graphic Lab Program Ms Word

artwork, streamlining workflow and creating interactivity.

User-friendly Interface

Flash 5 provides an easy to access environment for creating and editing Flash movies (animation with sound and interactivity). A user typically works with the key features as follows (Figure1):

The Stage the rectangular area where the movie playsThe Timeline where graphics are animated over timeSymbols the reusable media assets of a movieThe Library window where symbols are organizedThe Movie Explorer providing an overview of a movie and its structureFloating, dockable panels elements properties and authoring environment setting

Flash 5 Toolbar

Floating, dockable Panels

StageSymbol

Timeline

Library Window

Subselection Rectangle Paint Bucket Stroke color Lasso Text Brush Eraser Zoom Fill color

Arrow Pen Pencil Eyedropper Tool modifiers Line Oval Ink Bottle Hand

Figure : Drawing and Painting Tools

Page 43: Computer Graphic Lab Program Ms Word

Flash 5 can import different file formats (such as .ai, .dxf, .bmp, .emf, .fh9, .spl, .gif, .jpg, .png, .swf, and .wmf for windows system). The following are basic concepts to deal with in Flash

Drawing provides various tools for drawing freeform or precise lines, shapes, and paths, and painting filled objects.Symbol a symbol is a reusable image, animation, or button

Instance an instance is an occurrence of a symbol on the Stage. Symbols help to create sophisticated interactivity, reduce a file’s size and simplify editing a movie

Layers structure as transparent stacked sheets on top of each other and it helps to organize the artwork in a movie by separating objects on different level

Type the text block object where properties such as size, typeface, style, spacing, color and alignment can be set. Sophisticated transform can be applied like shape object.

Buttons the objects (with four statuses: Up, Over, Down and Hit) trap mouse clicks and trigger the interaction with Flash movie.

Sound the object can be integrated into a Flash layer. There are two types: event sounds (a complete pre-download before playing and independent to the Timeline) and stream sounds (synchronized to the Timeline)

Animation Tweening is an essential technique for creating animation. It defines starting and ending states of an instance, group, or text block and use transformation matrix to do the cal-culation and interpolates the values or shapes for the frames (cells on the Timeline) in be-tween. There are two types of tweened animation in Flash: tweening motion (position and shape) and tweening color. Here is an example of a tweening motion along a straight path .

Frame 1 and 5 are the starting and ending points. Frame 2 to 4 are interpo-lated.Bee object is put

on the top layer

Frame 1 Frame 5 Playhead

Page 44: Computer Graphic Lab Program Ms Word

list by dragging and dropping or fill in parameters in the argument fields. In Expert Mode, one can enter ActionScript code directly into the text editor on the right side area of the panel

Key technologies of Flash 5Vector graphics

Vector graphics is perhaps the most important technique used by Flash 5. Although there is other leading designing tools that build up on vector graphics, such as CorelDRAW 10 graphics suite, Macromedia Flash is the very first one who uses vector based graphic design in generating web contents and delivering them over the Internet.

Compared with bitmapped images (GIF and JPEG), which are optimized for a single resolution, the scalability of vector images is more ideal for displaying web contents uniformly on PDA, set-top boxes, or PCs. Vector images can be more compacted, thus make the file size small for delivering. Therefore, the product benefits from this designing feature both in terms of bandwidth efficiency and device independence. Flash file format (SWF)

The Macromedia Flash (SWF) file format was designed to deliver vector graphics and animation over the Internet. It features with extensibility (a tagged format), efficiency (a binary format), simplicity (a simple format) and scalability (vector based graphics). SWF structure is consists of a Header and a series of tagged data blocks .There are two types of tag definition tag (defining the content of a Flash movie) and control tag (manipulating characters and controlling the flow of the movie).

File Compression

Flash interactive movie needs frequent data exchange over a network connection. For high quality rendering, Flash is structured in separating the contents from its displaying system (Flash player). The Flash (SWF) file, a tagged format, is compressed to be small and ren-dered through binary code. Several compression techniques are used to reduce the file size:Compression Shapes are using delta encoding scheme, which assumes the first coordi-nate of a line to be the last coordinate of the previous one and distances are expressed by relative position to the previous one Shape Data Structure uses a unique structure to minimize the size of shapes and to effi-ciently render anti-aliased shapes on the screenChange Encoding SWF files only store the changes between states.Default values some structures, like matrices and color transforms, share common field with default valuesReuse by the character dictionary, a font, bitmap, shape, or button element can be stored once and referenced multiple times.

Header Tag Tag Tag

Macromedia Flash (SWF) File Structure

End Tag

Page 45: Computer Graphic Lab Program Ms Word

First Steps

Okay, you have a document to work on. Next we’re going to change the size and add some content to the document.In the Properties panel at the bottom of the window, click on the “Size” button and change the width to 400, the height to 128 and the frame rate to 30.This has the effect of making the document into a “letterbox” shaped rectangle which will play animations back at 30 steps per second.

Background Colours

Next we will change the background to have a graded blue look.Click on the Rectangle Tool in the toolbox (upper left) but don’t draw a rectangle on the document yet.Change the fill colour (Properties panel, bottom of the window) to a blended colour (not a single colour) like the circular graded blue. It can be found at the very bottom of the colour picker.Later you may want to try a few colours out and experiment a bit. For now, draw a rectangle almost as big as the document.Click on the Selection Tool (upper left) and click once on your rectangle. This selects the filled part of the rectangle (to select the filled part and the line around the edge, you would double-click).In the properties, you can see the width, height and position of the rectangle. You can change these figures to position an object exactly where you want.Try to change the rectangle’s properties so that it is 400 pixels wide, 128 pixels high and positioned at x=0, y=0. Odd isn’t it? The shape of the rectangle is locked, so click on the little padlock icon in the properties area. Now you can change the size easily. Lock the shape when you have finished, then save your work with a File|Save.

Tweaking the fill coloursClick on the Fill Transform Tool and then click on your blue shaded rectangle. You should see something like this image. If you have a simple plain colour it will not work.Play with all four of the control points to make a pleasing graded background.If you accidentally click on the grey background you will deselect the rectangle – just click on it to continue editing.

Pause for thoughtDid you think Flash was an animation program? Yet it seems like a drawing program! The current version of Flash is a versatile tool with many capabilities.Was that easier to do than to describe? If you got stuck, persevere. You will find lots of tutorials use the same style and language, so get used to getting the most out of them.More Layers

Page 46: Computer Graphic Lab Program Ms Word

In the Timeline panel (top of the window) you will see that we have something called “Layer 1”. To change the name of the layer, double-click on the name (or right-click and select Properties). Change the name to say GradedSky.Now look at the symbols to the right of the name – an eye, representing visibility, a padlock representing the lock status, and a square representing a highlight colour. Click on the circular dot under the padlock.You have protected the layer against accidental editing, which is surprisingly easy to do.Now we will add a layer and name it Text.Right-click on the GradedSky name and select Insert Layer from the context menu.Now change the name of the new layer from “Layer 2” to “Text”.This second layer sits over the first. Anything in this new layer appears to be on top of the GradedSky layer. We’re going to put some text in it.Adding TextClick on the Text Tool. Don’t create any text yet – just like the rectangle tool, we need to set some properties first.

In the

Properties panel, make sure the selection box is set to Static Text. If you have an empty properties panel, make sure the new layer is selected and not locked.Set the font to Lucida Sans, 72 point, yellow, not bold, not italic.Now click on the Text layer and type in “This is a long message”.Note that the text extends off the visible area. This is not a problem!Save your work. Use Ctrl-S or File|Save.AnimationClick on the Selection Tool and click on our new text message. It will be selected and you will be able to see the properties at the bottom of the window.If you have all of the properties visible, you will see the width, height and position of the text object. If not, click on the tiny downwards-facing arrow in the far lower-right corner of the panel.You can drag the text block around or type in new coordinates to change the position of the text in the layer.In the timeline (top of the window), on the layer (row) named Text, right-click in the little square under the number 60 – in other words, right click in frame 60 of our animation. From the menu, select Insert Keyframe.Now we have a two-second animation (remember, we have 30 frames per second) that does nothing at all!In frame 60, select the text block and move it across to the left. Move it so the end of the text is just off the left edge of our 400-pixel wide area.Have you noticed that the background has changed? We’ve lost our lovely blue rectangle. Right click in frame 60 on the GradedSky layer row and Insert Frame. This spreads the background over all 60 frames.Now double-click on any frame from 1 to 59 on the Text layer row. You should see that all the frames from 1 to 59 are selected as one big block. Now look at the properties panel – you should be able to select a Motion tween from a drop-down list box. Tweening is the process of getting the computer to work out all the stages “in between”.Excellent – you have an animation! Now save your work.TestingObviously we need to be able to test our animation, and Flash provides us with the tools for the job. One way to test is to press the Enter key; this gives a simple idea of how things will look.Another way to test is to press the Control and the Enter keys at the same time (Ctrl-Enter). Press Enter again to stop, and then navigate back to your document. You may want to use the

Page 47: Computer Graphic Lab Program Ms Word

Window menu, or click on the name of your document at the top left of the window area.Another way is to simply press the F12 key to preview your work in a browser. If this is set up, it gives a more accurate feel for how your animation will really look when you publish it.

Page 48: Computer Graphic Lab Program Ms Word

ApplicationTo create a movie in FlashProcedureThe most important thing to understand when working with flash is the timeline:

1. Make sure you have a “keyframe” in the first frame. Use F6.2.

3. Import your Ozzy picture from a file. File Import.

4. Now we want to make another keyframe on the 20th frame. Using F6 again.

Page 49: Computer Graphic Lab Program Ms Word

5. Right-Click in the gray area, and select “Create Motion Tween”. Then you should see:

Repeat step 4 for the 20th frame so you have no gray, it should all be blue.

5. Select the first frame in the Timeline, and position Ozzy completely out of the left screen. You can hold the Shift key, and use the arrow keys to position him more accurately. Drag-and-drop works fine too.Now if you grab the red box shown in the picture above, slide the bar through the frames…Ozzy should be moving in a smooth fashion from frame 1 to frame 20!NOW YOU CAN DO MOTION TWEEN!!

6. From here we are going to head to another scene. A scene acts like a webpage. You nor-mally have several pages in your personal website, well you have several scenes in Flash too! Things would get pretty confusing if we tried to make motion tweens 1000+ frames long (only about 1min20sec).

6. To add a new scene. Insert SceneAfter doing this, Flash should take you directly to that scene, and you should have a blank, fresh new space to work in.

7. Click “Scene 1” on the upper right of the screen.

8. Ok now that we are back to our first scene. Right-Click in the 20th frame to get the “Ac-tions” pop-up. Then single click on “actions” then double click “goto” within actions.

Page 50: Computer Graphic Lab Program Ms Word

Use these settings for the goto options.

9. Now go back to Scene 2 you just created.

10. Now we are going to make the red text fly in. Instead of having the text all on the same layer, to make things more interesting we will put sections on different layers. First thing then…. Add 4 new layers.

Each layer above has only one text box, or picture within itself.Since you have already created a motion tween with Ozzy. We will make another tween with text.Type in the text “The Godfather” on the top frame labeled the godfather.

11. Now create a motion tween for “The Godfather” text. Just make the tween, it shouldn’t move at all.

For the Ozzy tween, we made him move from left to right. This time we will make the text appear to fly down from large to small. Click on the first frame of the tween. You should notice that your text automatically is selected.

Page 51: Computer Graphic Lab Program Ms Word

12. Now instead of moving the text, right-click inside the blue box above and select Scale. Make the text VERY LARGE. Anywhere from 200% to 300% works awesome!

13.Ok, you should have a motion tween the makes the text appear to fly down from large to small. Our next step is to make sure that after the movie runs to the 20th frame, your Godfather text stays there and doesn’t go away. So….. go way down to the 105th frame and hit F6 again. Should look like this.

13. We now can forget about “the godfather” layer, no more messin’ with it.14.15. So yer a pro now eh? Well the same steps are done for the text “of” and “heavy metal.”

16. Insert your other “ozzy” picture. File Import. (we won’t mess with it just yet)17. Make sure on the ozzy layer, that your frames continue on until frame 94.

You should make a key frame on frame 73 using F6, and again on frame 94, then make the motion tween.The picture below shows what it should look like.

18. Click on frame 94.19. Now from the Instances panel, we need to select Alpha.

Then make the % zero.See what happens? Ozzy disappears!! Well that’s what we want.

20. On the ozzytwo layer, put your new ozzy picture on there, and make a motion tween from frames 82 to 105.

21. Alright now same thing with alpha, make him zero % from the start, then 100% at the end.

From the timeline picture above, you can see that everything you see in the “ozzy” movie takes place within frame 1 to frame 105. Also some tasks on different layers, overlap other tasks….

Page 52: Computer Graphic Lab Program Ms Word

Now, the movie is done. Double click on the ozzytwo layer on frame 105.We are going to use another action…

Pick Stop. And then you are finally done.If you weren’t to do this step, the flash movie would just loop over and over again forever. There are some cases you would want this effect.

Page 53: Computer Graphic Lab Program Ms Word

ADOBE PHOTOSHOPAdobe Photoshop is one of the most powerful image modification programs on the market today. It is widely used throughout the world, and has shown its handiwork to the public through altered photos of famous people, such as President Bush. It is so dominant that when we notice that an image has been altered, we say it has been “Photo shopped.” While this handout offers some very basic tips on using the tools available in Photoshop, more comprehensive guidance can be accessed on the web or in the help menu of your version of Photoshop.

About the Work AreaThe work area can be intimidating to work with because of all the complex functionality but with a quick breakdown of the available features and their uses, you will be ready to comfort-ably navigate the work area with ease. The work area in Photoshop has the following basic functionality and features:

Menu Bar – this is where you can access most of the commands and features in Photoshop

Drawing Palette – where the image being worked on will appear Options bar

content sensitive display of tool options – changes as different tools are selected display using Window > Options or Click a tool in the toolbox.

Lasso options bar

Tool box - for creating an editing images (display or hide using Windows > Tools) Palettes - to monitor and modify images (there are 5 palettes by default) Palette Well - to organize palettes in work area

Drag a palette’s tab into the palette well to store it in the palette well Once in the palette well click on the palette tab to use it

Resizing Images and Size Guide

When working with images for a website, you will need to resize your images to suit your particular purpose. Here is a basic guide that can help you decide on what is suitable. (The units used here are pixels, which are standard units across all computer platforms. The con-version between pixels and inches is roughly 1” = 72 pixels or 1cm = 28 pixels) To use this particular unit of measure, you will need to adjust you preference settings by selecting Edit > Preferences > Units and Rulers and changing the units and rulers to measure in pixels.

Page 54: Computer Graphic Lab Program Ms Word

*To resize a picture look on the menu bar and select Image > image sizeSelectionThere are

several ways to select images or portions of images in Photoshop. Here are few basic methods to do so:

Adding to a Selection and making a square Use the rectangular Selection Tool on the Toolbox to select area to work on. To add to a selection, hold Shift before dragging. To make the selection exactly square, start dragging, then hold Shift. You can press Ctrl+D to "deselect" and remove the selection at any time.Elliptical Selections and subtracting Selections Hold down on the Selection Tool on the Toolbar, and choose the Ellipse. To move the selection, just click inside it and drag. Holding Alt while selecting subtracts that area from the selection 

CroppingCropping is the process of removing portions of an image to create focus or strengthen the composition. You can crop an image using the crop tool and the Crop command

To crop an image using the Crop command: Select the part of the image you want to keep by doing one of the following: With the rectangle , rounded rectangle  , or elliptical marquee , drag over the area

you want to select. Hold down Shift as you drag to constrain the marquee to a square or circle. To drag a marquee from its center, hold down Alt (Windows) or Option (Mac OS) after you

begin dragging. Choose Image > Crop.

To crop an image using the crop tool: Select the crop tool . Press enter to apply the selection to the cropped areaModify Color and effectsPhotoshop has many powerful tools to modify the color and effects of images. Here are brief summaries of each of them:

I. Grayscale: Changes everything to different shades of grayII. Indexed Color: Uses at most 256 colors, so that your file size will be low. Best

for .GIFs and simple clip art.III. RBG Color: Best one: 16.7 million colorsIV. Lab Color: The intermediate color model Photoshop uses when converting from one

color mode to another.V. Multichannel: Uses 256 shades of gray, based on the color value of each pixel. This

is like the old western style.VI. 8 / 16 bits per channel: Distinctions in color. 16 has finer distinctions, but can also

make the file twice the size as 8.

You should experiment with a few options under the Filters menu to view a few of the available effects. Some that you may like to try out are:To improve the appearance of an image you can simply select: Image> Adjustments > Auto Levels/Contrast/Color. Here are some more brief descriptions of what the different, more ad-vanced, tools can accomplish for your image:

Hue/Saturation: Change to B&W, or choose “Desaturate”

Type of picture Size in PixelsBackground 1024 x 768 (roughly)Standard personal picture of yourself for a personal website

200 x 200

Title bar e.g. Google title bar on the Google homepage

276 x 110

Page 55: Computer Graphic Lab Program Ms Word

Equalize: Distributes the brightness of the image evenly throughout. Threshold: Converts to high contrast B&W images.

o Useful for determining the lightest and darkest parts of an image. Posterize: Lets you see how many different shades of brightness you want. Image Size: Increases the image resolution, but not the size Canvas Size: Increases the size of the canvas to do other stuff on it.

Filters can be used to achieve a special effect. These are fun to play with! Some examples are: Liquefy – to edit out unwanted areas of your pictures with colorful swirls Artistic Filters - to give artistic flare to a simple image Textures - to change the look and feel of an image.

Layers The Layers window shows the various layers that your image is made up of. To make a new layer, click the New Layer button (F) or selecting Layer > New > Layer

in the menu bar The background layer cannot be removed, since it has to serve as the background” for the

entire image. Also, you cannot initially modify this background image because it is “locked.” In order to “unlock” it, simply double click the name of the image in the Layer palette.

Additionally, if you somehow find that you cannot modify your image, it may be in the In-dexed mode. If this is the case, you need to change it to RGB mode under Image > Mode > RGB.

To work on a different layer, click on that layer. The eyeball will appear next to that layer. You can drag layers up and down the list. Remember – create a new layer for each part of your image. This allows you to go back and

edit the layers individually.

F

Photoshop Layers palette: A. Layers palette menu B. Layer set C. Layer D. Layer thumbnail E. Layer effect F. new layer icon

eyeball

Page 56: Computer Graphic Lab Program Ms Word

Text EditingTo edit text on the type layer: Always use a new layer to create text Select the horizontal type tool or the vertical type tool . Select the type layer in the layers palette (which will appear with the icon next to it), or

click the text flow to automatically select a type layer. Click to set insertion point or select one or more characters you want to edit Enter text and format as desired using the character palette (display character palette us-

ing: Window > Character or click Character palette tab if the window is open but not visible) Commit changes to type layer by either:

Click the Commit button in the options bar Press the Enter key on the numeric keypad. Press Ctrl+Enter on the main keyboard (Windows) or Command+Return (Mac

OS). Select any tool in the toolbox, click in the Layers, Channels, Paths, Actions, History,

or Styles palette, or select any available menu command.

ApplicationStep 1: Crop the Image into A SquareUse the crop tool from the tool palette to make your picture a square. Hold down the shift key and drag a selection around the picture to make a perfect square. Then press enter.

Step 2: Duplicate the Background Layer TwiceCreate duplicates for your original picture. Use the Ctrl+J shortcut twice to duplicate it. Name one Vertical strips, and the other hori-zontal strips.

Step 3: Fill the Background Layer with Black

Click on the original background layer and fill it with black by using the keyboard shortcut Alt+Backspace.

Step 4: Turn the Vertical Layer Off Click on the layer visibility icon (the

"eyeball" icon) to the left of the "Vertical Strips" layer in the Lay-ers palette.

Step 5: Turn On Pho- toshop's GridGo to the View+Show+Grid. You can also use the keyboard shortcut Ctrl+' to easily turn the grid on and off.

Step 6: Drag Out a Series of Horizontal SelectionsGrab your Rectangular Marquee Tool from the Tools palette. make sure the "Horizontal Strips"

layer is selected. Make horizontal strips that are two grid rows high and one grid row separating them. Hold down the Shift key and drag out more horizontal selections, keeping each one two grid rows high and leaving one grid row separating them.

Step 7: Add a Layer Mask

Page 57: Computer Graphic Lab Program Ms Word

With the horizontal selections in place, click on the Layer Mask icon (the rectangle with a cir-cle in it) at the bottom of the Layers palette to add a layer mask to the "Horizontal Strips" layer: After adding the layer mask, Photoshop hides the areas between our selections, reveal-ing the black-filled layer underneath. Press Ctrl+' to temporarily hide the grid

Step 8: Turn the "Vertical Strips" Layer Back On

Click on the top "Vertical Strips" layer in the Layers palette to select it, then click back on its layer visibility icon to bring back the eyeball and turn the layer itself back on:

Step 9: Drag Out a Series of Vertical SelectionsDo the same thing as you did for the hori-zontal strips for the vertical strips. Turn the grid on by pressing Ctrl+' and drag out your vertical selections. Hold down the Shift key to drag out numerous sections, two grid rows wide with one separating each.Step 10: Add a Layer MaskWith our vertical selections in place, click on the Layer Mask icon at the bottom of the Layers palette (the rectangle with a circle in it).Only the areas that were inside the vertical selections remain visible. Turn off the grid with Ctrl+' .

Step 11: Select All the Strip Intersection Pointshold Points

Hold down Shift+Ctrl+Alt and click directly on the "Vertical Strips" and “Horizontal Strips” layers mask thumbnail:

Step 12: Save the SelectionBefore we go any further, we need to save this selection. To do that, go up to the Select menu at the top of the screen and choose Save Selec-tion. When the "Save Selection" dialog box appears, just click OK in the top right corner to exit out of it:

Step 13: Deselect Every Other Square SelectionWith your Rectangular Marquee Tool hold down your Alt key and drag a selection around every other square selection. This will deselect the selections you drag around. Continue dragging around every other square selection to deselect it until only half of the original square selections are left.

Page 58: Computer Graphic Lab Program Ms Word

Step 14: Copy the Selection to a New Layer

Click on the "Horizontal Strips" layer thumbnail in the Layers palette

to select it. Then press Ctrl+J to copy the selected areas to a new layer.Step 15: Create a Clipping MaskWith the new layer selected, go up to the Layer menu at the top of the screen and choose Create Clipping Mask.

Step 16: Reload the Saved Selection Bring back the selection we saved by using the shortcut Ctrl+Alt+4

Step 17: Deselect the Opposite Square Selections

With the Rectangular Marquee Tool still selected, hold down your Alt key and drag around every other square selection to deselect it. This time though, you want to keep the square selections you deleted the first time we did this and deselect all the ones you kept, so that when you're done, your image looks like this:

Step 18: Copy the Selection to a New Layer

Click on the "Vertical Strips" layer at the top of the Layers palette to select it, then press Ctrl+J to copy the selected areas to a new layer.

Step 19: Create a Clipping Mask

Page 59: Computer Graphic Lab Program Ms Word

Press Ctrl+Alt+G to create a clipping mask

Step 20: Add an Outer Glow Layer StyleWith the top layer still selected, click on the Layer Styles (the purple f) icon at the bottom of the Layers palette, and select Outer Glow from the list. Set all the settings to match the ones at left

Step 21: Copy and Paste the Layer Style onto "Layer 1"Apply the exact same Outer Glow layer style to "Layer 1". Go up to the Layer menu at the top of the screen, choose Layer Style, and then choose Copy Layer Style. Then click on "Layer 1" in the Layers palette to select it, go back up to the Layer menu, choose Layer Style once again, and this time, choose Paste Layer Style.

Page 60: Computer Graphic Lab Program Ms Word

Sound Forge 

Workspace   When you first open Sound Forge, your workspace will be empty:

  When you open a sound file, it will show in this window.

The Data Window Each opened sound file has its own Data Window. There are some navigational buttons across the bottom of the Window:

1. The Zoom in/out buttons controls the horizontal scale of the sound wave.

2. The Level Zoom in/out buttons change the vertical scale of the sound wave.

3. The Maximize Width button changes the view so that you can see as much of the sound wave as possible in the window.

4. The Playbar buttons allow you to jump to the beginning or end of the sound, play, stop, or loop (repeating continuously) the sound.

Page 61: Computer Graphic Lab Program Ms Word

Editing Your SoundPlaying a Sound:

There are four ways to play a sound:

1. Click Play All on the Transport toolbar.

2. Click Play on the Transport toolbar.  (This will act as a looping playback.)

3. Click Play on the Playbar

4. Click Play Looped on the Playbar

While a file is playing, a vertical bar, moving across the sound wave, shows where you are in the sound file. You can also use the other controls, such as Stop, Rewind, Forward for further control of playback.

 

Playing part of a Sound:

You can begin playing back at any point in the sound by clicking where youwant to start, and then clicking Play.  To play only a short section in the middle,  click and drag the mouse across the segment that you want to play, then click Play. (Don't click the Play All button, it will ignore the selection or placement ofthe cursor and play the entire sound).

Basic Editing Operations:

Page 62: Computer Graphic Lab Program Ms Word

Sound editing can be used to cut clips down to size, extend the length of a clip, and remove extra noises between sounds, among many other things.  In the Edit menu, there are many common editing operations:

In order to edit any section of a sound file, you must first highlight it.Listed below are the common editing operations:

1. Cut: deletes a selection from the sound file, and copies it to the clipboard. (control + X)

2. Copy: copies a selection from the sound file onto the clipboard. (control + C)

3. Paste: inserts the material on the clipboard into the sound file at the cursor position. (control + V)

4. Paste Special:    a. Mix: mixes contents of the clipboard with the current selection. (control + M)    b. Crossfade: Crossfades (blends the overlapping area) the contents of the clipboard with the data in the window. (control + F)

5. Trim/Crop: deletes all the data outside of the selected region. (control + T)

6. Clear/Delete: Deletes the selection. (Delete)

7. Undo: Reverses any change made.  You can repeat the undo command to return to previous versions of the sound file.  (control + Z)

Effects and Processing

You have the option of adding all sorts of effects to your sound file.  The Effects menu lists the different effects offered by Sound Forge:

Here are some brief definitions of the effects:

Chorus: imitates the effect of having multiple sound sources for the same sound.

Delay/Echo: creates copies of the sound file which are mixed into the sound to generate echos.

Page 63: Computer Graphic Lab Program Ms Word

    

Distortion: distorts the sound.  May make the sound "fuzzy".

Dynamics: alters the volume of the sound file

Flange: creates a wish-washy effect.

Noise Gate: reduces extra noise between sounds in the file.

Pitch Bend: Alters the pitch of the sound.

Reverb: simulates the acoustics of different settings, such as a church hall, a shower, a room, etc.  This effect is most commonly used.  (It makes sounds a little "warmer").

Applying Effects:

You can apply an effect to a section of the sound or the entire sound.

1. Highlight the selected region of the sound. (or the entire sound)

2. Pull down the Effects menu and choose the effect.

3. Change the options in that effects window to what you would like, and hit OK.

4. Listen to the sound.

The Process Menu:

The Process menu provides you with more editing tools for the sound.

Here are some brief definitions of the most common Processes:

Fade: controls level of volume.

Graphic: allows you to place multiple fades throughout the sound.

In: fades the sound from 0 to 100 percent.

Out: fades the sound from 100 to 0 percent.

Graphic EQ: allows you to raise and lower certain frequencies within the sound.

Insert Silence: allows you to place a certain amount of silent time at a cursor location.

Pan: controls the left/right of the sound.

Graphic: allows you to place multiple points of panning throughout the sound.

Left to Right: pans from left to right.

Page 64: Computer Graphic Lab Program Ms Word

Right to Left: pans from right to left.

Reverse: reverses the sound.

Time Compress/Expand: enables you to speed up or slow down the sound, making the length longer or shorter.

Volume: controls the overall volume of the sound.

ApplicationUse Sound Forge to create Mixed DJ CD Recordings, and break the recording into individual tracks.?

To Start - record your mix.  Since you plan on placing this recording on CD you must record it at CD quality which is @ 44,100 sample rate / 16 bit-depth / Stereo. 

When you create a new file (File>New), it will ask you to verify these settings before opening a new file.

Save your recording!

When you have created your full mix you must now locate where in your recording you would like to place your track breaks. To place a break, insert a marker (To insert a marker press "M") where you would like the track break to occur.   In most cases, it would be best to place the break at the beginning (Downbeat) of a beat. Placing Markers at the correct point is crucial, otherwise your final audio CD may result in a slight skip sound between tracks.  You must make sure that the location of your markers is at a location where the waveform (audio signal) intersects the "0 Decibel Line".  (see the images below)

Make note of the "0 Decibel Line" indicated above

Page 65: Computer Graphic Lab Program Ms Word

Notice that the "Correct Marker Placement" image above shows that the waveform intersects the "0 Decibel Line" at the point where the marker is placed.  In the "Incorrect Marker Placement" image, the marker was placed at a point in the audio where it is above the "0 Decibel Line".  That incorrect placement would probably result in an unwanted skip sound.

After placing your markers at the desired locations, you must also place a marker at the VERY BEGINNING of the Recording, and VERY END.  This is important!

Next, you must convert all the Markers in the recording to Regions. (Special>Regions List>Markers To Regions)  It will then ask you if you are sure you want to convert all Markers To Regions.  Click "Yes".

Now you must save each region as its own file.  (Tools>Extract Regions)  When the next screen pops up, be sure to save the files in a location where there is enough room, then click on "Extract".  Sound Forge will now save all data as individual tracks.  These are then ready for recording in your favorite CD Recording Program. From this point, it is up to you!  Be sure when laying out your recording in your CD burning pro-gram that you enable the "Disk-At-Once" option so you don't have a 2 second gap between tracks!                                                           

Page 66: Computer Graphic Lab Program Ms Word

Ulead Cool 3D Ulead Cool 3D is a 3D utility program that helps you achieve still and animated 3D titles and headlines for Web pages, documents, videos, and multimedia..

User Level

Beginning, intermediate, and advanced PC users. It is intuitive enough for beginners who can use the preset examples, while powerful enough for more advanced users who want to create their own effects. There are numerous sophisticated controls to fine-tune features.

Toolbars

There are five toolbars, which can be hidden, opened or moved:

Standard–contains frequently used commands such as Open, Save, Undo, andRedo; and tools for changing font style, size and orientation.

Attribute–allows you to change settings of a currently selected thumbnail. Works with Easy-Palette.

Animation–lets you specify the key frames for creating animated series of images. Can also specify the object property for each frame.

Location–allows you to fine tune the current special placement of the title, lights, and title tex-ture depending on which tool is active.

Text–allows you to adjust space between characters and lines and align your text. Text cre-ation is straightforward in the Text dialog box. You can scroll through a list of fonts and Cool 3D automatically displays an on-the-fly sample. You can add 3D effects to the text, such as light, color, texture, camera angles, backgrounds and type styles. You can start from scratch or use one of the program's preset combos. Each preset folder has a different group of thumbnails.

EasyPalette–Lets you drag-and-drop still and animated features into your image. You can use presets, that combine style, color, lighting, and texture, from the Gallery. You can customize features by using the Attribute Toolbar, and then can save these settings on the EasyPalette for future use. The EasyPalette contains:

Object Style–contains the Gallery (samples combining style, color, lighting, and texture), Bevel, Light & Color, Texture, Board, and Motion sub-folders where attributes can be fine-tuned.

Templates–samples of Objects (graphics & icons) and Composition (project templates) to use.

Camera–allows you to control the distance and type of lens used.

Background–samples that can be used as a background.

Objects Effects--Twist and Explosion plug-in effects.

Global Effects - Fire plug-in effect. Beginners

An easy way to start for a beginner is to use the Compositions under Templates in the EasyPalette. I used this approach. After dragging-and-dropping a composition onto the window, I replaced the sample text with my own. Then I examined the attributes for each feature to see how Ulead got the result. Then I applied other thumbnails and changed attributes. In no time, I was creating spinning, twisting, exploding, and on-fire images.

Page 67: Computer Graphic Lab Program Ms Word

Realtime

Cool 3D uses Microsoft Direct 3D to create and render 3D titles, thus you can manipulate 3D text in real time, with no lag for redrawing and re-rendering. The presets take longer to render, though. There are five image display and output settings from draft to optimal to balance the detail of the display with the speed of rendering.

Animation

By using Ulead's tutorials on X-, Y-, and Z-Axis, Key Frames, and Fire and Explosion Plug-ins you easily create an animation. Key Frames let you set points in the duration of a video where changes to text objects occur. Thus if you want a text object to spin left for the first half of your video, then suddenly change directions and spin down, you would use key frames to change the text object's spin-attributes at the desired point. And each individual object can now be given its own texture, color, font, bevel, and animation path.

Saving

Files can be saved as JPEGs, TIFs, BMPs, animated GIFs, or video

Page 68: Computer Graphic Lab Program Ms Word

GIF AnimatorWelcome to the Microsoft GIF Animator. With this tool you can use any .GIF file, or any image you can copy to the Clipboard as part of an animation. You can create or modify an animation then save it for use in your web browser or other applications. You can add as many images to an animation as your computer memory allows. The GIF Animator contains a toolbar, an animation (frames) display column, a scroll bar, and three tabs; the Options tab when you open GIF Animator, and also the Animation, and Image tabs once you open a file.

· The Options tab controls the way GIF Animator manages your files.· The Animation tab controls characteristics of your animation.· The Image tab controls characteristics of individual frames in your animation.

You can add images to the animation display column by using drag and drop, by pasting an image from the Clipboard into a frame, or by opening an existing .GIF file from within GIF Animator. Set the Import Color Palette options in the Options tab before you add images to your animation. Use the scrollbar to view all the images in the current animation. Images are inserted before the current selected frame.

ToolbarThe toolbar that displays when you open the GIF Animator provides the following basic file and image handling features.

Button Description

New Create new file

Open Open an existing file

Save Save changes to the active file.

Insert Insert an additional .GIF file into the current animation.

Save As Save changes to another file name.

Page 69: Computer Graphic Lab Program Ms Word

Cut Remove selected image to the Clipboard.

Copy Duplicate selected image to the Clipboard.

Paste Place cut or copied image at the insertion point.

Delete Remove selected image without copying to the Clipboard.

Select All Select all images in the current animation.

Move Up/Down Position the selected image one frame closer to the beginning or to the end of the current animation.

Preview Play the results of your work without saving it.

Help Open this help file.

Animation Tab DialogThe Animation tab of GIF Animator provides control of the size, duration, and transparency attributes of an animation.

Animation Width : Allows you to specify the width of the space in which the animation plays. GIF Animator supplies a default value that you can modify. Specify a wider space for frames that move horizontally.

Animation Height Allows you to specify the height of the space in which the animation plays. GIF Animator supplies a default value that you can modify. Specify a taller space for frames that move vertically.

Image Count Displays the number of frames in the current animation. More images with smaller movements provide smoother motion, but create larger files and longer download times.Looping Click to select this check box if you want your animation to repeat.Repeat Count Allows you to specify the number of times you want your animation to repeat.

Trailing Comment Allows you to attach a comment to the animation.

Image Tab Dialog

The Image tab of GIF Animator provides control over characteristics of individual images within the animation.

Image Width Displays the width of the selected image.

Image Height Displays the height of the selected image.

Left Allows you to specify the position of the left edge of the selected image within its frame.

Top Allows you to specify the position of the top edge of the selected image within its frame.

Duration (1/100 s) Allows you to specify the amount of time, in 1/100 of a second increments, that the selected image displays during the animation. Varying duration throughout an animation can enhance the appearance of starts and stops and other effects.

Undraw Method Allows you to specify how frames display in the animation from the

Page 70: Computer Graphic Lab Program Ms Word

following choices:

Undefined Directs the browser to do nothing to the background before displaying the next image.

Leave Directs the browser to leave the previous graphic image as the next is drawn. This choice can create a shadowing effect.

Restore Background Directs the browser to redraw the original background as the current image is drawn.

Restore Previous Directs the browser to redraw the previous image as the current image is drawn.

Transparency Click to select this check box if you want to specify that one color in your animation will not display.

Transparent Color Click the box to display a palette from which you can choose a color that GIF Animator will treat as the transparent portion of the image. You can choose only one transparent color.

Options Tab Dialog

The Options tab of GIF Animator enables you to specify which palette GIF Animator uses to represent the images within the animation, and how colors are represented in the saved image.

Thumbnails Reflect Image Position Click to select this check box to see each image in the animation space that you specify in the Animation tab instead of as a full frame image.

Main Dialog Window Always on Top Click to select this check box to enable the GIF Animator window to remain the frontmost window on your desktop. This disables drag and drop to GIF Animator.

Import Color Palette Allows you to choose between the Browser palette, which provides a direct match to the most common browsers, and an “optimal” palette you can specify by clicking the dialog button to locate the Windows .PAL file you want to use.

Browser Palette GIF Animator uses a single palette that best matches the whole animation. Most efficient.

Optimal Palette GIF Animator creates a separate palette for each frame. High overhead; very good quality.

Load GIF Animator uses the palette you specify in the Open dialog.

Import Dither Method Allows you to choose a drawing method from the following list to best represent your color palette.