Sie sind auf Seite 1von 5

INTRODUCTION

Computer graphics is defined as creation, storage and manipulation of pictures and drawing by means of a digital computer. It enhances the power of communication between the computer and its users. It allows representation of huge set of numbers in the form of a graph or a picture which helps in better understanding of the characteristic and pattern of data. COMPONENTS OF VDU The video system consists of two basic components 1) 2) A video screen on which we actually see the images either in text or graphics. A video display adapter which is a special printed circuit board that plugs into one expansion slot present on the motherboard of the computer. A video display adapter is sometimes referred to as a video card. A video display adapter acts as an agent between the processor and video screen. The adapter consists of a special memory called VDU memory and circuitry which transfer the contents of the video memory on the screen. The microprocessor writes the information to be displayed on the screen into VDU memory, where as the display adapter circuitry transfers this information on to the screen. Each address on VDU memory corresponds to a specific location on the screen. The display adapter circuitry repeatedly (50 70 times per second) reads information from VDU memory and places it on the screen. This process is called refreshing the screen and the rate at which the display adapter refreshes the screen is called refresh rate. A number of display adapters are available with varying capabilities. Some of them are i) Monochrome Adapter (MA) ii) Hercules Adapter iii) Color Graphical Adapter (CGA) iv) Enhanced Graphic Adapter (EGA) v) Multicolor Graphics Adapter (MCGA)

vi) Video Graphics Arrays (VGA) vii) Super Video Graphics Arrays (SVGA) viii) Extended Graphics Adapter (XGA) VIDEO DISPLAY MODES Basically there are two different modes Text mode Graphics mode In text mode the video adapters provide built in support for ASCII characters which are constructed by using pixels. In the graphics mode, the user has the freedom to manipulate individual pixels on the screen, to form figures and text. We get very sharp images on the screen if we use monitors having higher resolution, i.e., monitors having more number of pixels. So it is essential to know the resolution of the monitor one uses. GRAPHIC FUNTIONS To execute the graphic functions graphic.h library file should be included in the C program. Some of the graphic functions are given below: i) initgraph() This function is used to initialize the graphics system and load the appropriate specified graphic driver and the mode used by the graphic function. The general form is initgraph(&gd, &gm, path); where gd The video driver to be used. gd=DETECT is used to find the current video driver in use.

gm It takes the integer value that corresponds the maximum resolution available from the monitor path Pathname is given if the drivers files are not present in the current location. ii) restorerectmode() This function is used to restore the original video mode detected by initgraph() iii) closegraph() This function de-allocates all the memory allocated by the graphic system. iv) cleardevice() This function clears the graphics screen and moves the current position to upper left corner of the screen corresponding to point (0, 0) v) putpixel(x, y, color) This function is used to place a pixel at particular co-ordinates. The list of color constant is given below: BLACK BLUE GREEN CYAN RED MAGENTA BROWN LIGHT GRAY DARK GRAY LIGHT BLUE LIGHT GREEN 0 1 2 3 4 5 6 7 8 9 10

LIGHT CYAN LIGHT RED YELLOW WHITE vi) getpixel(x, y)

11 12 14 15

LIGHT MAGENTA 13

This function is used to get the color value of the pixel (x, y) vii) getmaxx() This function returns the maximum x co-ordinate value of the current graphics driver. viii) getmaxy()

This function returns the maximum y coordinate value of current graphics driver. ix) getx() This function returns the current x co-ordinate position x) gety() This function returns the current y co-ordinate position xi) line(x1, y1, x2, y2) This function draws a line between two specified points (x1, y1) and (x2, y2) xii) rectangle(left, top, right, bottom) This function draws a rectangle from (left, top) point to (right, bottom) point xiii) circle(x, y, radius)

This function draws a circle with specified centre and radius xiv) arc(x, y, start_angle, end_angle, radius)

This function draws an arc at the center (x, y) with specified starting angle, ending angle and radius xv) ellipse(x, y, start_angle, end_angle, xradius, yradius) This function draws an ellipse. xvi) drawpoly(num_points, *poly_points)

This function draws a polygon with num_points-1 number of coordinates. xvii) setcolor(color)

This function sets the current drawing color xviii) getcolor() This function returns the current drawing color.

Das könnte Ihnen auch gefallen