BCA Raipur - BCA Notes S-1

Post your notes and other just by mailing us at bcaraipur@live.com

BCA Raipur - BCA Notes S-2

Post your notes and other just by mailing us at bcaraipur@live.com

BCA Raipur - BCA Notes S-3

Post your notes and other just by mailing us at bcaraipur@live.com

BCA Raipur - BCA Notes S-4

Post your notes and other just by mailing us at bcaraipur@live.com

BCA Raipur - BCA Notes S-5

Post your notes and other just by mailing us at bcaraipur@live.com

google search

Popular Posts


Welcome to BCA Notes

>>>>>>>>>>>>>>>>

Visitors

Search This Blog

Blogger templates

Visitor Map


Showing posts with label Computer Graphics. Show all posts
Showing posts with label Computer Graphics. Show all posts

Friday, 5 June 2015

Create a Program to change background colour USING setbkcolour function in cpp?

Create a Program to change  background colour USING setbkcolour function in cpp?

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

#include<iostream.h>

int main()

{

   int gd=DETECT,gm;

   //graphic construct is DETECT

   initgraph(&gd,&gm,"c:\\TurboC3\\BGI\\");

   //init graph has three parameter graphic driver graphic mode,bgi graphic path

setbkcolor(10);

   clrscr();

   //                 clear screen

   int x,y,x1,y1;

   cout<<"Enter x,y,x1,y1"<<endl;

   cin>>x>>y>>x1>>y1;

   line(x,y,x1,y1);

   //line(x,y,x1,y1)

      getch();

   closegraph();

   //closegraph();

     return(0);

}




Create a LINE USING line function in cpp?

2. Create a LINE USING line function in cpp?


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<iostream.h>
int main()
{
   int gd=DETECT,gm;
   //graphic construct is DETECT
   initgraph(&gd,&gm,"c:\\TurboC3\\BGI\\");
   //init graph has three parameter graphic driver graphic mode,bgi graphic path
   clrscr();
   //                 clear screen
   int x,y,x1,y1;
   cout<<"Enter x,y,x1,y1"<<endl;
   cin>>x>>y>>x1>>y1;
   line(x,y,x1,y1);
   //line(x,y,x1,y1)
      getch();
   closegraph();
   //closegraph();
     return(0);
}


Program to make a circle of circle with (100,100,100)

   1.     Program to make a circle of circle with (100,100,100)

Source Code:-

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
int main()
{
   int gd=DETECT,gm;
   //graphic construct is DETECT
   initgraph(&gd,&gm,"c:\\TurboC3\\BGI\\");
   //init graph has three parameter graphic driver graphic mode,BGI graphic path
   clrscr();
   //                 clear screen
   //defaultgraph();
   circle(100,100,100);
   //circle(x,y,Radius)

   getch();
   closegraph();d
   //closegraph();
     return(0);
}

Output:-


Sunday, 31 May 2015

Computer Graphics Notes Part-I

   1. What is Computer Graphics?

●       Creation, Manipulation, and Storage of geometric objects (modeling) and their images (rendering)
●       Display those images on screens or hard copy devices
●       Image processing
●       Others: GUI, Haptics, Displays (VR)...

   2. What drives computer graphics?

●       Game Industry
–        The newest driving force in CG
●       Why?  Volume and Profit
●       This is why we have commodity GPUs
–        Focus on interactivity
–        Cost effective solutions
–        Avoiding computing and other tricks
–        Games drive the baseline

    3. The Advantages of Interactive Graphics

Today, high quality graphics displays of personal computer provide one of the most natural means of communicating with a computer
It provides tools for producing pictures not only of concrete, ‘real-world’ objects but also of abstract, synthetic objects, such as mathematical surfaces in 4D and of data that have no inherent geometry, such as survey results.
It has an ability to show moving pictures, and thus it is possible to produce animations with interactive graphics.

With interactive graphics use can also control the animation by adjusting the speed, the portion of the total scene in view, the geometric relationship of the objects in the scene to one another, the amount of detail shown and so on.

The interactive graphics provides tool called motion dynamics. With this tool user can move and tumble objects with respect to a stationary observer, or he can make objects stationary and the viewer moving around them. A typical example is walking thorough made by builder to show flat interior and building surroundings. In many case it is also possible to move both objects and view.

4. Applications of computer graphics.

n  Computer Aided Design (CAD)
n  Presentation Graphics
n  Computer Art
n  Entertainment (animation, games, …)
n  Education & Training
n  Visualization (scientific & business)
n  Image Processing
n  Graphical User Interfaces

     5. What is vector and raster graphics?

n  Raster Graphics


Raster images, also known as bitmap images are made up of pixels that are arranged in a grid. For instance, a desktop icon, like the one shown here, is a 32px by 32px image that is, it is made up of a table of pixels that has 32 rows and 32 columns. These tiny pixels have different color information and when combined, they form the image. Common raster or bitmap file formats are .bmp, .jpeg or .jpg, .gif, .png, .pict, .tiff, .pcx and .psd. You can edit a bitmap or raster image using Adobe Photoshop, Microsoft Paint, and The GIMP etc.

n  Vector graphics

Unlike raster images, vector images are made up mathematically defined geometric shapes like lines, shapes and curves, with additional attributes like color and fill. A vector image file basically contains information on these shapes such as where they start, what are their paths, the curve of the paths etc. Software draws the vector image by reading this data.
Common vector image formats are .ai, .cdr, .cmx, .dxf, .wmf. Most popular vector graphics editing programs are Adobe Illustrator and CorelDRAW.

6.Difference between Raster and Vector Graphics

1.     Raster or Bitmap images are resolution dependent. Because of this it’s not possible to increase or decrease their size without sacrificing on image quality.
When the size of a bitmap or raster image is reduced, some pixels must be thrown away. Thus losing some of the image’s data. When you increase its size, some new pixels must be created based on the color values of the surrounding pixels, which is not accurate thus affecting the quality of image.
Vector based images are not dependent on resolution. The size of vector image can be increased or decreased to any proportion without affecting the image’s quality. Fonts are a type of vector objects.

2.     Raster or bitmap images are always rectangular in shape. If you see a bitmap image with any other shape then it just means that the rest of the pixels have same color as the image’s background color. Vector images, however, can have any shape. For example, see the image here. The vector bitmap and the vector circle seem to be the same on a white background. However, on any other color, the difference is obvious as the bitmap circle’s white pixels are visible, thus proving its rectangular shape.
3.     Unlike bitmap/raster image, Vector images can’t be used for realistic images. This is because vector images are made up of solid color areas and mathematical gradients, so they can’t be used to show continuous tones of colors in a natural photograph.
You must have noticed that most of the vector images have a cartoon like appearance. The reason behind it is the same; vector graphics can’t display continuous variation in color. 

However, the vector graphics technology is advancing pretty fast, and in near future we may be able to get a bitmap like appearance in vector graphic.

All scanned images and images taken from digital cameras are raster or bitmap images. Vector images are basically created using software like Adobe Illustrator. It’s impossible to capture/scan an image and convert it into a vector format without using specialized conversion software. However, it’s very easy to convert a vector image to a raster image. This process is called rasterizing.