Вы находитесь на странице: 1из 32

Kuvempu University Assignments for B.Sc.(IT) & M.Sc.

(IT) Courses Subject: Graphics & Multimedia Subject Code: BSIT 51 Assignment: TA (Compulsory) 1. What is the meaning of interactive computer graphics? List the various applications of the computer graphics.

The term interactive graphics refers to devices and systems that facilitate the man-machine graphic communication, in a way, which is more convenient than the writing convention. For example, to draw a straight line between two points, one has to input the coordinates of the two end points. In interactive graphics with the help of graphical input technique by indicating two end points on the display screen draws the line. While designing such a system emphasis is placed on Ease for interaction -Communication with the system Speed of interaction - How fast one can modify a displayed image.

The hardware components required to generate interactive graphics are the input device, the output device (usually display) and the computer system. The human operator is also an integral part of the interactive system. The text and graphics displayed act as an input to the human vision system and, Interactive Graphics therefore, the reaction of the human being will depend on how quickly one can see and appreciate the graphics present on the display. Many people for different domain of applications use interactive Graphics. For example, structural engineers use for efficient design of structures on the basis of the analysis of stress in various elements of the structure. From the survey it is evident that in future, engineers, designers etc., will be using computer graphics quite extensively. There is virtually no area in which graphical displays cannot be used to some advantage, and so it is not surprising to find the use of computer graphics so widespread. Today, we find computer Graphics used routinely in such diverse areas such as science, engineering, medicine, business, industry, government, art, entertainment, advertising, education, training, etc.
2. Explain in detail the Hardware required for effective graphics on the computer system.

Computers have been getting progressively more inexpensive and it has become household article in these days. Selection of right processor and motherboard is important for a graphic application. A prospective buyer of a system has multiple choices of the CPU. Four companies Intel (Pentium, Class P5 and P6), Centaur (IDT-C6, class P5), Cyrix (6X86 Class P6) and AMD (K6 class P6), offer P5 and P6 varieties of x86 class processors with MMX and clock speeds in the range of 200-300 MHz. Intels 440LX chipset with support for Accelerated Graphics Port (AGP) relieves congestion on the PCs PCI bus by moving graphics traffic on a dedicated point to

point channel between the graphic controller and the system chip set. The main factors to be considered for the selection for an important application are power consumption, mathematical and graphical processing capability and level of integration. Intel has captured a major chunk of PC market share with the introduction of Pentium processors. These microprocessors will drive advances PCs, workstations, super-servers, and promise improved graphics, better networking and video on desktop PCs. Apple believes that the horse power of the RISC processors will be required to run system software and applications of the future and CISC hardware and software has no further potential. DEC, IBM, Motorola, SGI/Mips and SUN Microsystems have all gone to the RISC route. If one is planning to do any serious work on graphics-based application using windows, OS/2, Windows NT, or UNIX/LINUX a system based on Pentium CPU is practically a necessity.
3. Compare Raster scan system with random scan system.

In raster scan display, the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called refresh buffer or frame buffer. In random scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. It draws a picture one line at a time and so it is referred to as vector displays.

Raster scan
The Most common type of graphics monitor employing a CRT is the raster-scan Display, based on television technology. In a raster- scan system; the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called the refresh buffer or frame buffer. Each point on the screen is called pixel. On a black and system with one bit per pixel, the frame buffer is called bitmap. For systems with multiple bits per pixel, the frame buffer is referred to as a pix map. Refreshing on raster scan display is carried out at the rate of 60 to 80 frames per second. Some displays use interlaced refresh procedure. First, all points on the even numbered scan lines are displayed then all the points along odd numbered lines are displayed. This is an effective technique for avoiding flickering.
F

Random scan display


When operated as a random-scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. Random scan monitors draw a picture one line at a time and for this reason they are also referred as vector displays (or stroke-writing or calligraphic displays). The component lines of a picture can be drawn and refreshed by a random-scan system in any specified order. A pen plotter operates in a similar way and is an example of a random-scan, hard-copy device. Refresh rate on a random-scan system depends on the number of lines to be displayed. Picture definition is now stored as a set of line- drawing commands in an area of memory referred to as the refresh display file. Sometimes the refresh display file is called the display list, display program, or simply the refresh buffer.

4. How many colors are possible if a. 24 bits / pixel is used b. 8 bits / pixel is used Justify your answer

Widely accepted industry standard uses 3 bytes, or 24 bits, per pixel, with one byte for each primary color results in 256 different intensity levels for each primary color. Thus a pixel can take on a color from 256 X 256 X 256 or 16.7 million possible choices. In Bi-level image

representation one bit per pixel is used to represent black-and white images. In gray level image 8 bits per pixel to allow a total of 256 intensity or gray levels. Image representation using lookup table can be viewed as a compromise between our desire to have a lower storage requirement and our need to support a reasonably sufficient number of Bit 1 : r 0 0 0 0 1 1 1 1 Bit 2 : g 0 0 1 1 0 0 1 1 bit 3: b______ 0 black 1 blue 0 green 1 cyan 0 red 1 Magenta 0 Yellow 1 White

simultaneous colors.

5. List and explain different text mode built-in functions of C Programming language.

