This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Showing posts with label computer graphics using c program. Show all posts
Showing posts with label computer graphics using c program. Show all posts

Sunday, November 25, 2012

DEVELOPING AN ANIMATION USING MASKING OF LAYER


DEVELOPING AN ANIMATION USING MASKING OF LAYER


Step 1 : Create a new Flash document
Step 2 : Insert one more layer, rather than the default layer.
Step 3 : Rename the top layer to "Mask" and the layer below that to "background".
Step 4 : Import your picture to the "background" layer.
Step 5 : Using Oval tool from your tool box, draw a circle in your "Mask" layer and delete it's border.
Step 6 : Drag the circle to one end of your picture.
Step 7 : Now go to"frame 40" of your "Mask" layer and press "F6" to insert a new keyframe.
Step 8 : Now go to "frame 40" of your "background" layer and press "F5" to insert frames, so that your background image is available all through your mask.
Step 9 : Select "frame 40" of your "Mask" layer, that is your new keyframe, Keeping the playhead on "frame 40" of "Mask" layer, drag the circle to other end of your picture.
Step 10 : Now go back to "frame 1" of your "Mask" layer, keeping the playhead on "frame 1" of your "Mask" layer, select Shape tween in your properties window.
Step 11 : Right click on the "Mask" layer (the area where you named the layer not where the frames exist) and select Mask.
Step 12 : select Control > Play

Step 13 : Stop












     OUTPUT:-




















IMAGE EDITING USING CLONING



IMAGE EDITING USING CLONING


Step 1 : Create a new Photoshop document
Step 2 : Import a picture on to the document
Step 3 : Select the Clone Stamp Tool from the toolbox.
Step 4 : On the Options bar across the top of the screen, select the brush size and type of brush you want to use
Step 5 : Move the cursor over the image to the area you would like to reproduce elsewhere.
Step 6 : Hold down the Alt key and click to select the area to clone from.
Step 7 : When you release the mouse, the brush will appear on the image in the shape of the brush selected. Crosshairs will appear over the area to be reproduced and move with the brush.
Step 8 : Click repeatedly or drag the mouse to reproduce the pattern.
Step 9 : Stop












OUTPUT:-




DEVELOPING AN ANIMATION USING ONION SKIN TECHNIQUE


DEVELOPING AN ANIMATION USING ONION SKIN TECHNIQUE


Step 1 : Create a new Flash document

Step 2 : Choose View > Grid > Show Grid

Step 3 : In the Timeline, select Frame 1

Step 4 : In the Tool Box, select the oval tool

Step 5 : Near the top of the edge, draw a circle

Step 6 : In the Timeline, select Frame 2

Step 7 : Choose Insert > Timeline > Key frame

Step 8 : Select the ball and reposition it at the bottom of the previous ball

Step 9 : Similarly create some more key frames and do the same in such a way that balls are positioned in a wave form

Step 10 : In the status bar of the timeline, check the onion skin button

Step 11 : In the timeline, check and modify onion marker button. Select Onion 2, Onion 5 or Onion all

Step 12 : Select Control > Play

Step 13 : Stop


















OUTPUT:-

Text Box: ANIMATION USING ONION SKIN METHOD




























IMAGE EDITING USING CROPING


IMAGE EDITING USING CROPING


Step 1 : Create a new Photoshop document
Step 2 : Import a picture on to the document
Step 3 : Select the Crop tool
Step 4 : Drag over the part of the image you want to keep to create a marquee.
Step 5 : To complete the crop, press Enter or double-click inside the cropping marquee.
Step 6 : Stop
































OUTPUT:-













DEVELOPING AN ANIMATION USING GUIDE LAYER TECHNIQUE


DEVELOPING AN ANIMATION USING GUIDE LAYER TECHNIQUE


Step 1 : Create a new Flash document

Step 2 : Choose View > Grid > Show Grid

Step 3 : In the Timeline, select Frame 1

Step 4 : In Frame 1, use the oval tool to create a circle that represents a ball

Step 5 : In the timeline, select Frame 20, and choose Insert > Frame

Step 6 : In the Timeline, select Frame 1

Step 7 : Choose Insert > Create Motion Tween

Step 8 : In the timeline, position in Frame 5, drag the ball to a new position

Step 9 : Do the same for Frame 10, 15 and 20

Step 10 : At the bottom of the timeline, click the add guide layer button

Step 11 : With the motion guide layer selected, use the pencil tool to draw a line on the stage showing the path

Step 12 : In Frame 1, drag the circle to position over the beginning of the motion path

Step 13 : In Frame 20, drag the circle to reposition it over the end of the motion path

Step 14 : Select  the first and select Control > Play

Step 15 : Stop


GUIDE LAYER ANIMATION
 
Output
 































3 DIMENSIONAL ROTATION


