Tsev > Xov xwm > Ntsiab lus

CMD_GRADIENT - Kos Ib Txoj Kev Gradient Zoo

Apr 27, 2019

image

C daim ntawv prototype

tsis muaj dabtsis cmd_gradient (int16_t x0,

int16_t y0,

uint32_t rgb0,

int16_t x1,

int16_t y1,

uint32_t rgb1);

Cov lus qhia

x0

x-coordinate ntawm point 0, hauv pixels

y0

y-coordinate ntawm point 0, hauv pixels

rgb0

Xim ntawm taw tes 0, raws li ib tug xov tooj 24-ntsis RGB. R yog qhov tseem ceeb tshaj 8, B yog

qhov tsawg. Yog li 0xff0000 yog ci liab.

x1

x-coordinate ntawm point 1, hauv pixels

y1

y-coordinate ntawm point 1, hauv pixels

rgb1

Xim ntawm taw tes 1

Kev piav qhia

Tag nrho cov xim cov kauj ruam qhov tseem ceeb yog xam raws li qhov curve tus interpolated los ntawm

cov RGB0 rau RGB1 parameter. Lub nkhaus curve yog nws tus kheej

suav rau tag nrho peb cov xim thiab cov kab zauv siv yog R0 + t * (R1 - R0), qhov twg t yog

interpolated ntawm 0 thiab 1. Gradient yuav tsum siv nrog Scissor muaj nuj nqi kom tau

lub gradient npaj.

image

image

image

image