There are two modes through which we can display text and Graphics in C language. They are: Text Mode: It is possible to handle only text Graphic Mode: It is possible to display, capture and animate figures

Text Mode
In this mode it is possible to handle only text. Text mode display can be in two forms 25 rows of 40 columns or 25 rows of 80 columns. Text mode can have 2 colors in monochrome monitor and 16 colors in color monitor. printf () function helps the text to be displayed on the monitor. To display text in attractive manner many different functions can be used. To execute these functions # include <conio.h> to be included in the program.

1.textmode( int mode);


This function sets the number of rows and columns of the screen, mode variable can take the values 0, 1, 1, or 3. 0: represents 40 column black and white 1: represents 40 column color 2: represents 80 column black and white 3: represents 80 column color Example: textmode(2); // sets the screen to 80 column black and white

2.clrscr();
This function clears the entire screen and locates the cursor on the top left corner(1,1) Example clrscr(); // clears the screen

3. gotoxy(int x, int y);


This function positions the cursor to the location specified by x and y. x represents the row number and y represents the column number. Example: gotoxy(10,20) // cursor is placed in 20th column of 10th row

4. textbackground (int color);


This function changes the background color of the text mode. Valid colors for the CGA are from 0 to 6 namely BLACK, BLUE, GREEN, CYAN, RED, MAGENTA and BROWN. Example: textbackground(2); Or //changes background color to blue textbackground(BLUE);

5. textcolor (int color);


This function sets the subsequent text color numbered between 0 to 15 and 128 for blinking. Example : textcolor(3); // set the next text color to Green

6. delline ();
It is possible to delete a line of text and after the deletion all the subsequent lines will be pushed up by one line Example : /* deletes the 5 line*/ gotoxy (5,4); delline ( );
th

7. insline()
Inserts a blank line at the current cursor position Example: /* inserts line at the 3 row */ gotoxy
rd

(3,5); insline ( );

6.

Write a C program to create Indian national flag.

Assignment: TB (Compulsory)

PART - A
1. What is the need for computer graphics?
Computer Graphics remains one of the most exciting and rapidly growing fields. Old Chinese saying One picture is worth of thousand words can be modified in this computer era into One picture is worth of many kilobytes of data. It is natural to expect that graphical communication, which is an older and more popular method of exchanging information than verbal communication, will often be more convenient when computers are utilized for this purpose. This is true because one must represent objects in two-dimensional and threedimensional spaces. Computer Graphics has revolutionized almost every computer-based application in science and technology. As the volume of information increases, problem of storage arises. As time is money, in the 21 century people doesnt have time to read huge number of pages. So this problem is solved by Computer Graphics. Pictures can represent a huge database like bar charts, pie charts etc. Suppose, we have to show the performance of some factory related with profit since from 1980. One requires large number of pages to store this huge information related with financial,

st

2. What is graphics processor? Why it is needed?


Video/Graphic processing can be made faster in two ways: by using graphic co-processor and a graphic Accelerator. The graphic co-processor boosts video performance by assuming tasks normally handled by the CPU. An accelerator takes control of a graphic task otherwise

performed by the CPU but it is not programmable. It is a fixed function processor and which carries out specific tasks hard-coded into the chip. The video adapters and monitors use analog signals and could generate 64 values for each of the primary colors RED, GREEN, and BLUE. The result is that these systems can present 256 colors simultaneously on the screen from a palette on 262144 colors.

To provide visual interface, additional processing capability is to be provided to the existing CPU. The solution is to provide dedicated graphic processor. This helps in managing the screen faster with an equivalent software algorithm executed on the CPU and certain amount of parallelism can be achieved for completing the graphic command. Several manufacturers of personal computers use a proprietary graphic processor. For example, Intel 82786 is essentially a line drawing processor; Texas Instruments 43010 is a high performance general-purpose processor.

3. What is a pixel ?
p(x,y) is a pixel at a horizontal distance x and vertical distance y from the origin. Any picture is represented by the combination of points. Most of the graphic packages are designed for Cartesian coordinate specification.

Pixel may be defined as the smallest size object or color spot that can be displayed and addressed on a monitor. Any image that is displayed on the monitor is made up of thousands of such small pixels. The closely spaced pixels divide the image area into a compact and uniform two-dimensional grid of pixel lines and columns.

4. Why C language is popular for graphics programming?


The need for higher-level abstraction that would facilitate the writing of operating systems drove the development of C language. Pascal and C are structured languages, rich in expressive power and applicable to a wide variety of users. Because of the rich set of graphical functions available in these languages helps in design of graphical applications. The C code is small, fast, portable, and flexible. C has become a choice for todays professionals, developers and also for Graphic programming.

5. Define resolution.
Image resolution refers as the pixel spacing i.e. the distance from one pixel to the next pixel. A typical PC monitor displays screen images with a resolution somewhere between 25 pixels per inch and 80 pixels per inch. Pixel is the smallest element of a displayed image, and dots (red, green and blue) are the smallest elements of a display surface (monitor screen). The dot pitch is the measure of screen resolution. The smaller the dot pitch, the higher the resolution, sharpness and detail of the image displayed.

6. Define aspect ratio.


