You are on page 1of 6

PRACTICAL-1 INTRODUTION TO COMPUTER GRAPHICS FUNTIONS 1.

initgraph() It initializesthe graphics system by loading a graphics driverfrom disc driver for validating a rigistered driver then puting the system into a graphics mode.It also resets all graphics colors,palettle,current position,etc Declaration: Void far initgraph(int far *graphdriver, int far *graphmode,char far *pathtodriver); 2. closegraph() It dealloates all memory allocated by the graphics system.It then restores the screen to the mode it was in before initgraph is called.It does not return any value. Declaration: Void far closegraph(void); 3. putpixel() Putpixel puts a point that is defined at (x,y).It plots a point at the specified value.It does not return any value. Declration:

Void far putpixel(int x,int y,int color); 4. getpixel() It gets the color of the pixel specified at (x,y).It returns the color of the given pixel. Declaration: Unsigned far getpixel(int x,int y); 5. getcolor() It returns the current drawing color. Declaration: int far getcolor(void); 6.setcolor() It sets the current drawing color to color which can range from 0 to getmax color.To select the drawing color with a setcolor either the color number or the equivalent color name can be passed.It does not return any value. Declaration: void far setcolor(int color); 7. ellipse() It draws an ellipse.

Declaration: void far ellipse(int x,int y,int stangle,int endangle, int xradius,int yradius); 8. fillellipse() It draws and fills an ellipse. Declaration: void far fillellipse(int x,int y,int xradius,int yradius); 9. sector() It draws and fills an elipticle pie slice in the current drawing area,then fills it using a pattern and color defined by setfill style or setfill pattern. Declaration: void far sector(int x,int y,int stangle,int endangle, int xradius,int yradius);

10. arc() It draws an circular arc in the current drawing area. Declaration: void far arc(int x,int y,int stangle,int endangel,int radius);

11. circle(),pieslice() Circle draws a circle in the current drawing area. Pieslice draws a pieslice in the current drawing area fills it using the current fill pattern and fill color. Declaration: void far circle(int x,int y,int radius); void far pieslice(int x,int hy,int stangle,int endangle,int radius); 12.line() It draws a line from (x1,y1) to (x2,y2) using the current color,line style and thickness.It does not update the current position. Declaration: void far line(int x1,int y1,int x2,int y2);

13. linerel() It draws a line from current position (CP) to a point that is defined at a relative distance(dx,dy) Declaration:

void far linerel(int dx,int dy); 14. rectangle() It draws a rectangle in the current line style,thickness and drawing color.(top,left) is the upper left corner and (bottom ,right) id the lower right corner which are to be passed to draw a rectangle.It returns nothing. Declaration: void far rectangle(int left,int top,int right,int bottom); 15. fillpoly() It draws and fills a polygon. Declaration: void far fillpoly(int numpoints,int far *polyoints);

16. clearviewport() Clears the current viewport. Declaration: void far clearviewport(void); 17. outtextxy()

It displays a string at the specified location in the viewport. Declaration: void far outtextxy(int x,int y,char far *textstring);

You might also like