4.5 NPAJ
Pib kos ib daim duab ua ntej
Kev piav qhia
Tag nrho cov primitives uas raug txhawb los ntawm FT800 yog txhais hauv cov lus saum toj no. Lub tswv yim qub
yuav tsum kos yog xaiv los ntawm BEGIN hais kom ua. Thaum xaiv txheej thaum ub, nws yuav yog
siv tau txog cov txheej txheem tshiab yog xaiv los ntawm BEGIN hais kom ua.
Thov nco ntsoov tias cov txheej txheem txheej thaum ub cov txheej txheem yuav tsis ua kom txog thaum
VERTEX2II lossis VERTEX2F yog tseg.
Cov lus qhia
kov
Bitmap kov. Tus nqi pib yog 0. Tus nqi siv tau yog ntawm 0 txog 31.
Kev piav qhia
Tuav 16 mus rau 31 yog txhais los ntawm FT800 rau cov font built-in thiab kov 15 yog
txhais nyob rau hauv lub tshuab pa engine commands CMD_GRADIENT, CMD_BUTTON thiab
CMD_KEYS. Cov neeg siv yuav txhais tau cov kev siv cov khoom siv tshiab los ntawm 0 mus rau 14. Yog tias muaj
tsis muaj cav ua cav hais kom ua CMD_GRADIENT, CMD_BUTTON thiab CMD_KEYS hauv
daim ntawv teev cov lus qhia tam sim no, cov neeg siv yuav txawm hais txog kev siv cov kev siv nyiaj bitmap 15.
Cov ntsiab lus graphics
Tus nqi ntawm tus tes taw yog ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
BITMAP_LAYOUT, BITMAP_SIZE
Ntau hom ntsis bitmap txhawb:
BARGRAPH - muab cov ntaub ntawv pov thawj raws li ib qho bar graph. Zoo li tus x coordinate hauv ib byte array, ces
muab ib qho pixels opaque yog hais tias tus nqi byte yog tsawg dua y, txwv tsis pub ib pob pixel. Lub
tshwm sim yog ib qho graph ntawm cov ntaub ntawv teev tseg. Ib qhov siab tshaj plaws ntawm 256 x 256 cov bitmap loj tuaj yeem ua tau
kos siv BARGRAPH hom. Taw qhia, dav thiab qhov siab ntawm daim duab tuaj yeem ua tau
hloov kho cov kev siv nyiaj hloov bitmap.
TEXT8X8 - lookup nyob rau hauv ib daim font 8 x 8. Lub bitmap yog ib byte array tam sim no nyob hauv cov duab
ram thiab txhua tus byte indexes rau hauv ib qho 8x8 CP437 [2] font (inbuilt font bitmap
tuam haujlwm 16 & 17 yog siv rau kev kos TEXT8X8 hom). Qhov tshwm sim yog hais tias lub bitmap
ua zoo li lub cim kab sib txawv. Ib qho kev ua tiav tib lub ntsis yuav kos tau uas yog siv tag nrho los yog ib feem ntawm cov
zaub; txhua tus bytes hauv cov ntaub ntawv teev lus sib dhos sib sau ua ib qho 8 x 8 pixel cim ntawm tes.
TEXTVGA - lookup nyob rau hauv 8 x 6 font nrog TEXTVGA syntax. Lub bitmap yog TEXTVGA
array tam sim no nyob rau hauv cov duab kos ram, txhua lub cim indexes mus rau ib qho 8x16 CP437 [2]
font (inbuilt font bitmap handle 18 & 19 yog siv rau teeb duab TEXTVGA nrog
tswj cov ntaub ntawv xws li tom qab xim, foreground xim thiab cursor lwm yam). Lub
tshwm sim yog tias cov bitmap ua zoo li ib daim phiaj TEXTVGA. Ib tus hluas kawg nkaus yuav raug twv qhov twg
npog tag nrho los yog ib feem ntawm cov khoom; txhua tus TEXTVGA cov ntaub ntawv hauv cov bitmap sib raug
ib tug 8 x 16 pixel cim ntawm tes.
PALETTED - bitmap bytes yog indices rau hauv ib lub rooj palette. Los ntawm kev siv lub palette lub rooj -
uas muaj 32-ntsis RGBA xim - ib qho tseem ceeb ntawm kev nco tau txais kev cawmdim. Lub
256 xim palette yog muab tso rau hauv ib qho siab 1K (256 x 4) byte RAM_PAL.
linestride
Bitmap linestride, hauv cov bytes. Thov nco ntsoov cov kev cai sib tw kom sib haum
piav qhia hauv qab no.
qhov siab
Bitmap qhov siab, hauv kab
Kev piav qhia
Cov kev txwv bitmap txhawb yog L1, L4, L8, RGB332, ARGB2, ARGB4, ARGB1555,
RGB565 thiab Palette.
Rau hom ntawv L1, kab kev tawm yuav tsum yog ntau yam ntawm 8 khoom; Rau L4 hom kab
stride yuav tsum muaj ntau yam ntawm 2 nibbles. (Hwjchim mus byte)
Yog xav paub ntxiv txog kev sib ncag, thov saib cov duab hauv qab no:
Cov ntsiab lus graphics
Tsis muaj
Saib kuj
BITMAP_HANDLE, BITMAP_SIZE, BITMAP_SOURCE
Cov lus qhia
lim
Bitmap filtering hom, ib qho ntawm NEAREST los yog BILINEAR
Tus nqi ntawm NEAREST yog 0 thiab tus nqi ntawm BILINEAR yog 1.
wrapx
Bitmap x qhwv hom, ib qho ntawm REPEAT los yog CEEV
Tus nqi ntawm BORDER yog 0 thiab tus nqi ntawm REPEAT yog 1.
sau ntawv
Bitmap y qhwv hom, ib qho ntawm REPEAT los yog CEEV
dav
Tig dav bitmap dav, hauv pixels
qhov siab
Kos qhov siab qhov kawg ntawm qhov kawg, hauv pixels
Kev piav qhia
Qhov kev hais no tswj ntawm kev kos duab ntawm bitmaps: on-screen loj ntawm lub bitmap,
tus cwj pwm rau wrapping, thiab kev ua haujlwm zoo. Thov nco ntsoov tias yog tias wrapx los yog
Wrap yog REPEAT ces tus coj nco layout dimension
(BITMAP_LAYOUT kab stride los yog qhov siab) yuav tsum muaj zog ntawm ob, txwv tsis pub qhov tshwm sim yog
undefined.
Kev ntsuas qhov dav thiab qhov siab, tus nqi ntawm 1 mus rau 511 txhais tau tias qhov dav dav kawg
thiab qhov siab hauv pixel. Tus nqi ntawm xoom txhais tias yog 512 pixels nyob rau hauv qhov dav lossis qhov siab.
Piv txwv
Teeb duab ib 64 x 64 qhov kawg:
Siv lub caij npav REPEAT rau cov pobzeb: dl (BITMAP_SO
Cov ntsiab lus graphics
Tsis muaj
Saib kuj
BITMAP_HANDLE, BITMAP_LAYOUT, BITMAP_SOURCE
Cov lus qhia
ntxiv
Bitmap chaw nyob hauv graphics SRAM FT800, kws dlhos lug ntawm kev moog rua qhov kawg nkaus
hom ntawv.
Piv txwv, yog tias hom ntawv bitmap yog RGB565 / ARGB4 / ARGB1555, lub ntsis ntawm qhov kawg
qhov chaw yuav tsum tau mus raws li 2 bytes.
Kev piav qhia
Lub qhov chaw nyob qhov twg yog qhov chaw nyob hauv lub cim xeeb loj qhov twg
Bitmap cov ntaub ntawv duab yog loaded.
Piv txwv
Teeb duab ib 64 x 64 qhov kawg, loaded ntawm chaw nyob 0:
Siv cov graphical tib yam, tab sis nrog qhov chaw thiab qhov loj hloov los qhia tsuas yog tus
32 x 32 ntxaws:
Cov ntsiab lus graphics
Tsis muaj
Saib kuj
BITMAP_LAYOUT, BITMAP_SIZE
Cov lus qhia
a
Coefficient A ntawm qhov hloov bitrap hloov matrix, nyob rau hauv kos npe 8.8 ntsis tsau-point
daim ntawv. Tus nqi pib yog 256.
Kev piav qhia
BITMAP_TRANSFORM_A-F coefficients yog siv los ua qhov kev hloov me ntsis
functionalities xws li ntuav, tig thiab txhais lus. Cov no yog cov zoo li openGL
hloov ua haujlwm.
Piv txwv
Tus nqi ntawm 0.5 (128) ua rau lub bitmap tshwm ob chav dav:
Cov ntsiab lus graphics
Tus nqi ntawm ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
Tsis muaj
Cov lus qhia
b
Coefficient B ntawm qhov kev hloov ua tiav bitmap, hauv kos npe 8.8 ntsis-tsau
daim ntawv. Tus nqi pib yog 0
Kev piav qhia
BITMAP_TRANSFORM_A-F coefficients yog siv los ua qhov kev hloov me ntsis
functionalities xws li ntuav, tig thiab txhais lus. Cov no yog cov zoo li openGL
hloov ua haujlwm.
Cov ntsiab lus graphics
Tus nqi ntawm B yog ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
Tsis muaj
Cov lus qhia
c
Coefficient C ntawm qhov hloov ntawm daim phiaj hloov bitmap, hauv kos npe 15.8 me ntsis
daim ntawv. Tus nqi pib yog 0
Kev piav qhia
BITMAP_TRANSFORM_A-F coefficients yog siv los ua qhov kev hloov me ntsis
functionalities xws li ntuav, tig thiab txhais lus. Cov no yog cov zoo li openGL
hloov ua haujlwm.
Cov ntsiab lus graphics
Tus nqi ntawm c yog ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
Tsis muaj
Cov lus qhia
d
Coefficient D ntawm cov kev hloov ua tiav bitmap, hauv kos npe 8.8 ntsis ntawm qhov chaw
daim ntawv. Tus nqi pib yog 0
Kev piav qhia
BITMAP_TRANSFORM_A-F coefficients yog siv los ua qhov kev hloov me ntsis
functionalities xws li ntuav, tig thiab txhais lus. Cov no yog cov zoo li openGL
hloov ua haujlwm.
Cov ntsiab lus graphics
Tus nqi ntawm d yog ib feem ntawm cov ntsiab lus hauv kev ua duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
Tsis muaj
Cov lus qhia
e
Coefficient E ntawm tus bitmap hloov matrix, nyob rau hauv kos npe 8.8 ntsis taag-point
daim ntawv. Tus nqi pib yog 256
Kev piav qhia
BITMAP_TRANSFORM_A-F coefficients yog siv los ua qhov kev hloov me ntsis
functionalities xws li ntuav, tig thiab txhais lus. Cov no yog cov zoo li openGL
hloov ua haujlwm.
Piv txwv
Tus nqi ntawm 0.5 (128) ua rau lub bitmap tshwm ob qhov siab:
Cov ntsiab lus graphics
Tus nqi ntawm e yog ib feem ntawm cov ntsiab lus teb, raws li tau hais tseg hauv seem 4.1
Saib kuj
Tsis muaj
Cov lus qhia
f
Coefficient F ntawm lub txaij bitmap bitrap, nyob rau hauv kos npe 15.8 me ntsis-taw tes
daim ntawv. Tus nqi pib yog 0
Kev piav qhia
BITMAP_TRANSFORM_A-F coefficients yog siv los ua qhov kev hloov me ntsis
functionalities xws li ntuav, tig thiab txhais lus. Cov no yog cov zoo li openGL
hloov ua haujlwm.
Cov ntsiab lus graphics
Tus nqi ntawm f yog ib qho ntawm cov ntsiab lus teb, raws li tau hais tseg hauv seem 4.1
Saib kuj
Tsis muaj
Cov lus qhia
src
Qhia meej tias qhov tseem ceeb li cas yog qhov lej. Ib ntawm XOOM, IB,
SRC_ALPHA, DST_ALPHA, ONE_MINUS_SRC_ALPHA lossis
ONE_MINUS_DST_ALPHA. Tus nqi pib yog SRC_ALPHA (2).
dst
Ntaus li cas lub hom phiaj ntawm qhov chaw ua haujlwm yog muab xam, ib qho ntawm tib qho
constants li src. Tus nqi pib yog ONE_MINUS_SRC_ALPHA (4)
Kev piav qhia
Qhov ua haujlwm ntawm cov kev tswj ntawm cov xim tshiab ua ke nrog qhov tseem ceeb
twb nyob hauv cov xim tsis tuaj yeem. Muab lub pixel qhov chaw thiab ib qho nqi dhau los hauv
xim tsis tuaj yeem lo lus, xim xim:
qhov chaw × src + destination × dst
rau txhua qhov xim xim: liab, ntsuab, xiav thiab alpha.
Piv txwv
Lub neej ntawd ua haujlwm ntawm kev ua haujlwm (SRC_ALPHA, ONE_MINUS_SRC_ALPHA)
Yog nqus mus rau overlay lo lus uas peb siv cov nuj nqis alpha:
Cov ntsiab lus graphics
Qhov tseem ceeb ntawm src thiab dst yog ib feem ntawm cov ntsiab lus teb kos duab, raws li tau piav hauv seem
4.1
Saib kuj
COLOR_A
Cov lus qhia
dest
Qhov chaw nyob hauv RAM_DL uas cov lus hais kom ua yuav tsum yog
hloov. FT800 muaj qhov teeb meem khaws cia qhov chaw nyob. Rov qab los
qhov txuas ntxiv mus ntawm qhov chaw nyob, qhov RETURN hais kom ua tau pab.
Kev piav qhia
HU thiab RETURN muaj ib pawg 4 theem ntxiv rau tus pointer tam sim no. Yam
ntxiv HUV / rov qab ua tiav yuav ua rau tus cwj pwm tsis txaj muag.
Cov ntsiab lus graphics
Tsis muaj
Saib kuj
YUAV, RETURN
Cov lus qhia
cell
bitmap xov tooj ntawm tes. Tus nqi pib yog 0
Cov ntsiab lus graphics
Tus nqi ntawm lub xov tooj yog ib feem ntawm cov ntsiab lus teb, raws li tau hais tseg hauv seem 4.1
Saib kuj
Tsis muaj
Cov lus qhia
c
Ntshiab xim tsis tuaj. Qhov no me ntsis mus rau 1 yuav tshem cov xim tsis ntawm FT800
rau cov nqi preset. Qhov no me ntsis mus rau 0 yuav tswj cov xim tsis ntawm lub
FT800 nrog ib qho tsis hloov pauv. Cov nqi preset sau tseg hauv kev hais kom ua
CLEAR_COLOR_RGB rau RGB channel thiab CLEAR_COLOR_A rau alpha channel.
s
Ntshav tsis sib haum. Teem qhov no me ntsis mus 1 yuav tshem lub stencil tsis ntawm lub
FT800 rau cov nqi preset. Qhov no me ntsis mus rau 0 yuav tuav lub stencil
tsis ntawm FT800 nrog ib qho tsis hloov pauv. Cov nqi preset sau tseg hauv
hais kom CLEAR_STENCIL.
t
Ntshav tsis tag. Qhov no yuav nce mentsis rau 1 yuav tshem tau daim pib ntawm lub FT800 rau
tus nqi preset. Qhov no me ntsis mus rau 0 yuav tswj cov tsis tag ntawm lub
FT800 nrog ib qho tsis hloov pauv. Cov nqi preset sau tseg hauv kev hais kom ua
CLEAR_TAG.
Kev piav qhia
Cov kev xeem ntawv thiab lub qhov ncauj qhov ncauj qhov ncauj qhov ntswg yuav cuam tshuam rau kev ua haujlwm ntawm qhov tseeb. Scissor
txwv cov duab plaub uas muaj tseeb, thiab tsis sau cov qhov ncauj qhov ntswg txwv cov teeb meem uas cuam tshuam.
Lub xeev ntawm txoj haujlwm ntawm alpha, ua haujlwm, thiab stenciling tsis cuam tshuam rau qhov tseeb.
Piv txwv
Kom tshem lub vijtsam kom kaj lug xiav:
Cov ntsiab lus graphics
Tsis muaj
Saib kuj
CLEAR_COLOR_A, CLEAR_STENCIL, CLEAR_TAG, CLEAR_COLOR_RGB
Cov lus qhia
alpha
Alpha tus nqi siv thaum lub xim tsis muaj tseeb. Tus nqi pib yog 0
Cov ntsiab lus graphics
Qhov nqi ntawm alpha yog ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
CLEAR_COLOR_RGB, CLEAR
Cov lus qhia
liab
Cov nqi liab siv thaum lub xim tsis muaj tseeb. Tus nqi pib yog 0
ntsuab
Ntsuab tus nqi siv thaum lub xim tsis muaj tseeb. Tus nqi pib yog 0
xiav
Cov nqi xiav siv thaum lub xim tsis muaj tseeb. Tus nqi pib yog 0
Kev piav qhia
Siv cov xim uas siv los ntawm CLEAR nram qab no.
Piv txwv
Kom tshem lub vijtsam kom kaj lug xiav:
Cov ntsiab lus graphics
Qhov tseem ceeb ntawm xim liab, ntsuab thiab xiav yog ib feem ntawm cov ntsiab lus teb, raws li tau piav tseg hauv
Tshooj 4.1
Saib kuj
CLEAR_COLOR_A, CLEAR
Cov lus qhia
s
Tus nqi siv thaum lub stencil tsis tau tshem tawm. Tus nqi pib yog 0
Cov ntsiab lus graphics
Tus nqi ntawm s yog ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
CLEAR
Cov lus qhia
t
Tus nqi siv thaum lub tag tsis muaj tseeb. Tus nqi pib yog 0.
Cov ntsiab lus graphics
Tus nqi ntawm s yog ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
TAG, TAG_MASK, CLEAR
Cov lus qhia
alpha
Alpha rau xim tam sim no. Tus nqi pib yog 255
Kev piav qhia
Teev tus nqi ntawm alpha rau cov ntsiab lus kos - cov ntsiab lus, cov kab, thiab cov bitmaps. Ua li cas
cov nuj nqis alpha cuam tshuam duab pixels nyob ntawm BLEND_FUNC; kev coj cwj pwm ua vim
yog lub pob tshab zoo.
Piv txwv
Teeb duab peb cim nrog daim duab 255, 128, thiab 64:
Cov ntsiab lus graphics
Qhov nqi ntawm alpha yog ib feem ntawm cov ntsiab lus duab, raws li tau hais tseg hauv seem 4.1
Saib kuj
COLOR_RGB, BLEND_FUNC
Cov lus qhia
r
Pab kom los yog lov tes taw hloov tshiab rau Channel FT800 xim. Thawj zaug
tus nqi yog 1 thiab txhais tau tias pab.
g
Pab los yog lov tes taw hloov tshiab ntawm cov xim ntsuab ntawm FT800 xim. Lub
thawj tus nqi yog 1 thiab txhais tau tias kev pab.
b
Pab kom los yog lov tes taw hloov tshiab ntawm cov xim tshiab ntawm FT800 xim. Thawj zaug
tus nqi yog 1 thiab txhais tau tias pab.
a
Pab kom los yog lov tes taw hloov tshiab ntawm alpha channel ntawm FT800 xim tsis. Lub
thawj tus nqi yog 1 thiab txhais tau tias kev pab.
Kev piav qhia
Lub npog qhov ncauj qhov quav yog qhov xim ntawm qhov pixel tshiab. Qee zaum
nws yog siv los xaiv kev hloov tshiab tsuas yog xim ntsuab, ntsuab, xiav los yog alpha raws ntawm
duab. Ntau zaus, nws yog siv los ua kom lov tes taw xim tshiab thaum muab kho dua rau
lossis thiab stencil buffers.
Piv txwv
Kos tus cim '8' hauv nruab nrab ntawm qhov screen. Tom qab ntawd pleev xim ib qho pom tsis pom 40-pixel
kov cheeb tsam hauv daim pib tsis tag:
Cov ntsiab lus graphics
Qhov tseem ceeb ntawm r, g, b thiab ib feem ntawm cov duab ntsiab lus, raws li tau hais hauv seem
4.1
Saib kuj
TAG_MASK
Cov lus qhia
liab
Liab tus nqi rau cov xim tam sim no. Tus nqi pib yog 255
ntsuab
Ntsuab tus nqi rau cov xim tam sim no. Tus nqi pib yog 255
xiav
Cov nqi xiav rau xim tam sim no. Tus nqi pib yog 255
Kev piav qhia
Poob lawm liab, ntsuab thiab xiav qhov tseem ceeb ntawm FT800 xim xim uas yuav raug siv rau
tom qab kos cov haujlwm.
Piv txwv
Teeb duab peb cim nrog cov xim sib txawv:
Cov ntsiab lus graphics
Qhov tseem ceeb ntawm xim liab, ntsuab thiab xiav yog ib feem ntawm cov ntsiab lus teb, raws li tau piav tseg hauv
Tshooj 4.1
Saib kuj
COLOR_A