The aspect ratio of the image is the ratio of the number of X pixels to the number of Y pixels. The standard aspect ratio PCs is 4:3, and some use 5:4. Monitors are calibrated to this standard so that when you draw a circle it appears to be a circle and not an ellipse.

7. Why refreshing is required in CRT ?


When the electron beam strikes a dot of phosphor material, it glows for a fraction of a second and then fades. As brightness of the dots begins to reduce, the screen-image becomes unstable and gradually fades out. In order to maintain a stable image, the electron beam must sweep the entire surface of the screen and then return to redraw it number of times per second. This process is called refreshing the screen. If the electron beam takes too long to return and redraw a pixel, the pixel begins to fade results in flicker in the image. In order to avoid flicker the screen image must be redrawn sufficiently quickly that the eye cannot tell that refresh is going on. The refresh rate is the number of times per second that the screen is refreshed. Some monitor uses a technique called interlacing for refreshing every line of the screen. In the first pass, odd-numbered lines are refreshed, and in the second pass, even numbered lines are refreshed. This allows the refresh rate to be doubled because only half the screen is redrawn at a time.

8. Name the different positioning devices.


The devices discussed so far, the mouse, the tablet, the joystick are called positioning devices. They are able to position the curser at any point on the screen. one needs devices that can point to a given position on the screen. This becomes essential when a diagram is already there on the screen, but some changes are to be made. So, instead of trying to know its coordinates, it is advisable to simply point to that portion of the picture and asks for changes. The simplest of such devices is the light pen. Its principle is extremely simple.

9. What are pointing devices?


The Mouse
A mouse is a small handled box used to position the screen cursor. It has two wheels at right angles to each other. Each of these wheels is connected to the shaft encode. For every incremental rotation of the wheel, an electrical signal is produced by the shaft encode. As the device is moved on a flat surface, the movement is coded in the x and y directions by counting the number of pulses received from the shaft encoder. These values are held in separate registers and the computer can sample them at a suitable rate. The Joy Stick Here, as the name suggests, we have a stick (or a handle, to be more exact) that can be moved in all possible directions and amount of movement in that direction controls the curser movement. Once the curser arrives at the desired position, clicking the buttons can choose the picture and any modification can be made. In fact, the joysticks were originally used for video games (hence the name joy stick). TABLETS

A stylus or a pen like apparatus, which is connected by a coaxial cable to the computer, is used to point to the grid. Each horizontal and vertical line carries a uniquely coded digital signal. When the stylus touches the junction of one horizontal and another vertical junction, the stylus picks up their corresponding signals. For example the 100 vertical signal and 125 horizontal signal identifies the position as the junction of the 100 vertical and 125 horizontal line or say the point (125, 100) that is unique
th th th th

10. What is multimedia?


The word Multimedia seems to be everywhere nowadays. The word multimedia is a compound of the Latin prefix multi meaning many, and the Latin-derived work media, which is the plural of the world medium. So multimedia simply means using more than one kind of medium.

11. What are sound cards?


With the introduction of Digital signal Processors, the CPU was relieved of the burden of processing sound and voice tasks, which in turn resulted in usable and fast voice recognition. The Wavetable synthesis board Wave Blaster, add on for sound blaster 16, helped in bringing out more realistic instrument and voice reproduction. Soon other cards like sound blaster AWE32, with full feature playback and multi-track music composition packages. The MIDI card with improved features can offer up to 128 instrument sounds. Creative labs have also come up with integrated sound chipsets, Vibra 8 and Vibra 16 which are single chip equivalent of sound blaster pro and sound blaster 16 cards plus and ISA bus interface aimed at main board implementation.

12. What is sampling?


Wave files contain digitally recorded sounds. This process is often referred to as Sampling. Sampling is like breaking a sound into tiny piece and storing each piece as a small, digital sample of sound. The rate at which a sound is Sampled can affect its quality. The higher the sampling rate (the more pieces of sound that are stored) the better the quality of sound. Higher quality of sound will occupy a lot of space in hard disk because of more samples.

13. What is morphing ?


Frame animation is made up of different frames or screens; they are rapidly displayed to simulate motions. Frame or cell animation makes it possible to appear to bend together, creating the effect of motion. 2D and 3D animation are fun, and add interest to a multimedia programme. The 3D animation adds the dimension of depth and reality. Another form of animation is MORPHING (Metamorphosing).Morphing involves a transition

between two objects over a given number of frames. (i.e.) The first object appears to turn into the second object. Animation is truly fun component in Multimedia.

14. What is rendering? Rendering The process of converting your designed objects with texturing and animation
into an image or a series of images is called rendering. Here various parameters are available like resolution, colors type of render,etc.
15. What is warping?

Warping
Certain parts of the image could be marked for a change and made to change to different one. For examples, the eyes of the owl had to morph into the eyes of cat, the eyes can alone be marked and warped.
16. Why we use scanner?

