Computer Graphics

computer graphics
View more...
   EMBED

Share

  • Rating

  • Date

    December 1969
  • Size

    1MB
  • Views

    693
  • Categories

Preview only show first 6 pages with water mark for full document please download

Transcript

KUVEMPU UNIVERSITY B.sc(I.T) COMPUTER GRAPHICS AND MULTIMEDIA CHITRANGADA CHAKRABORTY The term computer graphics includes almost everything on computers that is not text or sound. Today almost every computer can do some graphics, and people have even come to expect to control their computer through icons and pictures rather than just by typing. Here in our lab at the Program of Computer Graphics, we think of computer graphics as drawing pictures on computers, also called rendering. The pictures can be photographs, drawings, movies, or simulations - pictures of things, which do not yet exist and maybe could never exist. Or they may be pictures from places we cannot see directly, such as medical images from inside your body. We spend much of our time improving the way computer pictures can simulate real world scenes. We want images on computers to not just look more realistic, but also to be more realistic in their colors, the way objects and rooms are lighted, and the way different materials appear. We call this work “realistic image synthesis”. COMPUTER GRAPHICS AND MULTIMEDIA Page 1 B.sc(I.T) 2013 Kuvempu University Subject: Graphics & Multimedia Subject Code: BSIT – 51 Assignment: TA 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, 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. Some of the major applications are:        Building Design and Construction Electronics Design Mechanical Design Entertainment and Animation Aerospace Industry Medical Technology Cartography Page 2 COMPUTER GRAPHICS B.sc(I.T) 2013  Art and Commerce 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 Intel‟s 440LX chipset with support for Accelerated Graphics Port (AGP) relieves congestion on the PC‟s 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, superservers, 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 graphicsbased 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, COMPUTER GRAPHICS Page 3 B.sc(I.T) 2013 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 COMPUTER GRAPHICS Page 4 B.sc(I.T) 2013 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 RANDOM SCAN DISPLAY 1. In random scan display the beam is moved between the end points of the graphics primitives. 2. Random display flickers when the number of primitives in the buffer becomes too large. 3.Scan conversion is not required COMPUTER GRAPHICS RASTER SCAN DISPLAY 1. In raster scan display the beam is moved all over the screen one scan line at a time from top to bottom and then back to top. 2. In raster display the refresh process is independent of the complexity of the image. 3.Graphics primitives are specified in terms Page 5 B.sc(I.T) 2013 of their endpoints and must be scan converted into their corresponding Pixels in the frame buffer. 4. How many colors are possible if a. 24 bits / pixel is used b. 8 bits / pixel is used Justify your answer A digital image is composed of discrete pixels. These pixels are arranged in row and column order to form a rectangular picture area sometimes it is referred to as raster. The number of pixels per unit length is referred to as the resolution of the image. Image size is given as the total number of pixels in the horizontal directions times the total number of pixels in the vertical direction (512 X 512, 640 X 480). The ratio of an image‟s width to its height, measured in unit length or number of pixels, is referred to as its aspect ratio. Image representation is essentially the representation of pixel colors. Using direct coding we allocate a certain amount of storage space for each pixel to code its color. We may allocate 3 bits for each pixel, with one bit for each primary color. This 3 bit representation allows each primary to vary independently between two intensity levels: 0(off) or 1(on).Hence each pixel can take one of the eight colors. 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 1 0 1 0 1 0 1 Color Black Blue Green Cyan Red Magenta Yellow White 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 simultaneous colors 5. List and explain different text mode built-in functions of C Programming language. COMPUTER GRAPHICS Page 6 B.sc(I.T) 2013 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 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 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: COMPUTER GRAPHICS Page 7 B.sc(I.T) 2013 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(3,5); insline ( ); rd 6. Write a C program to create Indian national flag. COMPUTER GRAPHICS Page 8 B.sc(I.T) 2013 Assignment: TB PART - A 1. What is the need for computer graphics? Computer Graphics: It is the use of computers to define, store, manipulate ,interrogate and present pictorial output of the data. Need of computer Graphics:  Computers have become a powerful tool for rapid and economical production of pictures.  Old 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” as well as we can revise the saying to “ a computer is worth a million pictures “.  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. COMPUTER GRAPHICS Page 9 B.sc(I.T) 2013  This is true because one must represent objects in two dimensional and three dimensional spaces.  Computer graphics has revolutionized almost every computer based application in science and technology.  In today’s world as volume of information increases, problem of storage arises this problem is solved by computer graphics, pictures can represent a huge database in the form of pies, charts and graphs etc.  Suppose if 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, numerical and statistical information.  A common man requires a lot of time to understand it. There is an alternative to show or represent this information with the help of graphical tools such as bar chart or pie diagram i.e. we can express this data in pictorial form.  Computer graphics methods are utilized in computer aided design to produce the drawings of certain parts of a machine from any viewing angle.  Another field is the field of computer aided manufacturing where by employing computer graphics techniques, one may display the manufacturing layout for a given part and traces the path taken by machine tools for a given manufacturing process.  Architects can use computer graphics to produce layouts of buildings and utilize the for computer aided design  Virtual reality can take you one more step further, your architect can take you to walk in the simulated building to see and feel how accessible are the light switches and shelves and so on  Many people for different domains of applications use interactive computer graphics for example structural engineer’s use for efficient design of structures on the basis of analysis for 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,adver tising ,education and training. COMPUTER GRAPHICS Page 10 B.sc(I.T) 2013 2. What is graphics processor? Why it is needed? Graphics Processor:  It is specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to display.  They are used in embedded system, mobile phones, personal computers, workstations and game consoles. Need for Graphics Processor:  They are very efficient at manipulating computer graphics.  Their highly parallel structures make them more efficient than general purpose cpus for algorithms where processing of large blocks of data is done in parallel.  In a personal computer , a GPU can be present on a video card ,or it can be on the mother board or in certain cpus – on the cpu die. 3. What is a pixel ?     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 twodimensional grid of pixel lines and columns. 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. COMPUTER GRAPHICS Page 11 B.sc(I.T) 2013  Most of the graphic packages are designed for Cartesian coordinate specification. 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 today‟s 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. COMPUTER GRAPHICS Page 12 B.sc(I.T) 2013         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 various positioning devices are:  Mouse  Tablet  Joystick  Digitizer  Light pen  Track ball 9. What are pointing devices?   A pointing device is a hardware peripheral that allows user to point to objects on the screen and perform operations on them, such as selecting, clicking, moving, and dragging. Mouse is an example of pointing device. 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‟. Multimedia can be defined as presentation of information with integration of multiple media elements that can be used on and manipulated by computer. This media includes graphic software, video, audio, animation software, and computer hardware such as CD players, scanners and cameras 11. What are sound cards? COMPUTER GRAPHICS Page 13 B.sc(I.T) 2013    Sound card is the hardware for sound input and output. It is used with speakers, headphones, and microphones to record and play sound. Some sound cards also include MIDI, .Wav, and MP3 12. What is sampling?   The process of transfer of information from analog to digital is called 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 ?   It is the process of transformation of one image to another by the transformation and distortion of corresponding points in both the images. The best example will be Kawasaki advertisement where the motorbike changes into a cheetah. 14. What is 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?    It is the process where certain parts of the image could be marked for a change and made to change to different one for example legs of cheetah to be morphed with the wheels and head with head lights. Head can alone be marked and wrapped. 16. Why we use scanner?  Scanner is a peripheral device, which captures real object or image and saves it in a digital file as a graphic Page 14 COMPUTER GRAPHICS B.sc(I.T) 2013   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 gamut in Photoshop ?  The series of colors that a color system can demonstrate or print is called gamut in Photoshop. A color that can be displayed in RGB may be out of gamut, and therefore unprintable, for your CMYK setting. 18. What is a layer?        Layers can be visualized as transparent sheets placed over one another in an image. Creating a layered image refers to putting different objects on different levels in a sequence. You can create empty layers and add content to them, or you can create new layers from existing content. When you create a new layer, it appears either above the selected layer or within the selected layer set in the Layers palette. Layer sets help you organize and manage layers. You can use layer sets to easily move layers as a group, to apply attributes and masks to groups of layers, and to reduce clutter in the Layers palette. You cannot create a new layer set within an existing layer set 19. What are editing tools? Why it is needed?   Editing tools are used to fine-tune or modify graphic elements. Photoshop delivers highpowered image editing, photo retouching, and composition tools. It also supports features, such as Making Color Adjustments, Auto Color Command, Adjustment Layers and Fill Layers, and Masking Layers to help you get professionalquality results. 20. What is file format?     The method by which software organizes the data in the saved file is called the file format. The file name extension or suffixes indicate the format or usage of the file. Several different types of file formats are used by various kinds of software. For example: the GIF file format used for Web page images is a standard format that can be opened by any program that supports that standard format. Page 15 COMPUTER GRAPHICS B.sc(I.T) 2013 Fill in the blanks: 21. Multimedia constitutes an integration of multiple media such as text, graphics, audio, video and animation elements. 22. Wave or .wav files are the Microsoft 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 bit rate 24. Computer graphics can be classified into Bitmap images and Vector Graphics 25. Interpolation method is used to assign colors values to any new pixel, at the time of resampling. PART – B Answer any FIVE: 1. a) Briefly narrate the history of graphics hardware technology.       In early days, the high cost of the hardware for computer graphics remained the obstacle, which prevented their widespread use. Computers have been getting progressively more inexpensive and it has become a household article these days. The microelectronics revolution and the subsequent reduction in the price of the digital hardware have completely changed the situation. Due to this price reduction, it is now realistic to expect that all computers with graphic display hardware capability will be making extensive use of computer graphics. The announcement of the IBM personal computer using 16-bit Intel 8088 microprocessor on August 12,1981, can be regarded as a historic event, which had a profound effect in the world of computers. These computers significantly improved the state of display technology in the world of computers. The next major change in PC display technology was announced by Apple Company in 1984, when it introduced the Macintosh PC. It was the first PC that did not include a text-based display but provided only a graphic display. The application programs developed for the Macintosh advocated WYSIWYG (What You See Is What You Get) style of interface. Page 16  COMPUTER GRAPHICS B.sc(I.T) 2013   This concept has become a basic requirement in the area of desktop publishing (DTP). The PowerPC's from IBM, Apple, and other vendors created a new standard for DTP computers. With such a development, computer graphics and multimedia has become a necessity for all types of users. b) What are the strengths of UNIX operating system? Explain. Strength of Unix Operating System:              It is simple ,small,portable,powerful time sharing operating system to one with commercial strength. It is the most portable and configurable of all the operating system Unix have adopted to the new hardware architecture and application requirements by incorporating new functionalities like distributed file system,XII based GUIS,multithreading,distributality etc. Full multitasking with protected memory.Multiple users can run multiple programs each at the same time without interfering with each other or crashing the system. Very efficient virtual memory so many programs can run with a modest amount of physical memory. Access controls and security ,all users must be authenticated by a valid account passwords to use the system at all All files are owned by particular accounts. The owner can decide whether others have read or write access to his files A rich set of small commands and utilizes that do specific tasks as well not cluttered up with lots of special options. Unix is a well stocked tool box Ability to string commands and utilizes together in unlimited ways to accomplish more complicated tasks not limited to preconfigured combination or menus as in personal computer systems A powerfully unified file system, everything is a file:data,programs and all physical devices, entire file system appears as a single large tree of nested directories, regardless of how many different physical devices(disks) are included. A lean kernel that does the basics for you but doesn’t get in the way when you try to do the unusual Available on a wide variety of machines the most truly portable operating system. Optimized for a program development and thus for the unusual circumstances that are the rule in research. 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 Page 17 B.sc(I.T) 2013    Computer graphics are very useful tool for generating architect‟s 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 PCB‟s (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 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 computers are 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: COMPUTER GRAPHICS Page 18 B.sc(I.T) 2013     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. Random scan monitors draw a picture one line at a time and so they are also referred to as vector displays. Refreshing on raster scan display is carried out at the rate of 60 to 80- frames per second. Refresh rate on a random scan system depends on the number of lines to be displayed. The picture definition is stored in a memory area called refresh buffer or frame buffer in case of a raster scan display. Page 19 COMPUTER GRAPHICS B.sc(I.T) 2013   In case of random scan display, picture definition is stored as a set of line drawing commands in an area of memory referred to as the refresh display file. Refresh display file is also called the display list, display program, or the refresh buffer. b) With neat diagram explain the working principle of shadow mark CRT.    The Shadow Mask CRT is based on the principle of combining the basic colors - red, green and blue. The shadow mask CRT, instead of using one electron gun, uses three different guns placed adjacent to each other to form a triangle or a "Delta". Each pixel point on the screen is made up of three types of phosphors to produce red, blue, and green colors. Just in front of the phosphor screen, is a metal screen, called a "shadow mask". This plate has holes placed strategically, so that the beams from the three electron guns are focused on particular color- producing pixel only. Page 20  COMPUTER GRAPHICS B.sc(I.T) 2013    Now, unlike the beam penetration CRT‟s, the acceleration of the electron beam was being monitored, one can manipulate the intensity of the three beams simultaneously. If the red beam is made more intense, we get more of red color in the final combination etc. Since fine-tuning of the beam intensities is comparatively simple, we can get much more combination of colors than the beam penetration case. 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 Page 21 COMPUTER GRAPHICS B.sc(I.T) 2013  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. Following are the various graphical input interactive techniques: a. Positioning:  This operation used for locating or introducing a symbol at a desired location on the display, for defining end points of a straight line ,and /or for generating polygons ,circular arcs or other geometric figures  In general a special symbol is used this is generally called a cursor or tracking cross.  The following steps are used for positioning : I) Move cursor or the desired position on the screen ii) Inform the computer by either pressing the button available on the input device or by pressing the button available on the input device or by pressing the key on the keyboard. b. Constraints:  A constraint is a rule for altering input coordinate values to produce a specific orientation or alignment of the displayed coordinates  The most common constraint is horizontal or vertical alignment of straight lines  This type of constraints is useful in forming network layouts  With this contains we can create horizontal and vertical lines without working about precise specifications of end point co-ordinates. COMPUTER GRAPHICS Page 22 B.sc(I.T) 2013    A horizontal or vertical constraint is implemented by determining whether any two input co-ordinate end points are more nearly horizontal or vertical. If the difference is the Y values of the two end points is smaller than difference is X values, horizontal line is displayed. Similarly ,input co-ordinates could be constrained to lie along predefined paths, such as circular arcs. c. Grids:  When a grid is used, any input coordinate position is rounded to the nearest intersect on.  If the two grid lines, each of the two cursor positions is shifted to the nearest grid intersection point , and the lines is drawn between these grid points  Grids facilitate object constructions, because a new line can be joined easily to a Previously drawn line by selecting any position near endpoint grid intersection of one end of the displayed line.  Spacing between grid lines is often an option that can be set by the user .  Similarly grids can be turned on and off, and it is sometimes possible to use partial grids and grids of different sizes in different screen areas. d. Gravity Field:        Graphics packages can be designed to convert any input position near a line to a position on the line This conversion is accomplished by gravity field, area around the line. Any selected position within the gravity field of a line is moved to the nearest position on the line Areas around the endpoints are enlarged to make it easier for us to connect lines at their endpoints. Selected positions in one of the circular areas of the gravity field are attracted to the end points in that area. Size of the gravity fields is chosen large enough to aid positioning ,but small enough to reduce chances of overlap with other lines. If many lines are displayed ,gravity areas can overlap, and it may be difficult to specify points correctly e. Rubber band methods:    Straight line can be positioned and constructed using this method. Select a screen position from one end point of line then as the cursor moves around the line is displayed from the start position to the current position of the cursor When finally we select a second screen position the other line endpoint is set COMPUTER GRAPHICS Page 23 B.sc(I.T) 2013 f. Dragging:   It‟s used to move objects in position by dragging them with screen cursor We first select the object and then move the cursor in the direction in which we want the object to move , and the selected object follows the cursor path g. Dimensioning Techniques:  It helps in ascertaining location of the object, where mere visible accuracy Is not enough they may have to be positioned with respect to the actual coordinate system.  The more problem is that the coordinates need to keep changing as the figure is being dragged around and this demands rapid calculation on part of the system.  Normally the dimensions are displayed only when the object is being manipulated or moved around and will stay only long enough for the user to take note of them.  This ensures that they do not obscure the active parts of the picture, once completed picture on display h. Selection of Objects:  Select parts of the pictures for further operation after that tasks like moving,deletion,copying can be done  Second method is use multiple keys, that is position the cursor at the first point of selection, press certain combination of keys ,move the cursor to final position and again press certain combination of keys so that the figure lying in between them is selected.  Mouse facilitates same operation by use of multiple buttons on it  Once the selection is made normally the system is supposed to display the portion selected so that user can know he has actually selected what he had wanted to . i. Menu Selection:   Here the user will be able to choose and operate from a set of available commands displayed on the screen It‟s called menu operation where you select items from those available on the menu card. Page 24 COMPUTER GRAPHICS B.sc(I.T) 2013  It helps users to overcome the difficulty of having to draw simple and often used objects by providing them as a part of the system j. Graphical User Interface :   The main task of the designer of the user interface is to decide which of the existing procedures to use in the application and how best to present them to enable a user of an application to run it with least effort. An ideal GUI environment should allow user to input parameters through mouse and keyboard based graphical forms including menus,Buttons,meters, and slides or similar other tools to create an animated representation of the system and graphs and charts of the key variables k.Hard Copy devices:  We can put pictures on paper by directing graphics output to a printer  They produce output by either impact or non impact methods  Impact printer‟s press formed character faces against an inked ribbon onto the paper.  A line printer is an example of impact device, with the type face mounted on the bands,chains,drums,or wheels  Non impact printers and plotters use laser techniques, ink jet sprays, xerographic processes,electrostactic methods and electro thermal methods to get images on the paper. 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 a moving cursor around the display screen. c) With neat diagram explain the working principle of light pen. COMPUTER GRAPHICS Page 25 B.sc(I.T) 2013       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. The following table compares the text and graphics modes Text mode You can only handle text. You can display in 16 colors on a color monitor. Text mode display is in two forms, Graphics mode You can display, capture, and animate figures. You can display various colors. The resolution of the graphics mode COMPUTER GRAPHICS Page 26 B.sc(I.T) 2013 25 rows of 40 columns or 25 rows of 80 columns. depends on the adapter. b) With the help of an illustration explain how initgraph ( ) function works.     The initgraph() function is used to initialize the graphics system to load appropriate graphics drive and video mode used by the graphics functions. The syntax of this function is: initgraph(int *driver, int *mode, char *path) As its parameters, you must specify the graphics mode such as EGA, or VGA (depends on the graphics adapter being used), the graphics driver (a program that interfaced between the hardware and your C program), and path of the graphics driver. For example, to initialize graphics mode in CGA high resolution mode: int gdriver = 1, gmode=4; initgraph(&gdriver, &gmode, "d:\\tc\\bgi");  For example, to select the best driver and mode possible on a computer: int gdriver = DETECT, gmode; initgraph(&gdriver, &gmode, "d:\\tc\\bgi"); c) Develop a ‘c’ program to draw the structure of fish and give animation functions. #include #include #include #include #include void main() { int gdriver=DETECT,gmode; int i; initgraph(&gdriver,&gmode,"e:\\tc\\bgi"); int max_y=getmaxy()/2; i=0; setcolor(BLUE); while(!kbhit()) { line(0+i,max_y+30,0+i,max_y-30); /*triangle*/ line(0+i,max_y+30,30+i,max_y); line(0+i,max_y-30,30+i,max_y); ellipse(90+i,max_y,0,360,60,35); circle(120+i,max_y-5,5); i=i+3; if(i>=635) i=0; COMPUTER GRAPHICS Page 27 B.sc(I.T) 2013 delay(100); cleardevice(); } getch(); closegraph(); } 5. a) Develop a ‘c’ program to draw the car shape and move the car using animation functions. #include #include #include #include void car_wheel(int x,int y) { setcolor(WHITE); setfillstyle(SOLID_FILL,WHITE); circle(x,y,10); floodfill(x,y,WHITE); circle(x,y,25); } void car_body() { car_wheel(50,200); car_wheel(200,200); setcolor(RED); line(25,200,0,210); line(40,160,70,130); bar(105,110,125,130); line(0,160,40,160); line(70,130,170,130); line(170,130,200,160); line(175,200,75,200); line(200,160,260,160); line(260,160,260,200); line(260,200,225,200); arc(50,200,0,180,25); arc(200,200,0,180,25); setfillstyle(SOLID_FILL,RED); floodfill(150,170,RED); } void main() { int gdriver = DETECT,gmode; int i; void *buff; initgraph(&gdriver,&gmode,"e:\\tc\\bgi "); car_body(); COMPUTER GRAPHICS Page 28 B.sc(I.T) 2013 buff=malloc(imagesize(0,100,270,230)); getimage(0,100,270,230,buff); putimage(0,100,buff,XOR_PUT); i=0; while(!kbhit()) { if(i>500) i=0; putimage(i,100,buff,OR_PUT); delay(75); putimage(i,100,buff,XOR_PUT); putimage(i+5,100,buff,OR_PUT); delay(75); putimage(i+5,100,buff,XOR_PUT); i =i+10 } closegraph(); restorecrtmode(); getch(); } b) List the different graphics functions along with example.         C supports various graphics functions, such as: line(int x1, int y1, int x2, int y2): This draws a line from position (x1, y1) to (x2, y2) Example: line(10,50,10,100); bar(int x1, int y1, int x2, int y2): This draws a filled rectangle with diagonal from (x1, y1) to (x2,y2) bar(10,25,100,75) circle(int x, int y, int r): This draws a circle with center at (x, y) and radius of r. Example: circle(50,50,10) arc(int x, int y, int start, int end, int r): This draws an arc of circle with the center at (x,y), radius r and start and end specified in degrees to mention the portion of the circle that forms the arc. Example: arc(100,100,0,90,20) draws the first quarter of the circle, arc with center (100,100) and radius 20 c) Explain the use of getimage ( ) and putimage ( ) functions with example.  The getimage() function captures the image inside the rectangle whose diagonal is defined by (x1, y1), and (x2,y2),where x1, y1, x2, and y2 are the first four parameters of getimage().  The captured image is stored in an array, which is specified as the last parameter of getimage().  For example, to capture a rectangle whose diagonal is defined by (10, 50) and (50, 125), you can use the getimage() function as: int area = imagesize(10,50,50,125); unsigned char * buf = malloc(arear); COMPUTER GRAPHICS Page 29 B.sc(I.T) 2013 getimage(10,50,50,125, buf); The putimage() function copies the image captured using getimage(), starting at location (x, y), where x and y are the first two parameters of this function.  The image to be captured is specified as the third parameter.  The fourth parameter of this function specifies how the image has to be copied and takes any of the following values:  1. COPY_PUT or 0, which copies the image as it is 2. XOR_PUT or 1, which performs an exclusive OR between the background pixels and the image pixels 3. OR_PUT or 2, which performs an inclusive OR between the background pixels and the image pixels 4. AND_PUT or 3, which performs an AND between the background pixels and the image pixels 5. NOT_PUT or 4, which inverts the pixels of the image.   For example, animate a rectangle as it is you can use the COPY_PUT option in putimage: putimage(10,50, buf, COPY_PUT); COMPUTER GRAPHICS Page 30