graphic devices and output primitives
TRANSCRIPT
-
8/10/2019 Graphic Devices and Output Primitives
1/21
GRAPHICS DEVICES AND
OUTPUT PRIMITIVESJ.J. ADRI JOVIN
Assistant Professor
Department of Information TechnologySri Ramakrishna Institute of Technology
-
8/10/2019 Graphic Devices and Output Primitives
2/21
Raster Scan Displays
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
2
-
8/10/2019 Graphic Devices and Output Primitives
3/21
-
8/10/2019 Graphic Devices and Output Primitives
4/21
Random Scan Displays
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
4
-
8/10/2019 Graphic Devices and Output Primitives
5/21
Architecture
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
5
-
8/10/2019 Graphic Devices and Output Primitives
6/21
Color CRT Monitor
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
6
-
8/10/2019 Graphic Devices and Output Primitives
7/21
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
7
-
8/10/2019 Graphic Devices and Output Primitives
8/21
Flat Panel Displays
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
8
-
8/10/2019 Graphic Devices and Output Primitives
9/21
Input Devices
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
9
-
8/10/2019 Graphic Devices and Output Primitives
10/21
Trackball
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
10
-
8/10/2019 Graphic Devices and Output Primitives
11/21
Space ball
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
11
-
8/10/2019 Graphic Devices and Output Primitives
12/21
Joystick
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
12
-
8/10/2019 Graphic Devices and Output Primitives
13/21
Image Scanner
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
13
-
8/10/2019 Graphic Devices and Output Primitives
14/21
Touch Panel
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
14
-
8/10/2019 Graphic Devices and Output Primitives
15/21
Light Pen
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
15
-
8/10/2019 Graphic Devices and Output Primitives
16/21
Points and Lines
setpixel(x,y) load a specified color point in
the location specified by x and y
getpixel(x,y)retrieve the current frame
buffer intensity
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
16
-
8/10/2019 Graphic Devices and Output Primitives
17/21
Line drawing algorithms
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
17
cxmy .
12
12
xx
yym
11 xmyc
m
yx
xmy
-
8/10/2019 Graphic Devices and Output Primitives
18/21
DDA Algorithm
Digital Differential Analyzer
Consider positive slope and the slope is less
than or equal to 1.
We sample at unit x interval
For lines with positive slope, greater than 1,the roles of x and y are reversed
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
18
myy kk 1
mxx kk
11
-
8/10/2019 Graphic Devices and Output Primitives
19/21
DDA Algorithm (Contd..)
If the process start from right end point, we
have
Therefore
Similarly, for slope greater than 1,
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
19
1x
myy kk 1
mxx kk 11
-
8/10/2019 Graphic Devices and Output Primitives
20/21
DDA Algorithm (Contd..)
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
20
-
8/10/2019 Graphic Devices and Output Primitives
21/21
Bresenham Line Drawing Algorithm
J.J. ADRI JOVIN, Assistant Professor, Dept.of IT, SRIT
21
1. Input the two line endpoints and store the left endpoint in ),( 00 yx .
2. Load ),( 00 yx into the frame buffer; that is, plot the first point.
3. Calculate constants ,2,, yyx and xy 22 and obtain the starting value for the
decision parameter as
xyp 20
4. At each kx ,along the line, starting at 0k ,perform the following test. If 0kp , the
next point to plot is ),1( kk yx and
ypp kk 21
Otherwise, the next point to plot is )1,1( kk yx and
xypp kk 221 5. Repeat step 4 x times.