Scanner
Another way of creating graphics is by a Scanner Types of Scanners are l Flatbed or Sheet-fed Scanner l Film Scanner l Handheld Scanner l 3-D Scanner A Scanner scans over an image such as photo, drawing, logo, etc, converting it into an image and it can be seen on the screen. Using a good paint programme, Image Editor we can do adding, removing colors, filtering, Masking color etc., 17. What is ganut in Photoshop ? When you convert an image from one mode to another, the transition between modes creates a permanent change to the color values in the image. For example, when you convert an RGB linage to CMYK mode, the color values in the RGB gamut that are outside the CMIYK gamut are adjusted to fall within the CMYK gamut. Consequently, its best to convert to another mode only after doing as much editing as possible in the images original mode 18. What is a layer? The Layers palette lists all the layers in the image, starting with the topmost layer. A thumbnail of the layer contents appears to the left of the layer name. This thumbnail is updated as you edit the layer. Use the scroll bars or resize the palette to see additional layers. You use the Layers palette to create, hide, display, copy, merge, and delete layers. (Additional commands appear in the menu.) When you modify an image, the changes affect only the active layer, that is, the highlighted layer in the Layers palette. You select a layer to make it active, and only one layer can be active at a time. The name of the active layer also appears in the image windows title bar.

What are editing tools? Why it is needed? Editing Tools Eraser tool
The eraser tool changes pixels in the image as you drag through them. You can choose to change the color and transparency of the affected pixels, or to revert the affected area to its previously saved version.

Smudge tool
The smudge tool simulates the actions of dragging a finger through wet paint. The tool picks up color from where the stroke begins and pushes it in the direction in which you drag. Note: The smudge tool cannot be used with Bitmap or Indexed-color mode images.

Focus Tools / Blur Sharpen


The focus tools include the blur tool, which lets you blur hard edges or areas in an image to reduce detail, and the sharpen tool, which lets you sharpen soft edges to increase clarity or focus. Note: The blur and sharpen tools cannot be used with bitmap or index-color mode images.

Toning tools

The toning tools include the dodge and burn tools, which let you lighten or darken, respectively, specific areas of an image, and the sponge tool, which lets you change the color saturation of an area. The dadge and burn tools are based on the traditional photographers technique of increasing the amount of exposure given to a specific area on a print.

Type and type mask tools


Adobe Photoshop lets you add bitmap type to an image using the type tool. You can specify the leading, spacing, type styles, and alignment of the type. Normally, large bitmap characters appear jagged on the screen.

Viewing Tools
Moving the view of mi image.You can view different areas of an image using the image window scroll bars or the hand tool.

19. What is file format?


The method by which the software organizes the data in the saved file is called the file format. Several different types of file formats are used by various kinds of software to save files. Each one has its own format to organize the data. No file format completely agrees with another. Files are identified by its extension.

Fill in the blanks: 21. Object- Oriented Programming constitutes an integration of multiple media such as text, graphics, audio, video and animation elements. 22. Music Instrument Digital Interface (MIDI) files are the micro son standard file format for storing waveform audio data. 23. The amount of data that can be transmitted from one computer to another in a given time frame is called_____________ 24. Computer graphics can be classified into Science and Technology. 25. _____________method is used to assign colors values to any new pixel, at the time of resampling. PART - B Answer any FIVE: a) Briefly narrate the history of graphics hardware technology.
Selection of right processor and motherboard is important for a graphic application. A prospective buyer of a system has multiple choices of the CPU. Four companies Intel (Pentium, Class P5 and P6), Centaur (IDT-C6, class P5), Cyrix (6X86 Class P6) and AMD (K6 class P6), offer P5 and P6 varieties of x86 class processors with MMX and clock speeds in the range of 200-300 MHz. Intels 440LX chipset with support for Accelerated Graphics Port (AGP) relieves congestion on the PCs PCI bus by moving graphics traffic on a dedicated point to point channel between the graphic controller and the system chip set. The main factors to be considered for the selection for an important application are power consumption, mathematical and graphical processing capability and level of integration. Intel has captured a major chunk of PC market share with the introduction of Pentium processors. These microprocessors will drive advances PCs, workstations, super-servers, and promise improved graphics, better networking and video on desktop PCs. Apple believes that the horse power of the RISC processors will be required to run system software and applications of the future and CISC hardware and software has no further potential. DEC, IBM, Motorola, SGI/Mips and SUN Microsystems have all gone to the RISC route. If one is planning to do any serious work on graphics-based application using

windows, OS/2, Windows NT, or UNIX/LINUX a system based on Pentium CPU is practically a necessity.

b) What are the strengths of UNIX operating system? Explain.


The Unix operating system has evolved from its modest beginning as a simple, small, portable, powerful, time-sharing operating system to one with commercial strength. It is still the most portable and configurable of all operating systems. Computer Graphics Interface (CGI) is a device independent interface to graphic devices. It allows a computer to control several graphics devices simultaneously without regard for their individual characteristics. It supports graphics functions polylines, polymarkers, text, circle etc., with control over primitive attributes. It can take positional character string, selection from menus, single value etc. as graphics input. It also supports features such as mouse driven pop-up menus, icons, definable clipping etc. It also has status enquiry functions to get state of the screen, attributes settings, active devices and device/system capabilities. The mechanism called computer Graphics metafiles (CGM) provides for the exchange of pictures between applications. It supports bitmap facility for the creation and manipulation of graphics images. Unix provides graphics facility through graphics tools (AIX), Computer Graphics Interfaces (CGI) drivers, Postscript printer support etc.

c) Give the different applications of computer graphics.


Computer graphics is used in every field. Some of the major application areas are

1. Building Design and Construction


