# Компьютерная графика, осень 2011: Растровая графика

• Published on
13-Apr-2017

• View
136

• Download
22

Embed Size (px)

Transcript

• RasterRaster

..- 30

Computer Graphics Support Group

1

URL: http://www.school30.spb.ru/cgsg/cgc/

E-mail: CGSG@yandex.ru

• RasterRaster

..- 30

Computer Graphics Support Group

2

( ,

)

• RasterRaster

..- 30

Computer Graphics Support Group

3Line

x

y

(x1,y1)

(x2,y2)

• RasterRaster

..- 30

Computer Graphics Support Group

4Line: Digital Differential Analyzer (DDA)

(x,y) x2-x1

y2-y1

slope

• RasterRaster

..- 30

Computer Graphics Support Group

5Line: ( )

x

y

(x1,y1)

(x2,y2)

(x,y)

=

=

=

=

0),(0),(0),(

)11(),(0)11(

0)12()1()12()1(121

121

yxfyxfyxf

dxydyxydxxdyyxfdxydyxydxxdy

xxyyyyxxyyyy

xxxx

(x,y)

(x,y)

(x,y)

• RasterRaster

..- 30

Computer Graphics Support Group

6Line: ( )

P(x,y)

M(x+1,y+1/2)

f(x,y) M f: f(M) > 0 N f(M)

• RasterRaster

..- 30

Computer Graphics Support Group

7Line: ( )

P(x,y)

ME(x+2,y+1/2)

f(x,y) M f: f(M) > 0 N f(M)

• RasterRaster

..- 30

Computer Graphics Support Group

8Line: ( )

P1(x1,y1)

M0(x+1,y+1/2)

f(x,y)

f.

(x1,y1)

2

)11()211()11(

)211,11()( 0

dxdy

dxydyxydxxdy

yxfMf

=++

=++=

• RasterRaster

..- 30

Computer Graphics Support Group

9Line: ( )

.

: 2f = e

:e = 2 * dy - dx;

e > 0

e = e + 2 * dy - 2 *dx;

e = e + 2 * dy

e .

• RasterRaster

..- 30

Computer Graphics Support Group

10Line: ( )

• RasterRaster

..- 30

Computer Graphics Support Group

11Line: Fixed Point (DDA)

Fixed Point .

4- :

2b 2b

1/65536 x y fixed point,

(x+y)

(x-y)

16 (x >> 16)

: x = a

• RasterRaster

..- 30

Computer Graphics Support Group

12Circle

x

y

R

• RasterRaster

..- 30

Computer Graphics Support Group

13Circle: ( )

x

y

(0,R) x

0),(0),(0),(

yxfyxfyxf (x,y)

(x,y)

(x,y)

M f: f(M) >= 0 S f(M) < 0

• RasterRaster

..- 30

Computer Graphics Support Group

14Circle: ( )

P(x,y)

M

E

SE MSE

MEf(x,y)

f(M) (E SE):

522)(49344

)23()2()2

3,2()(

32)(4144

)21()2()2

1,2()(4112

)21()1()2

1,1()(

222

222

222

222

222

222

++=++++

=++=+=

++=++++

=++=+=

++++

=++=+=

yxMfRyyxx

RyxyxfMf

xMfRyyxx

RyxyxfMf

Ryyxx

RyxyxfMf

NE

E

• RasterRaster

..- 30

Computer Graphics Support Group

15Circle: ( )

P(0,R)

M0(1,R-1/2)

f(x,y)

SE

E

f. (x1,y1)

RRRR

RRRfMf

=++

=+==

45

411

)21(1)2

1,1()(22

2220

- . f 0 :

• RasterRaster

..- 30

Computer Graphics Support Group

16Circle: ( )

:

E SE(incrE=2*x+3 incrSE=2*(x-y)+5) .

E, x 1 :

incrE=incrE+2 incrSE=incrSE+2

SE, x 1, y 1 :incrE=incrE+2 incrSE=incrSE+4

:

incrE=3 incrSE=5-2*R

• RasterRaster

..- 30

Computer Graphics Support Group

17Circle: ( )

• RasterRaster

..- 30

Computer Graphics Support Group

18Polygon

• RasterRaster

..- 30

Computer Graphics Support Group

19Flood Fill

• RasterRaster

..- 30

Computer Graphics Support Group

20Flood Fill

• RasterRaster

..- 30

Computer Graphics Support Group

21Text

• RasterRaster

..- 30

Computer Graphics Support Group

22Text

0x3C

0x46

0x86

0x86

0x86

0xFE

0x86

0x00

( )

• RasterRaster

..- 30

Computer Graphics Support Group

23

. .