0% found this document useful (0 votes)
5 views

Computer Graphics Design

CGD3

Uploaded by

Avc Ccss
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Computer Graphics Design

CGD3

Uploaded by

Avc Ccss
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

IT 315 – COMPUTER GRAPHICS AND DESIGN

Preliminary Module
Student Name: ________________
Computer Graphics Design

Overview
Computer graphics is an art of drawing pictures on computer screens with the
help of programming. It involves computations, creation, and manipulation of
data. In other words, we can say that computer graphics is a rendering tool for
the generation and manipulation of images.
Graphic design is the process of visual communication through the use
of typography, photography, iconography and illustration. The field is considered
a subset of visual communication and communication design, but sometimes the
term "graphic design" is used synonymously. Graphic designers create and There are two ways RandomscanandRasterscan by which we can display an
combine symbols, images and text to form visual representations of ideas and object on the screen.
messages.
Raster Scan
They use typography, visual arts, and page layout techniques to create visual
compositions. Common applications of graphic design include corporate In a raster scan system, the electron beam is swept across the screen, one row at
design (logos and branding), editorial design (magazines, newspapers and a time from top to bottom. As the electron beam moves across each row, the
books), wayfinding or environmental design, advertising, web beam intensity is turned on and off to create a pattern of illuminated spots.
design, communication design, product packaging, and signage. Picture definition is stored in memory area called the Refresh Buffer or Frame
Buffer. This memory area holds the set of intensity values for all the screen
Cathode Ray Tube
points. Stored intensity values are then retrieved from the refresh buffer and
The primary output device in a graphical system is the video monitor. The main
“painted” on the screen one row scanline at a time as shown in the following
element of a video monitor is the Cathode Ray Tube CRTCRT, shown in the
illustration.
following illustration.
Each screen point is referred to as a pixel picture element or pel. At the end of
The operation of CRT is very simple − each scan line, the electron beam returns to the left side of the screen to begin
displaying the next scan line.
 The electron gun emits a beam of electrons cathode rays.
 The electron beam passes through focusing and deflection systems that
direct it towards specified positions on the phosphor-coated screen.
 When the beam hits the screen, the phosphor emits a small spot of light
at each position contacted by the electron beam.
 It redraws the picture by directing the electron beam back over the same
screen points quickly.
Random Scan VectorScan  Engineering drawings − mechanical, electrical, civil, etc. - Replacing the
blueprints of the past.
In this technique, the electron beam is directed only to the part of the screen  Typography − The use of character images in publishing - replacing the
where the picture is to be drawn rather than scanning from left to right and top hard type of the past.
to bottom as in raster scan. It is also called vector display, stroke-writing  Architecture − Construction plans, exterior sketches - replacing the
display, or calligraphic display. blueprints and hand drawings of the past.
Picture definition is stored as a set of line-drawing commands in an area of  Art − Computers provide a new medium for artists.
memory referred to as the refresh display file. To display a specified picture, the  Training − Flight simulators, computer aided instruction, etc.
system cycles through the set of commands in the display file, drawing each  Entertainment − Movies and games.
component line in turn. After all the line-drawing commands are processed, the  Simulation and modeling − Replacing physical modeling and enactments
system cycles back to the first line command in the list.
Line Generation Algorithm
Random-scan displays are designed to draw all the component lines of a picture
30 to 60 times each second.
A line connects two points. It is a basic element in graphics. To draw a line, you
need two points between which you can draw a line. In the following three
algorithms, we refer the one point of line as X0,Y0X0,Y0 and the second point of
line as X1,Y1X1,Y1.

DDA Algorithm
Digital Differential Analyzer DDADDA algorithm is the simple line generation
algorithm which is explained step by step here.
Step 1 − Get the input of two end points (X0,Y0)(X0,Y0) and (X1,Y1)(X1,Y1).
Step 2 − Calculate the difference between two end points.
dx = X1 - X0
dy = Y1 - Y0
Application of Computer Graphics
Step 3 − Based on the calculated difference in step-2, you need to identify the
Computer Graphics has numerous applications, some of which are listed below − number of steps to put pixel. If dx > dy, then you need more steps in x
 Computer graphics user interfaces GUIs − A graphic, mouse-oriented coordinate; otherwise in y coordinate.
paradigm which allows the user to interact with a computer.
if (absolute(dx) > absolute(dy))
 Business presentation graphics − "A picture is worth a thousand words".
Steps = absolute(dx);
 Cartography − Drawing maps.
else
 Weather Maps − Real-time mapping, symbolic representations.
Steps = absolute(dy);
 Satellite Imaging − Geodesic images.
 Photo Enhancement − Sharpening blurred photos. Step 4 − Calculate the increment in x coordinate and y coordinate.
 Medical imaging − MRIs, CAT scans, etc. - Non-invasive internal
examination. Xincrement = dx / (float) steps;
Yincrement = dy / (float) steps;
Step 5 − Put the pixel by successfully incrementing x and y coordinates
accordingly and complete the drawing of the line.

for(int v=0; v < Steps; v++)


{
x = x + Xincrement;
y = y + Yincrement;
putpixel(Round(x), Round(y));
}

Bresenham’s Line Generation


From the above illustration, the y coordinate on the mathematical line
The Bresenham algorithm is another incremental scan conversion algorithm. The at xk+1xk+1 is −
big advantage of this algorithm is that, it uses only integer calculations. Moving Y = m$Xk$+1$Xk$+1 + b
across the x axis in unit intervals and at each step choose between two different So, dupperdupper and dlowerdlower are given as follows −
y coordinates. dlower=y−ykdlower=y−yk
For example, as shown in the following illustration, from position 2,32,3 you =m(Xk+1)+b−Yk=m(Xk+1)+b−Yk
need to choose between 3,33,3 and 3,43,4. You would like the point that is
closer to the original line. and
dupper=(yk+1)−ydupper=(yk+1)−y