Computer graphics are very useful tool for generating architects drawings and visualizing structures. Taking the data about the building, the computer can make various images of building from different angles. The architect can Walk through building, looking at images on the computer.

2. Electronics Design
We know that electronic equipments like radio, television and computers are made up of many small electronic devices and components. These parts are mounted on PCBs (printed circuit board) and interconnected by copper tracks on boards. Until few years ago the design of PCBs was done entirely by hand. Today this procedure is completely computerized. The engineer works on the video screen and designs the PCB. Once design is complete one can generate a hardcopy output.

3. Mechanical Design
We know machines are simply complex arrangement of mechanical parts. Today, constructive Solid geometry technique (CSG) is used to design different parts on computer. Now a days, before manufacturing any machine, engineers design and simulate that machines on computer and fabricate it.

4. Entertainment and Animation


Computers are used in making cartoon animation films. It requires tedious calculation for which computersare ideally suited.

5. Aerospace Industry

Aircraft designer use computers to simulate the airflow over the wings. The air patterns around the wings are displayed on the graphics monitor. The patterns of the shock waves around the aircraft give the designer an idea about the area that may create unwanted turbulence. It is possible by using super computer such as CRAY or ETA.

6. Medical Technology
Today, Computerized axial Tomography (CAT) are used to compose the three dimensional model of

the brain by taking multiple X-rays of it. CAT scan is very useful in detecting various problems like brain tumors etc. Computers are also useful to generate images of delicate organs. It is useful to study the effect of drugs on tissues.

7. Cartography

Computer graphics is used to produce accurate and schematic representation of geographical and other natural phenomena from measurement data. Examples include geographic maps, relief maps, exploration maps for drilling and mining, oceanographic charts, weather maps, contour maps and population density maps.

8. Art and Commerce


Computer graphics is used to produce pictures that express a message and attract attention. Personal computers and teletext and videotext terminals in public places such as museums, transportation terminals, supermarkets and hotels, as well as in private homes, offer much simpler but still informative pictures that let users orient themselves, make choices, or even teleshop and conduct other business transactions. Finally, slide production for commercial, scientific, or educational presentations is another cost-effective use of graphics, given the steeply rising labor costs of the traditional means of creating such material.

2. a) Compare the merits and demerits of raster and random scanning system.
In raster scan display, the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called refresh buffer or frame buffer. In random scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. It draws a picture one line at a time and so it is referred to as vector displays.

Raster scan
The Most common type of graphics monitor employing a CRT is the raster-scan Display, based on television technology. In a raster- scan system; the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called the refresh buffer or frame buffer. Each point on the screen is called pixel. On a black and system with one bit per pixel, the frame buffer is called bitmap. For systems with multiple bits per pixel, the frame buffer is referred to as a pix map. Refreshing on raster scan display is carried out at the rate of 60 to 80 frames per second. Some displays use interlaced refresh procedure. First, all points on the even numbered scan lines are displayed then all the points along odd numbered lines are displayed. This is an effective technique for avoiding flickering.

Random scan display


When operated as a random-scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. Random scan monitors draw a picture one line at a time and for this reason they are also referred as vector displays (or stroke-writing or calligraphic displays). The component lines of a picture can be drawn and refreshed by a random-scan system in any specified order. A pen plotter operates in a similar way and is an example of a random-scan, hard-copy device. Refresh rate on a random-scan system depends on the number of lines to be displayed. Picture definition is now stored as a set of line- drawing commands in an area of memory referred to as the refresh display file. Sometimes the refresh display file is called the display list, display program, or simply the refresh buffer.

b) With neat diagram explain the working principle of shadow mark CRT.

shadow mask CRT, instead of using one electron gun, uses 3 different guns placed one by the side of the other to form a triangle or a Delta as shown. Each pixel point on the screen is also made up of 3 types of phosphors to produce red, blue and green colors. Just before the phosphor screen is a metal screen, called a shadow mask. This plate has holes placed strategically, so that when the beams from the three electron guns are focused on a particular pixel, they get focused on particular color producing pixel only. i.e. If for convenience sake we can call the electronic beams as red, blue and green beams (though in practice the colors are produced by the phosphors, and until the beams hit the phosphor dots, they produce no colors), the metal holes focus the red beam onto the red color producing phosphor, blue beam on the blue producing one etc. When focused on to a different pixel, the red beam again focuses on to the red phosphor and so on. The shadow mask CRT, though better than the beam penetration CRT in performance, is not without its disadvantages. Since three beams are to be focused, the role of the Shadow mask becomes critical. If the focusing is not achieved properly, the results tend to be poor. Also, since instead of one pixel point in a monochrome CRT now each pixel is made up of 3 points (for 3 colors), the resolution of the CRT (no. of pixels) for a given screen size reduces. Another problem is that since the shadow mask blocks a portion of the beams (while focusing them through the holes) their intensities get reduced, thus reducing the overall brightness of the picture. To overcome this effect, the beams will have to be produced at very high intensities to begin with. Also, since the 3 color points, though close to each other, are still not at the same point, the pictures tend to look like 3 colored pictures placed close by, rather than a single picture. Placing the dots as close to one another as possible can reduce this effect.

c) Explain the principle of DVST system.


