30
1 Introduction • Line attribute • Color and gray scale • Area filled attribute • Anti-aliasing

1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

Embed Size (px)

Citation preview

Page 1: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

1

Introduction

• Line attribute

• Color and gray scale

• Area filled attribute

• Anti-aliasing

Page 2: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

2

Attributes of Output Primitives

DefinitionDefinitionParameter that affects the way a primitive will be Parameter that affects the way a primitive will be displayeddisplayed

Line Attribute

. Type

. Width

. Color

. Pen & Brush

Page 3: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

3

Line Attribute

Type

. Solid

. Dotted – very short dash with spacing equal to

or greater than dash itself

. Dashed – displayed by generating an interdash spacing

Pixel count for the span and interspan length is specified

by the mask . Ex. 111100011110001111

Note : Fixed pixel with dashes can produce unequal length dashes. It depend on line orientation. So, need to adjust the number of plotted pixels for different slopes.

Page 4: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

4

Line Attribute

Width

. Specify in pixels and proportion of a standard line width.

. Thicker line can be produced by.

. Adding extra pixel vertically when |m| < 1

. Adding extra pixel horizontally when |m| > 1

. Issues:

. Line have different thickness on the slope

. Problem with

. End of the line

. Joining the two lines (polygon)

Page 5: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

5

Attributes of Output Primitives

Page 6: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

6

Attributes of Output Primitives

Page 7: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

7

Line Attribute

Pen and Brush. The selected “pen” or “brush” determine the way a line will be drawn.

. Pens and brushes have size, shape, color and pattern attribute.

. Pixel mask is applied in both of them.

Page 8: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

8

Curve Attribute

Similar to line : type + width

Thicker curves can be produced by:

1. Plotting additional pixel

2. Filling the space between two concentric circles.

3. Using thicker pen or brush

Page 9: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

9

COLOR AND GRAY SCALE LEVEL

ColorColors are represented by colors codes which are

positive integers.

Color information is stored in frame buffer or in separate table and use pixel values as index to the color table.

Two ways to store color information :1. Direct 2. Indirect

Page 10: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

10

COLOR

Direct

Page 11: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

11

COLOR

Indirect

Page 12: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

12

COLOR

Exercise:

What is the size of frame buffer required for the following cases:

Case 1 (Direct): Resolution of 1024 * 1024 with 24 bits per pixel

Case 2 (Indirect): Same resolution with 8 bit per pixel that indexed out of 16 million available colors

Conclusion

CLUT is good for storage but can’t give a very high resolution picture.

Page 13: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

13

GRAY SCALE LEVEL

Apply for monitor that have no color

Shades of grey (white->light grey->dark grey->black) Color code mapped onto grayscale codes 2 bits can give 4 level of grayscale 8 bits per pixel will allow 256 combination Dividing the actual code with 256 will give range of 0 and 1

Ex:Color code in color display is 118

To map to nearest grayscale then

118/256 = 0.45

light gray

Scale Shade

1 black

0.66 Dark grey

0.33 Light Grey

0 White

Page 14: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

14

AREA FILLED ATTRIBUTE

. Option for filling a defined region is whether solid , pattern and colors.

Fill Styles . Three basic fill styles are:

. hollow with color border.. interior color is same with background

Page 15: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

15

AREA FILLED ATTRIBUTE

. filled with a solid color .. color up to and including the border

pattern .. control by other table

Page 16: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

16

Pattern Fill

Ex: Table with two dimensional array of color codes.Index 1: Cpa[1,1] = 4

Cpa[2,2] = 4 | 4 0 | Cpa[1,2] = 0 | 0 4 | Cpa[2,1] = 0

Index 2: Cpb[1,1] = 4 Cpb[2,2] = 4 | 4 6 4 |

Cpb[3,3] = 4 | 6 4 6 | Cpb[1,2] = 6 | 4 6 4 |

Cpb[2,1] = 6 Cpb[2,3] = 6 Cpb[1,3] = 4 Cpb[3,1] = 4 Cpb[3,3] = 4

Page 17: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

17

Pattern Fill

.Filling an area with rectangular pattern is called tiling.

.Some pattern are generated based on and, or, xor, replace logic which result based on the foreground and background color.

.Soft Fill is a method where factor is given in order to control the transparency of background and foreground

P = tF+(1-t)B t: transparency value 0-1

Page 18: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

18

ANTIALIASING

Page 19: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

19

ANTIALIASING

Page 20: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

20

ANTIALIASING

This distortion is due to low-frequency sampling and it is called aliasing.

.To improve the appearance is called antialiasing method.

.The straight line, circle and ellipse drawing algorithms have to decide which pixel are closest to line.

.Scan conversion samples a line and choose which of the much smaller number of pixel on the screen to be plotted to represent a line.

Page 21: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

21

ANTIALIASING

Increasing Screen Resolution

Page 22: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

22

ANTIALIASING

Supersampling

Page 23: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

23

ANTIALIASING

Page 24: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

24

ANTIALIASING

Page 25: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

25

ANTIALIASING

Page 26: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

26

ANTIALIASING

Page 27: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

27

ANTIALIASING

Page 28: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

28

ANTIALIASING

Page 29: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

29

ANTIALIASING

Page 30: 1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing

30

Conclusion

• Polygon Filling (scan-line, boundary, flood) • Line attributes (size, type, color,pen&brush)• Color and gray scale representation and storing

• Full 24-bit• Color LUT

• Area filled (polygon) attributes • Fill styles (hollow, filled, pattern)

• Distortion (aliasing)• Anti-aliasing techniques

• Screen resolution• Super sampling• Area sampling (Weighted & unweighted)