The entry in the bitmap is a 1-bit data

The electron beam is swept across the screen one row at a time from top to bottom. As it movesacross each row, the beam intensity is turned on and off to create a pattern of illuminated spots.This scanning process is called refreshing. Each complete scanning of a screen is normally calleda frame.The refreshing rate, called the frame rate, is normally 60 to 80 frames per second, or describedas 60 Hz to 80 Hz.Picture definition is stored in a memory area called the frame buffer. This frame buffer storesthe intensity values for all the screen points. Each screen point is called a pixel (picture element).On black and white systems, the frame buffer storing the values of the pixels is called a bitmap.Each entry in the bitmap is a 1-bit data which determine the on (1) and off (0) of the intensity ofthe pixel.10On color systems, the frame buffer storing the values of the pixels is called a pixmap (Thoughnowadays many graphics libraries name it as bitmap too). Each entry in the pixmap occupies anumber of bits to represent the color of the pixel. For a true color display, the number of bits foreach entry is 24 (8 bits per red/green/blue channel, each channel 28=256levels of intensity value,ie. 256 voltage settings for each of the red/green/blue electron guns).Random Scan (Vector Display)The CRT’s electron beam is directed only to the parts of the screen where a picture is to bedrawn. The picture definition is stored as a set of line-drawing commands in a refresh display fileor a refresh buffer in memory.Random-scan generally have higher resolution than raster systems and can produce smooth linedrawings, however it cannot display realistic shaded scenes.Display ControllerFor a raster display device reads the frame buffer and generates the control signals for the screen,i.e. the signals for horizontal scanning and vertical scanning. Most display controllers include acolor map (or video look-up table). The major function of a color map is to provide a mappingbetween the input pixel values to the output color.Anti – AliasingOn dealing with integer pixel positions, jagged or stair step appearances happen very usually.This distortion of information due to under sampling is called aliasing. A number of ant aliasingmethods have been developed to compensate this problem.One way is to display objects at higher resolution. However there is a limit to how big we canLine drawing is accomplished by calculating intermediate positions along the line path betweentwo specified end points positions. An output device is then directed to fill in these positionsbetween the end pointsDigital devices display a straight line segment by plotting discrete points between the two endpoints. Discrete coordinate positions along the line path are calculated from the equation of theline. For a raster video display, the line color (intensity) is then loaded into the frame buffer atthe corresponding pixel coordinates. Reading from the frame buffer, the video controller thenplots “the screen pixels”.Pixel positions are referenced according to scan-line number and column number (pixel positionacross a scan line). Scan lines are numbered consecutively from 0, starting at the bottom of thescreen; and pixel columns are numbered from 0, left to right across each scan line.Figure: Line Path between endpoint positions (x1, y1) and (x2, y2)12m = ?y / ?x = y2-y1 / x2 – x1 …… (2)b = y1 – m . x1 ……….. (3)For any given x interval ?x along a line, we can compute the corresponding y interval ? y?y = m ?x (4) …………………. (4)We can obtain the x interval ?x corresponding to a specified ?y as? x = ? y/m ……………………….. (5)For lines with slope magnitudes |m| < 1, ?x can be set proportional to a small horizontaldeflection voltage and the corresponding vertical deflection is then set proportional to ?y ascalculated from Eq (4).For lines whose slopes have magnitudes |m | >1 , ?y can be set proportional to a small verticaldeflection voltage with the corresponding horizontal deflection voltage set proportional to ?x,calculated from Eq (5)For lines with m = 1, ?x = ?y and the horizontal and vertical deflections voltage are equal.Figure: Straight line Segment with five sampling positions along the x axis between x1 and x2Digital Differential Analyzer (DDA) AlgorithmThe digital differential analyzer (DDA) is a scan-conversion line algorithm based on calculationeither ?y or ?x.The line at unit intervals in one coordinates and determines corresponding integer values nearestthe line path for the other coordinate.A line with positive slop, if the slope is less than or equal to 1, at unit x intervals (?x=1) andcompute each successive y values as:yk+1 = yk + m ………………………. (6)Subscript k takes integer values starting from 1 for the first point and increases by 1 until thefinal endpoint is reached. m can be any real number between 0 and 1 and, the calculated y valuesmust be rounded to the nearest integer.13For lines with a positive slope greater than 1 we reverse the roles of x and y, (?y = 1) andcalculate each succeeding x value asxk+1 = xk + (1/m) ………………………. (7)Equation (6) and (7) are based on the assumption that lines are to be processed from the leftendpoint to the right endpoint.If this processing is reversed, ?x=-1 that the starting endpoint is at the rightyk+1 = yk – m ………………………. (8)When the slope is greater than 1 and ?y = -1 withxk+1 = xk-1(1/m) ……………………….. (9)If the absolute value of the slope is less than 1 and the start endpoint is at the left, we set ?x = 1and calculate y values with Eq. (6)When the start endpoint is at the right (for the same slope), we set ?x = -1 and obtain y positionsfrom Eq. (8). Similarly, when the absolute value of a negative slope is greater than 1, we use ?y= -1 and Eq. (9) or we use ?y = 1 and Eq. (7).Algorithm#define ROUND(a) ((int)(a+0.5))void lineDDA (int xa, int ya, int xb, int yb){int dx = xb – xa, dy = yb – ya, steps, k;float xIncrement, yIncrement, x = xa, y = ya;if (abs (dx) > abs (dy)) steps = abs (dx) ;else steps = abs dy);xIncrement = dx / (float) steps;yIncrement = dy / (float) stepssetpixel (ROUND(x), ROUND(y) ) ;for (k=0; k