Conceptually the Direct View Storage Tube (DVST) behaves like a CRT with highly persistent phosphor. Pictures drawn on will be seen for several minutes (40-50 minutes) before fading. It is similar to CRT as far as the electronic gun and phosphor coated mechanisms are concerned. But instead of the electron beam directly writing the pictures on the phosphor coated CRT screen, the writing is done with the help of a fine-mesh wire grid. The grid made of very thin, high quality wire is located with a dielectric and is mounted just before the screen on the path of the electron beam from the gun. A pattern of positive charges is deposited on the grid and this pattern is transferred to the phosphor coated CRT by a continuous flood of electrons. This flood of electrons is produced by a flood gun (This is separate frame the electron gun that produces the main electron beam). Just behind the storage mesh is a second grid called the collector. The function of the collector is to smooth out the flow of flood electrons. Since a large number of electrons are produced at high velocity by the flood gun, the collector grid, which is also negatively charged reduces, the acceleration on these electrons and the resulting low velocity flood pass through the collector and get attracted by the positively charged portions of the storage mesh (Since the electrons are negatively charged), but are repelled by the other portions of the mesh which are negatively charged (Note that the pattern of positive charges residing on the storage mesh actually defines the picture to be displayed). Thus, the electrons attracted by the positive charges pass through the mesh, travel on to the phosphor-coated screen and display the picture. Since the collector has slowed down the electrons, they may not be able to produce sharp and bright images. To overcome this problem, the screen itself is maintained at a high positive potential by means of a voltage applied to a thin aluminum coating between the tube face and the phosphor.

3. a) What are the different graphical input interactive techniques? Explain.


The term interactive graphics refers to devices and systems that facilitate the man-machine graphic communication, in a way, which is more convenient than the writing convention. For

example, to draw a straight line between two points, one has to input the coordinates of the two end points. In interactive graphics with the help of graphical input technique by indicating two end points on the display screen draws the line. While designing such a system emphasis is placed on Ease for interaction -Communication with the system Speed of interaction - How fast one can modify a displayed image.

The hardware components required to generate interactive graphics are the input device, the output device (usually display) and the computer system. The human operator is also an integral part of the interactive system. The text and graphics displayed act as an input to the human vision system and, Interactive Graphics therefore, the reaction of the human being will depend on how quickly one can see and appreciate the graphics present on the display. Many people for different domain of applications use interactive Graphics. For example, structural engineers use for efficient design of structures on the basis of the analysis of stress in various elements of the structure. From the survey it is evident that in future, engineers, designers etc., will be using computer graphics quite extensively. There is virtually no area in which graphical displays cannot be used to some advantage, and so it is not surprising to find the use of computer graphics so widespread. Today, we find computer Graphics used routinely in such diverse areas such as science, engineering, medicine, business, industry, government, art, entertainment, advertising, education, training, etc.

b) Explain the working principle of mouse. A mouse is a small handled box used to position
the screen cursor. It has two wheels at right angles to each other. Each of these wheels is connected to the shaft encode. For every incremental rotation of the wheel, an electrical signal is produced by the shaft encode. As the device is moved on a flat surface, the movement is coded in the x and y directions by counting the number of pulses received from the shaft encoder. These values are held in separate registers and the computer can sample them at a suitable rate. The device can, therefore, be used for moving a cursor around the display screen.

c) With neat diagram explain the working principle of light pen.

We know that every pixel on the screen that is a part of the picture emits light. In fact they are much brighter than their surrounding pixels. All that the light pen does is to make use of this light signal to indicate the position. A small aperture is held against the portion of the picture to be modified and the light from the pixels, after passing through the operator falls on a photocell. This photocell converts the light signal received from the screen to an electrical pulse a signal sent to the computer. Since the electrical signal is rather weak, an amplifier amplifies it before being sent to the computer. Since a tracking software keeps track of the position of the light pen always (in a manner much similar to the position of the mouse being kept track of by the software), a signal received by the light pen at any point indicates that portion of the picture that needs to be modified (most often that portion gets erased, paving way for any other modifications to be made). However, when the pen is being moved to its position - where the modification is required - it will encounter so many other light sources on the way and these should not trigger the computer. So the operator of the light pen is normally kept closed and when the final position is reached, then it can be opened by a switch - in a manner similar to the one used in a photographic camera, though, of course, the period of opening the operator is for much longer periods than in a camera.

4. a) Compare the features of text and graphics mode.

Text Mode
In this mode it is possible to handle only text. Text mode display can be in two forms 25 rows of 40 columns or 25 rows of 80 columns. Text mode can have 2 colors in monochrome monitor and 16 colors in color monitor. printf () function helps the text to be displayed on the monitor. To display text in attractive manner many different functions can be used. To execute these functions # include <conio.h> to be included in the program.

1.textmode( int mode);


This function sets the number of rows and columns of the screen, mode variable can take the values 0, 1, 1, or 3. 0: represents 40 column black and white 1: represents 40 column color 2: represents 80 column black and white 3: represents 80 column color Example: textmode(2); // sets the screen to 80 column black and white

2.clrscr();

This function clears the entire screen and locates the cursor on the top left corner(1,1) Example clrscr(); // clears the screen

3. gotoxy(int x, int y);