3 DIMENSIONAL ROTATION

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
float px[10],py[10],tx[10],ty[10],tx2[10],ty2[10],px2[10],py2[10];
void disp1();
void disp2();
void rotation();
float depth,vertices;
void main()
{
            int gd=DETECT,gm,i;
            initgraph(&gd,&gm,"");
            if(graphresult()!=grOk)
            {
                        printf("Graphics error");
                        getch();
                        return;
            }
            printf("Enter number of vertices : ");
            scanf("%f",&vertices);
            printf("Enter the depth value : ");
            scanf("%f",&depth);
            printf("Enter the x and y coordinates : ");
            for(i=0;i<vertices;i++)
            {
                        scanf("%f%f",&px[i],&py[i]);
                        px2[i]=px[i]+depth;
                        py2[i]=py[i]+depth;
            }
            disp1();
            rotation();
            disp2();
            getch();
}
void disp1()
{
            int i;
            for(i=0;i<vertices-1;i++)
            {
                         line(px[i],py[i],px[i+1],py[i+1]);
                         line(px2[i],py2[i],px2[i+1],py2[i+1]);
            }
             line(px[vertices-1],py[vertices-1],px[0],py[0]);
             line(px2[vertices-1],py2[vertices-1],px2[0],py2[0]);

            for(i=0;i<vertices;i++)
            line(px[i],py[i],px2[i],py2[i]);
}
void disp2()
{
            int i;
            for(i=0;i<vertices-1;i++)
            {
                        line(tx[i],ty[i],tx[i+1],ty[i+1]);
                         line(tx2[i],ty2[i],tx2[i+1],ty2[i+1]);
            }
            line(tx[vertices-1],ty[vertices-1],tx[0],ty[0]);
            line(tx2[vertices-1],ty2[vertices-1],tx2[0],ty2[0]);
            for(i=0;i<vertices;i++)
                        line(tx[i],ty[i],tx2[i],ty2[i]);
}
void rotation()
{
            float i,an,rx,ry,dir,s,a;
            printf("Enter the rotation angle : ");
            scanf("%f",&an);
            printf("Enter the rotation point : ");
            scanf("%f%f",&rx,&ry);
            printf("Enter the dircetion of rotation [1 for clockwise / 2 for anticlockwise] : ");
            scanf("%f",&dir);
            if(dir==1)
                        s=1;
            else
                        s=-1;
            a=an*3.14/180;
            for(i=0;i<vertices;i++)
            {
                        tx[i]=rx+(px[i]-rx)*cos(a) - (py[i]-ry)*sin(a)*s;
                        ty[i]=ry+(px[i]-rx)*sin(a)*s  + (py[i]-ry)*cos(a);
                        tx2[i]=rx+(px2[i]-rx)*cos(a) - (py2[i]-ry)*sin(a)*s;
                        ty2[i]=ry+(px2[i]-rx)*sin(a)*s + (py2[i]-ry)*cos(a);
            }
}










                                    3-DIMENSIONAL ROTATION


OUTPUT:


Enter the number of vertices: 3
Enter the depth value : 20
Enter the x and y coordinates : 100
150
150
150
150
100
Enter the rotation angle: 30
Enter the rotation point : 50
50
Enter the direction of rotation (1-Clockwise, 2-Anticlockwise) : 1












3 DIMENSIONAL SCALING


3 DIMENSIONAL SCALING

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
float px[10],py[10],tx[10],ty[10],tx2[10],ty2[10],px2[10],py2[10];
void disp1();
void disp2();
void scaling();
float depth,vertices;
void main()
{
            int gd=DETECT,gm,i;
            initgraph(&gd,&gm,"");
            if(graphresult()!=grOk)
            {
                         printf("Graphics error");
                        getch();
                        return;
            }
            printf("Enter number of vertices : ");
            scanf("%f",&vertices);
            printf("Enter the depth value : ");
            scanf("%f",&depth);
            printf("Enter the x and y coordinates : ");
            for(i=0;i<vertices;i++)
            {
                        scanf("%f%f",&px[i],&py[i]);
                        px2[i]=px[i]+depth;
                        py2[i]=py[i]+depth;
            }
            disp1();
            scaling();
            disp2();
            getch();
            return;
}
void disp1()
{
            int i;
            for(i=0;i<vertices-1;i++)
            {
                        line(px[i],py[i],px[i+1],py[i+1]);
                        line(px2[i],py2[i],px2[i+1],py2[i+1]);
            }
            line(px[vertices-1],py[vertices-1],px[0],py[0]);
            line(px2[vertices-1],py2[vertices-1],px2[0],py2[0]);
            for(i=0;i<vertices;i++)
            line(px[i],py[i],px2[i],py2[i]);
}
void disp2()
{
            int i;
            for(i=0;i<vertices-1;i++)
            {
                        line(tx[i],ty[i],tx[i+1],ty[i+1]);
                        line(tx2[i],ty2[i],tx2[i+1],ty2[i+1]);
            }
            line(tx[vertices-1],ty[vertices-1],tx[0],ty[0]);
            line(tx2[vertices-1],ty2[vertices-1],tx2[0],ty2[0]);
            for(i=0;i<vertices;i++)
                         line(tx[i],ty[i],tx2[i],ty2[i]);
            return;
}
void scaling()
{
            float sx,sy,sz,i,dep;
            printf("Enter the scale factors(3 values): ");
            scanf("%f%f%f",&sx,&sy,&sz);
            for(i=0;i<vertices;i++)
            {
                        tx[i]=px[i]*sx;
                         ty[i]=py[i]*sy;
                         dep=depth*sz;
                        tx2[i]=tx[i]+dep;
                        ty2[i]=ty[i]+dep;
            }
}

















                                    3-DIMENSIONAL SCALING


