digital media dr. jim rowan itec 2110. so far… we have compared bitmapped graphics and vector...

37
Digital Media Dr. Jim Rowan ITEC 2110

Upload: loreen-elliott

Post on 05-Jan-2016

225 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Digital Media

Dr. Jim Rowan

ITEC 2110

Page 2: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

So far…• We have compared bitmapped graphics

and vector graphics

• We have discussed bitmapped images, some file formats and some file compression techniques

• Today we are going to talk in a bit more detail about vector graphics

• Later we will cover Color

• Then 3D vector graphics

Page 3: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Vector Graphics…

• An elegant way to construct digital images that – have a compact representation – are scalable– are easy to edit

• And mandatory for 3-D modeling

Page 4: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

First…

Coordinate systems

Page 5: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Coordinate systems

• Bitmapped pixel coordinates (integer)

4,0 4,1 4,2 4,9

3,0 3,1 3,2 3,9

0,0 0,1 0,2 0,9

x

y

0

1

2

3

4

0 1 2 3 4 9

Page 6: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Coordinate systemsbitmapped

A

E

C D

x

y

0

1

2

3

4

0 1 2 3 4 9

B

A= ( , ) B= ( , ) C= ( , ) D= ( , ) E= ( , )

Page 7: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Coordinate systems• Vector graphics coordinates (real values)• A point is defined by its x and y coordinate

0 1 2 3

1

2

x

y

(1.41, 1.74)

(x,y)

Can be fractionalCan be negative

Page 8: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

• Vector graphics coordinates (real values)• A displacement (distance between points or movement from one point

to another) can be defined by a pair of points

Coordinate systems

0 1 2 3

1

2

x

y

(1.41, 1.74)

point 1

(3.12, 0.95)

displacement frompoint 1 to point 2...

= [(x2 - x1), (y2 - y1)](3.12 - 1.41, 0.95 - 1.74)(1.71,-0.79)

point 2

Page 9: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

• Vectors have magnitude (length) and direction• This vector goes down 0.79 and to the right 1.71• It is a two dimensional (x&y) vector that goes down and to the right (1.71,-0.79)

AKA vector

0 1 2 3

1

2

x

y

(1.41, 1.74)

(3.12, 0.95)

Page 10: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

• Another grandfathered term• From the time when displays were directly

“steered” by their programs• Give the display two points and it would move

the beam from one point to the other drawing a line...

• This movement could be described as a vector since it has magnitude (length) and direction (from one point to the other)

Vector graphics?

Page 11: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Absolute vs Window coordinates

• rendering software renders images in a window

• windows can be moved at will so...• the rendering program only knows where the

object is relative to the window it is in• rendering software does not know where the

window is on the screen• a coordinate transformation must be

performed

Page 12: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Absolute & Relative Coordinates

Page 13: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

The Bounding Box• It’s a way to locate an object in space

• what point is used to place an object?– the center of the object’s mass?– the upper left corner?– the lower right corner?

• images can be contained inside a “bounding box” which is the smallest box that contains all the points found in an object

Page 14: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Bounding Boxx

y

(0,0)

window 1

window 1

desktop screen

bounding box

(150,200)

window

(410,290)

(760,570)

(100,103)

Page 15: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Vector graphics

• Store shapes (like the line) very economically in the form of formulas or equations

• But which formula?• A line is defined by

y = mx + b (but that is for an infinitely long line)

• In computer graphics we want a line segment, i.e. it has endpoints

• Since a line segment can also be completely described by its endpoints…

Page 16: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Here’s the vector we saw earlier defined by it’s two

endpoints

0 1 2 3

1

2

x

(1.41, 1.74)

(3.12, 0.95)

Page 17: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

To display a vector graphic you need to convert the

vector graphic line to a

bitmapped graphic

Page 18: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Convert Vector to BitmappedVisually... “completely cover

the vector with pixels”

0 1 2 3

1

2

x

Page 19: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Vector to Bitmapped

0 1 2 3

1

2

x

Page 20: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

The artifact created:A jagged line…This is “aliasing”

0 1 2 3

1

2

x

Page 21: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Aliasing

When converting a vector graphic to a bitmapped graphic we can’t create a perfect representation

What we end up with is a bitmapped version of the vector

It’s not really the original but rather an alias of the original version

Page 22: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Aliasing

• Even we view a bitmapped digital photograph on a display, the reconstruction is performed by a display device, and by our eyes and by our brain.

• If the reconstructed image differs from the

original image, we are seeing an alias. • http://en.wikipedia.org/wiki/Aliasing

Page 23: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

To combat aliasing:anti-aliasing

• Techniques to mitigate the affect of aliases

• Smoothes the edges of jagged lines

Page 24: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Using anti-aliasing techniqueson our original line

0 1 2 3

1

2

x

our pixellated line to be displayed (the external model) is in black

Page 25: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

combating aliases:anti-aliasing techniques

0 1 2 3

1

2

x

the original vector graphic line stored in the internal model is in red

our pixellated line to be displayed (the external model) is in black

Page 26: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

combating aliases:anti-aliasing techniques

0 1 2 3

1

2

x

Page 27: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

combating aliases:anti-aliasing techniques“average the grayness”

0 1 2 3

1

2

x

Page 28: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

• So far we have just looked at a line– The line was stored as its endpoints

• What about other shapes?

Page 29: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

vector graphics:shapes

• connected lines are stored as a polyline– internally the polyline is stored as a series of

points

• closed polylines form a shape• open polyline is a jagged line

Page 30: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

vector graphics:rectangles and squares

• rectangles can be described by two corners• squares are special cases of the rectangle

Page 31: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

vector graphics:ellipses and circles

• ellipses can be described by two points• circles are special cases of the ellipses

– they are stored as a single point

http://en.wikipedia.org/wiki/Ellipse

Page 32: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

vector graphics: curves

• Question: How would you draw a curve using a computer with a mouse?

• You can’t draw smooth lines very easily• A line tool with handles (based on the

Bezier curve) can be manipulated by those handles

Page 33: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Lines and curves

• Bezier curves can be smoothly joined together

• An anchor point is the point where one joins the other

• When a curve closes on itself it is considered a closed curve

• When it doesn’t it’s an open curve

Page 34: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Lines and curves

• Closed (and open for that matter) lines can be filled– This is how drawn shapes become objects like the

cowboy on Toy Story (except that the characters in toy story were created in 3D, not 2D)

– solid color, pattern or gradient (linear or radial)

• Lines have ends– ends can be messy when joined so…– mitre, rounded, square, bevel

Page 35: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Manipulating objects

• Translation: is a simple up/down side-to-side movement

• Scaling: make bigger or smaller

• Rotation: about a point

• Reflection: about a line

Page 36: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

3-D?

• Way more complex than 2-D• 3-D shapes (objects) are defined by their

surfaces• Made even more complicated by the fact that

a 3-D object inside the computer must be translated into 2-D to be rendered on a computer screen...– This results in the need to specify the viewpoint

Page 37: Digital Media Dr. Jim Rowan ITEC 2110. So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats

Questions?