This function positions the cursor to the location specified by x and y. x represents the row number and y represents the column number. Example: gotoxy(10,20) // cursor is placed in 20th column of 10th row

Graphics Mode
In this mode it is possible to display text as well as graphical figures. The basic element of the graphical pictures is picture element, which is also called a pixel. The resolution of the monitor is measured in terms of pixels and it varies with respect to the type of the monitor. The monitor type may be monochrome, CGA, EGA, VGA, etc. depending on the monitor type and resolution, the graphics pictures and colors may vary. Some of the graphics functions are described below. To execute these functions (graphics.h) file should be included in the C program.

Two important hardware settings must be properly selected to get the best results. One is the graphic driver (gd) and the second one is the graphic mode(gm). During initialization one can incorporate necessary instructions to select the best driver and mode, for example: gd=DETECT; // selects the best resolution of the video unit The function initgraph statement does the initialization; 1. initgraph (int driver, int mode, char path); This function is used to initialize the graphics system to load the appropriate specified graphics driver and video mode used by the graphics function. The path is to specify the place in which the graphics driver files are available. The driver is specified as 0 to 10 representing the monitor types DETECT, CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514, HERCMONO, ATT400, AGA and PC3270. The mode specifies the resolution of the video. It can take the values as follows. MODE CGAC0 CGAC1 CGAC2 CGAC3 CGAH1 VALUE 0 1 2 3 4 RESOLUTION 320X200 320X200 320X200 320X200 640X200

The path specifies the system path from where the graphics driver files are to be searched. If the files are in current directory then the path is a null string.

Whenever any graphics figure has to be drawn this initgraph() function should be used to initialize the graphics mode on the video. After executing the above statement, the computer hardware is made ready to run and execute any graphics functions.

Example : int gd, gm; gd = 1; gm = 4; initgraph (&gd, &gm,c:\\tc\\bgi); /* initialize driver to CGA mode to high resolution mode and the third argument is the path name where the bgi(Borland Graphics Interface) files can be found. If the argument value is blank i.e. then driver files are expected to be present in the current directory */

2. restorecrtmode ( ); This function restores the screen to the mode that it had prior to the call to initgraph () Example: restorecrtmode (); /* restores back*/ 3. setpalatte (int index, int color); This function chooses an index for palette and matches the color with the index and this color sets the background color of CGA mode. Example: Setpalette (0, GREEN); /* sets the background to green*/ 4. putpixel(int x, y, int color); This function illuminates the pixel represented by x and y coordinates in the color represented by color. Example: Putpixel (10, 20, RED); /* illuminates the pixel (10, 20)in red */ 5. getpixel(int x, int y,); This function returns the color in which the pixel(x,y) is illuminated Example: Color = getpixel(10,20) /* returns the color of the pixel (10,20) */ 6. moveto(int x, y); This function position the current cursor into the pixel (x,y) Example : Moveto (10, 15); 7. lineto(int x, int y); This function draws a line from the current cursor position to (x,y) Example: lineto (150,175); /* draws line from current cursor to (150, 175) */ 8. line(int x1, int y1, int x2 int y2); This function draws a line from (x1, y1)to (x2,y2) Example: line(10,50,10,100); /*draws a vertical line */ 9. bar(int x1, int y1 in x2, int y2); This draws a rectangle with diagonal from (x1,y1)to (x2,y2). Example : bar (10,25,100,75);

10. bar3d(int x1, int y1, int x2, int y2,depth, topflag); This function provides a 3 dimensional view of rectangle boxes. 11. circle(int x, int y, radius); This function draws a circle centered at (x,y) with the radius specified by the variable radius (in terms of number of pixels) in the current drawing color. Example: circle (100, 100, 50); 12. arc(int x, int y, int start, int end, int radius); This function draws an arc of the circle with radius as specified in the variable radius and with center at (x,y). start and end given in degrees to mention the portion of he circle that form the arc. Example: arc (100, 100, 0, 90, 20);

13. pieslice(int x, int y, int start, int end, int radius); This function works in the same way as arc but it provides the 2 radii from center to start and end Example: pieslice( 100, 100, 90, 180, 50); 14. ellipse(int x, int y, int start, int end, int xrad, int yrad); This function draws an ellipse with xrad as radius along x axis and yrad as radius along y axis. The start and end should be 0 and 360 for full ellipse. Arc of ellipse can also be drawn by changing the start and end values as used in the function arc(). Example : ellipse (100,50,0,360,30,15); 15. setcolor(int color); This function sets the drawing color as specified by the variable color. The subsequent graphical figures will be in the color specified by the variable color. Example: setcolor(4); /* sets the color to red */

b) With the help of an illustration explain how in it graph ( ) function works.


The function initgraph statement does the initialization; 1. initgraph (int driver, int mode, char path); This function is used to initialize the graphics system to load the appropriate specified graphics driver and video mode used by the graphics function. The path is to specify the place in which the graphics driver files are available. The driver is specified as 0 to 10 representing the monitor types DETECT, CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514, HERCMONO, ATT400, AGA and PC3270. The mode specifies the resolution of the video. It can take the values as follows.