OUTPUT:


Enter the number of vertices: 3
Enter the depth value : 15
Enter the x and y coordinates : 100
50
50
50
50
100
Enter the scale factors ( 3 values ) : 2
2
2



2 DIMENSIONAL TRANSLATION


2 DIMENSIONAL TRANSLATION

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
int px[10],py[10],tx[10],ty[10];
void disp1();
void disp2();
void translation();
int i,n=0;
void main()
{
   /*reqest auto detection */
   int gdriver = DETECT, gmode, errorcode;


   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   /* an error occurred */
   if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }
   setcolor(getmaxcolor());
   printf("\n\n Enter the no of vertics:");
   scanf("%d",&n );
   printf("\n\nEnter the value for coordinate:");
   for(i=0;i<n;i++)
  {
scanf("%d",&px[i]);
scanf("%d",&py[i]);
  }
  clrscr();
  disp1();
  translation();
  clrscr();
  disp2();
  getch();
  closegraph();
}

void disp1()
{
for(i=0;i<n-1;i++)
line(px[i],py[i],px[i+1],py[i+1]);
line(px[n-1],py[n-1],px[0],py[0]);
getch();
}
void disp2()
{
for(i=0;i<n-1;i++)
line(tx[i],ty[i],tx[i+1],ty[i+1]);
line(tx[n-1],ty[n-1],tx[0],ty[0]);
getch();
}
void translation()
{
int dx,dy;
printf("Enter the translation vector:");
scanf("%d %d",&dx,&dy);
for(i=0;i<n;i++)
 {
 tx[i]=px[i]+dx;
 ty[i]=py[i]+dy;
 }
 }

                                   





















2 DIMENSIONAL TRANSLATION


OUTPUT:-

Enter the number of vertices:3

Enter the coordinate 1: 100 200

Enter the coordinate 2: 200 200

Enter the coordinate 3: 200 200

Enter the translation vector: 50 50














3 DIMENSIONAL TRANSLATION


3 DIMENSIONAL TRANSLATION

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
float px[10],py[10],tx[10],ty[10],tx2[10],ty2[10],px2[10],py2[10];
void disp1();
void disp2();
void translation();
float depth,vertices;
void main()
{
            int gd=DETECT,gm,i;
            initgraph(&gd,&gm,"");
            if(graphresult()!=grOk)
            {
                        printf("Graphics error");
                        getch();
                        return;
            }
            printf("Enter number of vertices : ");
            scanf("%f",&vertices);
            printf("Enter the depth value : ");
            scanf("%f",&depth);
            printf("Enter the x and y coordinates : ");
            for(i=0;i<vertices;i++)
            {
                        scanf("%f%f",&px[i],&py[i]);
                        px2[i]=px[i]+depth;
                        py2[i]=py[i]+depth;
            }
            disp1();
            translation();
            disp2();
            getch();
}
void disp1()
{
            int i;
            for(i=0;i<vertices-1;i++)
            {
                         line(px[i],py[i],px[i+1],py[i+1]);
                         line(px2[i],py2[i],px2[i+1],py2[i+1]);
            }
             line(px[vertices-1],py[vertices-1],px[0],py[0]);
             line(px2[vertices-1],py2[vertices-1],px2[0],py2[0]);

            for(i=0;i<vertices;i++)
                        line(px[i],py[i],px2[i],py2[i]);
}
void disp2()
{
            int i;
            for(i=0;i<vertices-1;i++)
            {
                         line(tx[i],ty[i],tx[i+1],ty[i+1]);
                         line(tx2[i],ty2[i],tx2[i+1],ty2[i+1]);
            }
            line(tx[vertices-1],ty[vertices-1],tx[0],ty[0]);
            line(tx2[vertices-1],ty2[vertices-1],tx2[0],ty2[0]);
            for(i=0;i<vertices;i++)
                         line(tx[i],ty[i],tx2[i],ty2[i]);
            return;
}
void translation()
{
            float dx,dy,i;
            printf("Enter the translation value ( 2 values )  : ");
            scanf("%f%f",&dx,&dy);
            for(i=0;i<vertices;i++)
            {
                         tx[i]=px[i]+dx;
                         ty[i]=py[i]+dy;
                        tx2[i]=dx+px2[i];
                         ty2[i]=dy+py2[i];
            }
}


                       















3-DIMENSIONAL TRANSLATION


OUTPUT:


Enter the number of vertices: 3
Enter the depth value : 10
Enter the x and y coordinates : 100
200
200
200
200
100