=Yk+1−m(Xk+1)−b=Yk+1−m(Xk+1)−b
You can use these to make a simple decision about which pixel is closer to the
mathematical line. This simple decision is based on the difference between the
two pixel positions.
dlower−dupper=2m(xk+1)−2yk+2b−1dlower−dupper=2m(xk+1)−2yk+2b−1

Let us substitute m with dy/dx where dx and dy are the differences between the
end-points.
dx(dlower−dupper)=dx(2dydx(xk+1)−2yk+2b−1)dx(dlower−dupper)=dx(2dydx(xk+
At sample position Xk+1,Xk+1, the vertical separations from the mathematical
1)−2yk+2b−1)
line are labelled as dupperdupper and dlowerdlower.
=2dy.xk−2dx.yk+2dy+2dx(2b−1)=2dy.xk−2dx.yk+2dy+2dx(2b−1)

=2dy.xk−2dx.yk+C=2dy.xk−2dx.yk+C

So, a decision parameter PkPk for the kth step along a line is given by −
pk=dx(dlower−dupper)pk=dx(dlower−dupper) (xk,yk+1)(xk,yk+1)

=2dy.xk−2dx.yk+C=2dy.xk−2dx.yk+C pk+1=pk+2dy−2dxpk+1=pk+2dy−2dx

The sign of the decision parameter PkPk is the same as that Step 5 − Repeat step 4 dx–1dx–1 times.
of dlower−dupperdlower−dupper.
For m > 1, find out whether you need to increment x while incrementing y each
If pkpk is negative, then choose the lower pixel, otherwise choose the upper
time.
pixel.
After solving, the equation for decision parameter PkPk will be very similar, just
Remember, the coordinate changes occur along the x axis in unit steps, so you
the x and y in the equation gets interchanged.
can do everything with integer calculations. At step k+1, the decision parameter
is given as − Mid-Point Algorithm
pk+1=2dy.xk+1−2dx.yk+1+Cpk+1=2dy.xk+1−2dx.yk+1+C Mid-point algorithm is due to Bresenham which was modified by Pitteway and
Van Aken. Assume that you have already put the point P at x,yx,y coordinate and
Subtracting pkpk from this we get − the slope of the line is 0 ≤ k ≤ 1 as shown in the following illustration.
pk+1−pk=2dy(xk+1−xk)−2dx(yk+1−yk)pk+1−pk=2dy(xk+1−xk)−2dx(yk+1−yk)
Now you need to decide whether to put the next point at E or N. This can be
chosen by identifying the intersection point Q closest to the point N or E. If the
But, xk+1xk+1 is the same as (xk)+1(xk)+1. So −
intersection point Q is closest to the point N then N is considered as the next
pk+1=pk+2dy−2dx(yk+1−yk)pk+1=pk+2dy−2dx(yk+1−yk)
point; otherwise E.
Where, Yk+1–YkYk+1–Yk is either 0 or 1 depending on the sign of PkPk.
The first decision parameter p0p0 is evaluated at (x0,y0)(x0,y0) is given as −
p0=2dy−dxp0=2dy−dx

Now, keeping in mind all the above points and calculations, here is the
Bresenham algorithm for slope m < 1 −
Step 1 − Input the two end-points of line, storing the left end-point in (x0,y0)
(x0,y0).
Step 2 − Plot the point (x0,y0)(x0,y0). To determine that, first calculate the mid-point Mx+1,y+½x+1,y+½. If the
Step 3 − Calculate the constants dx, dy, 2dy, and 2dy–2dx2dy–2dx and get the intersection point Q of the line with the vertical line connecting E and N is below
first value for the decision parameter as − M, then take E as the next point; otherwise take N as the next point.
p0=2dy−dxp0=2dy−dx
In order to check this, we need to consider the implicit equation −
Step 4 − At each XkXk along the line, starting at k = 0, perform the following test Fx,yx,y = mx + b - y

If pkpk < 0, the next point to plot is (xk+1,yk)(xk+1,yk) and For positive m at any given X,
pk+1=pk+2dypk+1=pk+2dy
 If y is on the line, then Fx,yx,y = 0
Otherwise,  If y is above the line, then Fx,yx,y < 0
 If y is below the line, then Fx,yx,y > 0 ___________________________________________________________________
____________________________________________________________

5. The big advantage of this algorithm is that, it uses only integer


calculations.

___________________________________________________________________
____________________________________________________________

References: https://www.techopedia.com/definition/24361/database-
management-systems-dbms
Let’s Do This: Answer/identify the following. https://www.tutorialspoint.com/ms_access/ms_access_objects.htm

1. The electron beam is directed only to the part of the screen where the
picture is to be drawn rather than scanning from left to right and top to
bottom as in raster scan. This is also called? Prepared By: CYEXAM AUGREE E. BELOY Reviewed By: QUEENIE FRANCES G. BORGOÑA
IT Instructor AVC – CCSS Dean
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________

2. Picture definition is stored as a set of line-drawing commands in an area


of memory referred to as the?

___________________________________________________________________
_______________________________________________________________

3. A graphic, mouse-oriented paradigm which allows the user to interact


with a computer.

___________________________________________________________________
____________________________________________________________

4. The use of character images in publishing - replacing the hard type of the
past.

You might also like