The path specifies the system path from where the graphics driver files are to be searched. If the files are in current directory then the path is a null string. Whenever any graphics figure has to be drawn this initgraph() function should be used to initialize the graphics mode on the video. After executing the above statement, the computer hardware is made ready to run and execute any graphics functions. Example : int gd, gm; gd = 1; gm = 4; initgraph (&gd, &gm,c:\\tc\\bgi);

c) Develop a c program to draw the structure of fish and give animation functions. //PROGRAM TO DISPLAY MOVEMENT OF FISH
MODE CGAC0 CGAC1 CGAC2 CGAC3 CGAH1 VALUE 0 1 2 3 4 RESOLUTION 320X200 320X200 320X200 320X200 640X200

#include<graphics.h> #include<stdlib.h> #include<conio.h> #include<dos.h> void main() { int gd=DETECT,gm,i,j,p,q,x,y,flag; struct arccoordstype arcinfo; initgraph(&gd,&gm,"c:\\tc"); y=getmaxy()/2; i=0; p=0;

q=0; j=0; flag=0; setcolor(WHITE); for(int k=0;k<500;k++) putpixel(random(620),random(419),15); while(!kbhit()) { line(0+i,y+20,0+i,y-20); /*triangle*/ line(0+i,y+20,20+i,y); line(0+i,y-20,20+i,y); ellipse(80+i,y,10-p,350+p,60,25); line(140+i,y+3,130+i,y+8); line(130+i,y+8,140+i,y-5); if(flag==0) p=p+2; if(flag==1) p=p-2; circle(120+i,y-6,5); line(60+i,y-25,30+i,y-45+j); line(30+i,y-45+j,100+i,y-25); line(60+i,y+25,30+i,y+45+q); line(30+i,y+45+q,100+i,y+25); i=i+3; if(i>=638) i=0; if(flag==0) j=j-2,q=q+2; if(flag==1) j=j+2,q=q-2; if(j<=-10) flag=1; else if(j>=0) flag=0; delay(100);

cleardevice(); } getch(); closegraph(); } 5. a) Develop a c program to draw the car shape and move the car using animation functions. //PROGRAM TO DISPLAY CAR MOVEMENT #include<dos.h> #include<iostream.h> #include<conio.h> #include<graphics.h> #include<stdlib.h> #define PI 3.14159 void draw_wheel(int x,int y,int theta) { int incr=45; setcolor(getmaxcolor()); setfillstyle(EMPTY_FILL,getmaxcolor()); for(double i=theta;i<theta+360.0;i+=2*incr) { sector(x,y,i,i+incr,20,20); arc(x,y,i+incr,i+2*incr,20); } } void draw_car(int ang) { int car_color=BLUE; draw_wheel(50,200,ang); draw_wheel(200,200,ang); setcolor(car_color); line(0,80,639,80); line(0,300,639,300); line(25,200,0,200); line(0,200,0,160); line(0,160,40,160); line(40,160,70,130);

line(70,130,170,130); line(170,130,200,160); line(200,160,260,160); line(260,160,260,200); line(260,200,225,200); line(175,200,75,200); arc(50,200,0,180,25); arc(200,200,0,180,25); setfillstyle(SOLID_FILL,car_color); floodfill(150,170,car_color); } void main() { int gd,gm,i,j; void *bitmap1,*bitmap2; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\\tc "); draw_car(0); bitmap1=malloc(imagesize(0,130,270,230)); getimage(0,130,270,230,bitmap1); putimage(0,130,bitmap1,XOR_PUT); draw_car(22); bitmap2=malloc(imagesize(0,130,270,230)); getimage(0,130,270,230,bitmap2); putimage(0,130,bitmap2,XOR_PUT); for(i=0;!kbhit();i+=10) { if(i>500) i=0; putimage(i,130,bitmap1,OR_PUT); delay(100); putimage(i,130,bitmap1,XOR_PUT); putimage(i+5,130,bitmap2,OR_PUT); delay(50); putimage(i+5,130,bitmap2,XOR_PUT); } closegraph(); } b) List the different graphics functions along with example.

The graphic functions support activities such as, graphics system control, drawing and filling, manipulating screen and view ports, text output, color control, error handling, and state queries. Above features makes the language very much feasible to use for graphics applications.

c) Explain the use of getimage ( ) and putimage ( ) functions with example.

getimage(in x1, int y1, int x2, int y2, buf); This function captures the image inside the rectangle whose diagonal is specified by (x1,y1) and x2,y2). The captured image is stored in the array buf. 1. putimage(int x, int y, buf, int op); This function copies the image captured using get image starting at location (x,y). op takes the values from 0 to 4 which represents the following

COPY_PUT XOR_PUT OR_PUT AND_PUT NOT_PUT 4. delay(int x);

0 1 2 3 4

copy as it is Exclusive OR with destination Inclusive OR with destination AND with destination invert image

6. a) With illustration briefly narrate the origin and development of multimedia technology. b) Give different application of multimedia. c) How graphics helps in digital imaging ? Explain. 7. a) Explain how moving images are recorded in the hard disk. b) Explain how sound helps in multimedia. What are the major types of sound files? c) Explain different types of animation techniques. 8. a) Explain the significance of file extensions and file formats. b) Give the steps to use rubber stamp tool. c) Give the steps to use the image printing utility of Photoshop.

Вам также может понравиться