directfb.h 233 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753
  1. /*
  2. (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
  3. (c) Copyright 2000-2004 Convergence (integrated media) GmbH
  4. All rights reserved.
  5. Written by Denis Oliver Kropp <dok@directfb.org>,
  6. Andreas Hundt <andi@fischlustig.de>,
  7. Sven Neumann <neo@directfb.org>,
  8. Ville Syrjälä <syrjala@sci.fi> and
  9. Claudio Ciccani <klan@users.sf.net>.
  10. This library is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU Lesser General Public
  12. License as published by the Free Software Foundation; either
  13. version 2 of the License, or (at your option) any later version.
  14. This library is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. Lesser General Public License for more details.
  18. You should have received a copy of the GNU Lesser General Public
  19. License along with this library; if not, write to the
  20. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef __DIRECTFB_H__
  24. #define __DIRECTFB_H__
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. #include <dfb_types.h>
  30. #include <sys/time.h> /* struct timeval */
  31. #include <directfb_build.h>
  32. #include <directfb_keyboard.h>
  33. #include <direct/interface.h>
  34. /*
  35. * Version handling.
  36. */
  37. extern const unsigned int directfb_major_version;
  38. extern const unsigned int directfb_minor_version;
  39. extern const unsigned int directfb_micro_version;
  40. extern const unsigned int directfb_binary_age;
  41. extern const unsigned int directfb_interface_age;
  42. /*
  43. * Check for a certain DirectFB version.
  44. * In case of an error a message is returned describing the mismatch.
  45. */
  46. const char * DirectFBCheckVersion( unsigned int required_major,
  47. unsigned int required_minor,
  48. unsigned int required_micro );
  49. /*
  50. * Main interface of DirectFB, created by DirectFBCreate().
  51. */
  52. DECLARE_INTERFACE( IDirectFB )
  53. /*
  54. * Interface to a surface object, being a graphics context for rendering and state control,
  55. * buffer operations, palette access and sub area translate'n'clip logic.
  56. */
  57. DECLARE_INTERFACE( IDirectFBSurface )
  58. /*
  59. * Interface for read/write access to the colors of a palette object and for cloning it.
  60. */
  61. DECLARE_INTERFACE( IDirectFBPalette )
  62. /*
  63. * Input device interface for keymap access, event buffers and state queries.
  64. */
  65. DECLARE_INTERFACE( IDirectFBInputDevice )
  66. /*
  67. * Layer interface for configuration, window stack usage or direct surface access, with shared/exclusive context.
  68. */
  69. DECLARE_INTERFACE( IDirectFBDisplayLayer )
  70. /*
  71. * Interface to a window object, controlling appearance and focus, positioning and stacking,
  72. * event buffers and surface access.
  73. */
  74. DECLARE_INTERFACE( IDirectFBWindow )
  75. /*
  76. * Interface to a local event buffer to send/receive events, wait for events, abort waiting or reset buffer.
  77. */
  78. DECLARE_INTERFACE( IDirectFBEventBuffer )
  79. /*
  80. * Font interface for getting metrics, measuring strings or single characters, query/choose encodings.
  81. */
  82. DECLARE_INTERFACE( IDirectFBFont )
  83. /*
  84. * Interface to an image provider, retrieving information about the image and rendering it to a surface.
  85. */
  86. DECLARE_INTERFACE( IDirectFBImageProvider )
  87. /*
  88. * Interface to a video provider for playback with advanced control and basic stream information.
  89. */
  90. DECLARE_INTERFACE( IDirectFBVideoProvider )
  91. /*
  92. * Data buffer interface, providing unified access to different kinds of data storage and live feed.
  93. */
  94. DECLARE_INTERFACE( IDirectFBDataBuffer )
  95. /*
  96. * Interface to different display outputs, encoders, connector settings, power management and synchronization.
  97. */
  98. DECLARE_INTERFACE( IDirectFBScreen )
  99. /*
  100. * OpenGL context of a surface.
  101. */
  102. DECLARE_INTERFACE( IDirectFBGL )
  103. /*
  104. * Return code of all interface methods and most functions
  105. *
  106. * Whenever a method has to return any information, it is done via output parameters. These are pointers to
  107. * primitive types such as <i>int *ret_num</i>, enumerated types like <i>DFBBoolean *ret_enabled</i>, structures
  108. * as in <i>DFBDisplayLayerConfig *ret_config</i>, just <i>void **ret_data</i> or other types...
  109. */
  110. typedef enum {
  111. /*
  112. * Aliases for backward compatibility and uniform look in DirectFB code
  113. */
  114. DFB_OK = DR_OK, /* No error occured. */
  115. DFB_FAILURE = DR_FAILURE, /* A general or unknown error occured. */
  116. DFB_INIT = DR_INIT, /* A general initialization error occured. */
  117. DFB_BUG = DR_BUG, /* Internal bug or inconsistency has been detected. */
  118. DFB_DEAD = DR_DEAD, /* Interface has a zero reference counter (available in debug mode). */
  119. DFB_UNSUPPORTED = DR_UNSUPPORTED, /* The requested operation or an argument is (currently) not supported. */
  120. DFB_UNIMPLEMENTED = DR_UNIMPLEMENTED, /* The requested operation is not implemented, yet. */
  121. DFB_ACCESSDENIED = DR_ACCESSDENIED, /* Access to the resource is denied. */
  122. DFB_INVAREA = DR_INVAREA, /* An invalid area has been specified or detected. */
  123. DFB_INVARG = DR_INVARG, /* An invalid argument has been specified. */
  124. DFB_NOSYSTEMMEMORY = DR_NOLOCALMEMORY, /* There's not enough system memory. */
  125. DFB_NOSHAREDMEMORY = DR_NOSHAREDMEMORY, /* There's not enough shared memory. */
  126. DFB_LOCKED = DR_LOCKED, /* The resource is (already) locked. */
  127. DFB_BUFFEREMPTY = DR_BUFFEREMPTY, /* The buffer is empty. */
  128. DFB_FILENOTFOUND = DR_FILENOTFOUND, /* The specified file has not been found. */
  129. DFB_IO = DR_IO, /* A general I/O error occured. */
  130. DFB_BUSY = DR_BUSY, /* The resource or device is busy. */
  131. DFB_NOIMPL = DR_NOIMPL, /* No implementation for this interface or content type has been found. */
  132. DFB_TIMEOUT = DR_TIMEOUT, /* The operation timed out. */
  133. DFB_THIZNULL = DR_THIZNULL, /* 'thiz' pointer is NULL. */
  134. DFB_IDNOTFOUND = DR_IDNOTFOUND, /* No resource has been found by the specified id. */
  135. DFB_DESTROYED = DR_DESTROYED, /* The underlying object (e.g. a window or surface) has been destroyed. */
  136. DFB_FUSION = DR_FUSION, /* Internal fusion error detected, most likely related to IPC resources. */
  137. DFB_BUFFERTOOLARGE = DR_BUFFERTOOLARGE, /* Buffer is too large. */
  138. DFB_INTERRUPTED = DR_INTERRUPTED, /* The operation has been interrupted. */
  139. DFB_NOCONTEXT = DR_NOCONTEXT, /* No context available. */
  140. DFB_TEMPUNAVAIL = DR_TEMPUNAVAIL, /* Temporarily unavailable. */
  141. DFB_LIMITEXCEEDED = DR_LIMITEXCEEDED, /* Attempted to exceed limit, i.e. any kind of maximum size, count etc. */
  142. DFB_NOSUCHMETHOD = DR_NOSUCHMETHOD, /* Requested method is not known, e.g. to remote site. */
  143. DFB_NOSUCHINSTANCE = DR_NOSUCHINSTANCE, /* Requested instance is not known, e.g. to remote site. */
  144. DFB_ITEMNOTFOUND = DR_ITEMNOTFOUND, /* No such item found. */
  145. DFB_VERSIONMISMATCH = DR_VERSIONMISMATCH, /* Some versions didn't match. */
  146. DFB_EOF = DR_EOF, /* Reached end of file. */
  147. DFB_SUSPENDED = DR_SUSPENDED, /* The requested object is suspended. */
  148. DFB_INCOMPLETE = DR_INCOMPLETE, /* The operation has been executed, but not completely. */
  149. DFB_NOCORE = DR_NOCORE, /* Core part not available. */
  150. /*
  151. * DirectFB specific result codes starting at (after) this offset
  152. */
  153. DFB__RESULT_OFFSET = D_RESULT_TYPE_BASE( 'D','F','B' ),
  154. DFB_NOVIDEOMEMORY, /* There's not enough video memory. */
  155. DFB_MISSINGFONT, /* No font has been set. */
  156. DFB_MISSINGIMAGE, /* No image has been set. */
  157. } DFBResult;
  158. /*
  159. * A boolean.
  160. */
  161. typedef enum {
  162. DFB_FALSE = 0,
  163. DFB_TRUE = !DFB_FALSE
  164. } DFBBoolean;
  165. /*
  166. * A point specified by x/y coordinates.
  167. */
  168. typedef struct {
  169. int x; /* X coordinate of it */
  170. int y; /* Y coordinate of it */
  171. } DFBPoint;
  172. /*
  173. * A horizontal line specified by x and width.
  174. */
  175. typedef struct {
  176. int x; /* X coordinate */
  177. int w; /* width of span */
  178. } DFBSpan;
  179. /*
  180. * A dimension specified by width and height.
  181. */
  182. typedef struct {
  183. int w; /* width of it */
  184. int h; /* height of it */
  185. } DFBDimension;
  186. /*
  187. * A rectangle specified by a point and a dimension.
  188. */
  189. typedef struct {
  190. int x; /* X coordinate of its top-left point */
  191. int y; /* Y coordinate of its top-left point */
  192. int w; /* width of it */
  193. int h; /* height of it */
  194. } DFBRectangle;
  195. /*
  196. * A rectangle specified by normalized coordinates.
  197. *
  198. * E.g. using 0.0, 0.0, 1.0, 1.0 would specify the whole screen.
  199. */
  200. typedef struct {
  201. float x; /* normalized X coordinate */
  202. float y; /* normalized Y coordinate */
  203. float w; /* normalized width */
  204. float h; /* normalized height */
  205. } DFBLocation;
  206. /*
  207. * A region specified by two points.
  208. *
  209. * The defined region includes both endpoints.
  210. */
  211. typedef struct {
  212. int x1; /* X coordinate of top-left point */
  213. int y1; /* Y coordinate of top-left point */
  214. int x2; /* X coordinate of lower-right point */
  215. int y2; /* Y coordinate of lower-right point */
  216. } DFBRegion;
  217. /*
  218. * Insets specify a distance from each edge of a rectangle.
  219. *
  220. * Positive values always mean 'outside'.
  221. */
  222. typedef struct {
  223. int l; /* distance from left edge */
  224. int t; /* distance from top edge */
  225. int r; /* distance from right edge */
  226. int b; /* distance from bottom edge */
  227. } DFBInsets;
  228. /*
  229. * A triangle specified by three points.
  230. */
  231. typedef struct {
  232. int x1; /* X coordinate of first edge */
  233. int y1; /* Y coordinate of first edge */
  234. int x2; /* X coordinate of second edge */
  235. int y2; /* Y coordinate of second edge */
  236. int x3; /* X coordinate of third edge */
  237. int y3; /* Y coordinate of third edge */
  238. } DFBTriangle;
  239. /*
  240. * A trapezoid specified by two points with a width each.
  241. */
  242. typedef struct {
  243. int x1; /* X coordinate of first span */
  244. int y1; /* Y coordinate of first span */
  245. int w1; /* width of first span */
  246. int x2; /* X coordinate of second span */
  247. int y2; /* Y coordinate of second span */
  248. int w2; /* width of second span */
  249. } DFBTrapezoid;
  250. /*
  251. * A color defined by channels with 8bit each.
  252. */
  253. typedef struct {
  254. u8 a; /* alpha channel */
  255. u8 r; /* red channel */
  256. u8 g; /* green channel */
  257. u8 b; /* blue channel */
  258. } DFBColor;
  259. /*
  260. * A color key defined by R,G,B and eventually a color index.
  261. */
  262. typedef struct {
  263. u8 index; /* color index */
  264. u8 r; /* red channel */
  265. u8 g; /* green channel */
  266. u8 b; /* blue channel */
  267. } DFBColorKey;
  268. /*
  269. * A color defined by channels with 8bit each.
  270. */
  271. typedef struct {
  272. u8 a; /* alpha channel */
  273. u8 y; /* luma channel */
  274. u8 u; /* chroma channel */
  275. u8 v; /* chroma channel */
  276. } DFBColorYUV;
  277. /*
  278. * Macro to compare two points.
  279. */
  280. #define DFB_POINT_EQUAL(a,b) ((a).x == (b).x && \
  281. (a).y == (b).y)
  282. /*
  283. * Macro to compare two rectangles.
  284. */
  285. #define DFB_RECTANGLE_EQUAL(a,b) ((a).x == (b).x && \
  286. (a).y == (b).y && \
  287. (a).w == (b).w && \
  288. (a).h == (b).h)
  289. /*
  290. * Macro to compare two locations.
  291. */
  292. #define DFB_LOCATION_EQUAL(a,b) ((a).x == (b).x && \
  293. (a).y == (b).y && \
  294. (a).w == (b).w && \
  295. (a).h == (b).h)
  296. /*
  297. * Macro to compare two regions.
  298. */
  299. #define DFB_REGION_EQUAL(a,b) ((a).x1 == (b).x1 && \
  300. (a).y1 == (b).y1 && \
  301. (a).x2 == (b).x2 && \
  302. (a).y2 == (b).y2)
  303. /*
  304. * Macro to compare two colors.
  305. */
  306. #define DFB_COLOR_EQUAL(x,y) ((x).a == (y).a && \
  307. (x).r == (y).r && \
  308. (x).g == (y).g && \
  309. (x).b == (y).b)
  310. /*
  311. * Macro to compare two color keys.
  312. */
  313. #define DFB_COLORKEY_EQUAL(x,y) ((x).index == (y).index && \
  314. (x).r == (y).r && \
  315. (x).g == (y).g && \
  316. (x).b == (y).b)
  317. /*
  318. * Print a description of the result code along with an
  319. * optional message that is put in front with a colon.
  320. */
  321. DFBResult DirectFBError(
  322. const char *msg, /* optional message */
  323. DFBResult result /* result code to interpret */
  324. );
  325. /*
  326. * Behaves like DirectFBError, but shuts down the calling application.
  327. */
  328. DFBResult DirectFBErrorFatal(
  329. const char *msg, /* optional message */
  330. DFBResult result /* result code to interpret */
  331. );
  332. /*
  333. * Returns a string describing 'result'.
  334. */
  335. const char *DirectFBErrorString(
  336. DFBResult result
  337. );
  338. /*
  339. * Retrieves information about supported command-line flags in the
  340. * form of a user-readable string formatted suitable to be printed
  341. * as usage information.
  342. */
  343. const char *DirectFBUsageString( void );
  344. /*
  345. * Parses the command-line and initializes some variables. You
  346. * absolutely need to call this before doing anything else.
  347. * Removes all options used by DirectFB from argv.
  348. */
  349. DFBResult DirectFBInit(
  350. int *argc, /* pointer to main()'s argc */
  351. char *(*argv[]) /* pointer to main()'s argv */
  352. );
  353. /*
  354. * Sets configuration parameters supported on command line and in
  355. * config file. Can only be called before DirectFBCreate but after
  356. * DirectFBInit.
  357. */
  358. DFBResult DirectFBSetOption(
  359. const char *name,
  360. const char *value
  361. );
  362. /*
  363. * Creates the super interface.
  364. */
  365. DFBResult DirectFBCreate(
  366. IDirectFB **interface /* pointer to the
  367. created interface */
  368. );
  369. typedef unsigned int DFBScreenID;
  370. typedef unsigned int DFBDisplayLayerID;
  371. typedef unsigned int DFBDisplayLayerSourceID;
  372. typedef unsigned int DFBSurfaceID;
  373. typedef unsigned int DFBWindowID;
  374. typedef unsigned int DFBInputDeviceID;
  375. typedef unsigned int DFBTextEncodingID;
  376. typedef u32 DFBDisplayLayerIDs;
  377. typedef unsigned int DFBColorID;
  378. /*
  379. * Predefined color IDs.
  380. */
  381. #define DCID_PRIMARY 0
  382. #define DCID_OUTLINE 1
  383. /*
  384. * Maximum number of color ids.
  385. */
  386. #define DFB_COLOR_IDS_MAX 8
  387. /*
  388. * Maximum number of layer ids.
  389. */
  390. #define DFB_DISPLAYLAYER_IDS_MAX 32
  391. /*
  392. * Adds the id to the bitmask of layer ids.
  393. */
  394. #define DFB_DISPLAYLAYER_IDS_ADD(ids,id) (ids) |= (1 << (id))
  395. /*
  396. * Removes the id from the bitmask of layer ids.
  397. */
  398. #define DFB_DISPLAYLAYER_IDS_REMOVE(ids,id) (ids) &= ~(1 << (id))
  399. /*
  400. * Checks if the bitmask of layer ids contains the id.
  401. */
  402. #define DFB_DISPLAYLAYER_IDS_HAVE(ids,id) ((ids) & (1 << (id)))
  403. /*
  404. * Empties (clears) the bitmask of layer ids.
  405. */
  406. #define DFB_DISPLAYLAYER_IDS_EMPTY(ids) (ids) = 0
  407. /*
  408. * Predefined text encoding IDs.
  409. */
  410. #define DTEID_UTF8 0
  411. #define DTEID_OTHER 1
  412. /*
  413. * The cooperative level controls the super interface's behaviour
  414. * in functions like SetVideoMode or CreateSurface for the primary.
  415. */
  416. typedef enum {
  417. DFSCL_NORMAL = 0x00000000, /* Normal shared access, primary
  418. surface will be the buffer of an
  419. implicitly created window at the
  420. resolution given by SetVideoMode().
  421. */
  422. DFSCL_FULLSCREEN, /* Application grabs the primary layer,
  423. SetVideoMode automates layer
  424. control. Primary surface is the
  425. primary layer surface. */
  426. DFSCL_EXCLUSIVE /* All but the primary layer will be
  427. disabled, the application has full
  428. control over layers if desired,
  429. other applications have no
  430. input/output/control. Primary
  431. surface is the primary layer
  432. surface. */
  433. } DFBCooperativeLevel;
  434. /*
  435. * Capabilities of a display layer.
  436. */
  437. typedef enum {
  438. DLCAPS_NONE = 0x00000000,
  439. DLCAPS_SURFACE = 0x00000001, /* The layer has a surface that can be drawn to. This
  440. may not be provided by layers that display realtime
  441. data, e.g. from an MPEG decoder chip. Playback
  442. control may be provided by an external API. */
  443. DLCAPS_OPACITY = 0x00000002, /* The layer supports blending with layer(s) below
  444. based on a global alpha factor. */
  445. DLCAPS_ALPHACHANNEL = 0x00000004, /* The layer supports blending with layer(s) below
  446. based on each pixel's alpha value. */
  447. DLCAPS_SCREEN_LOCATION = 0x00000008, /* The layer location on the screen can be changed,
  448. this includes position and size as normalized
  449. values. The default is 0.0f, 0.0f, 1.0f, 1.0f.
  450. Supports IDirectFBDisplayLayer::SetScreenLocation()
  451. and IDirectFBDisplayLayer::SetScreenRectangle().
  452. This implies DLCAPS_SCREEN_POSITION and _SIZE. */
  453. DLCAPS_FLICKER_FILTERING = 0x00000010, /* Flicker filtering can be enabled for smooth output
  454. on interlaced display devices. */
  455. DLCAPS_DEINTERLACING = 0x00000020, /* The layer provides optional deinterlacing for
  456. displaying interlaced video data on progressive
  457. display devices. */
  458. DLCAPS_SRC_COLORKEY = 0x00000040, /* A specific color can be declared as transparent. */
  459. DLCAPS_DST_COLORKEY = 0x00000080, /* A specific color of layers below can be specified
  460. as the color of the only locations where the layer
  461. is visible. */
  462. DLCAPS_BRIGHTNESS = 0x00000100, /* Adjustment of brightness is supported. */
  463. DLCAPS_CONTRAST = 0x00000200, /* Adjustment of contrast is supported. */
  464. DLCAPS_HUE = 0x00000400, /* Adjustment of hue is supported. */
  465. DLCAPS_SATURATION = 0x00000800, /* Adjustment of saturation is supported. */
  466. DLCAPS_LEVELS = 0x00001000, /* Adjustment of the layer's level
  467. (z position) is supported. */
  468. DLCAPS_FIELD_PARITY = 0x00002000, /* Field parity can be selected */
  469. DLCAPS_WINDOWS = 0x00004000, /* Hardware window support. */
  470. DLCAPS_SOURCES = 0x00008000, /* Sources can be selected. */
  471. DLCAPS_ALPHA_RAMP = 0x00010000, /* Alpha values for formats with one or two alpha bits
  472. can be chosen, i.e. using ARGB1555 or ARGB2554 the
  473. user can define the meaning of the two or four
  474. possibilities. In short, this feature provides a
  475. lookup table for the alpha bits of these formats.
  476. See also IDirectFBSurface::SetAlphaRamp(). */
  477. DLCAPS_PREMULTIPLIED = 0x00020000, /* Surfaces with premultiplied alpha are supported. */
  478. DLCAPS_SCREEN_POSITION = 0x00100000, /* The layer position on the screen can be changed.
  479. Supports IDirectFBDisplayLayer::SetScreenPosition(). */
  480. DLCAPS_SCREEN_SIZE = 0x00200000, /* The layer size (defined by its source rectangle)
  481. can be scaled to a different size on the screen
  482. (defined by its screen/destination rectangle or
  483. its normalized size) and does not have to be 1:1
  484. with it. */
  485. DLCAPS_CLIP_REGIONS = 0x00400000, /* Supports IDirectFBDisplayLayer::SetClipRegions(). */
  486. DLCAPS_ALL = 0x0073FFFF
  487. } DFBDisplayLayerCapabilities;
  488. /*
  489. * Capabilities of a screen.
  490. */
  491. typedef enum {
  492. DSCCAPS_NONE = 0x00000000,
  493. DSCCAPS_VSYNC = 0x00000001, /* Synchronization with the
  494. vertical retrace supported. */
  495. DSCCAPS_POWER_MANAGEMENT = 0x00000002, /* Power management supported. */
  496. DSCCAPS_MIXERS = 0x00000010, /* Has mixers. */
  497. DSCCAPS_ENCODERS = 0x00000020, /* Has encoders. */
  498. DSCCAPS_OUTPUTS = 0x00000040, /* Has outputs. */
  499. DSCCAPS_ALL = 0x00000073
  500. } DFBScreenCapabilities;
  501. /*
  502. * Used to enable some capabilities like flicker filtering or colorkeying.
  503. */
  504. typedef enum {
  505. DLOP_NONE = 0x00000000, /* None of these. */
  506. DLOP_ALPHACHANNEL = 0x00000001, /* Make usage of alpha channel
  507. for blending on a pixel per
  508. pixel basis. */
  509. DLOP_FLICKER_FILTERING = 0x00000002, /* Enable flicker filtering. */
  510. DLOP_DEINTERLACING = 0x00000004, /* Enable deinterlacing of an
  511. interlaced (video) source. */
  512. DLOP_SRC_COLORKEY = 0x00000008, /* Enable source color key. */
  513. DLOP_DST_COLORKEY = 0x00000010, /* Enable dest. color key. */
  514. DLOP_OPACITY = 0x00000020, /* Make usage of the global alpha
  515. factor set by SetOpacity. */
  516. DLOP_FIELD_PARITY = 0x00000040 /* Set field parity */
  517. } DFBDisplayLayerOptions;
  518. /*
  519. * Layer Buffer Mode.
  520. */
  521. typedef enum {
  522. DLBM_UNKNOWN = 0x00000000,
  523. DLBM_FRONTONLY = 0x00000001, /* no backbuffer */
  524. DLBM_BACKVIDEO = 0x00000002, /* backbuffer in video memory */
  525. DLBM_BACKSYSTEM = 0x00000004, /* backbuffer in system memory */
  526. DLBM_TRIPLE = 0x00000008, /* triple buffering */
  527. DLBM_WINDOWS = 0x00000010 /* no layer buffers at all,
  528. using buffer of each window */
  529. } DFBDisplayLayerBufferMode;
  530. /*
  531. * Flags defining which fields of a DFBSurfaceDescription are valid.
  532. */
  533. typedef enum {
  534. DSDESC_NONE = 0x00000000, /* none of these */
  535. DSDESC_CAPS = 0x00000001, /* caps field is valid */
  536. DSDESC_WIDTH = 0x00000002, /* width field is valid */
  537. DSDESC_HEIGHT = 0x00000004, /* height field is valid */
  538. DSDESC_PIXELFORMAT = 0x00000008, /* pixelformat field is valid */
  539. DSDESC_PREALLOCATED = 0x00000010, /* Surface uses data that has been
  540. preallocated by the application.
  541. The field array 'preallocated'
  542. has to be set using the first
  543. element for the front buffer
  544. and eventually the second one
  545. for the back buffer. */
  546. DSDESC_PALETTE = 0x00000020, /* Initialize the surfaces palette
  547. with the entries specified in the
  548. description. */
  549. DSDESC_RESOURCE_ID = 0x00000100, /* user defined resource id for general purpose
  550. surfaces is specified, or resource id of window,
  551. layer, user is returned */
  552. DSDESC_HINTS = 0x00000200, /* Flags for optimized allocation and pixel format selection are set.
  553. See also DFBSurfaceHintFlags. */
  554. DSDESC_ALL = 0x0000033F /* all of these */
  555. } DFBSurfaceDescriptionFlags;
  556. /*
  557. * Flags defining which fields of a DFBPaletteDescription are valid.
  558. */
  559. typedef enum {
  560. DPDESC_CAPS = 0x00000001, /* Specify palette capabilities. */
  561. DPDESC_SIZE = 0x00000002, /* Specify number of entries. */
  562. DPDESC_ENTRIES = 0x00000004 /* Initialize the palette with the
  563. entries specified in the
  564. description. */
  565. } DFBPaletteDescriptionFlags;
  566. /*
  567. * The surface capabilities.
  568. */
  569. typedef enum {
  570. DSCAPS_NONE = 0x00000000, /* None of these. */
  571. DSCAPS_PRIMARY = 0x00000001, /* It's the primary surface. */
  572. DSCAPS_SYSTEMONLY = 0x00000002, /* Surface data is permanently stored in system memory.<br>
  573. There's no video memory allocation/storage. */
  574. DSCAPS_VIDEOONLY = 0x00000004, /* Surface data is permanently stored in video memory.<br>
  575. There's no system memory allocation/storage. */
  576. DSCAPS_DOUBLE = 0x00000010, /* Surface is double buffered */
  577. DSCAPS_SUBSURFACE = 0x00000020, /* Surface is just a sub area of another
  578. one sharing the surface data. */
  579. DSCAPS_INTERLACED = 0x00000040, /* Each buffer contains interlaced video (or graphics)
  580. data consisting of two fields.<br>
  581. Their lines are stored interleaved. One field's height
  582. is a half of the surface's height. */
  583. DSCAPS_SEPARATED = 0x00000080, /* For usage with DSCAPS_INTERLACED.<br>
  584. DSCAPS_SEPARATED specifies that the fields are NOT
  585. interleaved line by line in the buffer.<br>
  586. The first field is followed by the second one. */
  587. DSCAPS_STATIC_ALLOC = 0x00000100, /* The amount of video or system memory allocated for the
  588. surface is never less than its initial value. This way
  589. a surface can be resized (smaller and bigger up to the
  590. initial size) without reallocation of the buffers. It's
  591. useful for surfaces that need a guaranteed space in
  592. video memory after resizing. */
  593. DSCAPS_TRIPLE = 0x00000200, /* Surface is triple buffered. */
  594. DSCAPS_PREMULTIPLIED = 0x00001000, /* Surface stores data with premultiplied alpha. */
  595. DSCAPS_DEPTH = 0x00010000, /* A depth buffer is allocated. */
  596. DSCAPS_SHARED = 0x00100000, /* The surface will be accessible among processes. */
  597. DSCAPS_ROTATED = 0x01000000, /* The back buffers are allocated with swapped width/height (unimplemented!). */
  598. DSCAPS_ALL = 0x011113F7, /* All of these. */
  599. DSCAPS_FLIPPING = DSCAPS_DOUBLE | DSCAPS_TRIPLE /* Surface needs Flip() calls to make
  600. updates/changes visible/usable. */
  601. } DFBSurfaceCapabilities;
  602. /*
  603. * The palette capabilities.
  604. */
  605. typedef enum {
  606. DPCAPS_NONE = 0x00000000 /* None of these. */
  607. } DFBPaletteCapabilities;
  608. /*
  609. * Flags controlling drawing commands.
  610. */
  611. typedef enum {
  612. DSDRAW_NOFX = 0x00000000, /* uses none of the effects */
  613. DSDRAW_BLEND = 0x00000001, /* uses alpha from color */
  614. DSDRAW_DST_COLORKEY = 0x00000002, /* write to destination only if the destination pixel
  615. matches the destination color key */
  616. DSDRAW_SRC_PREMULTIPLY = 0x00000004, /* multiplies the color's rgb channels by the alpha
  617. channel before drawing */
  618. DSDRAW_DST_PREMULTIPLY = 0x00000008, /* modulates the dest. color with the dest. alpha */
  619. DSDRAW_DEMULTIPLY = 0x00000010, /* divides the color by the alpha before writing the
  620. data to the destination */
  621. DSDRAW_XOR = 0x00000020 /* bitwise xor the destination pixels with the
  622. specified color after premultiplication */
  623. } DFBSurfaceDrawingFlags;
  624. /*
  625. * Flags controlling blitting commands.
  626. */
  627. typedef enum {
  628. DSBLIT_NOFX = 0x00000000, /* uses none of the effects */
  629. DSBLIT_BLEND_ALPHACHANNEL = 0x00000001, /* enables blending and uses
  630. alphachannel from source */
  631. DSBLIT_BLEND_COLORALPHA = 0x00000002, /* enables blending and uses
  632. alpha value from color */
  633. DSBLIT_COLORIZE = 0x00000004, /* modulates source color with
  634. the color's r/g/b values */
  635. DSBLIT_SRC_COLORKEY = 0x00000008, /* don't blit pixels matching the source color key */
  636. DSBLIT_DST_COLORKEY = 0x00000010, /* write to destination only if the destination pixel
  637. matches the destination color key */
  638. DSBLIT_SRC_PREMULTIPLY = 0x00000020, /* modulates the source color with the (modulated)
  639. source alpha */
  640. DSBLIT_DST_PREMULTIPLY = 0x00000040, /* modulates the dest. color with the dest. alpha */
  641. DSBLIT_DEMULTIPLY = 0x00000080, /* divides the color by the alpha before writing the
  642. data to the destination */
  643. DSBLIT_DEINTERLACE = 0x00000100, /* deinterlaces the source during blitting by reading
  644. only one field (every second line of full
  645. image) scaling it vertically by factor two */
  646. DSBLIT_SRC_PREMULTCOLOR = 0x00000200, /* modulates the source color with the color alpha */
  647. DSBLIT_XOR = 0x00000400, /* bitwise xor the destination pixels with the
  648. source pixels after premultiplication */
  649. DSBLIT_INDEX_TRANSLATION = 0x00000800, /* do fast indexed to indexed translation,
  650. this flag is mutual exclusive with all others */
  651. DSBLIT_ROTATE90 = 0x00002000, /* rotate the image by 90 degree */
  652. DSBLIT_ROTATE180 = 0x00001000, /* rotate the image by 180 degree */
  653. DSBLIT_ROTATE270 = 0x00004000, /* rotate the image by 270 degree */
  654. DSBLIT_COLORKEY_PROTECT = 0x00010000, /* make sure written pixels don't match color key (internal only ATM) */
  655. DSBLIT_SRC_MASK_ALPHA = 0x00100000, /* modulate source alpha channel with alpha channel from source mask,
  656. see also IDirectFBSurface::SetSourceMask() */
  657. DSBLIT_SRC_MASK_COLOR = 0x00200000, /* modulate source color channels with color channels from source mask,
  658. see also IDirectFBSurface::SetSourceMask() */
  659. DSBLIT_SOURCE2 = 0x00400000, /* use secondary source instead of destination for reading */
  660. DSBLIT_FLIP_HORIZONTAL = 0x01000000, /* flip the image horizontally */
  661. DSBLIT_FLIP_VERTICAL = 0x02000000, /* flip the image vertically */
  662. } DFBSurfaceBlittingFlags;
  663. /*
  664. * Options for drawing and blitting operations. Not mandatory for acceleration.
  665. */
  666. typedef enum {
  667. DSRO_NONE = 0x00000000, /* None of these. */
  668. DSRO_SMOOTH_UPSCALE = 0x00000001, /* Use interpolation for upscale StretchBlit(). */
  669. DSRO_SMOOTH_DOWNSCALE = 0x00000002, /* Use interpolation for downscale StretchBlit(). */
  670. DSRO_MATRIX = 0x00000004, /* Use the transformation matrix set via IDirectFBSurface::SetMatrix(). */
  671. DSRO_ANTIALIAS = 0x00000008, /* Enable anti-aliasing for edges (alphablend must be enabled). */
  672. DSRO_ALL = 0x0000000F /* All of these. */
  673. } DFBSurfaceRenderOptions;
  674. /*
  675. * Mask of accelerated functions.
  676. */
  677. typedef enum {
  678. DFXL_NONE = 0x00000000, /* None of these. */
  679. DFXL_FILLRECTANGLE = 0x00000001, /* FillRectangle() is accelerated. */
  680. DFXL_DRAWRECTANGLE = 0x00000002, /* DrawRectangle() is accelerated. */
  681. DFXL_DRAWLINE = 0x00000004, /* DrawLine() is accelerated. */
  682. DFXL_FILLTRIANGLE = 0x00000008, /* FillTriangle() is accelerated. */
  683. DFXL_FILLTRAPEZOID = 0x00000010, /* FillTrapezoid() is accelerated. */
  684. DFXL_BLIT = 0x00010000, /* Blit() and TileBlit() are accelerated. */
  685. DFXL_STRETCHBLIT = 0x00020000, /* StretchBlit() is accelerated. */
  686. DFXL_TEXTRIANGLES = 0x00040000, /* TextureTriangles() is accelerated. */
  687. DFXL_BLIT2 = 0x00080000, /* BatchBlit2() is accelerated. */
  688. DFXL_DRAWSTRING = 0x01000000, /* DrawString() and DrawGlyph() are accelerated. */
  689. DFXL_ALL = 0x010F001F, /* All drawing/blitting functions. */
  690. DFXL_ALL_DRAW = 0x0000001F, /* All drawing functions. */
  691. DFXL_ALL_BLIT = 0x010F0000, /* All blitting functions. */
  692. } DFBAccelerationMask;
  693. /*
  694. * @internal
  695. */
  696. #define DFB_DRAWING_FUNCTION(a) ((a) & 0x0000FFFF)
  697. /*
  698. * @internal
  699. */
  700. #define DFB_BLITTING_FUNCTION(a) ((a) & 0xFFFF0000)
  701. /*
  702. * Type of display layer for basic classification.
  703. * Values may be or'ed together.
  704. */
  705. typedef enum {
  706. DLTF_NONE = 0x00000000, /* Unclassified, no specific type. */
  707. DLTF_GRAPHICS = 0x00000001, /* Can be used for graphics output. */
  708. DLTF_VIDEO = 0x00000002, /* Can be used for live video output.*/
  709. DLTF_STILL_PICTURE = 0x00000004, /* Can be used for single frames. */
  710. DLTF_BACKGROUND = 0x00000008, /* Can be used as a background layer.*/
  711. DLTF_ALL = 0x0000000F /* All type flags set. */
  712. } DFBDisplayLayerTypeFlags;
  713. /*
  714. * Type of input device for basic classification.
  715. * Values may be or'ed together.
  716. */
  717. typedef enum {
  718. DIDTF_NONE = 0x00000000, /* Unclassified, no specific type. */
  719. DIDTF_KEYBOARD = 0x00000001, /* Can act as a keyboard. */
  720. DIDTF_MOUSE = 0x00000002, /* Can be used as a mouse. */
  721. DIDTF_JOYSTICK = 0x00000004, /* Can be used as a joystick. */
  722. DIDTF_REMOTE = 0x00000008, /* Is a remote control. */
  723. DIDTF_VIRTUAL = 0x00000010, /* Is a virtual input device. */
  724. DIDTF_ALL = 0x0000001F /* All type flags set. */
  725. } DFBInputDeviceTypeFlags;
  726. /*
  727. * Basic input device features.
  728. */
  729. typedef enum {
  730. DICAPS_KEYS = 0x00000001, /* device supports key events */
  731. DICAPS_AXES = 0x00000002, /* device supports axis events */
  732. DICAPS_BUTTONS = 0x00000004, /* device supports button events */
  733. DICAPS_ALL = 0x00000007 /* all capabilities */
  734. } DFBInputDeviceCapabilities;
  735. /*
  736. * Identifier (index) for e.g. mouse or joystick buttons.
  737. */
  738. typedef enum {
  739. DIBI_LEFT = 0x00000000, /* left mouse button */
  740. DIBI_RIGHT = 0x00000001, /* right mouse button */
  741. DIBI_MIDDLE = 0x00000002, /* middle mouse button */
  742. DIBI_FIRST = DIBI_LEFT, /* other buttons:
  743. DIBI_FIRST + zero based index */
  744. DIBI_LAST = 0x0000001F /* 32 buttons maximum */
  745. } DFBInputDeviceButtonIdentifier;
  746. /*
  747. * Axis identifier (index) for e.g. mouse or joystick.
  748. *
  749. * The X, Y and Z axis are predefined. To access other axes,
  750. * use DIAI_FIRST plus a zero based index, e.g. the 4th axis
  751. * would be (DIAI_FIRST + 3).
  752. */
  753. typedef enum {
  754. DIAI_X = 0x00000000, /* X axis */
  755. DIAI_Y = 0x00000001, /* Y axis */
  756. DIAI_Z = 0x00000002, /* Z axis */
  757. DIAI_FIRST = DIAI_X, /* other axis:
  758. DIAI_FIRST + zero based index */
  759. DIAI_LAST = 0x0000001F /* 32 axes maximum */
  760. } DFBInputDeviceAxisIdentifier;
  761. /*
  762. * Flags defining which fields of a DFBWindowDescription are valid.
  763. */
  764. typedef enum {
  765. DWDESC_CAPS = 0x00000001, /* caps field is valid */
  766. DWDESC_WIDTH = 0x00000002, /* width field is valid */
  767. DWDESC_HEIGHT = 0x00000004, /* height field is valid */
  768. DWDESC_PIXELFORMAT = 0x00000008, /* pixelformat field is valid */
  769. DWDESC_POSX = 0x00000010, /* posx field is valid */
  770. DWDESC_POSY = 0x00000020, /* posy field is valid */
  771. DWDESC_SURFACE_CAPS = 0x00000040, /* Create the window surface with
  772. special capabilities. */
  773. DWDESC_PARENT = 0x00000080, /* This window has a parent according to parent_id field. */
  774. DWDESC_OPTIONS = 0x00000100, /* Initial window options have been set. */
  775. DWDESC_STACKING = 0x00000200, /* Initial stacking class has been set. */
  776. DWDESC_TOPLEVEL_ID = 0x00000400, /* The top level window is set in toplevel_id field. */
  777. DWDESC_RESOURCE_ID = 0x00001000, /* Resource id for window surface creation has been set. */
  778. } DFBWindowDescriptionFlags;
  779. /*
  780. * Flags defining which fields of a DFBDataBufferDescription are valid.
  781. */
  782. typedef enum {
  783. DBDESC_FILE = 0x00000001, /* Create a static buffer for the
  784. specified filename. */
  785. DBDESC_MEMORY = 0x00000002 /* Create a static buffer for the
  786. specified memory area. */
  787. } DFBDataBufferDescriptionFlags;
  788. /*
  789. * Capabilities a window can have.
  790. */
  791. typedef enum {
  792. DWCAPS_NONE = 0x00000000, /* None of these. */
  793. DWCAPS_ALPHACHANNEL = 0x00000001, /* The window has an alphachannel
  794. for pixel-per-pixel blending. */
  795. DWCAPS_DOUBLEBUFFER = 0x00000002, /* The window's surface is double
  796. buffered. This is very useful
  797. to avoid visibility of content
  798. that is still in preparation.
  799. Normally a window's content can
  800. get visible before an update if
  801. there is another reason causing
  802. a window stack repaint. */
  803. DWCAPS_INPUTONLY = 0x00000004, /* The window has no surface.
  804. You can not draw to it but it
  805. receives events */
  806. DWCAPS_NODECORATION = 0x00000008, /* The window won't be decorated. */
  807. DWCAPS_SUBWINDOW = 0x00000010, /* Not a top level window. */
  808. DWCAPS_COLOR = 0x00000020, /* The window has no buffer;
  809. it consumes no backing store.
  810. It is filled with a constant color
  811. and it receives events. The color is
  812. never specified premultiplied. */
  813. DWCAPS_NOFOCUS = 0x00000100, /* Window will never get focus or receive key events, unless it grabs them. */
  814. DWCAPS_ALL = 0x0000013F /* All of these. */
  815. } DFBWindowCapabilities;
  816. /*
  817. * Flags controlling the appearance and behaviour of the window.
  818. */
  819. typedef enum {
  820. DWOP_NONE = 0x00000000, /* none of these */
  821. DWOP_COLORKEYING = 0x00000001, /* enable color key */
  822. DWOP_ALPHACHANNEL = 0x00000002, /* enable alpha blending using the
  823. window's alpha channel */
  824. DWOP_OPAQUE_REGION = 0x00000004, /* overrides DWOP_ALPHACHANNEL for the
  825. region set by SetOpaqueRegion() */
  826. DWOP_SHAPED = 0x00000008, /* window doesn't receive mouse events for
  827. invisible regions, must be used with
  828. DWOP_ALPHACHANNEL or DWOP_COLORKEYING */
  829. DWOP_KEEP_POSITION = 0x00000010, /* window can't be moved
  830. with the mouse */
  831. DWOP_KEEP_SIZE = 0x00000020, /* window can't be resized
  832. with the mouse */
  833. DWOP_KEEP_STACKING = 0x00000040, /* window can't be raised
  834. or lowered with the mouse */
  835. DWOP_GHOST = 0x00001000, /* never get focus or input,
  836. clicks will go through,
  837. implies DWOP_KEEP... */
  838. DWOP_INDESTRUCTIBLE = 0x00002000, /* window can't be destroyed
  839. by internal shortcut */
  840. DWOP_INPUTONLY = 0x00004000, /* The window will be input only.
  841. It will receive events but is not shown.
  842. Note that toggling this bit will not
  843. free/assign the window surface. */
  844. DWOP_SCALE = 0x00010000, /* Surface won't be changed if window size on screen changes. The surface
  845. can be resized separately using IDirectFBWindow::ResizeSurface(). */
  846. DWOP_KEEP_ABOVE = 0x00100000, /* Keep window above parent window. */
  847. DWOP_KEEP_UNDER = 0x00200000, /* Keep window under parent window. */
  848. DWOP_FOLLOW_BOUNDS = 0x00400000, /* Follow window bounds from parent. */
  849. DWOP_ALL = 0x0071707F /* all possible options */
  850. } DFBWindowOptions;
  851. /*
  852. * The stacking class restricts the stacking order of windows.
  853. */
  854. typedef enum {
  855. DWSC_MIDDLE = 0x00000000, /* This is the default stacking
  856. class of new windows. */
  857. DWSC_UPPER = 0x00000001, /* Window is always above windows
  858. in the middle stacking class.
  859. Only windows that are also in
  860. the upper stacking class can
  861. get above them. */
  862. DWSC_LOWER = 0x00000002 /* Window is always below windows
  863. in the middle stacking class.
  864. Only windows that are also in
  865. the lower stacking class can
  866. get below them. */
  867. } DFBWindowStackingClass;
  868. /*
  869. * Flags describing how to load a font.
  870. *
  871. * These flags describe how a font is loaded and affect how the
  872. * glyphs are drawn. There is no way to change this after the font
  873. * has been loaded. If you need to render a font with different
  874. * attributes, you have to create multiple FontProviders of the
  875. * same font file.
  876. */
  877. typedef enum {
  878. DFFA_NONE = 0x00000000, /* none of these flags */
  879. DFFA_NOKERNING = 0x00000001, /* don't use kerning */
  880. DFFA_NOHINTING = 0x00000002, /* don't use hinting */
  881. DFFA_MONOCHROME = 0x00000004, /* don't use anti-aliasing */
  882. DFFA_NOCHARMAP = 0x00000008, /* no char map, glyph indices are
  883. specified directly */
  884. DFFA_FIXEDCLIP = 0x00000010, /* width fixed advance, clip to it */
  885. DFFA_NOBITMAP = 0x00000020, /* ignore bitmap strikes; for
  886. bitmap-only fonts this flag is
  887. ignored */
  888. DFFA_OUTLINED = 0x00000040,
  889. DFFA_AUTOHINTING = 0x00000080, /* prefer auto-hinter over the font's
  890. native hinter */
  891. DFFA_SOFTHINTING = 0x00000100 /* use a lighter hinting algorithm
  892. that produces glyphs that are more
  893. fuzzy but better resemble the
  894. original shape */
  895. } DFBFontAttributes;
  896. /*
  897. * Flags defining which fields of a DFBFontDescription are valid.
  898. */
  899. typedef enum {
  900. DFDESC_ATTRIBUTES = 0x00000001, /* attributes field is valid */
  901. DFDESC_HEIGHT = 0x00000002, /* height is specified */
  902. DFDESC_WIDTH = 0x00000004, /* width is specified */
  903. DFDESC_INDEX = 0x00000008, /* index is specified */
  904. DFDESC_FIXEDADVANCE = 0x00000010, /* specify a fixed advance overriding
  905. any character advance of fixed or
  906. proportional fonts */
  907. DFDESC_FRACT_HEIGHT = 0x00000020, /* fractional height is set */
  908. DFDESC_FRACT_WIDTH = 0x00000040, /* fractional width is set */
  909. DFDESC_OUTLINE_WIDTH = 0x00000080, /* outline width is set */
  910. DFDESC_OUTLINE_OPACITY = 0x00000100, /* outline opacity is set */
  911. DFDESC_ROTATION = 0x00000200, /* rotation is set */
  912. } DFBFontDescriptionFlags;
  913. /*
  914. * Description of how to load glyphs from a font file.
  915. *
  916. * The attributes control how the glyphs are rendered. Width and height can be used to specify the
  917. * desired face size in pixels. If you are loading a non-scalable font, you shouldn't specify a
  918. * font size.
  919. *
  920. * Please note that the height value in the DFBFontDescription doesn't correspond to the height
  921. * returned by IDirectFBFont::GetHeight().
  922. *
  923. * The index field controls which face is loaded from a font file that provides a collection of
  924. * faces. This is rarely needed.
  925. *
  926. * Fractional sizes (fract_height and fract_width) are 26.6 fixed point integers and override
  927. * the pixel sizes if both are specified.
  928. *
  929. * Outline parameters are ignored if DFFA_OUTLINED is not used (see DFBFontAttributes). To change the
  930. * default values of 1.0 each use DFDESC_OUTLINE_WIDTH and/or DFDESC_OUTLINE_OPACITY.
  931. *
  932. * The rotation value is a 0.24 fixed point number of rotations. Use the macros DFB_DEGREES
  933. * and DFB_RADIANS to convert from those units.
  934. */
  935. typedef struct {
  936. DFBFontDescriptionFlags flags;
  937. DFBFontAttributes attributes;
  938. int height;
  939. int width;
  940. unsigned int index;
  941. int fixed_advance;
  942. int fract_height;
  943. int fract_width;
  944. int outline_width; /* Outline width as 16.16 fixed point integer */
  945. int outline_opacity; /* Outline opacity as 16.16 fixed point integer */
  946. int rotation;
  947. } DFBFontDescription;
  948. #define DFB_DEGREES(deg) ((int)((deg)/360.0*(1<<24)))
  949. #define DFB_RADIANS(rad) ((int)((rad)/(2.0*M_PI)*(1<<24)))
  950. /*
  951. * @internal
  952. *
  953. * Encodes format constants in the following way (bit 31 - 0):
  954. *
  955. * lkjj:hhgg | gfff:eeed | cccc:bbbb | baaa:aaaa
  956. *
  957. * a) pixelformat index<br>
  958. * b) effective color (or index) bits per pixel of format<br>
  959. * c) effective alpha bits per pixel of format<br>
  960. * d) alpha channel present<br>
  961. * e) bytes per "pixel in a row" (1/8 fragment, i.e. bits)<br>
  962. * f) bytes per "pixel in a row" (decimal part, i.e. bytes)<br>
  963. * g) smallest number of pixels aligned to byte boundary (minus one)<br>
  964. * h) multiplier for planes minus one (1/4 fragment)<br>
  965. * j) multiplier for planes minus one (decimal part)<br>
  966. * k) color and/or alpha lookup table present<br>
  967. * l) alpha channel is inverted
  968. */
  969. #define DFB_SURFACE_PIXELFORMAT( index, color_bits, alpha_bits, has_alpha, \
  970. row_bits, row_bytes, align, mul_f, mul_d, \
  971. has_lut, inv_alpha ) \
  972. ( (((index ) & 0x7F) ) | \
  973. (((color_bits) & 0x1F) << 7) | \
  974. (((alpha_bits) & 0x0F) << 12) | \
  975. (((has_alpha ) ? 1 :0) << 16) | \
  976. (((row_bits ) & 0x07) << 17) | \
  977. (((row_bytes ) & 0x07) << 20) | \
  978. (((align ) & 0x07) << 23) | \
  979. (((mul_f ) & 0x03) << 26) | \
  980. (((mul_d ) & 0x03) << 28) | \
  981. (((has_lut ) ? 1 :0) << 30) | \
  982. (((inv_alpha ) ? 1 :0) << 31) )
  983. /*
  984. * Pixel format of a surface.
  985. */
  986. typedef enum {
  987. DSPF_UNKNOWN = 0x00000000, /* unknown or unspecified format */
  988. /* 16 bit ARGB (2 byte, alpha 1@15, red 5@10, green 5@5, blue 5@0) */
  989. DSPF_ARGB1555 = DFB_SURFACE_PIXELFORMAT( 0, 15, 1, 1, 0, 2, 0, 0, 0, 0, 0 ),
  990. /* 16 bit RGB (2 byte, red 5@11, green 6@5, blue 5@0) */
  991. DSPF_RGB16 = DFB_SURFACE_PIXELFORMAT( 1, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
  992. /* 24 bit RGB (3 byte, red 8@16, green 8@8, blue 8@0) */
  993. DSPF_RGB24 = DFB_SURFACE_PIXELFORMAT( 2, 24, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
  994. /* 24 bit RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0) */
  995. DSPF_RGB32 = DFB_SURFACE_PIXELFORMAT( 3, 24, 0, 0, 0, 4, 0, 0, 0, 0, 0 ),
  996. /* 32 bit ARGB (4 byte, alpha 8@24, red 8@16, green 8@8, blue 8@0) */
  997. DSPF_ARGB = DFB_SURFACE_PIXELFORMAT( 4, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
  998. /* 8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */
  999. DSPF_A8 = DFB_SURFACE_PIXELFORMAT( 5, 0, 8, 1, 0, 1, 0, 0, 0, 0, 0 ),
  1000. /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */
  1001. DSPF_YUY2 = DFB_SURFACE_PIXELFORMAT( 6, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
  1002. /* 8 bit RGB (1 byte, red 3@5, green 3@2, blue 2@0) */
  1003. DSPF_RGB332 = DFB_SURFACE_PIXELFORMAT( 7, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0 ),
  1004. /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */
  1005. DSPF_UYVY = DFB_SURFACE_PIXELFORMAT( 8, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
  1006. /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size U/V planes) */
  1007. DSPF_I420 = DFB_SURFACE_PIXELFORMAT( 9, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
  1008. /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size V/U planes) */
  1009. DSPF_YV12 = DFB_SURFACE_PIXELFORMAT( 10, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
  1010. /* 8 bit LUT (8 bit color and alpha lookup from palette) */
  1011. DSPF_LUT8 = DFB_SURFACE_PIXELFORMAT( 11, 8, 0, 1, 0, 1, 0, 0, 0, 1, 0 ),
  1012. /* 8 bit ALUT (1 byte, alpha 4@4, color lookup 4@0) */
  1013. DSPF_ALUT44 = DFB_SURFACE_PIXELFORMAT( 12, 4, 4, 1, 0, 1, 0, 0, 0, 1, 0 ),
  1014. /* 32 bit ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */
  1015. DSPF_AiRGB = DFB_SURFACE_PIXELFORMAT( 13, 24, 8, 1, 0, 4, 0, 0, 0, 0, 1 ),
  1016. /* 1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */
  1017. DSPF_A1 = DFB_SURFACE_PIXELFORMAT( 14, 0, 1, 1, 1, 0, 7, 0, 0, 0, 0 ),
  1018. /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size Cb|Cr [7:0|7:0] plane) */
  1019. DSPF_NV12 = DFB_SURFACE_PIXELFORMAT( 15, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
  1020. /* 16 bit YUV (8 bit Y plane followed by one 16 bit half width Cb|Cr [7:0|7:0] plane) */
  1021. DSPF_NV16 = DFB_SURFACE_PIXELFORMAT( 16, 24, 0, 0, 0, 1, 0, 0, 1, 0, 0 ),
  1022. /* 16 bit ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */
  1023. DSPF_ARGB2554 = DFB_SURFACE_PIXELFORMAT( 17, 14, 2, 1, 0, 2, 0, 0, 0, 0, 0 ),
  1024. /* 16 bit ARGB (2 byte, alpha 4@12, red 4@8, green 4@4, blue 4@0) */
  1025. DSPF_ARGB4444 = DFB_SURFACE_PIXELFORMAT( 18, 12, 4, 1, 0, 2, 0, 0, 0, 0, 0 ),
  1026. /* 16 bit RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */
  1027. DSPF_RGBA4444 = DFB_SURFACE_PIXELFORMAT( 19, 12, 4, 1, 0, 2, 0, 0, 0, 0, 0 ),
  1028. /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size Cr|Cb [7:0|7:0] plane) */
  1029. DSPF_NV21 = DFB_SURFACE_PIXELFORMAT( 20, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
  1030. /* 32 bit AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */
  1031. DSPF_AYUV = DFB_SURFACE_PIXELFORMAT( 21, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
  1032. /* 4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */
  1033. DSPF_A4 = DFB_SURFACE_PIXELFORMAT( 22, 0, 4, 1, 4, 0, 1, 0, 0, 0, 0 ),
  1034. /* 1 bit alpha (3 byte/ alpha 1@18, red 6@12, green 6@6, blue 6@0) */
  1035. DSPF_ARGB1666 = DFB_SURFACE_PIXELFORMAT( 23, 18, 1, 1, 0, 3, 0, 0, 0, 0, 0 ),
  1036. /* 6 bit alpha (3 byte/ alpha 6@18, red 6@12, green 6@6, blue 6@0) */
  1037. DSPF_ARGB6666 = DFB_SURFACE_PIXELFORMAT( 24, 18, 6, 1, 0, 3, 0, 0, 0, 0, 0 ),
  1038. /* 6 bit RGB (3 byte/ red 6@12, green 6@6, blue 6@0) */
  1039. DSPF_RGB18 = DFB_SURFACE_PIXELFORMAT( 25, 18, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
  1040. /* 2 bit LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */
  1041. DSPF_LUT2 = DFB_SURFACE_PIXELFORMAT( 26, 2, 0, 1, 2, 0, 3, 0, 0, 1, 0 ),
  1042. /* 16 bit RGB (2 byte, nothing @12, red 4@8, green 4@4, blue 4@0) */
  1043. DSPF_RGB444 = DFB_SURFACE_PIXELFORMAT( 27, 12, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
  1044. /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */
  1045. DSPF_RGB555 = DFB_SURFACE_PIXELFORMAT( 28, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
  1046. /* 16 bit BGR (2 byte, nothing @15, blue 5@10, green 5@5, red 5@0) */
  1047. DSPF_BGR555 = DFB_SURFACE_PIXELFORMAT( 29, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
  1048. /* 16 bit RGBA (2 byte, red 5@11, green 5@6, blue 5@1, alpha 1@0) */
  1049. DSPF_RGBA5551 = DFB_SURFACE_PIXELFORMAT( 30, 15, 1, 1, 0, 2, 0, 0, 0, 0, 0 ),
  1050. /* 24 bit full YUV planar (8 bit Y plane followed by an 8 bit Cb and an
  1051. 8 bit Cr plane) */
  1052. DSPF_YUV444P = DFB_SURFACE_PIXELFORMAT( 31, 24, 0, 0, 0, 1, 0, 0, 2, 0, 0 ),
  1053. /* 24 bit ARGB (3 byte, alpha 8@16, red 5@11, green 6@5, blue 5@0) */
  1054. DSPF_ARGB8565 = DFB_SURFACE_PIXELFORMAT( 32, 16, 8, 1, 0, 3, 0, 0, 0, 0, 0 ),
  1055. /* 32 bit AVYU 4:4:4 (4 byte, alpha 8@24, Cr 8@16, Y 8@8, Cb 8@0) */
  1056. DSPF_AVYU = DFB_SURFACE_PIXELFORMAT( 33, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
  1057. /* 24 bit VYU 4:4:4 (3 byte, Cr 8@16, Y 8@8, Cb 8@0) */
  1058. DSPF_VYU = DFB_SURFACE_PIXELFORMAT( 34, 24, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
  1059. /* 1 bit alpha (1 byte/ 8 pixel, LEAST significant bit used first) */
  1060. DSPF_A1_LSB = DFB_SURFACE_PIXELFORMAT( 35, 0, 1, 1, 1, 0, 7, 0, 0, 0, 0 ),
  1061. /* 16 bit YUV (8 bit Y plane followed by 8 bit 2x1 subsampled V/U planes) */
  1062. DSPF_YV16 = DFB_SURFACE_PIXELFORMAT( 36, 16, 0, 0, 0, 1, 0, 0, 1, 0, 0 ),
  1063. } DFBSurfacePixelFormat;
  1064. /* Number of pixelformats defined */
  1065. #define DFB_NUM_PIXELFORMATS 37
  1066. /* These macros extract information about the pixel format. */
  1067. #define DFB_PIXELFORMAT_INDEX(fmt) (((fmt) & 0x0000007F) )
  1068. #define DFB_COLOR_BITS_PER_PIXEL(fmt) (((fmt) & 0x00000F80) >> 7)
  1069. #define DFB_ALPHA_BITS_PER_PIXEL(fmt) (((fmt) & 0x0000F000) >> 12)
  1070. #define DFB_PIXELFORMAT_HAS_ALPHA(fmt) (((fmt) & 0x00010000) != 0)
  1071. #define DFB_BITS_PER_PIXEL(fmt) (((fmt) & 0x007E0000) >> 17)
  1072. #define DFB_BYTES_PER_PIXEL(fmt) (((fmt) & 0x00700000) >> 20)
  1073. #define DFB_BYTES_PER_LINE(fmt,width) (((((fmt) & 0x007E0000) >> 17) * (width) + 7) >> 3)
  1074. #define DFB_PIXELFORMAT_ALIGNMENT(fmt) (((fmt) & 0x03800000) >> 23)
  1075. #define DFB_PLANE_MULTIPLY(fmt,height) ((((((fmt) & 0x3C000000) >> 26) + 4) * (height)) >> 2)
  1076. #define DFB_PIXELFORMAT_IS_INDEXED(fmt) (((fmt) & 0x40000000) != 0)
  1077. #define DFB_PLANAR_PIXELFORMAT(fmt) (((fmt) & 0x3C000000) != 0)
  1078. #define DFB_PIXELFORMAT_INV_ALPHA(fmt) (((fmt) & 0x80000000) != 0)
  1079. /*
  1080. * Hint flags for optimized allocation, format selection etc.
  1081. */
  1082. typedef enum {
  1083. DSHF_NONE = 0x00000000,
  1084. DSHF_LAYER = 0x00000001, /* Surface optimized for display layer usage */
  1085. DSHF_WINDOW = 0x00000002, /* Surface optimized for being a window buffer */
  1086. DSHF_CURSOR = 0x00000004, /* Surface optimized for usage as a cursor shape */
  1087. DSHF_FONT = 0x00000008, /* Surface optimized for text rendering */
  1088. DSHF_ALL = 0x0000000F
  1089. } DFBSurfaceHintFlags;
  1090. /*
  1091. * Description of the surface that is to be created.
  1092. */
  1093. typedef struct {
  1094. DFBSurfaceDescriptionFlags flags; /* field validation */
  1095. DFBSurfaceCapabilities caps; /* capabilities */
  1096. int width; /* pixel width */
  1097. int height; /* pixel height */
  1098. DFBSurfacePixelFormat pixelformat; /* pixel format */
  1099. struct {
  1100. void *data; /* data pointer of existing buffer */
  1101. int pitch; /* pitch of buffer */
  1102. } preallocated[2];
  1103. struct {
  1104. const DFBColor *entries;
  1105. unsigned int size;
  1106. } palette; /* initial palette */
  1107. unsigned long resource_id; /* universal resource id, either user specified for general
  1108. purpose surfaces or id of layer or window */
  1109. DFBSurfaceHintFlags hints; /* usage hints for optimized allocation, format selection etc. */
  1110. } DFBSurfaceDescription;
  1111. /*
  1112. * Description of the palette that is to be created.
  1113. */
  1114. typedef struct {
  1115. DFBPaletteDescriptionFlags flags; /* Validation of fields. */
  1116. DFBPaletteCapabilities caps; /* Palette capabilities. */
  1117. unsigned int size; /* Number of entries. */
  1118. const DFBColor *entries; /* Preset palette
  1119. entries. */
  1120. } DFBPaletteDescription;
  1121. #define DFB_DISPLAY_LAYER_DESC_NAME_LENGTH 32
  1122. /*
  1123. * Description of the display layer capabilities.
  1124. */
  1125. typedef struct {
  1126. DFBDisplayLayerTypeFlags type; /* Classification of the display layer. */
  1127. DFBDisplayLayerCapabilities caps; /* Capability flags of the display layer. */
  1128. char name[DFB_DISPLAY_LAYER_DESC_NAME_LENGTH]; /* Display layer name. */
  1129. int level; /* Default level. */
  1130. int regions; /* Number of concurrent regions supported.<br>
  1131. -1 = unlimited,
  1132. 0 = unknown/one,
  1133. >0 = actual number */
  1134. int sources; /* Number of selectable sources. */
  1135. int clip_regions; /* Number of clipping regions. */
  1136. DFBSurfaceCapabilities surface_caps;
  1137. unsigned int surface_accessor;
  1138. } DFBDisplayLayerDescription;
  1139. /*
  1140. * Capabilities of a display layer source.
  1141. */
  1142. typedef enum {
  1143. DDLSCAPS_NONE = 0x00000000, /* none of these */
  1144. DDLSCAPS_SURFACE = 0x00000001, /* source has an accessable surface */
  1145. DDLSCAPS_ALL = 0x00000001 /* all of these */
  1146. } DFBDisplayLayerSourceCaps;
  1147. #define DFB_DISPLAY_LAYER_SOURCE_DESC_NAME_LENGTH 24
  1148. /*
  1149. * Description of a display layer source.
  1150. */
  1151. typedef struct {
  1152. DFBDisplayLayerSourceID source_id; /* ID of the source. */
  1153. char name[DFB_DISPLAY_LAYER_SOURCE_DESC_NAME_LENGTH]; /* Name of the source. */
  1154. DFBDisplayLayerSourceCaps caps; /* Capabilites of the source. */
  1155. } DFBDisplayLayerSourceDescription;
  1156. #define DFB_SCREEN_DESC_NAME_LENGTH 32
  1157. /*
  1158. * Description of the display encoder capabilities.
  1159. */
  1160. typedef struct {
  1161. DFBScreenCapabilities caps; /* Capability flags of
  1162. the screen. */
  1163. char name[DFB_SCREEN_DESC_NAME_LENGTH]; /* Rough description. */
  1164. int mixers; /* Number of mixers
  1165. available. */
  1166. int encoders; /* Number of display
  1167. encoders available. */
  1168. int outputs; /* Number of output
  1169. connectors available. */
  1170. } DFBScreenDescription;
  1171. #define DFB_INPUT_DEVICE_DESC_NAME_LENGTH 32
  1172. #define DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH 40
  1173. /*
  1174. * Description of the input device capabilities.
  1175. */
  1176. typedef struct {
  1177. DFBInputDeviceTypeFlags type; /* classification of
  1178. input device */
  1179. DFBInputDeviceCapabilities caps; /* capabilities,
  1180. validates the
  1181. following fields */
  1182. int min_keycode; /* minimum hardware
  1183. keycode or -1 if
  1184. no differentiation
  1185. between hardware
  1186. keys is made */
  1187. int max_keycode; /* maximum hardware
  1188. keycode or -1 if
  1189. no differentiation
  1190. between hardware
  1191. keys is made */
  1192. DFBInputDeviceAxisIdentifier max_axis; /* highest axis
  1193. identifier */
  1194. DFBInputDeviceButtonIdentifier max_button; /* highest button
  1195. identifier */
  1196. char name[DFB_INPUT_DEVICE_DESC_NAME_LENGTH]; /* Device name */
  1197. char vendor[DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH]; /* Device vendor */
  1198. int vendor_id; /* Vendor ID */
  1199. int product_id; /* Product ID */
  1200. } DFBInputDeviceDescription;
  1201. typedef enum {
  1202. DIAIF_NONE = 0x00000000,
  1203. DIAIF_ABS_MIN = 0x00000001,
  1204. DIAIF_ABS_MAX = 0x00000002,
  1205. DIAIF_ALL = 0x00000003
  1206. } DFBInputDeviceAxisInfoFlags;
  1207. typedef struct {
  1208. DFBInputDeviceAxisInfoFlags flags;
  1209. int abs_min;
  1210. int abs_max;
  1211. } DFBInputDeviceAxisInfo;
  1212. #define DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH 40
  1213. #define DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH 60
  1214. typedef struct {
  1215. int major; /* Major version */
  1216. int minor; /* Minor version */
  1217. char name[DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH]; /* Driver name */
  1218. char vendor[DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH]; /* Driver vendor */
  1219. } DFBGraphicsDriverInfo;
  1220. #define DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH 48
  1221. #define DFB_GRAPHICS_DEVICE_DESC_VENDOR_LENGTH 64
  1222. /*
  1223. * Description of the graphics device capabilities.
  1224. */
  1225. typedef struct {
  1226. DFBAccelerationMask acceleration_mask; /* Accelerated functions */
  1227. DFBSurfaceBlittingFlags blitting_flags; /* Supported blitting flags */
  1228. DFBSurfaceDrawingFlags drawing_flags; /* Supported drawing flags */
  1229. unsigned int video_memory; /* Amount of video memory in bytes */
  1230. char name[DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH]; /* Device/Chipset name */
  1231. char vendor[DFB_GRAPHICS_DEVICE_DESC_VENDOR_LENGTH]; /* Device vendor */
  1232. DFBGraphicsDriverInfo driver;
  1233. } DFBGraphicsDeviceDescription;
  1234. /*
  1235. * Description of the window that is to be created.
  1236. */
  1237. typedef struct {
  1238. DFBWindowDescriptionFlags flags; /* field validation */
  1239. DFBWindowCapabilities caps; /* capabilities */
  1240. int width; /* pixel width */
  1241. int height; /* pixel height */
  1242. DFBSurfacePixelFormat pixelformat; /* pixel format */
  1243. int posx; /* distance from left layer border */
  1244. int posy; /* distance from upper layer border */
  1245. DFBSurfaceCapabilities surface_caps; /* pixel format */
  1246. DFBWindowID parent_id; /* window id of parent window */
  1247. DFBWindowOptions options; /* initial window options */
  1248. DFBWindowStackingClass stacking; /* initial stacking class */
  1249. unsigned long resource_id; /* resource id used to create the window surface */
  1250. DFBWindowID toplevel_id; /* top level window, if != 0 window will be a sub window */
  1251. } DFBWindowDescription;
  1252. /*
  1253. * Description of a data buffer that is to be created.
  1254. */
  1255. typedef struct {
  1256. DFBDataBufferDescriptionFlags flags; /* field validation */
  1257. const char *file; /* for file based data buffers */
  1258. struct {
  1259. const void *data; /* static data pointer */
  1260. unsigned int length; /* length of buffer */
  1261. } memory; /* memory based buffers */
  1262. } DFBDataBufferDescription;
  1263. /*
  1264. * Return value of callback function of enumerations.
  1265. */
  1266. typedef enum {
  1267. DFENUM_OK = 0x00000000, /* Proceed with enumeration */
  1268. DFENUM_CANCEL = 0x00000001 /* Cancel enumeration */
  1269. } DFBEnumerationResult;
  1270. /*
  1271. * Called for each supported video mode.
  1272. */
  1273. typedef DFBEnumerationResult (*DFBVideoModeCallback) (
  1274. int width,
  1275. int height,
  1276. int bpp,
  1277. void *callbackdata
  1278. );
  1279. /*
  1280. * Called for each existing screen.
  1281. * "screen_id" can be used to get an interface to the screen.
  1282. */
  1283. typedef DFBEnumerationResult (*DFBScreenCallback) (
  1284. DFBScreenID screen_id,
  1285. DFBScreenDescription desc,
  1286. void *callbackdata
  1287. );
  1288. /*
  1289. * Called for each existing display layer.
  1290. * "layer_id" can be used to get an interface to the layer.
  1291. */
  1292. typedef DFBEnumerationResult (*DFBDisplayLayerCallback) (
  1293. DFBDisplayLayerID layer_id,
  1294. DFBDisplayLayerDescription desc,
  1295. void *callbackdata
  1296. );
  1297. /*
  1298. * Called for each existing input device.
  1299. * "device_id" can be used to get an interface to the device.
  1300. */
  1301. typedef DFBEnumerationResult (*DFBInputDeviceCallback) (
  1302. DFBInputDeviceID device_id,
  1303. DFBInputDeviceDescription desc,
  1304. void *callbackdata
  1305. );
  1306. /*
  1307. * Called for each block of continous data requested, e.g. by a
  1308. * Video Provider. Write as many data as you can but not more
  1309. * than specified by length. Return the number of bytes written
  1310. * or 'EOF' if no data is available anymore.
  1311. */
  1312. typedef int (*DFBGetDataCallback) (
  1313. void *buffer,
  1314. unsigned int length,
  1315. void *callbackdata
  1316. );
  1317. /*
  1318. * Information about an IDirectFBVideoProvider.
  1319. */
  1320. typedef enum {
  1321. DVCAPS_BASIC = 0x00000000, /* basic ops (PlayTo, Stop) */
  1322. DVCAPS_SEEK = 0x00000001, /* supports SeekTo */
  1323. DVCAPS_SCALE = 0x00000002, /* can scale the video */
  1324. DVCAPS_INTERLACED = 0x00000004, /* supports interlaced surfaces */
  1325. DVCAPS_SPEED = 0x00000008, /* supports changing playback speed */
  1326. DVCAPS_BRIGHTNESS = 0x00000010, /* supports Brightness adjustment */
  1327. DVCAPS_CONTRAST = 0x00000020, /* supports Contrast adjustment */
  1328. DVCAPS_HUE = 0x00000040, /* supports Hue adjustment */
  1329. DVCAPS_SATURATION = 0x00000080, /* supports Saturation adjustment */
  1330. DVCAPS_INTERACTIVE = 0x00000100, /* supports SendEvent */
  1331. DVCAPS_VOLUME = 0x00000200, /* supports Volume adjustment */
  1332. DVCAPS_EVENT = 0x00000400, /* supports the sending of events as video/audio data changes.*/
  1333. DVCAPS_ATTRIBUTES = 0x00000800, /* supports dynamic changing of atrributes.*/
  1334. DVCAPS_AUDIO_SEL = 0x00001000, /* Supportes chosing audio outputs.*/
  1335. } DFBVideoProviderCapabilities;
  1336. /*
  1337. * Information about the status of an IDirectFBVideoProvider.
  1338. */
  1339. typedef enum {
  1340. DVSTATE_UNKNOWN = 0x00000000, /* unknown status */
  1341. DVSTATE_PLAY = 0x00000001, /* video provider is playing */
  1342. DVSTATE_STOP = 0x00000002, /* playback was stopped */
  1343. DVSTATE_FINISHED = 0x00000003, /* playback is finished */
  1344. DVSTATE_BUFFERING = 0x00000004 /* video provider is buffering,
  1345. playback is running */
  1346. } DFBVideoProviderStatus;
  1347. /*
  1348. * Flags controlling playback mode of a IDirectFBVideoProvider.
  1349. */
  1350. typedef enum {
  1351. DVPLAY_NOFX = 0x00000000, /* normal playback */
  1352. DVPLAY_REWIND = 0x00000001, /* reverse playback */
  1353. DVPLAY_LOOPING = 0x00000002 /* automatically restart
  1354. playback when end-of-stream
  1355. is reached (gapless). */
  1356. } DFBVideoProviderPlaybackFlags;
  1357. /*
  1358. * Flags to allow Audio Unit selection.
  1359. */
  1360. typedef enum {
  1361. DVAUDIOUNIT_NONE = 0x00000000, /* No Audio Unit */
  1362. DVAUDIOUNIT_ONE = 0x00000001, /* Audio Unit One */
  1363. DVAUDIOUNIT_TWO = 0x00000002, /* Audio Unit Two */
  1364. DVAUDIOUNIT_THREE = 0x00000004, /* Audio Unit Three */
  1365. DVAUDIOUNIT_FOUR = 0x00000008, /* Audio Unit Four */
  1366. DVAUDIOUNIT_ALL = 0x0000000F, /* Audio Unit One */
  1367. } DFBVideoProviderAudioUnits;
  1368. /*
  1369. * Flags defining which fields of a DFBColorAdjustment are valid.
  1370. */
  1371. typedef enum {
  1372. DCAF_NONE = 0x00000000, /* none of these */
  1373. DCAF_BRIGHTNESS = 0x00000001, /* brightness field is valid */
  1374. DCAF_CONTRAST = 0x00000002, /* contrast field is valid */
  1375. DCAF_HUE = 0x00000004, /* hue field is valid */
  1376. DCAF_SATURATION = 0x00000008, /* saturation field is valid */
  1377. DCAF_ALL = 0x0000000F /* all of these */
  1378. } DFBColorAdjustmentFlags;
  1379. /*
  1380. * Color Adjustment used to adjust video colors.
  1381. *
  1382. * All fields are in the range 0x0 to 0xFFFF with
  1383. * 0x8000 as the default value (no adjustment).
  1384. */
  1385. typedef struct {
  1386. DFBColorAdjustmentFlags flags;
  1387. u16 brightness;
  1388. u16 contrast;
  1389. u16 hue;
  1390. u16 saturation;
  1391. } DFBColorAdjustment;
  1392. /*
  1393. * <i><b>IDirectFB</b></i> is the main interface. It can be
  1394. * retrieved by a call to <i>DirectFBCreate</i>. It's the only
  1395. * interface with a global creation facility. Other interfaces
  1396. * are created by this interface or interfaces created by it.
  1397. *
  1398. * <b>Hardware capabilities</b> such as the amount of video
  1399. * memory or a list of supported drawing/blitting functions and
  1400. * flags can be retrieved. It also provides enumeration of all
  1401. * supported video modes.
  1402. *
  1403. * <b>Input devices</b> and <b>display layers</b> that are
  1404. * present can be enumerated via a callback mechanism. The
  1405. * callback is given the capabilities and the device or layer
  1406. * ID. An interface to specific input devices or display layers
  1407. * can be retrieved by passing the device or layer ID to the
  1408. * corresponding method.
  1409. *
  1410. * <b>Surfaces</b> for general purpose use can be created via
  1411. * <i>CreateSurface</i>. These surfaces are so called "offscreen
  1412. * surfaces" and could be used for sprites or icons.
  1413. *
  1414. * The <b>primary surface</b> is an abstraction and API shortcut
  1415. * for getting a surface for visual output. Fullscreen games for
  1416. * example have the whole screen as their primary
  1417. * surface. Alternatively fullscreen applications can be forced
  1418. * to run in a window. The primary surface is also created via
  1419. * <i>CreateSurface</i> but with the special capability
  1420. * DSCAPS_PRIMARY.
  1421. *
  1422. * The <b>cooperative level</b> selects the type of the primary
  1423. * surface. With a call to <i>SetCooperativeLevel</i> the
  1424. * application can choose between the surface of an implicitly
  1425. * created window and the surface of the primary layer
  1426. * (deactivating the window stack). The application doesn't need
  1427. * to have any extra functionality to run in a window. If the
  1428. * application is forced to run in a window the call to
  1429. * <i>SetCooperativeLevel</i> fails with DFB_ACCESSDENIED.
  1430. * Applications that want to be "window aware" shouldn't exit on
  1431. * this error.
  1432. *
  1433. * The <b>video mode</b> can be changed via <i>SetVideoMode</i>
  1434. * and is the size and depth of the primary surface, i.e. the
  1435. * screen when in exclusive cooperative level. Without exclusive
  1436. * access <i>SetVideoMode</i> sets the size of the implicitly
  1437. * created window.
  1438. *
  1439. * <b>Event buffers</b> can be created with an option to
  1440. * automatically attach input devices matching the specified
  1441. * capabilities. If DICAPS_NONE is passed an event buffer with
  1442. * nothing attached to is created. An event buffer can be
  1443. * attached to input devices and windows.
  1444. *
  1445. * <b>Fonts, images and videos</b> are created by this
  1446. * interface. There are different implementations for different
  1447. * content types. On creation a suitable implementation is
  1448. * automatically chosen.
  1449. */
  1450. DEFINE_INTERFACE( IDirectFB,
  1451. /** Cooperative level, video mode **/
  1452. /*
  1453. * Puts the interface into the specified cooperative level.
  1454. *
  1455. * Function fails with DFB_LOCKED if another instance already
  1456. * is in a cooperative level other than DFSCL_NORMAL.
  1457. */
  1458. DFBResult (*SetCooperativeLevel) (
  1459. IDirectFB *thiz,
  1460. DFBCooperativeLevel level
  1461. );
  1462. /*
  1463. * Switch the current video mode (primary layer).
  1464. *
  1465. * If in shared cooperative level this function sets the
  1466. * resolution of the window that is created implicitly for
  1467. * the primary surface.
  1468. *
  1469. * The following values are valid for bpp: 2, 8, 12, 14, 15, 18, 24, 32.
  1470. * These will result in the following formats, respectively: DSPF_LUT2,
  1471. * DSPF_LUT8, DSPF_ARGB4444, DSPF_ARGB2554, DSPF_ARGB1555, DSPF_RGB16,
  1472. * DSPF_RGB18, DSPF_RGB24, DSPF_RGB32.
  1473. */
  1474. DFBResult (*SetVideoMode) (
  1475. IDirectFB *thiz,
  1476. int width,
  1477. int height,
  1478. int bpp
  1479. );
  1480. /** Hardware capabilities **/
  1481. /*
  1482. * Get a description of the graphics device.
  1483. *
  1484. * For more detailed information use
  1485. * IDirectFBSurface::GetAccelerationMask().
  1486. */
  1487. DFBResult (*GetDeviceDescription) (
  1488. IDirectFB *thiz,
  1489. DFBGraphicsDeviceDescription *ret_desc
  1490. );
  1491. /*
  1492. * Enumerate supported video modes.
  1493. *
  1494. * Calls the given callback for all available video modes.
  1495. * Useful to select a certain mode to be used with
  1496. * IDirectFB::SetVideoMode().
  1497. */
  1498. DFBResult (*EnumVideoModes) (
  1499. IDirectFB *thiz,
  1500. DFBVideoModeCallback callback,
  1501. void *callbackdata
  1502. );
  1503. /** Surfaces & Palettes **/
  1504. /*
  1505. * Create a surface matching the specified description.
  1506. */
  1507. DFBResult (*CreateSurface) (
  1508. IDirectFB *thiz,
  1509. const DFBSurfaceDescription *desc,
  1510. IDirectFBSurface **ret_interface
  1511. );
  1512. /*
  1513. * Create a palette matching the specified description.
  1514. *
  1515. * Passing a NULL description creates a default palette with
  1516. * 256 entries filled with colors matching the RGB332 format.
  1517. */
  1518. DFBResult (*CreatePalette) (
  1519. IDirectFB *thiz,
  1520. const DFBPaletteDescription *desc,
  1521. IDirectFBPalette **ret_interface
  1522. );
  1523. /** Screens **/
  1524. /*
  1525. * Enumerate all existing screen.
  1526. *
  1527. * Calls the given callback for each available screen.
  1528. * The callback is passed the screen id that can be
  1529. * used to retrieve an interface to a specific screen using
  1530. * IDirectFB::GetScreen().
  1531. */
  1532. DFBResult (*EnumScreens) (
  1533. IDirectFB *thiz,
  1534. DFBScreenCallback callback,
  1535. void *callbackdata
  1536. );
  1537. /*
  1538. * Retrieve an interface to a specific screen.
  1539. */
  1540. DFBResult (*GetScreen) (
  1541. IDirectFB *thiz,
  1542. DFBScreenID screen_id,
  1543. IDirectFBScreen **ret_interface
  1544. );
  1545. /** Display Layers **/
  1546. /*
  1547. * Enumerate all existing display layers.
  1548. *
  1549. * Calls the given callback for each available display
  1550. * layer. The callback is passed the layer id that can be
  1551. * used to retrieve an interface to a specific layer using
  1552. * IDirectFB::GetDisplayLayer().
  1553. */
  1554. DFBResult (*EnumDisplayLayers) (
  1555. IDirectFB *thiz,
  1556. DFBDisplayLayerCallback callback,
  1557. void *callbackdata
  1558. );
  1559. /*
  1560. * Retrieve an interface to a specific display layer.
  1561. *
  1562. * The default <i>layer_id</i> is DLID_PRIMARY.
  1563. * Others can be obtained using IDirectFB::EnumDisplayLayers().
  1564. */
  1565. DFBResult (*GetDisplayLayer) (
  1566. IDirectFB *thiz,
  1567. DFBDisplayLayerID layer_id,
  1568. IDirectFBDisplayLayer **ret_interface
  1569. );
  1570. /** Input Devices **/
  1571. /*
  1572. * Enumerate all existing input devices.
  1573. *
  1574. * Calls the given callback for all available input devices.
  1575. * The callback is passed the device id that can be used to
  1576. * retrieve an interface on a specific device using
  1577. * IDirectFB::GetInputDevice().
  1578. */
  1579. DFBResult (*EnumInputDevices) (
  1580. IDirectFB *thiz,
  1581. DFBInputDeviceCallback callback,
  1582. void *callbackdata
  1583. );
  1584. /*
  1585. * Retrieve an interface to a specific input device.
  1586. */
  1587. DFBResult (*GetInputDevice) (
  1588. IDirectFB *thiz,
  1589. DFBInputDeviceID device_id,
  1590. IDirectFBInputDevice **ret_interface
  1591. );
  1592. /*
  1593. * Create a buffer for events.
  1594. *
  1595. * Creates an empty event buffer without event sources connected to it.
  1596. */
  1597. DFBResult (*CreateEventBuffer) (
  1598. IDirectFB *thiz,
  1599. IDirectFBEventBuffer **ret_buffer
  1600. );
  1601. /*
  1602. * Create a buffer for events with input devices connected.
  1603. *
  1604. * Creates an event buffer and attaches all input devices
  1605. * with matching capabilities. If no input devices match,
  1606. * e.g. by specifying DICAPS_NONE, a buffer will be returned
  1607. * that has no event sources connected to it.
  1608. *
  1609. * If global is DFB_FALSE events will only be delivered if this
  1610. * instance of IDirectFB has a focused primary (either running fullscreen
  1611. * or running in windowed mode with the window being focused).
  1612. *
  1613. * If global is DFB_TRUE no event will be discarded.
  1614. */
  1615. DFBResult (*CreateInputEventBuffer) (
  1616. IDirectFB *thiz,
  1617. DFBInputDeviceCapabilities caps,
  1618. DFBBoolean global,
  1619. IDirectFBEventBuffer **ret_buffer
  1620. );
  1621. /** Media **/
  1622. /*
  1623. * Create an image provider for the specified file.
  1624. */
  1625. DFBResult (*CreateImageProvider) (
  1626. IDirectFB *thiz,
  1627. const char *filename,
  1628. IDirectFBImageProvider **ret_interface
  1629. );
  1630. /*
  1631. * Create a video provider.
  1632. */
  1633. DFBResult (*CreateVideoProvider) (
  1634. IDirectFB *thiz,
  1635. const char *filename,
  1636. IDirectFBVideoProvider **ret_interface
  1637. );
  1638. /*
  1639. * Load a font from the specified file given a description
  1640. * of how to load the glyphs.
  1641. */
  1642. DFBResult (*CreateFont) (
  1643. IDirectFB *thiz,
  1644. const char *filename,
  1645. const DFBFontDescription *desc,
  1646. IDirectFBFont **ret_interface
  1647. );
  1648. /*
  1649. * Create a data buffer.
  1650. *
  1651. * If no description is specified (NULL) a streamed data buffer
  1652. * is created.
  1653. */
  1654. DFBResult (*CreateDataBuffer) (
  1655. IDirectFB *thiz,
  1656. const DFBDataBufferDescription *desc,
  1657. IDirectFBDataBuffer **ret_interface
  1658. );
  1659. /** Clipboard **/
  1660. /*
  1661. * Set clipboard content.
  1662. *
  1663. * This is an experimental and intermediate API call that is
  1664. * supposed to change soon.
  1665. *
  1666. * If timestamp is non null DirectFB returns the time stamp
  1667. * that it associated with the new data.
  1668. */
  1669. DFBResult (*SetClipboardData) (
  1670. IDirectFB *thiz,
  1671. const char *mime_type,
  1672. const void *data,
  1673. unsigned int size,
  1674. struct timeval *ret_timestamp
  1675. );
  1676. /*
  1677. * Get clipboard content.
  1678. *
  1679. * Memory returned in *ret_mimetype and *ret_data has to be freed.
  1680. *
  1681. * This is an experimental and intermediate API call that is
  1682. * supposed to change soon.
  1683. */
  1684. DFBResult (*GetClipboardData) (
  1685. IDirectFB *thiz,
  1686. char **ret_mimetype,
  1687. void **ret_data,
  1688. unsigned int *ret_size
  1689. );
  1690. /*
  1691. * Get time stamp of last SetClipboardData call.
  1692. *
  1693. * This is an experimental and intermediate API call that is
  1694. * supposed to change soon.
  1695. */
  1696. DFBResult (*GetClipboardTimeStamp) (
  1697. IDirectFB *thiz,
  1698. struct timeval *ret_timestamp
  1699. );
  1700. /** Misc **/
  1701. /*
  1702. * Suspend DirectFB, no other calls to DirectFB are allowed
  1703. * until Resume has been called.
  1704. */
  1705. DFBResult (*Suspend) (
  1706. IDirectFB *thiz
  1707. );
  1708. /*
  1709. * Resume DirectFB, only to be called after Suspend.
  1710. */
  1711. DFBResult (*Resume) (
  1712. IDirectFB *thiz
  1713. );
  1714. /*
  1715. * Wait until graphics card is idle,
  1716. * i.e. finish all drawing/blitting functions.
  1717. */
  1718. DFBResult (*WaitIdle) (
  1719. IDirectFB *thiz
  1720. );
  1721. /*
  1722. * Wait for next vertical retrace.
  1723. */
  1724. DFBResult (*WaitForSync) (
  1725. IDirectFB *thiz
  1726. );
  1727. /** Extensions **/
  1728. /*
  1729. * Load an implementation of a specific interface type.
  1730. *
  1731. * This methods loads an interface implementation of the specified
  1732. * <b>type</b> of interface, e.g. "IFusionSound".
  1733. *
  1734. * A specific implementation can be forced with the optional
  1735. * <b>implementation</b> argument.
  1736. *
  1737. * Implementations are passed <b>arg</b> during probing and construction.
  1738. *
  1739. * If an implementation has been successfully probed and the interface
  1740. * has been constructed, the resulting interface pointer is stored in
  1741. * <b>interface</b>.
  1742. */
  1743. DFBResult (*GetInterface) (
  1744. IDirectFB *thiz,
  1745. const char *type,
  1746. const char *implementation,
  1747. void *arg,
  1748. void **ret_interface
  1749. );
  1750. )
  1751. /* predefined layer ids */
  1752. #define DLID_PRIMARY 0x0000
  1753. /* predefined layer source ids */
  1754. #define DLSID_SURFACE 0x0000
  1755. /* predefined screen ids */
  1756. #define DSCID_PRIMARY 0x0000
  1757. /* predefined input device ids */
  1758. #define DIDID_KEYBOARD 0x0000 /* primary keyboard */
  1759. #define DIDID_MOUSE 0x0001 /* primary mouse */
  1760. #define DIDID_JOYSTICK 0x0002 /* primary joystick */
  1761. #define DIDID_REMOTE 0x0003 /* primary remote control */
  1762. #define DIDID_ANY 0x0010 /* no primary device */
  1763. /*
  1764. * Cooperative level handling the access permissions.
  1765. */
  1766. typedef enum {
  1767. DLSCL_SHARED = 0, /* shared access */
  1768. DLSCL_EXCLUSIVE, /* exclusive access,
  1769. fullscreen/mode switching */
  1770. DLSCL_ADMINISTRATIVE /* administrative access,
  1771. enumerate windows, control them */
  1772. } DFBDisplayLayerCooperativeLevel;
  1773. /*
  1774. * Background mode defining how to erase/initialize the area
  1775. * for a windowstack repaint
  1776. */
  1777. typedef enum {
  1778. DLBM_DONTCARE = 0, /* do not clear the layer before
  1779. repainting the windowstack */
  1780. DLBM_COLOR, /* fill with solid color
  1781. (SetBackgroundColor) */
  1782. DLBM_IMAGE, /* use an image (SetBackgroundImage) */
  1783. DLBM_TILE /* use a tiled image (SetBackgroundImage) */
  1784. } DFBDisplayLayerBackgroundMode;
  1785. /*
  1786. * Layer configuration flags
  1787. */
  1788. typedef enum {
  1789. DLCONF_NONE = 0x00000000,
  1790. DLCONF_WIDTH = 0x00000001,
  1791. DLCONF_HEIGHT = 0x00000002,
  1792. DLCONF_PIXELFORMAT = 0x00000004,
  1793. DLCONF_BUFFERMODE = 0x00000008,
  1794. DLCONF_OPTIONS = 0x00000010,
  1795. DLCONF_SOURCE = 0x00000020,
  1796. DLCONF_SURFACE_CAPS = 0x00000040,
  1797. DLCONF_ALL = 0x0000007F
  1798. } DFBDisplayLayerConfigFlags;
  1799. /*
  1800. * Layer configuration
  1801. */
  1802. typedef struct {
  1803. DFBDisplayLayerConfigFlags flags; /* Which fields of the configuration are set */
  1804. int width; /* Pixel width */
  1805. int height; /* Pixel height */
  1806. DFBSurfacePixelFormat pixelformat; /* Pixel format */
  1807. DFBDisplayLayerBufferMode buffermode; /* Buffer mode */
  1808. DFBDisplayLayerOptions options; /* Enable capabilities */
  1809. DFBDisplayLayerSourceID source; /* Selected layer source */
  1810. DFBSurfaceCapabilities surface_caps; /* Choose surface capabilities, available:
  1811. INTERLACED, SEPARATED, PREMULTIPLIED. */
  1812. } DFBDisplayLayerConfig;
  1813. /*
  1814. * Screen Power Mode.
  1815. */
  1816. typedef enum {
  1817. DSPM_ON = 0,
  1818. DSPM_STANDBY,
  1819. DSPM_SUSPEND,
  1820. DSPM_OFF
  1821. } DFBScreenPowerMode;
  1822. /*
  1823. * Capabilities of a mixer.
  1824. */
  1825. typedef enum {
  1826. DSMCAPS_NONE = 0x00000000, /* None of these. */
  1827. DSMCAPS_FULL = 0x00000001, /* Can mix full tree as specified in the description. */
  1828. DSMCAPS_SUB_LEVEL = 0x00000002, /* Can set a maximum layer level, e.g. to exclude an OSD from VCR output. */
  1829. DSMCAPS_SUB_LAYERS = 0x00000004, /* Can select a number of layers individually as specified in the description. */
  1830. DSMCAPS_BACKGROUND = 0x00000008 /* Background color is configurable. */
  1831. } DFBScreenMixerCapabilities;
  1832. #define DFB_SCREEN_MIXER_DESC_NAME_LENGTH 24
  1833. /*
  1834. * Description of a mixer.
  1835. */
  1836. typedef struct {
  1837. DFBScreenMixerCapabilities caps;
  1838. DFBDisplayLayerIDs layers; /* Visible layers if the
  1839. full tree is selected. */
  1840. int sub_num; /* Number of layers that can
  1841. be selected in sub mode. */
  1842. DFBDisplayLayerIDs sub_layers; /* Layers available for sub mode
  1843. with layer selection. */
  1844. char name[DFB_SCREEN_MIXER_DESC_NAME_LENGTH]; /* Mixer name */
  1845. } DFBScreenMixerDescription;
  1846. /*
  1847. * Flags for mixer configuration.
  1848. */
  1849. typedef enum {
  1850. DSMCONF_NONE = 0x00000000, /* None of these. */
  1851. DSMCONF_TREE = 0x00000001, /* (Sub) tree is selected. */
  1852. DSMCONF_LEVEL = 0x00000002, /* Level is specified. */
  1853. DSMCONF_LAYERS = 0x00000004, /* Layer selection is set. */
  1854. DSMCONF_BACKGROUND = 0x00000010, /* Background color is set. */
  1855. DSMCONF_ALL = 0x00000017
  1856. } DFBScreenMixerConfigFlags;
  1857. /*
  1858. * (Sub) tree selection.
  1859. */
  1860. typedef enum {
  1861. DSMT_UNKNOWN = 0x00000000, /* Unknown mode */
  1862. DSMT_FULL = 0x00000001, /* Full tree. */
  1863. DSMT_SUB_LEVEL = 0x00000002, /* Sub tree via maximum level. */
  1864. DSMT_SUB_LAYERS = 0x00000003 /* Sub tree via layer selection. */
  1865. } DFBScreenMixerTree;
  1866. /*
  1867. * Configuration of a mixer.
  1868. */
  1869. typedef struct {
  1870. DFBScreenMixerConfigFlags flags; /* Validates struct members. */
  1871. DFBScreenMixerTree tree; /* Selected (sub) tree. */
  1872. int level; /* Max. level of sub level mode. */
  1873. DFBDisplayLayerIDs layers; /* Layers for sub layers mode. */
  1874. DFBColor background; /* Background color. */
  1875. } DFBScreenMixerConfig;
  1876. /*
  1877. * Capabilities of an output.
  1878. */
  1879. typedef enum {
  1880. DSOCAPS_NONE = 0x00000000, /* None of these. */
  1881. DSOCAPS_CONNECTORS = 0x00000001, /* Output connectors are available. */
  1882. DSOCAPS_ENCODER_SEL = 0x00000010, /* Encoder can be selected. */
  1883. DSOCAPS_SIGNAL_SEL = 0x00000020, /* Signal(s) can be selected. */
  1884. DSOCAPS_CONNECTOR_SEL = 0x00000040, /* Connector(s) can be selected. */
  1885. DSOCAPS_SLOW_BLANKING = 0x00000080, /* Slow Blanking on outputs is supported. */
  1886. DSOCAPS_RESOLUTION = 0x00000100, /* Output Resolution can be changed. (global screen size)*/
  1887. DSOCAPS_ALL = 0x000001F1
  1888. } DFBScreenOutputCapabilities;
  1889. /*
  1890. * Type of output connector.
  1891. */
  1892. typedef enum {
  1893. DSOC_UNKNOWN = 0x00000000, /* Unknown type */
  1894. DSOC_VGA = 0x00000001, /* VGA connector */
  1895. DSOC_SCART = 0x00000002, /* SCART connector */
  1896. DSOC_YC = 0x00000004, /* Y/C connector */
  1897. DSOC_CVBS = 0x00000008, /* CVBS connector */
  1898. DSOC_SCART2 = 0x00000010, /* 2nd SCART connector */
  1899. DSOC_COMPONENT = 0x00000020, /* Component video connector */
  1900. DSOC_HDMI = 0x00000040, /* HDMI connector */
  1901. DSOC_656 = 0x00000080, /* DVO connector */
  1902. } DFBScreenOutputConnectors;
  1903. /*
  1904. * Type of output signal.
  1905. */
  1906. typedef enum {
  1907. DSOS_NONE = 0x00000000, /* No signal */
  1908. DSOS_VGA = 0x00000001, /* VGA signal */
  1909. DSOS_YC = 0x00000002, /* Y/C signal */
  1910. DSOS_CVBS = 0x00000004, /* CVBS signal */
  1911. DSOS_RGB = 0x00000008, /* R/G/B signal */
  1912. DSOS_YCBCR = 0x00000010, /* Y/Cb/Cr signal */
  1913. DSOS_HDMI = 0x00000020, /* HDMI signal */
  1914. DSOS_656 = 0x00000040 /* 656 Digital output signal */
  1915. } DFBScreenOutputSignals;
  1916. /*
  1917. * Type of slow blanking signalling.
  1918. */
  1919. typedef enum {
  1920. DSOSB_OFF = 0x00000000, /* No signal */
  1921. DSOSB_16x9 = 0x00000001, /* 16*9 Widescreen signalling */
  1922. DSOSB_4x3 = 0x00000002, /* 4*3 widescreen signalling */
  1923. DSOSB_FOLLOW = 0x00000004, /* Follow signalling */
  1924. DSOSB_MONITOR = 0x00000008 /* Monitor */
  1925. } DFBScreenOutputSlowBlankingSignals;
  1926. /**
  1927. * Resolutions. TV Standards implies too many things:
  1928. * resolution / encoding / frequency.
  1929. */
  1930. typedef enum {
  1931. DSOR_UNKNOWN = 0x00000000, /* Unknown Resolution */
  1932. DSOR_640_480 = 0x00000001, /* 640x480 Resolution */
  1933. DSOR_720_480 = 0x00000002, /* 720x480 Resolution */
  1934. DSOR_720_576 = 0x00000004, /* 720x576 Resolution */
  1935. DSOR_800_600 = 0x00000008, /* 800x600 Resolution */
  1936. DSOR_1024_768 = 0x00000010, /* 1024x768 Resolution */
  1937. DSOR_1152_864 = 0x00000020, /* 1152x864 Resolution */
  1938. DSOR_1280_720 = 0x00000040, /* 1280x720 Resolution */
  1939. DSOR_1280_768 = 0x00000080, /* 1280x768 Resolution */
  1940. DSOR_1280_960 = 0x00000100, /* 1280x960 Resolution */
  1941. DSOR_1280_1024 = 0x00000200, /* 1280x1024 Resolution */
  1942. DSOR_1400_1050 = 0x00000400, /* 1400x1050 Resolution */
  1943. DSOR_1600_1200 = 0x00000800, /* 1600x1200 Resolution */
  1944. DSOR_1920_1080 = 0x00001000, /* 1920x1080 Resolution */
  1945. DSOR_ALL = 0x00001FFF /* All Resolution */
  1946. } DFBScreenOutputResolution;
  1947. #define DFB_SCREEN_OUTPUT_DESC_NAME_LENGTH 24
  1948. /*
  1949. * Description of a screen output.
  1950. */
  1951. typedef struct {
  1952. DFBScreenOutputCapabilities caps; /* Screen capabilities. */
  1953. DFBScreenOutputConnectors all_connectors; /* Output connectors. */
  1954. DFBScreenOutputSignals all_signals; /* Output signals. */
  1955. DFBScreenOutputResolution all_resolutions; /* Output Resolutions */
  1956. char name[DFB_SCREEN_OUTPUT_DESC_NAME_LENGTH]; /* Output name */
  1957. } DFBScreenOutputDescription;
  1958. /*
  1959. * Flags for screen output configuration.
  1960. */
  1961. typedef enum {
  1962. DSOCONF_NONE = 0x00000000, /* None of these. */
  1963. DSOCONF_ENCODER = 0x00000001, /* Set encoder the signal(s) comes from. */
  1964. DSOCONF_SIGNALS = 0x00000002, /* Select signal(s) from encoder. */
  1965. DSOCONF_CONNECTORS = 0x00000004, /* Select output connector(s). */
  1966. DSOCONF_SLOW_BLANKING= 0x00000008, /* Can select slow blanking support. */
  1967. DSOCONF_RESOLUTION = 0x00000010, /* Can change output resolution */
  1968. DSOCONF_ALL = 0x0000001F
  1969. } DFBScreenOutputConfigFlags;
  1970. /*
  1971. * Configuration of an output.
  1972. */
  1973. typedef struct {
  1974. DFBScreenOutputConfigFlags flags; /* Validates struct members. */
  1975. int encoder; /* Chosen encoder. */
  1976. DFBScreenOutputSignals out_signals; /* Selected encoder signal(s). */
  1977. DFBScreenOutputConnectors out_connectors; /* Selected output connector(s). */
  1978. DFBScreenOutputSlowBlankingSignals slow_blanking;/* Slow Blanking signals. */
  1979. DFBScreenOutputResolution resolution; /* Output Resolution */
  1980. } DFBScreenOutputConfig;
  1981. /*
  1982. * Capabilities of a display encoder.
  1983. */
  1984. typedef enum {
  1985. DSECAPS_NONE = 0x00000000, /* None of these. */
  1986. DSECAPS_TV_STANDARDS = 0x00000001, /* TV standards can be selected. */
  1987. DSECAPS_TEST_PICTURE = 0x00000002, /* Test picture generation supported. */
  1988. DSECAPS_MIXER_SEL = 0x00000004, /* Mixer can be selected. */
  1989. DSECAPS_OUT_SIGNALS = 0x00000008, /* Different output signals are supported. */
  1990. DSECAPS_SCANMODE = 0x00000010, /* Can switch between interlaced and progressive output. */
  1991. DSECAPS_FREQUENCY = 0x00000020, /* Can switch between different frequencies. */
  1992. DSECAPS_BRIGHTNESS = 0x00000100, /* Adjustment of brightness is supported. */
  1993. DSECAPS_CONTRAST = 0x00000200, /* Adjustment of contrast is supported. */
  1994. DSECAPS_HUE = 0x00000400, /* Adjustment of hue is supported. */
  1995. DSECAPS_SATURATION = 0x00000800, /* Adjustment of saturation is supported. */
  1996. DSECAPS_CONNECTORS = 0x00001000, /* Select output connector(s). */
  1997. DSECAPS_SLOW_BLANKING = 0x00002000, /* Slow Blanking on outputs is supported. */
  1998. DSECAPS_RESOLUTION = 0x00004000, /* Different encoder resolutions supported */
  1999. DSECAPS_ALL = 0x00007f3f
  2000. } DFBScreenEncoderCapabilities;
  2001. /*
  2002. * Type of display encoder.
  2003. */
  2004. typedef enum {
  2005. DSET_UNKNOWN = 0x00000000, /* Unknown type */
  2006. DSET_CRTC = 0x00000001, /* Encoder is a CRTC. */
  2007. DSET_TV = 0x00000002, /* TV output encoder. */
  2008. DSET_DIGITAL = 0x00000004 /* Support signals other than SD TV standards. */
  2009. } DFBScreenEncoderType;
  2010. /*
  2011. * TV standards.
  2012. */
  2013. typedef enum {
  2014. DSETV_UNKNOWN = 0x00000000, /* Unknown standard */
  2015. DSETV_PAL = 0x00000001, /* PAL */
  2016. DSETV_NTSC = 0x00000002, /* NTSC */
  2017. DSETV_SECAM = 0x00000004, /* SECAM */
  2018. DSETV_PAL_60 = 0x00000008, /* PAL-60 */
  2019. DSETV_PAL_BG = 0x00000010, /* PAL BG support (specific) */
  2020. DSETV_PAL_I = 0x00000020, /* PAL I support (specific) */
  2021. DSETV_PAL_M = 0x00000040, /* PAL M support (specific) */
  2022. DSETV_PAL_N = 0x00000080, /* PAL N support (specific) */
  2023. DSETV_PAL_NC = 0x00000100, /* PAL NC support (specific) */
  2024. DSETV_NTSC_M_JPN = 0x00000200, /* NTSC_JPN support */
  2025. DSETV_DIGITAL = 0x00000400, /* TV standards from the digital domain. specify resolution, scantype, frequency.*/
  2026. DSETV_NTSC_443 = 0x00000800, /* NTSC with 4.43MHz colour carrier */
  2027. DSETV_ALL = 0x00000FFF /* All TV Standards*/
  2028. } DFBScreenEncoderTVStandards;
  2029. /*
  2030. * Scan modes.
  2031. */
  2032. typedef enum {
  2033. DSESM_UNKNOWN = 0x00000000, /* Unknown mode */
  2034. DSESM_INTERLACED = 0x00000001, /* Interlaced scan mode */
  2035. DSESM_PROGRESSIVE = 0x00000002 /* Progressive scan mode */
  2036. } DFBScreenEncoderScanMode;
  2037. /*
  2038. * Frequency of output signal.
  2039. */
  2040. typedef enum {
  2041. DSEF_UNKNOWN = 0x00000000, /* Unknown Frequency */
  2042. DSEF_25HZ = 0x00000001, /* 25 Hz Output. */
  2043. DSEF_29_97HZ = 0x00000002, /* 29.97 Hz Output. */
  2044. DSEF_50HZ = 0x00000004, /* 50 Hz Output. */
  2045. DSEF_59_94HZ = 0x00000008, /* 59.94 Hz Output. */
  2046. DSEF_60HZ = 0x00000010, /* 60 Hz Output. */
  2047. DSEF_75HZ = 0x00000020, /* 75 Hz Output. */
  2048. DSEF_30HZ = 0x00000040, /* 30 Hz Output. */
  2049. DSEF_24HZ = 0x00000080, /* 24 Hz Output. */
  2050. DSEF_23_976HZ = 0x00000100, /* 23.976 Hz Output. */
  2051. } DFBScreenEncoderFrequency;
  2052. #define DFB_SCREEN_ENCODER_DESC_NAME_LENGTH 24
  2053. /*
  2054. * Description of a display encoder.
  2055. */
  2056. typedef struct {
  2057. DFBScreenEncoderCapabilities caps; /* Encoder capabilities. */
  2058. DFBScreenEncoderType type; /* Type of encoder. */
  2059. DFBScreenEncoderTVStandards tv_standards; /* Supported TV standards. */
  2060. DFBScreenOutputSignals out_signals; /* Supported output signals. */
  2061. DFBScreenOutputConnectors all_connectors; /* Supported output connectors */
  2062. DFBScreenOutputResolution all_resolutions; /* Supported Resolutions*/
  2063. char name[DFB_SCREEN_ENCODER_DESC_NAME_LENGTH]; /* Encoder name */
  2064. } DFBScreenEncoderDescription;
  2065. /*
  2066. * Flags for display encoder configuration.
  2067. */
  2068. typedef enum {
  2069. DSECONF_NONE = 0x00000000, /* None of these. */
  2070. DSECONF_TV_STANDARD = 0x00000001, /* Set TV standard. */
  2071. DSECONF_TEST_PICTURE = 0x00000002, /* Set test picture mode. */
  2072. DSECONF_MIXER = 0x00000004, /* Select mixer. */
  2073. DSECONF_OUT_SIGNALS = 0x00000008, /* Select generated output signal(s). */
  2074. DSECONF_SCANMODE = 0x00000010, /* Select interlaced or progressive output. */
  2075. DSECONF_TEST_COLOR = 0x00000020, /* Set color for DSETP_SINGLE. */
  2076. DSECONF_ADJUSTMENT = 0x00000040, /* Set color adjustment. */
  2077. DSECONF_FREQUENCY = 0x00000080, /* Set Output Frequency*/
  2078. DSECONF_CONNECTORS = 0x00000100, /* Select output connector(s). */
  2079. DSECONF_SLOW_BLANKING = 0x00000200, /* Can select slow blanking support. */
  2080. DSECONF_RESOLUTION = 0x00000400, /* Can change resolution of the encoder.*/
  2081. DSECONF_ALL = 0x000007FF
  2082. } DFBScreenEncoderConfigFlags;
  2083. /*
  2084. * Test picture mode.
  2085. */
  2086. typedef enum {
  2087. DSETP_OFF = 0x00000000, /* Disable test picture. */
  2088. DSETP_MULTI = 0x00000001, /* Show color bars. */
  2089. DSETP_SINGLE = 0x00000002, /* Whole screen as defined in configuration. */
  2090. DSETP_WHITE = 0x00000010, /* Whole screen (ff, ff, ff). */
  2091. DSETP_YELLOW = 0x00000020, /* Whole screen (ff, ff, 00). */
  2092. DSETP_CYAN = 0x00000030, /* Whole screen (00, ff, ff). */
  2093. DSETP_GREEN = 0x00000040, /* Whole screen (00, ff, 00). */
  2094. DSETP_MAGENTA = 0x00000050, /* Whole screen (ff, 00, ff). */
  2095. DSETP_RED = 0x00000060, /* Whole screen (ff, 00, 00). */
  2096. DSETP_BLUE = 0x00000070, /* Whole screen (00, 00, ff). */
  2097. DSETP_BLACK = 0x00000080 /* Whole screen (00, 00, 00). */
  2098. } DFBScreenEncoderTestPicture;
  2099. /*
  2100. * Configuration of a display encoder.
  2101. */
  2102. typedef struct {
  2103. DFBScreenEncoderConfigFlags flags; /* Validates struct members. */
  2104. DFBScreenEncoderTVStandards tv_standard; /* TV standard. */
  2105. DFBScreenEncoderTestPicture test_picture; /* Test picture mode. */
  2106. int mixer; /* Selected mixer. */
  2107. DFBScreenOutputSignals out_signals; /* Generated output signals. */
  2108. DFBScreenOutputConnectors out_connectors; /* Selected output connector(s). */
  2109. DFBScreenOutputSlowBlankingSignals slow_blanking;/* Slow Blanking signals. */
  2110. DFBScreenEncoderScanMode scanmode; /* Interlaced or progressive output. */
  2111. DFBColor test_color; /* Color for DSETP_SINGLE. */
  2112. DFBColorAdjustment adjustment; /* Color adjustment. */
  2113. DFBScreenEncoderFrequency frequency; /* Selected Output Frequency*/
  2114. DFBScreenOutputResolution resolution; /* Selected Output resolution*/
  2115. } DFBScreenEncoderConfig;
  2116. /*******************
  2117. * IDirectFBScreen *
  2118. *******************/
  2119. /*
  2120. * <i>No summary yet...</i>
  2121. */
  2122. DEFINE_INTERFACE( IDirectFBScreen,
  2123. /** Retrieving information **/
  2124. /*
  2125. * Get the unique screen ID.
  2126. */
  2127. DFBResult (*GetID) (
  2128. IDirectFBScreen *thiz,
  2129. DFBScreenID *ret_screen_id
  2130. );
  2131. /*
  2132. * Get a description of this screen, i.e. the capabilities.
  2133. */
  2134. DFBResult (*GetDescription) (
  2135. IDirectFBScreen *thiz,
  2136. DFBScreenDescription *ret_desc
  2137. );
  2138. /*
  2139. * Get the screen's width and height in pixels.
  2140. */
  2141. DFBResult (*GetSize) (
  2142. IDirectFBScreen *thiz,
  2143. int *ret_width,
  2144. int *ret_height
  2145. );
  2146. /** Display Layers **/
  2147. /*
  2148. * Enumerate all existing display layers for this screen.
  2149. *
  2150. * Calls the given callback for each available display
  2151. * layer. The callback is passed the layer id that can be
  2152. * used to retrieve an interface to a specific layer using
  2153. * IDirectFB::GetDisplayLayer().
  2154. */
  2155. DFBResult (*EnumDisplayLayers) (
  2156. IDirectFBScreen *thiz,
  2157. DFBDisplayLayerCallback callback,
  2158. void *callbackdata
  2159. );
  2160. /** Power management **/
  2161. /*
  2162. * Set screen power mode.
  2163. */
  2164. DFBResult (*SetPowerMode) (
  2165. IDirectFBScreen *thiz,
  2166. DFBScreenPowerMode mode
  2167. );
  2168. /** Synchronization **/
  2169. /*
  2170. * Wait for next vertical retrace.
  2171. */
  2172. DFBResult (*WaitForSync) (
  2173. IDirectFBScreen *thiz
  2174. );
  2175. /** Mixers **/
  2176. /*
  2177. * Get a description of available mixers.
  2178. *
  2179. * All descriptions are written to the array pointed to by
  2180. * <b>ret_descriptions</b>. The number of mixers is returned by
  2181. * IDirectFBScreen::GetDescription().
  2182. */
  2183. DFBResult (*GetMixerDescriptions) (
  2184. IDirectFBScreen *thiz,
  2185. DFBScreenMixerDescription *ret_descriptions
  2186. );
  2187. /*
  2188. * Get current mixer configuration.
  2189. */
  2190. DFBResult (*GetMixerConfiguration) (
  2191. IDirectFBScreen *thiz,
  2192. int mixer,
  2193. DFBScreenMixerConfig *ret_config
  2194. );
  2195. /*
  2196. * Test mixer configuration.
  2197. *
  2198. * If configuration fails and 'ret_failed' is not NULL it will
  2199. * indicate which fields of the configuration caused the error.
  2200. */
  2201. DFBResult (*TestMixerConfiguration) (
  2202. IDirectFBScreen *thiz,
  2203. int mixer,
  2204. const DFBScreenMixerConfig *config,
  2205. DFBScreenMixerConfigFlags *ret_failed
  2206. );
  2207. /*
  2208. * Set mixer configuration.
  2209. */
  2210. DFBResult (*SetMixerConfiguration) (
  2211. IDirectFBScreen *thiz,
  2212. int mixer,
  2213. const DFBScreenMixerConfig *config
  2214. );
  2215. /** Encoders **/
  2216. /*
  2217. * Get a description of available display encoders.
  2218. *
  2219. * All descriptions are written to the array pointed to by
  2220. * <b>ret_descriptions</b>. The number of encoders is returned by
  2221. * IDirectFBScreen::GetDescription().
  2222. */
  2223. DFBResult (*GetEncoderDescriptions) (
  2224. IDirectFBScreen *thiz,
  2225. DFBScreenEncoderDescription *ret_descriptions
  2226. );
  2227. /*
  2228. * Get current encoder configuration.
  2229. */
  2230. DFBResult (*GetEncoderConfiguration) (
  2231. IDirectFBScreen *thiz,
  2232. int encoder,
  2233. DFBScreenEncoderConfig *ret_config
  2234. );
  2235. /*
  2236. * Test encoder configuration.
  2237. *
  2238. * If configuration fails and 'ret_failed' is not NULL it will
  2239. * indicate which fields of the configuration caused the
  2240. * error.
  2241. */
  2242. DFBResult (*TestEncoderConfiguration) (
  2243. IDirectFBScreen *thiz,
  2244. int encoder,
  2245. const DFBScreenEncoderConfig *config,
  2246. DFBScreenEncoderConfigFlags *ret_failed
  2247. );
  2248. /*
  2249. * Set encoder configuration.
  2250. */
  2251. DFBResult (*SetEncoderConfiguration) (
  2252. IDirectFBScreen *thiz,
  2253. int encoder,
  2254. const DFBScreenEncoderConfig *config
  2255. );
  2256. /** Outputs **/
  2257. /*
  2258. * Get a description of available outputs.
  2259. *
  2260. * All descriptions are written to the array pointed to by
  2261. * <b>ret_descriptions</b>. The number of outputs is returned by
  2262. * IDirectFBScreen::GetDescription().
  2263. */
  2264. DFBResult (*GetOutputDescriptions) (
  2265. IDirectFBScreen *thiz,
  2266. DFBScreenOutputDescription *ret_descriptions
  2267. );
  2268. /*
  2269. * Get current output configuration.
  2270. */
  2271. DFBResult (*GetOutputConfiguration) (
  2272. IDirectFBScreen *thiz,
  2273. int output,
  2274. DFBScreenOutputConfig *ret_config
  2275. );
  2276. /*
  2277. * Test output configuration.
  2278. *
  2279. * If configuration fails and 'ret_failed' is not NULL it will
  2280. * indicate which fields of the configuration caused the error.
  2281. */
  2282. DFBResult (*TestOutputConfiguration) (
  2283. IDirectFBScreen *thiz,
  2284. int output,
  2285. const DFBScreenOutputConfig *config,
  2286. DFBScreenOutputConfigFlags *ret_failed
  2287. );
  2288. /*
  2289. * Set output configuration.
  2290. */
  2291. DFBResult (*SetOutputConfiguration) (
  2292. IDirectFBScreen *thiz,
  2293. int output,
  2294. const DFBScreenOutputConfig *config
  2295. );
  2296. /** Synchronization **/
  2297. /*
  2298. * Return current VSync count.
  2299. */
  2300. DFBResult (*GetVSyncCount) (
  2301. IDirectFBScreen *thiz,
  2302. unsigned long *ret_count
  2303. );
  2304. )
  2305. /*************************
  2306. * IDirectFBDisplayLayer *
  2307. *************************/
  2308. /*
  2309. * <i>No summary yet...</i>
  2310. */
  2311. DEFINE_INTERFACE( IDirectFBDisplayLayer,
  2312. /** Information **/
  2313. /*
  2314. * Get the unique layer ID.
  2315. */
  2316. DFBResult (*GetID) (
  2317. IDirectFBDisplayLayer *thiz,
  2318. DFBDisplayLayerID *ret_layer_id
  2319. );
  2320. /*
  2321. * Get a description of this display layer, i.e. the capabilities.
  2322. */
  2323. DFBResult (*GetDescription) (
  2324. IDirectFBDisplayLayer *thiz,
  2325. DFBDisplayLayerDescription *ret_desc
  2326. );
  2327. /*
  2328. * Get a description of available sources.
  2329. *
  2330. * All descriptions are written to the array pointed to by
  2331. * <b>ret_descriptions</b>. The number of sources is returned by
  2332. * IDirectFBDisplayLayer::GetDescription().
  2333. */
  2334. DFBResult (*GetSourceDescriptions) (
  2335. IDirectFBDisplayLayer *thiz,
  2336. DFBDisplayLayerSourceDescription *ret_descriptions
  2337. );
  2338. /*
  2339. * For an interlaced display, this returns the currently inactive
  2340. * field: 0 for the top field, and 1 for the bottom field.
  2341. *
  2342. * The inactive field is the one you should draw to next to avoid
  2343. * tearing, the active field is the one currently being displayed.
  2344. *
  2345. * For a progressive output, this should always return 0. We should
  2346. * also have some other call to indicate whether the display layer
  2347. * is interlaced or progressive, but this is a start.
  2348. */
  2349. DFBResult (*GetCurrentOutputField) (
  2350. IDirectFBDisplayLayer *thiz,
  2351. int *ret_field
  2352. );
  2353. /** Interfaces **/
  2354. /*
  2355. * Get an interface to layer's surface.
  2356. *
  2357. * Only available in exclusive mode.
  2358. */
  2359. DFBResult (*GetSurface) (
  2360. IDirectFBDisplayLayer *thiz,
  2361. IDirectFBSurface **ret_interface
  2362. );
  2363. /*
  2364. * Get an interface to the screen to which the layer belongs.
  2365. */
  2366. DFBResult (*GetScreen) (
  2367. IDirectFBDisplayLayer *thiz,
  2368. IDirectFBScreen **ret_interface
  2369. );
  2370. /** Configuration **/
  2371. /*
  2372. * Set cooperative level to get control over the layer
  2373. * or the windows within this layer.
  2374. */
  2375. DFBResult (*SetCooperativeLevel) (
  2376. IDirectFBDisplayLayer *thiz,
  2377. DFBDisplayLayerCooperativeLevel level
  2378. );
  2379. /*
  2380. * Get current layer configuration.
  2381. */
  2382. DFBResult (*GetConfiguration) (
  2383. IDirectFBDisplayLayer *thiz,
  2384. DFBDisplayLayerConfig *ret_config
  2385. );
  2386. /*
  2387. * Test layer configuration.
  2388. *
  2389. * If configuration fails and 'failed' is not NULL it will
  2390. * indicate which fields of the configuration caused the
  2391. * error.
  2392. */
  2393. DFBResult (*TestConfiguration) (
  2394. IDirectFBDisplayLayer *thiz,
  2395. const DFBDisplayLayerConfig *config,
  2396. DFBDisplayLayerConfigFlags *ret_failed
  2397. );
  2398. /*
  2399. * Set layer configuration.
  2400. *
  2401. * Only available in exclusive or administrative mode.
  2402. */
  2403. DFBResult (*SetConfiguration) (
  2404. IDirectFBDisplayLayer *thiz,
  2405. const DFBDisplayLayerConfig *config
  2406. );
  2407. /** Layout **/
  2408. /*
  2409. * Set location on screen as normalized values.
  2410. *
  2411. * So the whole screen is 0.0, 0.0, 1.0, 1.0.
  2412. */
  2413. DFBResult (*SetScreenLocation) (
  2414. IDirectFBDisplayLayer *thiz,
  2415. float x,
  2416. float y,
  2417. float width,
  2418. float height
  2419. );
  2420. /*
  2421. * Set location on screen in pixels.
  2422. */
  2423. DFBResult (*SetScreenPosition) (
  2424. IDirectFBDisplayLayer *thiz,
  2425. int x,
  2426. int y
  2427. );
  2428. /*
  2429. * Set location on screen in pixels.
  2430. */
  2431. DFBResult (*SetScreenRectangle) (
  2432. IDirectFBDisplayLayer *thiz,
  2433. int x,
  2434. int y,
  2435. int width,
  2436. int height
  2437. );
  2438. /** Misc Settings **/
  2439. /*
  2440. * Set global alpha factor for blending with layer(s) below.
  2441. */
  2442. DFBResult (*SetOpacity) (
  2443. IDirectFBDisplayLayer *thiz,
  2444. u8 opacity
  2445. );
  2446. /*
  2447. * Set the source rectangle.
  2448. *
  2449. * Only this part of the layer will be displayed.
  2450. */
  2451. DFBResult (*SetSourceRectangle) (
  2452. IDirectFBDisplayLayer *thiz,
  2453. int x,
  2454. int y,
  2455. int width,
  2456. int height
  2457. );
  2458. /*
  2459. * For an interlaced display, this sets the field parity.
  2460. *
  2461. * field: 0 for top field first, and 1 for bottom field first.
  2462. */
  2463. DFBResult (*SetFieldParity) (
  2464. IDirectFBDisplayLayer *thiz,
  2465. int field
  2466. );
  2467. /*
  2468. * Set the clipping region(s).
  2469. *
  2470. * If supported, this method sets the clipping <b>regions</b> that are used to
  2471. * to enable or disable visibility of parts of the layer. The <b>num_regions</b>
  2472. * must not exceed the limit as stated in the display layer description.
  2473. *
  2474. * If <b>positive</b> is DFB_TRUE the layer will be shown only in these regions,
  2475. * otherwise it's shown as usual except in these regions.
  2476. *
  2477. * Also see IDirectFBDisplayLayer::GetDescription().
  2478. */
  2479. DFBResult (*SetClipRegions) (
  2480. IDirectFBDisplayLayer *thiz,
  2481. const DFBRegion *regions,
  2482. int num_regions,
  2483. DFBBoolean positive
  2484. );
  2485. /** Color keys **/
  2486. /*
  2487. * Set the source color key.
  2488. *
  2489. * If a pixel of the layer matches this color the underlying
  2490. * pixel is visible at this point.
  2491. */
  2492. DFBResult (*SetSrcColorKey) (
  2493. IDirectFBDisplayLayer *thiz,
  2494. u8 r,
  2495. u8 g,
  2496. u8 b
  2497. );
  2498. /*
  2499. * Set the destination color key.
  2500. *
  2501. * The layer is only visible at points where the underlying
  2502. * pixel matches this color.
  2503. */
  2504. DFBResult (*SetDstColorKey) (
  2505. IDirectFBDisplayLayer *thiz,
  2506. u8 r,
  2507. u8 g,
  2508. u8 b
  2509. );
  2510. /** Z Order **/
  2511. /*
  2512. * Get the current display layer level.
  2513. *
  2514. * The level describes the z axis position of a layer. The
  2515. * primary layer is always on level zero unless a special
  2516. * driver adds support for level adjustment on the primary
  2517. * layer. Layers above have a positive level, e.g. video
  2518. * overlays. Layers below have a negative level, e.g. video
  2519. * underlays or background layers.
  2520. */
  2521. DFBResult (*GetLevel) (
  2522. IDirectFBDisplayLayer *thiz,
  2523. int *ret_level
  2524. );
  2525. /*
  2526. * Set the display layer level.
  2527. *
  2528. * Moves the layer to the specified level. The order of all
  2529. * other layers won't be changed. Note that only a few
  2530. * layers support level adjustment which is reflected by
  2531. * their capabilities.
  2532. */
  2533. DFBResult (*SetLevel) (
  2534. IDirectFBDisplayLayer *thiz,
  2535. int level
  2536. );
  2537. /** Background handling **/
  2538. /*
  2539. * Set the erase behaviour for windowstack repaints.
  2540. *
  2541. * Only available in exclusive or administrative mode.
  2542. */
  2543. DFBResult (*SetBackgroundMode) (
  2544. IDirectFBDisplayLayer *thiz,
  2545. DFBDisplayLayerBackgroundMode mode
  2546. );
  2547. /*
  2548. * Set the background image for the imaged background mode.
  2549. *
  2550. * Only available in exclusive or administrative mode.
  2551. */
  2552. DFBResult (*SetBackgroundImage) (
  2553. IDirectFBDisplayLayer *thiz,
  2554. IDirectFBSurface *surface
  2555. );
  2556. /*
  2557. * Set the color for a solid colored background.
  2558. *
  2559. * Only available in exclusive or administrative mode.
  2560. */
  2561. DFBResult (*SetBackgroundColor) (
  2562. IDirectFBDisplayLayer *thiz,
  2563. u8 r,
  2564. u8 g,
  2565. u8 b,
  2566. u8 a
  2567. );
  2568. /** Color adjustment **/
  2569. /*
  2570. * Get the layers color adjustment.
  2571. */
  2572. DFBResult (*GetColorAdjustment) (
  2573. IDirectFBDisplayLayer *thiz,
  2574. DFBColorAdjustment *ret_adj
  2575. );
  2576. /*
  2577. * Set the layers color adjustment.
  2578. *
  2579. * Only available in exclusive or administrative mode.
  2580. *
  2581. * This function only has an effect if the underlying
  2582. * hardware supports this operation. Check the layers
  2583. * capabilities to find out if this is the case.
  2584. */
  2585. DFBResult (*SetColorAdjustment) (
  2586. IDirectFBDisplayLayer *thiz,
  2587. const DFBColorAdjustment *adj
  2588. );
  2589. /** Windows **/
  2590. /*
  2591. * Create a window within this layer given a
  2592. * description of the window that is to be created.
  2593. */
  2594. DFBResult (*CreateWindow) (
  2595. IDirectFBDisplayLayer *thiz,
  2596. const DFBWindowDescription *desc,
  2597. IDirectFBWindow **ret_interface
  2598. );
  2599. /*
  2600. * Retrieve an interface to an existing window.
  2601. *
  2602. * The window is identified by its window id.
  2603. */
  2604. DFBResult (*GetWindow) (
  2605. IDirectFBDisplayLayer *thiz,
  2606. DFBWindowID window_id,
  2607. IDirectFBWindow **ret_interface
  2608. );
  2609. /** Cursor handling **/
  2610. /*
  2611. * Enable/disable the mouse cursor for this layer.
  2612. *
  2613. * Windows on a layer will only receive motion events if
  2614. * the cursor is enabled. This function is only available
  2615. * in exclusive/administrative mode.
  2616. */
  2617. DFBResult (*EnableCursor) (
  2618. IDirectFBDisplayLayer *thiz,
  2619. int enable
  2620. );
  2621. /*
  2622. * Returns the x/y coordinates of the layer's mouse cursor.
  2623. */
  2624. DFBResult (*GetCursorPosition) (
  2625. IDirectFBDisplayLayer *thiz,
  2626. int *ret_x,
  2627. int *ret_y
  2628. );
  2629. /*
  2630. * Move cursor to specified position.
  2631. *
  2632. * Handles movement like a real one, i.e. generates events.
  2633. */
  2634. DFBResult (*WarpCursor) (
  2635. IDirectFBDisplayLayer *thiz,
  2636. int x,
  2637. int y
  2638. );
  2639. /*
  2640. * Set cursor acceleration.
  2641. *
  2642. * Sets the acceleration of cursor movements. The amount
  2643. * beyond the 'threshold' will be multiplied with the
  2644. * acceleration factor. The acceleration factor is
  2645. * 'numerator/denominator'.
  2646. */
  2647. DFBResult (*SetCursorAcceleration) (
  2648. IDirectFBDisplayLayer *thiz,
  2649. int numerator,
  2650. int denominator,
  2651. int threshold
  2652. );
  2653. /*
  2654. * Set the cursor shape and the hotspot.
  2655. */
  2656. DFBResult (*SetCursorShape) (
  2657. IDirectFBDisplayLayer *thiz,
  2658. IDirectFBSurface *shape,
  2659. int hot_x,
  2660. int hot_y
  2661. );
  2662. /*
  2663. * Set the cursor opacity.
  2664. *
  2665. * This function is especially useful if you want
  2666. * to hide the cursor but still want windows on this
  2667. * display layer to receive motion events. In this
  2668. * case, simply set the cursor opacity to zero.
  2669. */
  2670. DFBResult (*SetCursorOpacity) (
  2671. IDirectFBDisplayLayer *thiz,
  2672. u8 opacity
  2673. );
  2674. /** Synchronization **/
  2675. /*
  2676. * Wait for next vertical retrace.
  2677. */
  2678. DFBResult (*WaitForSync) (
  2679. IDirectFBDisplayLayer *thiz
  2680. );
  2681. /** Contexts **/
  2682. /*
  2683. * Switch the layer context.
  2684. *
  2685. * Switches to the shared context unless <b>exclusive</b> is DFB_TRUE
  2686. * and the cooperative level of this interface is DLSCL_EXCLUSIVE.
  2687. */
  2688. DFBResult (*SwitchContext) (
  2689. IDirectFBDisplayLayer *thiz,
  2690. DFBBoolean exclusive
  2691. );
  2692. /** Rotation **/
  2693. /*
  2694. * Set the rotation of data within the layer.
  2695. *
  2696. * Only available in exclusive or administrative mode.
  2697. *
  2698. * Any <b>rotation</b> other than 0, 90, 180 or 270 is not supported.
  2699. *
  2700. * No layer hardware feature usage, only rotated blitting is used.
  2701. */
  2702. DFBResult (*SetRotation) (
  2703. IDirectFBDisplayLayer *thiz,
  2704. int rotation
  2705. );
  2706. /*
  2707. * Get the rotation of data within the layer.
  2708. */
  2709. DFBResult (*GetRotation) (
  2710. IDirectFBDisplayLayer *thiz,
  2711. int *ret_rotation
  2712. );
  2713. /** Windows **/
  2714. /*
  2715. * Retrieve an interface to an existing window.
  2716. *
  2717. * The window is identified by its surface' resource id.
  2718. */
  2719. DFBResult (*GetWindowByResourceID) (
  2720. IDirectFBDisplayLayer *thiz,
  2721. unsigned long resource_id,
  2722. IDirectFBWindow **ret_interface
  2723. );
  2724. )
  2725. /*
  2726. * Flipping flags controlling the behaviour of IDirectFBSurface::Flip().
  2727. */
  2728. typedef enum {
  2729. DSFLIP_NONE = 0x00000000, /* None of these. */
  2730. DSFLIP_WAIT = 0x00000001, /* Flip() returns upon vertical sync. Flipping is still done
  2731. immediately unless DSFLIP_ONSYNC is specified, too. */
  2732. DSFLIP_BLIT = 0x00000002, /* Copy from back buffer to front buffer rather than
  2733. just swapping these buffers. This behaviour is enforced
  2734. if the region passed to Flip() is not NULL or if the
  2735. surface being flipped is a sub surface. */
  2736. DSFLIP_ONSYNC = 0x00000004, /* Do the actual flipping upon the next vertical sync.
  2737. The Flip() method will still return immediately unless
  2738. DSFLIP_WAIT is specified, too. */
  2739. DSFLIP_PIPELINE = 0x00000008,
  2740. DSFLIP_ONCE = 0x00000010,
  2741. DSFLIP_QUEUE = 0x00000100,
  2742. DSFLIP_FLUSH = 0x00000200,
  2743. DSFLIP_SIS_ARCH = 0X00000400,
  2744. DSFLIP_WAITFORSYNC = DSFLIP_WAIT | DSFLIP_ONSYNC
  2745. } DFBSurfaceFlipFlags;
  2746. /*
  2747. * Flags controlling the text layout.
  2748. */
  2749. typedef enum {
  2750. DSTF_LEFT = 0x00000000, /* left aligned */
  2751. DSTF_CENTER = 0x00000001, /* horizontally centered */
  2752. DSTF_RIGHT = 0x00000002, /* right aligned */
  2753. DSTF_TOP = 0x00000004, /* y specifies the top
  2754. instead of the baseline */
  2755. DSTF_BOTTOM = 0x00000008, /* y specifies the bottom
  2756. instead of the baseline */
  2757. DSTF_OUTLINE = 0x00000010, /* enables outline rendering if loaded font supports it */
  2758. DSTF_TOPLEFT = DSTF_TOP | DSTF_LEFT,
  2759. DSTF_TOPCENTER = DSTF_TOP | DSTF_CENTER,
  2760. DSTF_TOPRIGHT = DSTF_TOP | DSTF_RIGHT,
  2761. DSTF_BOTTOMLEFT = DSTF_BOTTOM | DSTF_LEFT,
  2762. DSTF_BOTTOMCENTER = DSTF_BOTTOM | DSTF_CENTER,
  2763. DSTF_BOTTOMRIGHT = DSTF_BOTTOM | DSTF_RIGHT
  2764. } DFBSurfaceTextFlags;
  2765. /*
  2766. * Flags defining the type of data access.
  2767. * These are important for surface swapping management.
  2768. */
  2769. typedef enum {
  2770. DSLF_READ = 0x00000001, /* Request read access while
  2771. surface is locked. */
  2772. DSLF_WRITE = 0x00000002 /* Request write access. If
  2773. specified and surface has
  2774. a back buffer, it will be
  2775. used. Otherwise, the front
  2776. buffer is used. */
  2777. } DFBSurfaceLockFlags;
  2778. /*
  2779. * Available Porter/Duff rules.
  2780. */
  2781. typedef enum {
  2782. /* pixel = (source * fs + destination * fd),
  2783. sa = source alpha,
  2784. da = destination alpha */
  2785. DSPD_NONE = 0, /* fs: sa fd: 1.0-sa (defaults) */
  2786. DSPD_CLEAR = 1, /* fs: 0.0 fd: 0.0 */
  2787. DSPD_SRC = 2, /* fs: 1.0 fd: 0.0 */
  2788. DSPD_SRC_OVER = 3, /* fs: 1.0 fd: 1.0-sa */
  2789. DSPD_DST_OVER = 4, /* fs: 1.0-da fd: 1.0 */
  2790. DSPD_SRC_IN = 5, /* fs: da fd: 0.0 */
  2791. DSPD_DST_IN = 6, /* fs: 0.0 fd: sa */
  2792. DSPD_SRC_OUT = 7, /* fs: 1.0-da fd: 0.0 */
  2793. DSPD_DST_OUT = 8, /* fs: 0.0 fd: 1.0-sa */
  2794. DSPD_SRC_ATOP = 9, /* fs: da fd: 1.0-sa */
  2795. DSPD_DST_ATOP = 10, /* fs: 1.0-da fd: sa */
  2796. DSPD_ADD = 11, /* fs: 1.0 fd: 1.0 */
  2797. DSPD_XOR = 12, /* fs: 1.0-da fd: 1.0-sa */
  2798. DSPD_DST = 13, /* fs: 0.0 fd: 1.0 */
  2799. } DFBSurfacePorterDuffRule;
  2800. /*
  2801. * Blend functions to use for source and destination blending
  2802. */
  2803. typedef enum {
  2804. /*
  2805. * pixel color = sc * cf[sf] + dc * cf[df]
  2806. * pixel alpha = sa * af[sf] + da * af[df]
  2807. * sc = source color
  2808. * sa = source alpha
  2809. * dc = destination color
  2810. * da = destination alpha
  2811. * sf = source blend function
  2812. * df = destination blend function
  2813. * cf[x] = color factor for blend function x
  2814. * af[x] = alpha factor for blend function x
  2815. */
  2816. DSBF_UNKNOWN = 0, /* */
  2817. DSBF_ZERO = 1, /* cf: 0 af: 0 */
  2818. DSBF_ONE = 2, /* cf: 1 af: 1 */
  2819. DSBF_SRCCOLOR = 3, /* cf: sc af: sa */
  2820. DSBF_INVSRCCOLOR = 4, /* cf: 1-sc af: 1-sa */
  2821. DSBF_SRCALPHA = 5, /* cf: sa af: sa */
  2822. DSBF_INVSRCALPHA = 6, /* cf: 1-sa af: 1-sa */
  2823. DSBF_DESTALPHA = 7, /* cf: da af: da */
  2824. DSBF_INVDESTALPHA = 8, /* cf: 1-da af: 1-da */
  2825. DSBF_DESTCOLOR = 9, /* cf: dc af: da */
  2826. DSBF_INVDESTCOLOR = 10, /* cf: 1-dc af: 1-da */
  2827. DSBF_SRCALPHASAT = 11, /* cf: min(sa, 1-da) af: 1 */
  2828. } DFBSurfaceBlendFunction;
  2829. /*
  2830. * Transformed vertex of a textured triangle.
  2831. */
  2832. typedef struct {
  2833. float x; /* Destination X coordinate (in pixels) */
  2834. float y; /* Destination Y coordinate (in pixels) */
  2835. float z; /* Z coordinate */
  2836. float w; /* W coordinate */
  2837. float s; /* Texture S coordinate */
  2838. float t; /* Texture T coordinate */
  2839. } DFBVertex;
  2840. /*
  2841. * Way of building triangles from the list of vertices.
  2842. */
  2843. typedef enum {
  2844. DTTF_LIST, /* 0/1/2 3/4/5 6/7/8 ... */
  2845. DTTF_STRIP, /* 0/1/2 1/2/3 2/3/4 ... */
  2846. DTTF_FAN /* 0/1/2 0/2/3 0/3/4 ... */
  2847. } DFBTriangleFormation;
  2848. /*
  2849. * Flags controlling surface masks set via IDirectFBSurface::SetSourceMask().
  2850. */
  2851. typedef enum {
  2852. DSMF_NONE = 0x00000000, /* None of these. */
  2853. DSMF_STENCIL = 0x00000001, /* Take <b>x</b> and <b>y</b> as fixed start coordinates in the mask. */
  2854. DSMF_ALL = 0x00000001, /* All of these. */
  2855. } DFBSurfaceMaskFlags;
  2856. /********************
  2857. * IDirectFBSurface *
  2858. ********************/
  2859. /*
  2860. * <i>No summary yet...</i>
  2861. */
  2862. DEFINE_INTERFACE( IDirectFBSurface,
  2863. /** Retrieving information **/
  2864. /*
  2865. * Return the capabilities of this surface.
  2866. */
  2867. DFBResult (*GetCapabilities) (
  2868. IDirectFBSurface *thiz,
  2869. DFBSurfaceCapabilities *ret_caps
  2870. );
  2871. /*
  2872. * Get the surface's position in pixels.
  2873. */
  2874. DFBResult (*GetPosition) (
  2875. IDirectFBSurface *thiz,
  2876. int *ret_x,
  2877. int *ret_y
  2878. );
  2879. /*
  2880. * Get the surface's width and height in pixels.
  2881. */
  2882. DFBResult (*GetSize) (
  2883. IDirectFBSurface *thiz,
  2884. int *ret_width,
  2885. int *ret_height
  2886. );
  2887. /*
  2888. * Created sub surfaces might be clipped by their parents,
  2889. * this function returns the resulting rectangle relative
  2890. * to this surface.
  2891. *
  2892. * For non sub surfaces this function returns
  2893. * { 0, 0, width, height }.
  2894. */
  2895. DFBResult (*GetVisibleRectangle) (
  2896. IDirectFBSurface *thiz,
  2897. DFBRectangle *ret_rect
  2898. );
  2899. /*
  2900. * Get the current pixel format.
  2901. */
  2902. DFBResult (*GetPixelFormat) (
  2903. IDirectFBSurface *thiz,
  2904. DFBSurfacePixelFormat *ret_format
  2905. );
  2906. /*
  2907. * Get a mask of drawing functions that are hardware
  2908. * accelerated with the current settings.
  2909. *
  2910. * If a source surface is specified the mask will also
  2911. * contain accelerated blitting functions. Note that there
  2912. * is no guarantee that these will actually be accelerated
  2913. * since the surface storage (video/system) is examined only
  2914. * when something actually gets drawn or blitted.
  2915. */
  2916. DFBResult (*GetAccelerationMask) (
  2917. IDirectFBSurface *thiz,
  2918. IDirectFBSurface *source,
  2919. DFBAccelerationMask *ret_mask
  2920. );
  2921. /** Palette & Alpha Ramp **/
  2922. /*
  2923. * Get access to the surface's palette.
  2924. *
  2925. * Returns an interface that can be used to gain
  2926. * read and/or write access to the surface's palette.
  2927. */
  2928. DFBResult (*GetPalette) (
  2929. IDirectFBSurface *thiz,
  2930. IDirectFBPalette **ret_interface
  2931. );
  2932. /*
  2933. * Change the surface's palette.
  2934. */
  2935. DFBResult (*SetPalette) (
  2936. IDirectFBSurface *thiz,
  2937. IDirectFBPalette *palette
  2938. );
  2939. /*
  2940. * Set the alpha ramp for formats with one or two alpha bits.
  2941. *
  2942. * Either all four values or the first and the
  2943. * last one are used, depending on the format.
  2944. * Default values are: 0x00, 0x55, 0xaa, 0xff.
  2945. */
  2946. DFBResult (*SetAlphaRamp) (
  2947. IDirectFBSurface *thiz,
  2948. u8 a0,
  2949. u8 a1,
  2950. u8 a2,
  2951. u8 a3
  2952. );
  2953. /** Buffer operations **/
  2954. /*
  2955. * Lock the surface for the access type specified.
  2956. *
  2957. * Returns a data pointer and the line pitch of it.<br>
  2958. * <br>
  2959. * <b>Note:</b> If the surface is double/triple buffered and
  2960. * the DSLF_WRITE flag is specified, the pointer is to the back
  2961. * buffer. In all other cases, the pointer is to the front
  2962. * buffer.
  2963. */
  2964. DFBResult (*Lock) (
  2965. IDirectFBSurface *thiz,
  2966. DFBSurfaceLockFlags flags,
  2967. void **ret_ptr,
  2968. int *ret_pitch
  2969. );
  2970. /*
  2971. * Obsolete. Returns DFB_FAILURE always.
  2972. *
  2973. * Previously returned the framebuffer offset of a locked surface.
  2974. * However, it is not a safe API to use at all, since it is not
  2975. * guaranteed that the offset actually belongs to fbmem (e.g. could be AGP memory).
  2976. */
  2977. DFBResult (*GetFramebufferOffset) (
  2978. IDirectFBSurface *thiz,
  2979. int *offset
  2980. );
  2981. /*
  2982. * Unlock the surface after direct access.
  2983. */
  2984. DFBResult (*Unlock) (
  2985. IDirectFBSurface *thiz
  2986. );
  2987. /*
  2988. * Flip/Update surface buffers.
  2989. *
  2990. * If no region is specified the whole surface is flipped,
  2991. * otherwise blitting is used to update the region.
  2992. * If surface capabilities don't include DSCAPS_FLIPPING,
  2993. * this method has the effect to make visible changes
  2994. * made to the surface contents.
  2995. */
  2996. DFBResult (*Flip) (
  2997. IDirectFBSurface *thiz,
  2998. const DFBRegion *region,
  2999. DFBSurfaceFlipFlags flags
  3000. );
  3001. /*
  3002. * Set the active field.
  3003. *
  3004. * Interlaced surfaces consist of two fields. Software driven
  3005. * deinterlacing uses this method to manually switch the field
  3006. * that is displayed, e.g. scaled up vertically by two.
  3007. */
  3008. DFBResult (*SetField) (
  3009. IDirectFBSurface *thiz,
  3010. int field
  3011. );
  3012. /*
  3013. * Clear the surface and its depth buffer if existent.
  3014. *
  3015. * Fills the whole (sub) surface with the specified color while ignoring
  3016. * drawing flags and color of the current state, but limited to the current clip.
  3017. *
  3018. * As with all drawing and blitting functions the backbuffer is written to.
  3019. * If you are initializing a double buffered surface you may want to clear both
  3020. * buffers by doing a Clear-Flip-Clear sequence.
  3021. */
  3022. DFBResult (*Clear) (
  3023. IDirectFBSurface *thiz,
  3024. u8 r,
  3025. u8 g,
  3026. u8 b,
  3027. u8 a
  3028. );
  3029. /** Drawing/blitting control **/
  3030. /*
  3031. * Set the clipping region used to limit the area for
  3032. * drawing, blitting and text functions.
  3033. *
  3034. * If no region is specified (NULL passed) the clip is set
  3035. * to the surface extents (initial clip).
  3036. */
  3037. DFBResult (*SetClip) (
  3038. IDirectFBSurface *thiz,
  3039. const DFBRegion *clip
  3040. );
  3041. /*
  3042. * Get the clipping region used to limit the area for
  3043. * drawing, blitting and text functions.
  3044. */
  3045. DFBResult (*GetClip) (
  3046. IDirectFBSurface *thiz,
  3047. DFBRegion *ret_clip
  3048. );
  3049. /*
  3050. * Set the color used for drawing/text functions or
  3051. * alpha/color modulation (blitting functions).
  3052. *
  3053. * If you are not using the alpha value it should be set to
  3054. * 0xff to ensure visibility when the code is ported to or
  3055. * used for surfaces with an alpha channel.
  3056. *
  3057. * This method should be avoided for surfaces with an indexed
  3058. * pixelformat, e.g. DSPF_LUT8, otherwise an expensive search
  3059. * in the color/alpha lookup table occurs.
  3060. */
  3061. DFBResult (*SetColor) (
  3062. IDirectFBSurface *thiz,
  3063. u8 r,
  3064. u8 g,
  3065. u8 b,
  3066. u8 a
  3067. );
  3068. /*
  3069. * Set the color like with SetColor() but using
  3070. * an index to the color/alpha lookup table.
  3071. *
  3072. * This method is only supported by surfaces with an
  3073. * indexed pixelformat, e.g. DSPF_LUT8. For these formats
  3074. * this method should be used instead of SetColor().
  3075. */
  3076. DFBResult (*SetColorIndex) (
  3077. IDirectFBSurface *thiz,
  3078. unsigned int index
  3079. );
  3080. /*
  3081. * Set the blend function that applies to the source.
  3082. */
  3083. DFBResult (*SetSrcBlendFunction) (
  3084. IDirectFBSurface *thiz,
  3085. DFBSurfaceBlendFunction function
  3086. );
  3087. /*
  3088. * Set the blend function that applies to the destination.
  3089. */
  3090. DFBResult (*SetDstBlendFunction) (
  3091. IDirectFBSurface *thiz,
  3092. DFBSurfaceBlendFunction function
  3093. );
  3094. /*
  3095. * Set the source and destination blend function by
  3096. * specifying a Porter/Duff rule.
  3097. */
  3098. DFBResult (*SetPorterDuff) (
  3099. IDirectFBSurface *thiz,
  3100. DFBSurfacePorterDuffRule rule
  3101. );
  3102. /*
  3103. * Set the source color key, i.e. the color that is excluded
  3104. * when blitting FROM this surface TO another that has
  3105. * source color keying enabled.
  3106. */
  3107. DFBResult (*SetSrcColorKey) (
  3108. IDirectFBSurface *thiz,
  3109. u8 r,
  3110. u8 g,
  3111. u8 b
  3112. );
  3113. /*
  3114. * Set the source color key like with SetSrcColorKey() but using
  3115. * an index to the color/alpha lookup table.
  3116. *
  3117. * This method is only supported by surfaces with an
  3118. * indexed pixelformat, e.g. DSPF_LUT8. For these formats
  3119. * this method should be used instead of SetSrcColorKey().
  3120. */
  3121. DFBResult (*SetSrcColorKeyIndex) (
  3122. IDirectFBSurface *thiz,
  3123. unsigned int index
  3124. );
  3125. /*
  3126. * Set the destination color key, i.e. the only color that
  3127. * gets overwritten by drawing and blitting to this surface
  3128. * when destination color keying is enabled.
  3129. */
  3130. DFBResult (*SetDstColorKey) (
  3131. IDirectFBSurface *thiz,
  3132. u8 r,
  3133. u8 g,
  3134. u8 b
  3135. );
  3136. /*
  3137. * Set the destination color key like with SetDstColorKey() but using
  3138. * an index to the color/alpha lookup table.
  3139. *
  3140. * This method is only supported by surfaces with an
  3141. * indexed pixelformat, e.g. DSPF_LUT8. For these formats
  3142. * this method should be used instead of SetDstColorKey().
  3143. */
  3144. DFBResult (*SetDstColorKeyIndex) (
  3145. IDirectFBSurface *thiz,
  3146. unsigned int index
  3147. );
  3148. /** Blitting functions **/
  3149. /*
  3150. * Set the flags for all subsequent blitting commands.
  3151. */
  3152. DFBResult (*SetBlittingFlags) (
  3153. IDirectFBSurface *thiz,
  3154. DFBSurfaceBlittingFlags flags
  3155. );
  3156. /*
  3157. * Blit an area from the source to this surface.
  3158. *
  3159. * Pass a NULL rectangle to use the whole source surface.
  3160. * Source may be the same surface.
  3161. */
  3162. DFBResult (*Blit) (
  3163. IDirectFBSurface *thiz,
  3164. IDirectFBSurface *source,
  3165. const DFBRectangle *source_rect,
  3166. int x,
  3167. int y
  3168. );
  3169. /*
  3170. * Blit an area from the source tiled to this surface.
  3171. *
  3172. * Pass a NULL rectangle to use the whole source surface.
  3173. * Source may be the same surface.
  3174. */
  3175. DFBResult (*TileBlit) (
  3176. IDirectFBSurface *thiz,
  3177. IDirectFBSurface *source,
  3178. const DFBRectangle *source_rect,
  3179. int x,
  3180. int y
  3181. );
  3182. /*
  3183. * Blit a bunch of areas at once.
  3184. *
  3185. * Source may be the same surface.
  3186. */
  3187. DFBResult (*BatchBlit) (
  3188. IDirectFBSurface *thiz,
  3189. IDirectFBSurface *source,
  3190. const DFBRectangle *source_rects,
  3191. const DFBPoint *dest_points,
  3192. int num
  3193. );
  3194. /*
  3195. * Blit an area scaled from the source to the destination
  3196. * rectangle.
  3197. *
  3198. * Pass a NULL rectangle to use the whole source surface.
  3199. */
  3200. DFBResult (*StretchBlit) (
  3201. IDirectFBSurface *thiz,
  3202. IDirectFBSurface *source,
  3203. const DFBRectangle *source_rect,
  3204. const DFBRectangle *destination_rect
  3205. );
  3206. /*
  3207. * Preliminary texture mapping support.
  3208. *
  3209. * Maps a <b>texture</b> onto triangles being built
  3210. * from <b>vertices</b> according to the chosen <b>formation</b>.
  3211. *
  3212. * Optional <b>indices</b> can be used to avoid rearrangement of vertex lists,
  3213. * otherwise the vertex list is processed consecutively, i.e. as if <b>indices</b>
  3214. * are ascending numbers starting at zero.
  3215. *
  3216. * Either the number of <b>indices</b> (if non NULL) or the number of <b>vertices</b> is
  3217. * specified by <b>num</b> and has to be three at least. If the chosen <b>formation</b>
  3218. * is DTTF_LIST it also has to be a multiple of three.
  3219. */
  3220. DFBResult (*TextureTriangles) (
  3221. IDirectFBSurface *thiz,
  3222. IDirectFBSurface *texture,
  3223. const DFBVertex *vertices,
  3224. const int *indices,
  3225. int num,
  3226. DFBTriangleFormation formation
  3227. );
  3228. /** Drawing functions **/
  3229. /*
  3230. * Set the flags for all subsequent drawing commands.
  3231. */
  3232. DFBResult (*SetDrawingFlags) (
  3233. IDirectFBSurface *thiz,
  3234. DFBSurfaceDrawingFlags flags
  3235. );
  3236. /*
  3237. * Fill the specified rectangle with the given color
  3238. * following the specified flags.
  3239. */
  3240. DFBResult (*FillRectangle) (
  3241. IDirectFBSurface *thiz,
  3242. int x,
  3243. int y,
  3244. int w,
  3245. int h
  3246. );
  3247. /*
  3248. * Draw an outline of the specified rectangle with the given
  3249. * color following the specified flags.
  3250. */
  3251. DFBResult (*DrawRectangle) (
  3252. IDirectFBSurface *thiz,
  3253. int x,
  3254. int y,
  3255. int w,
  3256. int h
  3257. );
  3258. /*
  3259. * Draw a line from one point to the other with the given color
  3260. * following the drawing flags.
  3261. */
  3262. DFBResult (*DrawLine) (
  3263. IDirectFBSurface *thiz,
  3264. int x1,
  3265. int y1,
  3266. int x2,
  3267. int y2
  3268. );
  3269. /*
  3270. * Draw 'num_lines' lines with the given color following the
  3271. * drawing flags. Each line specified by a DFBRegion.
  3272. */
  3273. DFBResult (*DrawLines) (
  3274. IDirectFBSurface *thiz,
  3275. const DFBRegion *lines,
  3276. unsigned int num_lines
  3277. );
  3278. /*
  3279. * Fill a non-textured triangle.
  3280. */
  3281. DFBResult (*FillTriangle) (
  3282. IDirectFBSurface *thiz,
  3283. int x1,
  3284. int y1,
  3285. int x2,
  3286. int y2,
  3287. int x3,
  3288. int y3
  3289. );
  3290. /*
  3291. * Fill a bunch of rectangles with a single call.
  3292. *
  3293. * Fill <b>num</b> rectangles with the current color following the
  3294. * drawing flags. Each rectangle specified by a DFBRectangle.
  3295. */
  3296. DFBResult (*FillRectangles) (
  3297. IDirectFBSurface *thiz,
  3298. const DFBRectangle *rects,
  3299. unsigned int num
  3300. );
  3301. /*
  3302. * Fill spans specified by x and width.
  3303. *
  3304. * Fill <b>num</b> spans with the given color following the
  3305. * drawing flags. Each span is specified by a DFBSpan.
  3306. */
  3307. DFBResult (*FillSpans) (
  3308. IDirectFBSurface *thiz,
  3309. int y,
  3310. const DFBSpan *spans,
  3311. unsigned int num
  3312. );
  3313. /*
  3314. * Fill a bunch of triangles with a single call.
  3315. *
  3316. * Fill <b>num</b> triangles with the current color following the
  3317. * drawing flags. Each triangle specified by a DFBTriangle.
  3318. */
  3319. DFBResult (*FillTriangles) (
  3320. IDirectFBSurface *thiz,
  3321. const DFBTriangle *tris,
  3322. unsigned int num
  3323. );
  3324. /** Text functions **/
  3325. /*
  3326. * Set the font used by DrawString() and DrawGlyph().
  3327. * You can pass NULL here to unset the font.
  3328. */
  3329. DFBResult (*SetFont) (
  3330. IDirectFBSurface *thiz,
  3331. IDirectFBFont *font
  3332. );
  3333. /*
  3334. * Get the font associated with a surface.
  3335. *
  3336. * This function increases the font's reference count.
  3337. */
  3338. DFBResult (*GetFont) (
  3339. IDirectFBSurface *thiz,
  3340. IDirectFBFont **ret_font
  3341. );
  3342. /*
  3343. * Draw a string at the specified position with the
  3344. * given color following the specified flags.
  3345. *
  3346. * Bytes specifies the number of bytes to take from the
  3347. * string or -1 for the complete NULL-terminated string. You
  3348. * need to set a font using the SetFont() method before
  3349. * calling this function.
  3350. */
  3351. DFBResult (*DrawString) (
  3352. IDirectFBSurface *thiz,
  3353. const char *text,
  3354. int bytes,
  3355. int x,
  3356. int y,
  3357. DFBSurfaceTextFlags flags
  3358. );
  3359. /*
  3360. * Draw a single glyph specified by its character code at the
  3361. * specified position with the given color following the
  3362. * specified flags.
  3363. *
  3364. * If font was loaded with the DFFA_NOCHARMAP flag, index specifies
  3365. * the raw glyph index in the font.
  3366. *
  3367. * You need to set a font using the SetFont() method before
  3368. * calling this function.
  3369. */
  3370. DFBResult (*DrawGlyph) (
  3371. IDirectFBSurface *thiz,
  3372. unsigned int character,
  3373. int x,
  3374. int y,
  3375. DFBSurfaceTextFlags flags
  3376. );
  3377. /*
  3378. * Change the encoding used for text rendering.
  3379. */
  3380. DFBResult (*SetEncoding) (
  3381. IDirectFBSurface *thiz,
  3382. DFBTextEncodingID encoding
  3383. );
  3384. /** Lightweight helpers **/
  3385. /*
  3386. * Get an interface to a sub area of this surface.
  3387. *
  3388. * No image data is duplicated, this is a clipped graphics
  3389. * within the original surface. This is very helpful for
  3390. * lightweight components in a GUI toolkit. The new
  3391. * surface's state (color, drawingflags, etc.) is
  3392. * independent from this one. So it's a handy graphics
  3393. * context. If no rectangle is specified, the whole surface
  3394. * (or a part if this surface is a subsurface itself) is
  3395. * represented by the new one.
  3396. */
  3397. DFBResult (*GetSubSurface) (
  3398. IDirectFBSurface *thiz,
  3399. const DFBRectangle *rect,
  3400. IDirectFBSurface **ret_interface
  3401. );
  3402. /** OpenGL **/
  3403. /*
  3404. * Get a unique OpenGL context for this surface.
  3405. */
  3406. DFBResult (*GetGL) (
  3407. IDirectFBSurface *thiz,
  3408. IDirectFBGL **ret_interface
  3409. );
  3410. /** Debug **/
  3411. /*
  3412. * Dump the contents of the surface to one or two files.
  3413. *
  3414. * Creates a PPM file containing the RGB data and a PGM file with
  3415. * the alpha data if present.
  3416. *
  3417. * The complete filenames will be
  3418. * <b>directory</b>/<b>prefix</b>_<i>####</i>.ppm for RGB and
  3419. * <b>directory</b>/<b>prefix</b>_<i>####</i>.pgm for the alpha channel
  3420. * if present. Example: "/directory/prefix_0000.ppm". No existing files
  3421. * will be overwritten.
  3422. */
  3423. DFBResult (*Dump) (
  3424. IDirectFBSurface *thiz,
  3425. const char *directory,
  3426. const char *prefix
  3427. );
  3428. /*
  3429. * Disable hardware acceleration.
  3430. *
  3431. * If any function in <b>mask</b> is set, acceleration will not be used for it.<br/>
  3432. * Default is DFXL_NONE.
  3433. */
  3434. DFBResult (*DisableAcceleration) (
  3435. IDirectFBSurface *thiz,
  3436. DFBAccelerationMask mask
  3437. );
  3438. /** Resources **/
  3439. /*
  3440. * Release possible reference to source surface.
  3441. *
  3442. * For performance reasons the last surface that has been used for Blit() and others stays
  3443. * attached to the state of the destination surface to save the overhead of reprogramming
  3444. * the same values each time.
  3445. *
  3446. * That leads to the last source being still around regardless of it being released
  3447. * via its own interface. The worst case is generation of thumbnails using StretchBlit()
  3448. * from a huge surface to a small one. The small thumbnail surface keeps the big one alive,
  3449. * because no other blitting will be done to the small surface afterwards.
  3450. *
  3451. * To solve this, here's the method applications should use in such a case.
  3452. */
  3453. DFBResult (*ReleaseSource) (
  3454. IDirectFBSurface *thiz
  3455. );
  3456. /** Blitting control **/
  3457. /*
  3458. * Set index translation table.
  3459. *
  3460. * Set the translation table used for fast indexed to indexed
  3461. * pixel format conversion.
  3462. *
  3463. * A negative index means that the pixel will not be written.
  3464. *
  3465. * Undefined indices will be treated like negative ones.
  3466. */
  3467. DFBResult (*SetIndexTranslation) (
  3468. IDirectFBSurface *thiz,
  3469. const int *indices,
  3470. int num_indices
  3471. );
  3472. /** Rendering **/
  3473. /*
  3474. * Set options affecting the output of drawing and blitting operations.
  3475. *
  3476. * None of these is mandatory and therefore unsupported flags will not
  3477. * cause a software fallback.
  3478. */
  3479. DFBResult (*SetRenderOptions) (
  3480. IDirectFBSurface *thiz,
  3481. DFBSurfaceRenderOptions options
  3482. );
  3483. /** Drawing/blitting control **/
  3484. /*
  3485. * Set the transformation matrix.
  3486. *
  3487. * Enable usage of this matrix by setting DSRO_MATRIX via IDirectFBSurface::SetRenderOptions().
  3488. *
  3489. * The matrix consists of 3x3 fixed point 16.16 values.
  3490. * The order in the array is from left to right and from top to bottom.
  3491. *
  3492. * All drawing and blitting will be transformed:
  3493. *
  3494. * <pre>
  3495. * X' = (X * v0 + Y * v1 + v2) / (X * v6 + Y * v7 + v8)
  3496. * Y' = (X * v3 + Y * v4 + v5) / (X * v6 + Y * v7 + v8)
  3497. * </pre>
  3498. */
  3499. DFBResult (*SetMatrix) (
  3500. IDirectFBSurface *thiz,
  3501. const s32 *matrix
  3502. );
  3503. /*
  3504. * Set the surface to be used as a mask for blitting.
  3505. *
  3506. * The <b>mask</b> applies when DSBLIT_SRC_MASK_ALPHA or DSBLIT_SRC_MASK_COLOR is used.
  3507. *
  3508. * Depending on the <b>flags</b> reading either starts at a fixed location in the mask with
  3509. * absolute <b>x</b> and <b>y</b>, or at the same location as in the source, with <b>x</b>
  3510. * and <b>y</b> used as an offset.
  3511. *
  3512. * <i>Example with DSMF_STENCIL:</i>
  3513. * <pre>
  3514. * Blit from <b>19, 6</b> in the source
  3515. * and <b> 0, 0</b> in the mask (<b>x = 0, y = 0</b>)
  3516. * or <b>-5, 17</b> (<b>x = -5, y = 17</b>)
  3517. * or <b>23, 42</b> (<b>x = 23, y = 42</b>)
  3518. * </pre>
  3519. *
  3520. * <i>Example without:</i>
  3521. * <pre>
  3522. * Blit from <b>19, 6</b> in the source
  3523. * and <b>19, 6</b> in the mask (<b>x = 0, y = 0</b>)
  3524. * or <b>14, 23</b> (<b>x = -5, y = 17</b>)
  3525. * or <b>42, 48</b> (<b>x = 23, y = 42</b>)
  3526. * </pre>
  3527. *
  3528. * See also IDirectFBSurface::SetBlittingFlags().
  3529. */
  3530. DFBResult (*SetSourceMask) (
  3531. IDirectFBSurface *thiz,
  3532. IDirectFBSurface *mask,
  3533. int x,
  3534. int y,
  3535. DFBSurfaceMaskFlags flags
  3536. );
  3537. /** Lightweight helpers **/
  3538. /*
  3539. * Make this a sub surface or adjust the rectangle of this sub surface.
  3540. */
  3541. DFBResult (*MakeSubSurface) (
  3542. IDirectFBSurface *thiz,
  3543. IDirectFBSurface *from,
  3544. const DFBRectangle *rect
  3545. );
  3546. /** Direct Write/Read **/
  3547. /*
  3548. * Write to the surface without the need for (Un)Lock.
  3549. *
  3550. * <b>rect</b> defines the area inside the surface.
  3551. * <br><b>ptr</b> and <b>pitch</b> specify the source.
  3552. * <br>The format of the surface and the source data must be the same.
  3553. */
  3554. DFBResult (*Write) (
  3555. IDirectFBSurface *thiz,
  3556. const DFBRectangle *rect,
  3557. const void *ptr,
  3558. int pitch
  3559. );
  3560. /*
  3561. * Read from the surface without the need for (Un)Lock.
  3562. *
  3563. * <b>rect</b> defines the area inside the surface to be read.
  3564. * <br><b>ptr</b> and <b>pitch</b> specify the destination.
  3565. * <br>The destination data will have the same format as the surface.
  3566. */
  3567. DFBResult (*Read) (
  3568. IDirectFBSurface *thiz,
  3569. const DFBRectangle *rect,
  3570. void *ptr,
  3571. int pitch
  3572. );
  3573. /** Drawing/blitting control **/
  3574. /*
  3575. * Sets color values used for drawing/text functions or
  3576. * alpha/color modulation (blitting functions).
  3577. */
  3578. DFBResult (*SetColors) (
  3579. IDirectFBSurface *thiz,
  3580. const DFBColorID *ids,
  3581. const DFBColor *colors,
  3582. unsigned int num
  3583. );
  3584. /** Blitting functions **/
  3585. /*
  3586. * Blit a bunch of areas at once using secondary source for reading instead of destination.
  3587. *
  3588. * Source may be the same surface.
  3589. */
  3590. DFBResult (*BatchBlit2) (
  3591. IDirectFBSurface *thiz,
  3592. IDirectFBSurface *source,
  3593. IDirectFBSurface *source2,
  3594. const DFBRectangle *source_rects,
  3595. const DFBPoint *dest_points,
  3596. const DFBPoint *source2_points,
  3597. int num
  3598. );
  3599. /** Buffer operations **/
  3600. /*
  3601. * Returns the physical address of a locked surface.
  3602. *
  3603. * The surface must exist in a video memory pool.
  3604. */
  3605. DFBResult (*GetPhysicalAddress) (
  3606. IDirectFBSurface *thiz,
  3607. unsigned long *addr
  3608. );
  3609. /** Drawing functions **/
  3610. /*
  3611. * Fill a bunch of trapezoids with a single call.
  3612. *
  3613. * Fill <b>num</b> trapezoids with the current color following the
  3614. * drawing flags. Each trapezoid specified by a DFBTrapezoid.
  3615. */
  3616. DFBResult (*FillTrapezoids) (
  3617. IDirectFBSurface *thiz,
  3618. const DFBTrapezoid *traps,
  3619. unsigned int num
  3620. );
  3621. )
  3622. /********************
  3623. * IDirectFBPalette *
  3624. ********************/
  3625. /*
  3626. * <i>No summary yet...</i>
  3627. */
  3628. DEFINE_INTERFACE( IDirectFBPalette,
  3629. /** Retrieving information **/
  3630. /*
  3631. * Return the capabilities of this palette.
  3632. */
  3633. DFBResult (*GetCapabilities) (
  3634. IDirectFBPalette *thiz,
  3635. DFBPaletteCapabilities *ret_caps
  3636. );
  3637. /*
  3638. * Get the number of entries in the palette.
  3639. */
  3640. DFBResult (*GetSize) (
  3641. IDirectFBPalette *thiz,
  3642. unsigned int *ret_size
  3643. );
  3644. /** Palette entries **/
  3645. /*
  3646. * Write entries to the palette.
  3647. *
  3648. * Writes the specified number of entries to the palette at the
  3649. * specified offset.
  3650. */
  3651. DFBResult (*SetEntries) (
  3652. IDirectFBPalette *thiz,
  3653. const DFBColor *entries,
  3654. unsigned int num_entries,
  3655. unsigned int offset
  3656. );
  3657. /*
  3658. * Read entries from the palette.
  3659. *
  3660. * Reads the specified number of entries from the palette at the
  3661. * specified offset.
  3662. */
  3663. DFBResult (*GetEntries) (
  3664. IDirectFBPalette *thiz,
  3665. DFBColor *ret_entries,
  3666. unsigned int num_entries,
  3667. unsigned int offset
  3668. );
  3669. /*
  3670. * Find the best matching entry.
  3671. *
  3672. * Searches the map for an entry which best matches the specified color.
  3673. */
  3674. DFBResult (*FindBestMatch) (
  3675. IDirectFBPalette *thiz,
  3676. u8 r,
  3677. u8 g,
  3678. u8 b,
  3679. u8 a,
  3680. unsigned int *ret_index
  3681. );
  3682. /** Clone **/
  3683. /*
  3684. * Create a copy of the palette.
  3685. */
  3686. DFBResult (*CreateCopy) (
  3687. IDirectFBPalette *thiz,
  3688. IDirectFBPalette **ret_interface
  3689. );
  3690. /** YUV Palette **/
  3691. /*
  3692. * Write entries to the palette.
  3693. *
  3694. * Writes the specified number of entries to the palette at the
  3695. * specified offset.
  3696. */
  3697. DFBResult (*SetEntriesYUV) (
  3698. IDirectFBPalette *thiz,
  3699. const DFBColorYUV *entries,
  3700. unsigned int num_entries,
  3701. unsigned int offset
  3702. );
  3703. /*
  3704. * Read entries from the palette.
  3705. *
  3706. * Reads the specified number of entries from the palette at the
  3707. * specified offset.
  3708. */
  3709. DFBResult (*GetEntriesYUV) (
  3710. IDirectFBPalette *thiz,
  3711. DFBColorYUV *ret_entries,
  3712. unsigned int num_entries,
  3713. unsigned int offset
  3714. );
  3715. /*
  3716. * Find the best matching entry.
  3717. *
  3718. * Searches the map for an entry which best matches the specified color.
  3719. */
  3720. DFBResult (*FindBestMatchYUV) (
  3721. IDirectFBPalette *thiz,
  3722. u8 y,
  3723. u8 u,
  3724. u8 v,
  3725. u8 a,
  3726. unsigned int *ret_index
  3727. );
  3728. )
  3729. /*
  3730. * Specifies whether a key is currently down.
  3731. */
  3732. typedef enum {
  3733. DIKS_UP = 0x00000000, /* key is not pressed */
  3734. DIKS_DOWN = 0x00000001 /* key is pressed */
  3735. } DFBInputDeviceKeyState;
  3736. /*
  3737. * Specifies whether a button is currently pressed.
  3738. */
  3739. typedef enum {
  3740. DIBS_UP = 0x00000000, /* button is not pressed */
  3741. DIBS_DOWN = 0x00000001 /* button is pressed */
  3742. } DFBInputDeviceButtonState;
  3743. /*
  3744. * Flags specifying which buttons are currently down.
  3745. */
  3746. typedef enum {
  3747. DIBM_LEFT = 0x00000001, /* left mouse button */
  3748. DIBM_RIGHT = 0x00000002, /* right mouse button */
  3749. DIBM_MIDDLE = 0x00000004 /* middle mouse button */
  3750. } DFBInputDeviceButtonMask;
  3751. /*
  3752. * Flags specifying which modifiers are currently pressed.
  3753. */
  3754. typedef enum {
  3755. DIMM_SHIFT = (1 << DIMKI_SHIFT), /* Shift key is pressed */
  3756. DIMM_CONTROL = (1 << DIMKI_CONTROL), /* Control key is pressed */
  3757. DIMM_ALT = (1 << DIMKI_ALT), /* Alt key is pressed */
  3758. DIMM_ALTGR = (1 << DIMKI_ALTGR), /* AltGr key is pressed */
  3759. DIMM_META = (1 << DIMKI_META), /* Meta key is pressed */
  3760. DIMM_SUPER = (1 << DIMKI_SUPER), /* Super key is pressed */
  3761. DIMM_HYPER = (1 << DIMKI_HYPER) /* Hyper key is pressed */
  3762. } DFBInputDeviceModifierMask;
  3763. /************************
  3764. * IDirectFBInputDevice *
  3765. ************************/
  3766. /*
  3767. * <i>No summary yet...</i>
  3768. */
  3769. DEFINE_INTERFACE( IDirectFBInputDevice,
  3770. /** Retrieving information **/
  3771. /*
  3772. * Get the unique device ID.
  3773. */
  3774. DFBResult (*GetID) (
  3775. IDirectFBInputDevice *thiz,
  3776. DFBInputDeviceID *ret_device_id
  3777. );
  3778. /*
  3779. * Get a description of this device, i.e. the capabilities.
  3780. */
  3781. DFBResult (*GetDescription) (
  3782. IDirectFBInputDevice *thiz,
  3783. DFBInputDeviceDescription *ret_desc
  3784. );
  3785. /** Key mapping **/
  3786. /*
  3787. * Fetch one entry from the keymap for a specific hardware keycode.
  3788. */
  3789. DFBResult (*GetKeymapEntry) (
  3790. IDirectFBInputDevice *thiz,
  3791. int keycode,
  3792. DFBInputDeviceKeymapEntry *ret_entry
  3793. );
  3794. /*
  3795. * Set one entry of the keymap to the specified entry.
  3796. * Each entry has 4 modifier combinations for going from key to symbol.
  3797. */
  3798. DFBResult (*SetKeymapEntry) (
  3799. IDirectFBInputDevice *thiz,
  3800. int keycode,
  3801. DFBInputDeviceKeymapEntry *entry
  3802. );
  3803. /*
  3804. * Load a keymap from the specified file.
  3805. * All specified keys will overwrite the current keymap.
  3806. * On return of an error, the keymap is in an unspecified state.
  3807. * the file must be ASCII containing lines:
  3808. * keycode <hw code> = <key id> = <symbol> .... (up to 4 symbols)
  3809. * Modifier-key-sensitive keys can be framed between
  3810. * capslock: .... :capslock or numlock: ... :numlock.
  3811. */
  3812. DFBResult (*LoadKeymap) (
  3813. IDirectFBInputDevice *thiz,
  3814. char *filename
  3815. );
  3816. /** Event buffers **/
  3817. /*
  3818. * Create an event buffer for this device and attach it.
  3819. */
  3820. DFBResult (*CreateEventBuffer) (
  3821. IDirectFBInputDevice *thiz,
  3822. IDirectFBEventBuffer **ret_buffer
  3823. );
  3824. /*
  3825. * Attach an existing event buffer to this device.
  3826. *
  3827. * NOTE: Attaching multiple times generates multiple events.
  3828. *
  3829. */
  3830. DFBResult (*AttachEventBuffer) (
  3831. IDirectFBInputDevice *thiz,
  3832. IDirectFBEventBuffer *buffer
  3833. );
  3834. /*
  3835. * Detach an event buffer from this device.
  3836. */
  3837. DFBResult (*DetachEventBuffer) (
  3838. IDirectFBInputDevice *thiz,
  3839. IDirectFBEventBuffer *buffer
  3840. );
  3841. /** General state queries **/
  3842. /*
  3843. * Get the current state of one key.
  3844. */
  3845. DFBResult (*GetKeyState) (
  3846. IDirectFBInputDevice *thiz,
  3847. DFBInputDeviceKeyIdentifier key_id,
  3848. DFBInputDeviceKeyState *ret_state
  3849. );
  3850. /*
  3851. * Get the current modifier mask.
  3852. */
  3853. DFBResult (*GetModifiers) (
  3854. IDirectFBInputDevice *thiz,
  3855. DFBInputDeviceModifierMask *ret_modifiers
  3856. );
  3857. /*
  3858. * Get the current state of the key locks.
  3859. */
  3860. DFBResult (*GetLockState) (
  3861. IDirectFBInputDevice *thiz,
  3862. DFBInputDeviceLockState *ret_locks
  3863. );
  3864. /*
  3865. * Get a mask of currently pressed buttons.
  3866. *
  3867. * The first button corrensponds to the right most bit.
  3868. */
  3869. DFBResult (*GetButtons) (
  3870. IDirectFBInputDevice *thiz,
  3871. DFBInputDeviceButtonMask *ret_buttons
  3872. );
  3873. /*
  3874. * Get the state of a button.
  3875. */
  3876. DFBResult (*GetButtonState) (
  3877. IDirectFBInputDevice *thiz,
  3878. DFBInputDeviceButtonIdentifier button,
  3879. DFBInputDeviceButtonState *ret_state
  3880. );
  3881. /*
  3882. * Get the current value of the specified axis.
  3883. */
  3884. DFBResult (*GetAxis) (
  3885. IDirectFBInputDevice *thiz,
  3886. DFBInputDeviceAxisIdentifier axis,
  3887. int *ret_pos
  3888. );
  3889. /** Specialized queries **/
  3890. /*
  3891. * Utility function combining two calls to GetAxis().
  3892. *
  3893. * You may leave one of the x/y arguments NULL.
  3894. */
  3895. DFBResult (*GetXY) (
  3896. IDirectFBInputDevice *thiz,
  3897. int *ret_x,
  3898. int *ret_y
  3899. );
  3900. )
  3901. /*
  3902. * Event class.
  3903. */
  3904. typedef enum {
  3905. DFEC_NONE = 0x00, /* none of these */
  3906. DFEC_INPUT = 0x01, /* raw input event */
  3907. DFEC_WINDOW = 0x02, /* windowing event */
  3908. DFEC_USER = 0x03, /* custom event for the user of this library */
  3909. DFEC_UNIVERSAL = 0x04, /* universal event for custom usage with variable size */
  3910. DFEC_VIDEOPROVIDER = 0x05 /* video provider event */
  3911. } DFBEventClass;
  3912. /*
  3913. * The type of an input event.
  3914. */
  3915. typedef enum {
  3916. DIET_UNKNOWN = 0, /* unknown event */
  3917. DIET_KEYPRESS, /* a key is been pressed */
  3918. DIET_KEYRELEASE, /* a key is been released */
  3919. DIET_BUTTONPRESS, /* a (mouse) button is been pressed */
  3920. DIET_BUTTONRELEASE, /* a (mouse) button is been released */
  3921. DIET_AXISMOTION /* mouse/joystick movement */
  3922. } DFBInputEventType;
  3923. /*
  3924. * Flags defining which additional (optional) event fields are valid.
  3925. */
  3926. typedef enum {
  3927. DIEF_NONE = 0x0000, /* no additional fields */
  3928. DIEF_TIMESTAMP = 0x0001, /* timestamp is valid */
  3929. DIEF_AXISABS = 0x0002, /* axis and axisabs are valid */
  3930. DIEF_AXISREL = 0x0004, /* axis and axisrel are valid */
  3931. DIEF_KEYCODE = 0x0008, /* used internally by the input core,
  3932. always set at application level */
  3933. DIEF_KEYID = 0x0010, /* used internally by the input core,
  3934. always set at application level */
  3935. DIEF_KEYSYMBOL = 0x0020, /* used internally by the input core,
  3936. always set at application level */
  3937. DIEF_MODIFIERS = 0x0040, /* used internally by the input core,
  3938. always set at application level */
  3939. DIEF_LOCKS = 0x0080, /* used internally by the input core,
  3940. always set at application level */
  3941. DIEF_BUTTONS = 0x0100, /* used internally by the input core,
  3942. always set at application level */
  3943. DIEF_GLOBAL = 0x0200, /* Only for event buffers creates by
  3944. IDirectFB::CreateInputEventBuffer()
  3945. with global events enabled.
  3946. Indicates that the event would have been
  3947. filtered if the buffer hadn't been
  3948. global. */
  3949. DIEF_REPEAT = 0x0400, /* repeated event, e.g. key or button press */
  3950. DIEF_FOLLOW = 0x0800, /* another event will follow immediately, e.g. x/y axis */
  3951. DIEF_MIN = 0x1000, /* minimum value is set, e.g. for absolute axis motion */
  3952. DIEF_MAX = 0x2000, /* maximum value is set, e.g. for absolute axis motion */
  3953. } DFBInputEventFlags;
  3954. /*
  3955. * An input event, item of an input buffer.
  3956. */
  3957. typedef struct {
  3958. DFBEventClass clazz; /* clazz of event */
  3959. DFBInputEventType type; /* type of event */
  3960. DFBInputDeviceID device_id; /* source of event */
  3961. DFBInputEventFlags flags; /* which optional fields
  3962. are valid? */
  3963. /* additionally (check flags) */
  3964. struct timeval timestamp; /* time of event creation */
  3965. /* DIET_KEYPRESS, DIET_KEYRELEASE */
  3966. int key_code; /* hardware keycode, no
  3967. mapping, -1 if device
  3968. doesn't differentiate
  3969. between several keys */
  3970. DFBInputDeviceKeyIdentifier key_id; /* basic mapping,
  3971. modifier independent */
  3972. DFBInputDeviceKeySymbol key_symbol; /* advanced mapping,
  3973. unicode compatible,
  3974. modifier dependent */
  3975. /* additionally (check flags) */
  3976. DFBInputDeviceModifierMask modifiers; /* pressed modifiers
  3977. (optional) */
  3978. DFBInputDeviceLockState locks; /* active locks
  3979. (optional) */
  3980. /* DIET_BUTTONPRESS, DIET_BUTTONRELEASE */
  3981. DFBInputDeviceButtonIdentifier button; /* in case of a button
  3982. event */
  3983. DFBInputDeviceButtonMask buttons; /* mask of currently
  3984. pressed buttons */
  3985. /* DIET_AXISMOTION */
  3986. DFBInputDeviceAxisIdentifier axis; /* in case of an axis
  3987. event */
  3988. /* one of these two (check flags) */
  3989. int axisabs; /* absolute mouse/
  3990. joystick coordinate */
  3991. int axisrel; /* relative mouse/
  3992. joystick movement */
  3993. /* general information */
  3994. int min; /* minimum possible value */
  3995. int max; /* maximum possible value */
  3996. } DFBInputEvent;
  3997. /*
  3998. * Window Event Types - can also be used as flags for event filters.
  3999. */
  4000. typedef enum {
  4001. DWET_NONE = 0x00000000,
  4002. DWET_POSITION = 0x00000001, /* window has been moved by
  4003. window manager or the
  4004. application itself */
  4005. DWET_SIZE = 0x00000002, /* window has been resized
  4006. by window manager or the
  4007. application itself */
  4008. DWET_CLOSE = 0x00000004, /* closing this window has been
  4009. requested only */
  4010. DWET_DESTROYED = 0x00000008, /* window got destroyed by global
  4011. deinitialization function or
  4012. the application itself */
  4013. DWET_GOTFOCUS = 0x00000010, /* window got focus */
  4014. DWET_LOSTFOCUS = 0x00000020, /* window lost focus */
  4015. DWET_KEYDOWN = 0x00000100, /* a key has gone down while
  4016. window has focus */
  4017. DWET_KEYUP = 0x00000200, /* a key has gone up while
  4018. window has focus */
  4019. DWET_BUTTONDOWN = 0x00010000, /* mouse button went down in
  4020. the window */
  4021. DWET_BUTTONUP = 0x00020000, /* mouse button went up in
  4022. the window */
  4023. DWET_MOTION = 0x00040000, /* mouse cursor changed its
  4024. position in window */
  4025. DWET_ENTER = 0x00080000, /* mouse cursor entered
  4026. the window */
  4027. DWET_LEAVE = 0x00100000, /* mouse cursor left the window */
  4028. DWET_WHEEL = 0x00200000, /* mouse wheel was moved while
  4029. window has focus */
  4030. DWET_POSITION_SIZE = DWET_POSITION | DWET_SIZE,/* initially sent to
  4031. window when it's
  4032. created */
  4033. DWET_UPDATE = 0x01000000,
  4034. DWET_ALL = 0x013F033F /* all event types */
  4035. } DFBWindowEventType;
  4036. /*
  4037. * Flags for a window event.
  4038. */
  4039. typedef enum {
  4040. DWEF_NONE = 0x00000000, /* none of these */
  4041. DWEF_RETURNED = 0x00000001, /* This is a returned event, e.g. unconsumed key. */
  4042. DWEF_RELATIVE = 0x00000002, /* This is a relative motion event (using DWCF_RELATIVE) */
  4043. DWEF_REPEAT = 0x00000010, /* repeat event, e.g. repeating key */
  4044. DWEF_ALL = 0x00000013 /* all of these */
  4045. } DFBWindowEventFlags;
  4046. /*
  4047. * Video Provider Event Types - can also be used as flags for event filters.
  4048. */
  4049. typedef enum {
  4050. DVPET_NONE = 0x00000000,
  4051. DVPET_STARTED = 0x00000001, /* The video provider has started the playback */
  4052. DVPET_STOPPED = 0x00000002, /* The video provider has stopped the playback */
  4053. DVPET_SPEEDCHANGE = 0x00000004, /* A speed change has occured */
  4054. DVPET_STREAMCHANGE = 0x00000008, /* A stream description change has occured */
  4055. DVPET_FATALERROR = 0x00000010, /* A fatal error has occured: restart must be done */
  4056. DVPET_FINISHED = 0x00000020, /* The video provider has finished the playback */
  4057. DVPET_SURFACECHANGE = 0x00000040, /* A surface description change has occured */
  4058. DVPET_FRAMEDECODED = 0x00000080, /* A frame has been decoded by the decoder */
  4059. DVPET_FRAMEDISPLAYED = 0x00000100, /* A frame has been rendered to the output */
  4060. DVPET_DATAEXHAUSTED = 0x00000200, /* There is no more data available for consumption */
  4061. DVPET_VIDEOACTION = 0x00000400, /* An action is required on the video provider */
  4062. DVPET_DATALOW = 0x00000800, /* The stream buffer is running low in data (threshold defined by implementation). */
  4063. DVPET_DATAHIGH = 0x00001000, /* The stream buffer is high. */
  4064. DVPET_BUFFERTIMELOW = 0x00002000, /* The stream buffer has less than requested playout time buffered. */
  4065. DVPET_BUFFERTIMEHIGH = 0x00004000, /* The stream buffer has more than requested playout time buffered. */
  4066. DVPET_ALL = 0x00007FFF /* All event types */
  4067. } DFBVideoProviderEventType;
  4068. /*
  4069. * Event from the windowing system.
  4070. */
  4071. typedef struct {
  4072. DFBEventClass clazz; /* clazz of event */
  4073. DFBWindowEventType type; /* type of event */
  4074. /* used by DWET_KEYDOWN, DWET_KEYUP */
  4075. DFBWindowEventFlags flags; /* event flags */
  4076. DFBWindowID window_id; /* source of event */
  4077. /* used by DWET_MOVE, DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP,
  4078. DWET_ENTER, DWET_LEAVE */
  4079. int x; /* x position of window
  4080. or coordinate within
  4081. window */
  4082. int y; /* y position of window
  4083. or coordinate within
  4084. window */
  4085. /* used by DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP,
  4086. DWET_ENTER, DWET_LEAVE */
  4087. int cx; /* x cursor position */
  4088. int cy; /* y cursor position */
  4089. /* used by DWET_WHEEL */
  4090. int step; /* wheel step */
  4091. /* used by DWET_RESIZE */
  4092. int w; /* width of window */
  4093. int h; /* height of window */
  4094. /* used by DWET_KEYDOWN, DWET_KEYUP */
  4095. int key_code; /* hardware keycode, no
  4096. mapping, -1 if device
  4097. doesn't differentiate
  4098. between several keys */
  4099. DFBInputDeviceKeyIdentifier key_id; /* basic mapping,
  4100. modifier independent */
  4101. DFBInputDeviceKeySymbol key_symbol; /* advanced mapping,
  4102. unicode compatible,
  4103. modifier dependent */
  4104. DFBInputDeviceModifierMask modifiers; /* pressed modifiers */
  4105. DFBInputDeviceLockState locks; /* active locks */
  4106. /* used by DWET_BUTTONDOWN, DWET_BUTTONUP */
  4107. DFBInputDeviceButtonIdentifier button; /* button being
  4108. pressed or released */
  4109. /* used by DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP */
  4110. DFBInputDeviceButtonMask buttons; /* mask of currently
  4111. pressed buttons */
  4112. struct timeval timestamp; /* always set */
  4113. } DFBWindowEvent;
  4114. /*
  4115. * Video Provider Event Types - can also be used as flags for event filters.
  4116. */
  4117. typedef enum {
  4118. DVPEDST_UNKNOWN = 0x00000000, /* Event is valid for unknown Data */
  4119. DVPEDST_AUDIO = 0x00000001, /* Event is valid for Audio Data */
  4120. DVPEDST_VIDEO = 0x00000002, /* Event is valid for Video Data */
  4121. DVPEDST_DATA = 0x00000004, /* Event is valid for Data types */
  4122. DVPEDST_ALL = 0x00000007, /* Event is valid for all Data types */
  4123. } DFBVideoProviderEventDataSubType;
  4124. /*
  4125. * Event from the video provider
  4126. */
  4127. typedef struct {
  4128. DFBEventClass clazz; /* clazz of event */
  4129. DFBVideoProviderEventType type; /* type of event */
  4130. DFBVideoProviderEventDataSubType data_type; /* data type that this event is applicable for. */
  4131. int data[4]; /* custom data - large enough for 4 ints so that in most cases
  4132. memory allocation will not be needed */
  4133. } DFBVideoProviderEvent;
  4134. /*
  4135. * Event for usage by the user of this library.
  4136. */
  4137. typedef struct {
  4138. DFBEventClass clazz; /* clazz of event */
  4139. unsigned int type; /* custom type */
  4140. void *data; /* custom data */
  4141. } DFBUserEvent;
  4142. /*
  4143. * Universal event for custom usage with variable size.
  4144. */
  4145. typedef struct {
  4146. DFBEventClass clazz; /* clazz of event (DFEC_UNIVERSAL) */
  4147. unsigned int size; /* size of this event, minimum is sizeof(DFBUniversalEvent),
  4148. e.g. 8 bytes (on 32bit architectures) */
  4149. /* custom data follows, size of this data is 'size' - sizeof(DFBUniversalEvent) */
  4150. } DFBUniversalEvent;
  4151. /*
  4152. * General container for a DirectFB Event.
  4153. */
  4154. typedef union {
  4155. DFBEventClass clazz; /* clazz of event */
  4156. DFBInputEvent input; /* field for input events */
  4157. DFBWindowEvent window; /* field for window events */
  4158. DFBUserEvent user; /* field for user-defined events */
  4159. DFBUniversalEvent universal; /* field for universal events */
  4160. DFBVideoProviderEvent videoprovider; /* field for video provider */
  4161. } DFBEvent;
  4162. #define DFB_EVENT(e) ((DFBEvent *) (e))
  4163. /*
  4164. * Statistics about event buffer queue.
  4165. */
  4166. typedef struct {
  4167. unsigned int num_events; /* Total number of events in the queue. */
  4168. unsigned int DFEC_INPUT; /* Number of input events. */
  4169. unsigned int DFEC_WINDOW; /* Number of window events. */
  4170. unsigned int DFEC_USER; /* Number of user events. */
  4171. unsigned int DFEC_UNIVERSAL; /* Number of universal events. */
  4172. unsigned int DFEC_VIDEOPROVIDER; /* Number of universal events. */
  4173. unsigned int DIET_KEYPRESS;
  4174. unsigned int DIET_KEYRELEASE;
  4175. unsigned int DIET_BUTTONPRESS;
  4176. unsigned int DIET_BUTTONRELEASE;
  4177. unsigned int DIET_AXISMOTION;
  4178. unsigned int DWET_POSITION;
  4179. unsigned int DWET_SIZE;
  4180. unsigned int DWET_CLOSE;
  4181. unsigned int DWET_DESTROYED;
  4182. unsigned int DWET_GOTFOCUS;
  4183. unsigned int DWET_LOSTFOCUS;
  4184. unsigned int DWET_KEYDOWN;
  4185. unsigned int DWET_KEYUP;
  4186. unsigned int DWET_BUTTONDOWN;
  4187. unsigned int DWET_BUTTONUP;
  4188. unsigned int DWET_MOTION;
  4189. unsigned int DWET_ENTER;
  4190. unsigned int DWET_LEAVE;
  4191. unsigned int DWET_WHEEL;
  4192. unsigned int DWET_POSITION_SIZE;
  4193. unsigned int DVPET_STARTED;
  4194. unsigned int DVPET_STOPPED;
  4195. unsigned int DVPET_SPEEDCHANGE;
  4196. unsigned int DVPET_STREAMCHANGE;
  4197. unsigned int DVPET_FATALERROR;
  4198. unsigned int DVPET_FINISHED;
  4199. unsigned int DVPET_SURFACECHANGE;
  4200. unsigned int DVPET_FRAMEDECODED;
  4201. unsigned int DVPET_FRAMEDISPLAYED;
  4202. unsigned int DVPET_DATAEXHAUSTED;
  4203. unsigned int DVPET_DATALOW;
  4204. unsigned int DVPET_VIDEOACTION;
  4205. unsigned int DVPET_DATAHIGH;
  4206. unsigned int DVPET_BUFFERTIMELOW;
  4207. unsigned int DVPET_BUFFERTIMEHIGH;
  4208. } DFBEventBufferStats;
  4209. /************************
  4210. * IDirectFBEventBuffer *
  4211. ************************/
  4212. /*
  4213. * <i>No summary yet...</i>
  4214. */
  4215. DEFINE_INTERFACE( IDirectFBEventBuffer,
  4216. /** Buffer handling **/
  4217. /*
  4218. * Clear all events stored in this buffer.
  4219. */
  4220. DFBResult (*Reset) (
  4221. IDirectFBEventBuffer *thiz
  4222. );
  4223. /** Waiting for events **/
  4224. /*
  4225. * Wait for the next event to occur.
  4226. * Thread is idle in the meantime.
  4227. */
  4228. DFBResult (*WaitForEvent) (
  4229. IDirectFBEventBuffer *thiz
  4230. );
  4231. /*
  4232. * Block until next event to occur or timeout is reached.
  4233. * Thread is idle in the meantime.
  4234. */
  4235. DFBResult (*WaitForEventWithTimeout) (
  4236. IDirectFBEventBuffer *thiz,
  4237. unsigned int seconds,
  4238. unsigned int milli_seconds
  4239. );
  4240. /** Fetching events **/
  4241. /*
  4242. * Get the next event and remove it from the FIFO.
  4243. */
  4244. DFBResult (*GetEvent) (
  4245. IDirectFBEventBuffer *thiz,
  4246. DFBEvent *ret_event
  4247. );
  4248. /*
  4249. * Get the next event but leave it there, i.e. do a preview.
  4250. */
  4251. DFBResult (*PeekEvent) (
  4252. IDirectFBEventBuffer *thiz,
  4253. DFBEvent *ret_event
  4254. );
  4255. /*
  4256. * Check if there is a pending event in the queue. This
  4257. * function returns DFB_OK if there is at least one event,
  4258. * DFB_BUFFER_EMPTY otherwise.
  4259. */
  4260. DFBResult (*HasEvent) (
  4261. IDirectFBEventBuffer *thiz
  4262. );
  4263. /** Sending events **/
  4264. /*
  4265. * Put an event into the FIFO.
  4266. *
  4267. * This function does not wait until the event got fetched.
  4268. */
  4269. DFBResult (*PostEvent) (
  4270. IDirectFBEventBuffer *thiz,
  4271. const DFBEvent *event
  4272. );
  4273. /*
  4274. * Wake up any thread waiting for events in this buffer.
  4275. *
  4276. * This method causes any IDirectFBEventBuffer::WaitForEvent() or
  4277. * IDirectFBEventBuffer::WaitForEventWithTimeout() call to return with DFB_INTERRUPTED.
  4278. *
  4279. * It should be used rather than sending wake up messages which
  4280. * may pollute the queue and consume lots of CPU and memory compared to
  4281. * this 'single code line method'.
  4282. */
  4283. DFBResult (*WakeUp) (
  4284. IDirectFBEventBuffer *thiz
  4285. );
  4286. /** Special handling **/
  4287. /*
  4288. * Create a file descriptor for reading events.
  4289. *
  4290. * This method provides an alternative for reading events from an event buffer.
  4291. * It creates a file descriptor which can be used in select(), poll() or read().
  4292. *
  4293. * In general only non-threaded applications which already use select() or poll() need it.
  4294. *
  4295. * <b>Note:</b> This method flushes the event buffer. After calling this method all other
  4296. * methods except IDirectFBEventBuffer::PostEvent() will return DFB_UNSUPPORTED.
  4297. * Calling this method again will return DFB_BUSY.
  4298. */
  4299. DFBResult (*CreateFileDescriptor) (
  4300. IDirectFBEventBuffer *thiz,
  4301. int *ret_fd
  4302. );
  4303. /** Statistics **/
  4304. /*
  4305. * Enable/disable collection of event buffer statistics.
  4306. */
  4307. DFBResult (*EnableStatistics) (
  4308. IDirectFBEventBuffer *thiz,
  4309. DFBBoolean enable
  4310. );
  4311. /*
  4312. * Query collected event buffer statistics.
  4313. */
  4314. DFBResult (*GetStatistics) (
  4315. IDirectFBEventBuffer *thiz,
  4316. DFBEventBufferStats *ret_stats
  4317. );
  4318. )
  4319. /*
  4320. * The key selection defines a mode for filtering keys while the window is having the focus.
  4321. */
  4322. typedef enum {
  4323. DWKS_ALL = 0x00000000, /* Select all keys (default). */
  4324. DWKS_NONE = 0x00000001, /* Don't select any key. */
  4325. DWKS_LIST = 0x00000002 /* Select a list of keys. */
  4326. } DFBWindowKeySelection;
  4327. typedef enum {
  4328. DWGM_DEFAULT = 0x00000000, /* Use default values. */
  4329. DWGM_FOLLOW = 0x00000001, /* Use values of parent window. */
  4330. DWGM_RECTANGLE = 0x00000002, /* Use pixel values as defined. */
  4331. DWGM_LOCATION = 0x00000003 /* Use relative values as defined. */
  4332. } DFBWindowGeometryMode;
  4333. typedef struct {
  4334. DFBWindowGeometryMode mode;
  4335. DFBRectangle rectangle;
  4336. DFBLocation location;
  4337. } DFBWindowGeometry;
  4338. typedef enum {
  4339. DWCF_NONE = 0x00000000,
  4340. DWCF_RELATIVE = 0x00000001,
  4341. DWCF_EXPLICIT = 0x00000002,
  4342. DWCF_UNCLIPPED = 0x00000004,
  4343. DWCF_TRAPPED = 0x00000008,
  4344. DWCF_FIXED = 0x00000010,
  4345. DWCF_INVISIBLE = 0x00000020,
  4346. DWCF_ALL = 0x0000003F
  4347. } DFBWindowCursorFlags;
  4348. /*******************
  4349. * IDirectFBWindow *
  4350. *******************/
  4351. /*
  4352. * <i>No summary yet...</i>
  4353. */
  4354. DEFINE_INTERFACE( IDirectFBWindow,
  4355. /** Retrieving information **/
  4356. /*
  4357. * Get the unique window ID.
  4358. */
  4359. DFBResult (*GetID) (
  4360. IDirectFBWindow *thiz,
  4361. DFBWindowID *ret_window_id
  4362. );
  4363. /*
  4364. * Get the current position of this window.
  4365. */
  4366. DFBResult (*GetPosition) (
  4367. IDirectFBWindow *thiz,
  4368. int *ret_x,
  4369. int *ret_y
  4370. );
  4371. /*
  4372. * Get the size of the window in pixels.
  4373. */
  4374. DFBResult (*GetSize) (
  4375. IDirectFBWindow *thiz,
  4376. int *ret_width,
  4377. int *ret_height
  4378. );
  4379. /** Close & Destroy **/
  4380. /*
  4381. * Send a close message to the window.
  4382. *
  4383. * This function sends a message of type DWET_CLOSE to the window.
  4384. * It does NOT actually close it.
  4385. */
  4386. DFBResult (*Close) (
  4387. IDirectFBWindow *thiz
  4388. );
  4389. /*
  4390. * Destroys the window and sends a destruction message.
  4391. *
  4392. * This function sends a message of type DWET_DESTROY to
  4393. * the window after removing it from the window stack and
  4394. * freeing its data. Some functions called from this
  4395. * interface will return DFB_DESTROYED after that.
  4396. */
  4397. DFBResult (*Destroy) (
  4398. IDirectFBWindow *thiz
  4399. );
  4400. /** Surface & Scaling **/
  4401. /*
  4402. * Get an interface to the backing store surface.
  4403. *
  4404. * This surface has to be flipped to make previous drawing
  4405. * commands visible, i.e. to repaint the windowstack for
  4406. * that region.
  4407. */
  4408. DFBResult (*GetSurface) (
  4409. IDirectFBWindow *thiz,
  4410. IDirectFBSurface **ret_surface
  4411. );
  4412. /*
  4413. * Resize the surface of a scalable window.
  4414. *
  4415. * This requires the option DWOP_SCALE.
  4416. * See IDirectFBWindow::SetOptions().
  4417. */
  4418. DFBResult (*ResizeSurface) (
  4419. IDirectFBWindow *thiz,
  4420. int width,
  4421. int height
  4422. );
  4423. /** Events **/
  4424. /*
  4425. * Create an event buffer for this window and attach it.
  4426. */
  4427. DFBResult (*CreateEventBuffer) (
  4428. IDirectFBWindow *thiz,
  4429. IDirectFBEventBuffer **ret_buffer
  4430. );
  4431. /*
  4432. * Attach an existing event buffer to this window.
  4433. *
  4434. * NOTE: Attaching multiple times generates multiple events.
  4435. *
  4436. */
  4437. DFBResult (*AttachEventBuffer) (
  4438. IDirectFBWindow *thiz,
  4439. IDirectFBEventBuffer *buffer
  4440. );
  4441. /*
  4442. * Detach an event buffer from this window.
  4443. */
  4444. DFBResult (*DetachEventBuffer) (
  4445. IDirectFBWindow *thiz,
  4446. IDirectFBEventBuffer *buffer
  4447. );
  4448. /*
  4449. * Enable specific events to be sent to the window.
  4450. *
  4451. * The argument is a mask of events that will be set in the
  4452. * window's event mask. The default event mask is DWET_ALL.
  4453. */
  4454. DFBResult (*EnableEvents) (
  4455. IDirectFBWindow *thiz,
  4456. DFBWindowEventType mask
  4457. );
  4458. /*
  4459. * Disable specific events from being sent to the window.
  4460. *
  4461. * The argument is a mask of events that will be cleared in
  4462. * the window's event mask. The default event mask is DWET_ALL.
  4463. */
  4464. DFBResult (*DisableEvents) (
  4465. IDirectFBWindow *thiz,
  4466. DFBWindowEventType mask
  4467. );
  4468. /** Options **/
  4469. /*
  4470. * Set options controlling appearance and behaviour of the window.
  4471. */
  4472. DFBResult (*SetOptions) (
  4473. IDirectFBWindow *thiz,
  4474. DFBWindowOptions options
  4475. );
  4476. /*
  4477. * Get options controlling appearance and behaviour of the window.
  4478. */
  4479. DFBResult (*GetOptions) (
  4480. IDirectFBWindow *thiz,
  4481. DFBWindowOptions *ret_options
  4482. );
  4483. /*
  4484. * Set the window color, or colorises the window.
  4485. *
  4486. * In case you specified DWCAPS_COLOR, this sets the window draw color.
  4487. * In case you didn't, it colorises the window with this color; this will darken the window.
  4488. * no DWCAPS_COLOR and an opacity of 0 means: no effect.
  4489. */
  4490. DFBResult (*SetColor) (
  4491. IDirectFBWindow *thiz,
  4492. u8 r,
  4493. u8 g,
  4494. u8 b,
  4495. u8 a
  4496. );
  4497. /*
  4498. * Set the window color key.
  4499. *
  4500. * If a pixel of the window matches this color the
  4501. * underlying window or the background is visible at this
  4502. * point.
  4503. */
  4504. DFBResult (*SetColorKey) (
  4505. IDirectFBWindow *thiz,
  4506. u8 r,
  4507. u8 g,
  4508. u8 b
  4509. );
  4510. /*
  4511. * Set the window color key (indexed).
  4512. *
  4513. * If a pixel (indexed format) of the window matches this
  4514. * color index the underlying window or the background is
  4515. * visible at this point.
  4516. */
  4517. DFBResult (*SetColorKeyIndex) (
  4518. IDirectFBWindow *thiz,
  4519. unsigned int index
  4520. );
  4521. /*
  4522. * Set the window's global opacity factor.
  4523. *
  4524. * Set it to "0" to hide a window.
  4525. * Setting it to "0xFF" makes the window opaque if
  4526. * it has no alpha channel.
  4527. */
  4528. DFBResult (*SetOpacity) (
  4529. IDirectFBWindow *thiz,
  4530. u8 opacity
  4531. );
  4532. /*
  4533. * Disable alpha channel blending for one region of the window.
  4534. *
  4535. * If DWOP_ALPHACHANNEL and DWOP_OPAQUE_REGION are set but not DWOP_COLORKEYING
  4536. * and the opacity of the window is 255 the window gets rendered
  4537. * without alpha blending within the specified region.
  4538. *
  4539. * This is extremely useful for alpha blended window decorations while
  4540. * the main content stays opaque and gets rendered faster.
  4541. */
  4542. DFBResult (*SetOpaqueRegion) (
  4543. IDirectFBWindow *thiz,
  4544. int x1,
  4545. int y1,
  4546. int x2,
  4547. int y2
  4548. );
  4549. /*
  4550. * Get the current opacity factor of this window.
  4551. */
  4552. DFBResult (*GetOpacity) (
  4553. IDirectFBWindow *thiz,
  4554. u8 *ret_opacity
  4555. );
  4556. /*
  4557. * Bind a cursor shape to this window.
  4558. *
  4559. * This method will set a per-window cursor shape. Everytime
  4560. * the cursor enters this window, the specified shape is set.
  4561. *
  4562. * Passing NULL will unbind a set shape and release its surface.
  4563. */
  4564. DFBResult (*SetCursorShape) (
  4565. IDirectFBWindow *thiz,
  4566. IDirectFBSurface *shape,
  4567. int hot_x,
  4568. int hot_y
  4569. );
  4570. /** Position and Size **/
  4571. /*
  4572. * Move the window by the specified distance.
  4573. */
  4574. DFBResult (*Move) (
  4575. IDirectFBWindow *thiz,
  4576. int dx,
  4577. int dy
  4578. );
  4579. /*
  4580. * Move the window to the specified coordinates.
  4581. */
  4582. DFBResult (*MoveTo) (
  4583. IDirectFBWindow *thiz,
  4584. int x,
  4585. int y
  4586. );
  4587. /*
  4588. * Resize the window.
  4589. */
  4590. DFBResult (*Resize) (
  4591. IDirectFBWindow *thiz,
  4592. int width,
  4593. int height
  4594. );
  4595. /*
  4596. * Set position and size in one step.
  4597. */
  4598. DFBResult (*SetBounds) (
  4599. IDirectFBWindow *thiz,
  4600. int x,
  4601. int y,
  4602. int width,
  4603. int height
  4604. );
  4605. /** Stacking **/
  4606. /*
  4607. * Put the window into a specific stacking class.
  4608. */
  4609. DFBResult (*SetStackingClass) (
  4610. IDirectFBWindow *thiz,
  4611. DFBWindowStackingClass stacking_class
  4612. );
  4613. /*
  4614. * Raise the window by one within the window stack.
  4615. */
  4616. DFBResult (*Raise) (
  4617. IDirectFBWindow *thiz
  4618. );
  4619. /*
  4620. * Lower the window by one within the window stack.
  4621. */
  4622. DFBResult (*Lower) (
  4623. IDirectFBWindow *thiz
  4624. );
  4625. /*
  4626. * Put the window on the top of the window stack.
  4627. */
  4628. DFBResult (*RaiseToTop) (
  4629. IDirectFBWindow *thiz
  4630. );
  4631. /*
  4632. * Send a window to the bottom of the window stack.
  4633. */
  4634. DFBResult (*LowerToBottom) (
  4635. IDirectFBWindow *thiz
  4636. );
  4637. /*
  4638. * Put a window on top of another window.
  4639. */
  4640. DFBResult (*PutAtop) (
  4641. IDirectFBWindow *thiz,
  4642. IDirectFBWindow *lower
  4643. );
  4644. /*
  4645. * Put a window below another window.
  4646. */
  4647. DFBResult (*PutBelow) (
  4648. IDirectFBWindow *thiz,
  4649. IDirectFBWindow *upper
  4650. );
  4651. /** Binding **/
  4652. /*
  4653. * Bind a window at the specified position of this window.
  4654. *
  4655. * After binding, bound window will be automatically moved
  4656. * when this window moves to a new position.<br>
  4657. * Binding the same window to multiple windows is not supported.
  4658. * Subsequent call to Bind() automatically unbounds the bound window
  4659. * before binding it again.<br>
  4660. * To move the bound window to a new position call Bind() again
  4661. * with the new coordinates.
  4662. */
  4663. DFBResult (*Bind) (
  4664. IDirectFBWindow *thiz,
  4665. IDirectFBWindow *window,
  4666. int x,
  4667. int y
  4668. );
  4669. /*
  4670. * Unbind a window from this window.
  4671. */
  4672. DFBResult (*Unbind) (
  4673. IDirectFBWindow *thiz,
  4674. IDirectFBWindow *window
  4675. );
  4676. /** Focus handling **/
  4677. /*
  4678. * Pass the focus to this window.
  4679. */
  4680. DFBResult (*RequestFocus) (
  4681. IDirectFBWindow *thiz
  4682. );
  4683. /*
  4684. * Grab the keyboard, i.e. all following keyboard events are
  4685. * sent to this window ignoring the focus.
  4686. */
  4687. DFBResult (*GrabKeyboard) (
  4688. IDirectFBWindow *thiz
  4689. );
  4690. /*
  4691. * Ungrab the keyboard, i.e. switch to standard key event
  4692. * dispatching.
  4693. */
  4694. DFBResult (*UngrabKeyboard) (
  4695. IDirectFBWindow *thiz
  4696. );
  4697. /*
  4698. * Grab the pointer, i.e. all following mouse events are
  4699. * sent to this window ignoring the focus.
  4700. */
  4701. DFBResult (*GrabPointer) (
  4702. IDirectFBWindow *thiz
  4703. );
  4704. /*
  4705. * Ungrab the pointer, i.e. switch to standard mouse event
  4706. * dispatching.
  4707. */
  4708. DFBResult (*UngrabPointer) (
  4709. IDirectFBWindow *thiz
  4710. );
  4711. /*
  4712. * Grab a specific key, i.e. all following events of this key are
  4713. * sent to this window ignoring the focus.
  4714. */
  4715. DFBResult (*GrabKey) (
  4716. IDirectFBWindow *thiz,
  4717. DFBInputDeviceKeySymbol symbol,
  4718. DFBInputDeviceModifierMask modifiers
  4719. );
  4720. /*
  4721. * Ungrab a specific key, i.e. switch to standard key event
  4722. * dispatching.
  4723. */
  4724. DFBResult (*UngrabKey) (
  4725. IDirectFBWindow *thiz,
  4726. DFBInputDeviceKeySymbol symbol,
  4727. DFBInputDeviceModifierMask modifiers
  4728. );
  4729. /** Key selection **/
  4730. /*
  4731. * Selects a mode for filtering keys while being focused.
  4732. *
  4733. * The <b>selection</b> defines whether all, none or a specific set (list) of keys is selected.
  4734. * In case of a specific set, the <b>keys</b> array with <b>num_keys</b> has to be provided.
  4735. *
  4736. * Multiple calls to this method are possible. Each overrides all settings from the previous call.
  4737. */
  4738. DFBResult (*SetKeySelection) (
  4739. IDirectFBWindow *thiz,
  4740. DFBWindowKeySelection selection,
  4741. const DFBInputDeviceKeySymbol *keys,
  4742. unsigned int num_keys
  4743. );
  4744. /*
  4745. * Grab all unselected (filtered out) keys.
  4746. *
  4747. * Unselected keys are those not selected by the focused window. These keys won't be sent
  4748. * to that window. Instead one window in the stack can collect them.
  4749. *
  4750. * See also IDirectFBWindow::UngrabUnselectedKeys() and IDirectFBWindow::SetKeySelection().
  4751. */
  4752. DFBResult (*GrabUnselectedKeys) (
  4753. IDirectFBWindow *thiz
  4754. );
  4755. /*
  4756. * Release the grab of unselected (filtered out) keys.
  4757. *
  4758. * See also IDirectFBWindow::GrabUnselectedKeys() and IDirectFBWindow::SetKeySelection().
  4759. */
  4760. DFBResult (*UngrabUnselectedKeys) (
  4761. IDirectFBWindow *thiz
  4762. );
  4763. /** Advanced Geometry **/
  4764. /*
  4765. * Set area of surface to be shown in window.
  4766. *
  4767. * Default and maximum is to show whole surface.
  4768. */
  4769. DFBResult (*SetSrcGeometry) (
  4770. IDirectFBWindow *thiz,
  4771. const DFBWindowGeometry *geometry
  4772. );
  4773. /*
  4774. * Set destination location of window within its bounds.
  4775. *
  4776. * Default and maximum is to fill whole bounds.
  4777. */
  4778. DFBResult (*SetDstGeometry) (
  4779. IDirectFBWindow *thiz,
  4780. const DFBWindowGeometry *geometry
  4781. );
  4782. /** Properties **/
  4783. /*
  4784. * Set property controlling appearance and behaviour of the window.
  4785. */
  4786. DFBResult (*SetProperty) (
  4787. IDirectFBWindow *thiz,
  4788. const char *key,
  4789. void *value,
  4790. void **ret_old_value
  4791. );
  4792. /*
  4793. * Get property controlling appearance and behaviour of the window.
  4794. */
  4795. DFBResult (*GetProperty) (
  4796. IDirectFBWindow *thiz,
  4797. const char *key,
  4798. void **ret_value
  4799. );
  4800. /*
  4801. * Remove property controlling appearance and behaviour of the window.
  4802. */
  4803. DFBResult (*RemoveProperty) (
  4804. IDirectFBWindow *thiz,
  4805. const char *key,
  4806. void **ret_value
  4807. );
  4808. /*
  4809. * Set window rotation.
  4810. */
  4811. DFBResult (*SetRotation) (
  4812. IDirectFBWindow *thiz,
  4813. int rotation
  4814. );
  4815. /** Association **/
  4816. /*
  4817. * Change the window association.
  4818. *
  4819. * If <b>window_id</b> is 0, the window will be dissociated.
  4820. */
  4821. DFBResult (*SetAssociation) (
  4822. IDirectFBWindow *thiz,
  4823. DFBWindowID window_id
  4824. );
  4825. /** Application ID **/
  4826. /*
  4827. * Set application ID.
  4828. *
  4829. * The usage of the application ID is not imposed by DirectFB
  4830. * and can be used at will by the application. Any change will
  4831. * be notified, and as such, an application manager using SaWMan
  4832. * can be used to act on any change.
  4833. */
  4834. DFBResult (*SetApplicationID) (
  4835. IDirectFBWindow *thiz,
  4836. unsigned long application_id
  4837. );
  4838. /*
  4839. * Get current application ID.
  4840. */
  4841. DFBResult (*GetApplicationID) (
  4842. IDirectFBWindow *thiz,
  4843. unsigned long *ret_application_id
  4844. );
  4845. /** Updates **/
  4846. /*
  4847. * Signal start of window content updates.
  4848. */
  4849. DFBResult (*BeginUpdates) (
  4850. IDirectFBWindow *thiz,
  4851. const DFBRegion *update
  4852. );
  4853. /** Events **/
  4854. /*
  4855. * Send event
  4856. */
  4857. DFBResult (*SendEvent) (
  4858. IDirectFBWindow *thiz,
  4859. const DFBWindowEvent *event
  4860. );
  4861. /** Cursor **/
  4862. /*
  4863. * Set cursor flags (active when in focus).
  4864. */
  4865. DFBResult (*SetCursorFlags) (
  4866. IDirectFBWindow *thiz,
  4867. DFBWindowCursorFlags flags
  4868. );
  4869. /*
  4870. * Set cursor resolution (coordinate space for cursor within window).
  4871. *
  4872. * The default cursor resolution is the surface dimensions.
  4873. */
  4874. DFBResult (*SetCursorResolution) (
  4875. IDirectFBWindow *thiz,
  4876. const DFBDimension *resolution
  4877. );
  4878. /*
  4879. * Set cursor position within window coordinates (surface or cursor resolution).
  4880. */
  4881. DFBResult (*SetCursorPosition) (
  4882. IDirectFBWindow *thiz,
  4883. int x,
  4884. int y
  4885. );
  4886. )
  4887. /*
  4888. * Called for each provided text encoding.
  4889. */
  4890. typedef DFBEnumerationResult (*DFBTextEncodingCallback) (
  4891. DFBTextEncodingID encoding_id,
  4892. const char *name,
  4893. void *context
  4894. );
  4895. /*****************
  4896. * IDirectFBFont *
  4897. *****************/
  4898. /*
  4899. * <i>No summary yet...</i>
  4900. */
  4901. DEFINE_INTERFACE( IDirectFBFont,
  4902. /** Retrieving information **/
  4903. /*
  4904. * Get the distance from the baseline to the top of the
  4905. * logical extents of this font.
  4906. */
  4907. DFBResult (*GetAscender) (
  4908. IDirectFBFont *thiz,
  4909. int *ret_ascender
  4910. );
  4911. /*
  4912. * Get the distance from the baseline to the bottom of
  4913. * the logical extents of this font.
  4914. *
  4915. * This is a negative value!
  4916. */
  4917. DFBResult (*GetDescender) (
  4918. IDirectFBFont *thiz,
  4919. int *ret_descender
  4920. );
  4921. /*
  4922. * Get the logical height of this font. This is the
  4923. * distance from one baseline to the next when writing
  4924. * several lines of text. Note that this value does not
  4925. * correspond the height value specified when loading the
  4926. * font.
  4927. */
  4928. DFBResult (*GetHeight) (
  4929. IDirectFBFont *thiz,
  4930. int *ret_height
  4931. );
  4932. /*
  4933. * Get the maximum character width.
  4934. *
  4935. * This is a somewhat dubious value. Not all fonts
  4936. * specify it correcly. It can give you an idea of
  4937. * the maximum expected width of a rendered string.
  4938. */
  4939. DFBResult (*GetMaxAdvance) (
  4940. IDirectFBFont *thiz,
  4941. int *ret_maxadvance
  4942. );
  4943. /*
  4944. * Get the kerning to apply between two glyphs specified by
  4945. * their character codes.
  4946. */
  4947. DFBResult (*GetKerning) (
  4948. IDirectFBFont *thiz,
  4949. unsigned int prev,
  4950. unsigned int current,
  4951. int *ret_kern_x,
  4952. int *ret_kern_y
  4953. );
  4954. /** Measurements **/
  4955. /*
  4956. * Get the logical width of the specified string
  4957. * as if it were drawn with this font.
  4958. *
  4959. * Bytes specifies the number of bytes to take from the
  4960. * string or -1 for the complete NULL-terminated string.
  4961. *
  4962. * The returned width may be different than the actual drawn
  4963. * width of the text since this function returns the logical
  4964. * width that should be used to layout the text. A negative
  4965. * width indicates right-to-left rendering.
  4966. */
  4967. DFBResult (*GetStringWidth) (
  4968. IDirectFBFont *thiz,
  4969. const char *text,
  4970. int bytes,
  4971. int *ret_width
  4972. );
  4973. /*
  4974. * Get the logical and real extents of the specified
  4975. * string as if it were drawn with this font.
  4976. *
  4977. * Bytes specifies the number of bytes to take from the
  4978. * string or -1 for the complete NULL-terminated string.
  4979. *
  4980. * The logical rectangle describes the typographic extents
  4981. * and should be used to layout text. The ink rectangle
  4982. * describes the smallest rectangle containing all pixels
  4983. * that are touched when drawing the string. If you only
  4984. * need one of the rectangles, pass NULL for the other one.
  4985. *
  4986. * The ink rectangle is guaranteed to be a valid rectangle
  4987. * with positive width and height, while the logical
  4988. * rectangle may have negative width indicating right-to-left
  4989. * layout.
  4990. *
  4991. * The rectangle offsets are reported relative to the
  4992. * baseline and refer to the text being drawn using
  4993. * DSTF_LEFT.
  4994. */
  4995. DFBResult (*GetStringExtents) (
  4996. IDirectFBFont *thiz,
  4997. const char *text,
  4998. int bytes,
  4999. DFBRectangle *ret_logical_rect,
  5000. DFBRectangle *ret_ink_rect
  5001. );
  5002. /*
  5003. * Get the extents of a glyph specified by its character code.
  5004. *
  5005. * The rectangle describes the the smallest rectangle
  5006. * containing all pixels that are touched when drawing the
  5007. * glyph. It is reported relative to the baseline. If you
  5008. * only need the advance, pass NULL for the rectangle.
  5009. *
  5010. * The advance describes the horizontal offset to the next
  5011. * glyph (without kerning applied). It may be a negative
  5012. * value indicating left-to-right rendering. If you don't
  5013. * need this value, pass NULL for advance.
  5014. */
  5015. DFBResult (*GetGlyphExtents) (
  5016. IDirectFBFont *thiz,
  5017. unsigned int character,
  5018. DFBRectangle *ret_rect,
  5019. int *ret_advance
  5020. );
  5021. /*
  5022. * Get the next explicit or automatic break within a string
  5023. * along with the logical width of the text, the string length,
  5024. * and a pointer to the next text line.
  5025. *
  5026. * The bytes specifies the maximum number of bytes to take from the
  5027. * string or -1 for complete NULL-terminated string.
  5028. *
  5029. * The max_width specifies logical width of column onto which
  5030. * the text will be drawn. Then the logical width of fitted
  5031. * text is returned in ret_width. The returned width may overlap
  5032. * the max width specified if there's only one character
  5033. * that fits.
  5034. *
  5035. * The number of characters that fit into this column is returned
  5036. * by the ret_str_length. Note that you can not use this value as
  5037. * the number of bytes to take when using DrawString() as it
  5038. * represents to the number of characters, not the number of
  5039. * bytes.
  5040. *
  5041. * In ret_next_line a pointer to the next line of text is
  5042. * returned. This will point to NULL or the end of the string if
  5043. * there's no more break.
  5044. */
  5045. DFBResult (*GetStringBreak) (
  5046. IDirectFBFont *thiz,
  5047. const char *text,
  5048. int bytes,
  5049. int max_width,
  5050. int *ret_width,
  5051. int *ret_str_length,
  5052. const char **ret_next_line
  5053. );
  5054. /** Encodings **/
  5055. /*
  5056. * Change the default encoding used when the font is set at a surface.
  5057. *
  5058. * It's also the encoding used for the measurement functions
  5059. * of this interface, e.g. IDirectFBFont::GetStringExtents().
  5060. */
  5061. DFBResult (*SetEncoding) (
  5062. IDirectFBFont *thiz,
  5063. DFBTextEncodingID encoding
  5064. );
  5065. /*
  5066. * Enumerate all provided text encodings.
  5067. */
  5068. DFBResult (*EnumEncodings) (
  5069. IDirectFBFont *thiz,
  5070. DFBTextEncodingCallback callback,
  5071. void *context
  5072. );
  5073. /*
  5074. * Find an encoding by its name.
  5075. */
  5076. DFBResult (*FindEncoding) (
  5077. IDirectFBFont *thiz,
  5078. const char *name,
  5079. DFBTextEncodingID *ret_encoding
  5080. );
  5081. /** Resources **/
  5082. /*
  5083. * Dispose resources used by the font.
  5084. *
  5085. * Keeps font usable, recreating resources as needed.
  5086. */
  5087. DFBResult (*Dispose) (
  5088. IDirectFBFont *thiz
  5089. );
  5090. /** Measurements **/
  5091. /*
  5092. * Get the line spacing vector of this font. This is the
  5093. * displacement vector from one line to the next when writing
  5094. * several lines of text. It differs from the height only
  5095. * when the font is rotated.
  5096. */
  5097. DFBResult (*GetLineSpacingVector) (
  5098. IDirectFBFont *thiz,
  5099. int *ret_xspacing,
  5100. int *ret_yspacing
  5101. );
  5102. /*
  5103. * Get the extents of a glyph specified by its character code (extended version).
  5104. *
  5105. * The rectangle describes the the smallest rectangle
  5106. * containing all pixels that are touched when drawing the
  5107. * glyph. It is reported relative to the baseline. If you
  5108. * only need the advance, pass NULL for the rectangle.
  5109. *
  5110. * The advance describes the horizontal offset to the next
  5111. * glyph (without kerning applied). It may be a negative
  5112. * value indicating left-to-right rendering. If you don't
  5113. * need this value, pass NULL for advance.
  5114. */
  5115. DFBResult (*GetGlyphExtentsXY) (
  5116. IDirectFBFont *thiz,
  5117. unsigned int character,
  5118. DFBRectangle *ret_rect,
  5119. int *ret_xadvance,
  5120. int *ret_yadvance
  5121. );
  5122. )
  5123. /*
  5124. * Capabilities of an image.
  5125. */
  5126. typedef enum {
  5127. DICAPS_NONE = 0x00000000, /* None of these. */
  5128. DICAPS_ALPHACHANNEL = 0x00000001, /* The image data contains an
  5129. alphachannel. */
  5130. DICAPS_COLORKEY = 0x00000002 /* The image has a colorkey,
  5131. e.g. the transparent color
  5132. of a GIF image. */
  5133. } DFBImageCapabilities;
  5134. /*
  5135. * Information about an image including capabilities and values
  5136. * belonging to available capabilities.
  5137. */
  5138. typedef struct {
  5139. DFBImageCapabilities caps; /* capabilities */
  5140. u8 colorkey_r; /* colorkey red channel */
  5141. u8 colorkey_g; /* colorkey green channel */
  5142. u8 colorkey_b; /* colorkey blue channel */
  5143. } DFBImageDescription;
  5144. typedef enum {
  5145. DIRCR_OK,
  5146. DIRCR_ABORT
  5147. } DIRenderCallbackResult;
  5148. /*
  5149. * Called whenever a chunk of the image is decoded.
  5150. * Has to be registered with IDirectFBImageProvider::SetRenderCallback().
  5151. */
  5152. typedef DIRenderCallbackResult (*DIRenderCallback)(DFBRectangle *rect, void *ctx);
  5153. /**************************
  5154. * IDirectFBImageProvider *
  5155. **************************/
  5156. /*
  5157. * <i>No summary yet...</i>
  5158. */
  5159. DEFINE_INTERFACE( IDirectFBImageProvider,
  5160. /** Retrieving information **/
  5161. /*
  5162. * Get a surface description that best matches the image
  5163. * contained in the file.
  5164. *
  5165. * For opaque image formats the pixel format of the primary
  5166. * layer is used. For images with alpha channel an ARGB
  5167. * surface description is returned.
  5168. */
  5169. DFBResult (*GetSurfaceDescription) (
  5170. IDirectFBImageProvider *thiz,
  5171. DFBSurfaceDescription *ret_dsc
  5172. );
  5173. /*
  5174. * Get a description of the image.
  5175. *
  5176. * This includes stuff that does not belong into the surface
  5177. * description, e.g. a colorkey of a transparent GIF.
  5178. */
  5179. DFBResult (*GetImageDescription) (
  5180. IDirectFBImageProvider *thiz,
  5181. DFBImageDescription *ret_dsc
  5182. );
  5183. /** Rendering **/
  5184. /*
  5185. * Render the file contents into the destination contents
  5186. * doing automatic scaling and color format conversion.
  5187. *
  5188. * If the image file has an alpha channel it is rendered
  5189. * with alpha channel if the destination surface is of the
  5190. * ARGB pixelformat. Otherwise, transparent areas are
  5191. * blended over a black background.
  5192. *
  5193. * If a destination rectangle is specified, the rectangle is
  5194. * clipped to the destination surface. If NULL is passed as
  5195. * destination rectangle, the whole destination surface is
  5196. * taken. The image is stretched to fill the rectangle.
  5197. */
  5198. DFBResult (*RenderTo) (
  5199. IDirectFBImageProvider *thiz,
  5200. IDirectFBSurface *destination,
  5201. const DFBRectangle *destination_rect
  5202. );
  5203. /*
  5204. * Registers a callback for progressive image loading.
  5205. *
  5206. * The function is called each time a chunk of the image is decoded.
  5207. */
  5208. DFBResult (*SetRenderCallback) (
  5209. IDirectFBImageProvider *thiz,
  5210. DIRenderCallback callback,
  5211. void *callback_data
  5212. );
  5213. /** Encoding **/
  5214. /*
  5215. * Encode a portion of a surface.
  5216. */
  5217. DFBResult (*WriteBack) (
  5218. IDirectFBImageProvider *thiz,
  5219. IDirectFBSurface *surface,
  5220. const DFBRectangle *src_rect,
  5221. const char *filename
  5222. );
  5223. )
  5224. /*
  5225. * Capabilities of an audio/video stream.
  5226. */
  5227. typedef enum {
  5228. DVSCAPS_NONE = 0x00000000, /* None of these. */
  5229. DVSCAPS_VIDEO = 0x00000001, /* Stream contains video. */
  5230. DVSCAPS_AUDIO = 0x00000002 /* Stream contains audio. */
  5231. /* DVSCAPS_SUBPICTURE ?! */
  5232. } DFBStreamCapabilities;
  5233. #define DFB_STREAM_DESC_ENCODING_LENGTH 30
  5234. #define DFB_STREAM_DESC_TITLE_LENGTH 255
  5235. #define DFB_STREAM_DESC_AUTHOR_LENGTH 255
  5236. #define DFB_STREAM_DESC_ALBUM_LENGTH 255
  5237. #define DFB_STREAM_DESC_GENRE_LENGTH 32
  5238. #define DFB_STREAM_DESC_COMMENT_LENGTH 255
  5239. /*
  5240. * Informations about an audio/video stream.
  5241. */
  5242. typedef struct {
  5243. DFBStreamCapabilities caps; /* capabilities */
  5244. struct {
  5245. char encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "MPEG4") */
  5246. double framerate; /* number of frames per second */
  5247. double aspect; /* frame aspect ratio */
  5248. int bitrate; /* amount of bits per second */
  5249. int afd; /* Active Format Descriptor */
  5250. int width; /* Width as reported by Sequence Header */
  5251. int height; /* Height as reported by Sequence Header */
  5252. } video; /* struct containing the above encoding properties for video */
  5253. struct {
  5254. char encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "AAC") */
  5255. int samplerate; /* number of samples per second */
  5256. int channels; /* number of channels per sample */
  5257. int bitrate; /* amount of bits per second */
  5258. } audio; /* struct containing the above four encoding properties for audio */
  5259. char title[DFB_STREAM_DESC_TITLE_LENGTH]; /* title */
  5260. char author[DFB_STREAM_DESC_AUTHOR_LENGTH]; /* author */
  5261. char album[DFB_STREAM_DESC_ALBUM_LENGTH]; /* album */
  5262. short year; /* year */
  5263. char genre[DFB_STREAM_DESC_GENRE_LENGTH]; /* genre */
  5264. char comment[DFB_STREAM_DESC_COMMENT_LENGTH]; /* comment */
  5265. } DFBStreamDescription;
  5266. /*
  5267. * Type of an audio stream.
  5268. */
  5269. typedef enum {
  5270. DSF_ES = 0x00000000, /* ES. */
  5271. DSF_PES = 0x00000001, /* PES. */
  5272. } DFBStreamFormat;
  5273. /*
  5274. * Stream attributes for an audio/video stream.
  5275. */
  5276. typedef struct {
  5277. struct {
  5278. char encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "MPEG4") */
  5279. DFBStreamFormat format; /* format of the video stream */
  5280. } video; /* struct containing the above two encoding properties for video */
  5281. struct {
  5282. char encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "AAC") */
  5283. DFBStreamFormat format; /* format of the audio stream */
  5284. } audio; /* struct containing the above two encoding properties for audio */
  5285. } DFBStreamAttributes;
  5286. /*
  5287. * Buffer levels and occupancy for Audio/Video input buffers.
  5288. */
  5289. typedef struct {
  5290. DFBStreamCapabilities valid; /* Which of the Audio / Video sections are valid. */
  5291. struct {
  5292. unsigned int buffer_size; /* Size in bytes of the input buffer to video decoder */
  5293. unsigned int minimum_level; /* The level at which a DVPET_DATALOW event will be generated. */
  5294. unsigned int maximum_level; /* The level at which a DVPET_DATAHIGH event will be generated. */
  5295. unsigned int current_level; /* Current fill level of video input buffer.*/
  5296. } video; /* struct containing the above two encoding properties for video */
  5297. struct {
  5298. unsigned int buffer_size; /* Size in bytes of the input buffer to audio decoder */
  5299. unsigned int minimum_level; /* The level at which a DVPET_DATALOW event will be generated. */
  5300. unsigned int maximum_level; /* The level at which a DVPET_DATAHIGH event will be generated. */
  5301. unsigned int current_level; /* Current fill level of audio input buffer.*/
  5302. } audio; /* struct containing the above two encoding properties for audio */
  5303. } DFBBufferOccupancy;
  5304. /*
  5305. * Buffer thresholds for Audio and Video.
  5306. */
  5307. typedef struct {
  5308. DFBStreamCapabilities selection; /* Which of the Audio / Video are we setting? */
  5309. struct {
  5310. unsigned int minimum_level; /* The level at which a DVPET_DATALOW event will be generated. */
  5311. unsigned int maximum_level; /* The level at which a DVPET_DATAHIGH event will be generated. */
  5312. unsigned int minimum_time; /* The level at which a DVPET_BUFFERTIMELOW event will be generated. */
  5313. unsigned int maximum_time; /* The level at which a DVPET_BUFFERTIMEHIGH event will be generated. */
  5314. } video; /* struct containing the above two encoding properties for video */
  5315. struct {
  5316. unsigned int minimum_level; /* The level at which a DVPET_DATALOW event will be generated. */
  5317. unsigned int maximum_level; /* The level at which a DVPET_DATAHIGH event will be generated. */
  5318. unsigned int minimum_time; /* The level at which a DVPET_BUFFERTIMELOW event will be generated. */
  5319. unsigned int maximum_time; /* The level at which a DVPET_BUFFERTIMEHIGH event will be generated. */
  5320. } audio; /* struct containing the above two encoding properties for audio */
  5321. } DFBBufferThresholds;
  5322. /*
  5323. * Called for each written frame.
  5324. */
  5325. typedef void (*DVFrameCallback)(void *ctx);
  5326. /**************************
  5327. * IDirectFBVideoProvider *
  5328. **************************/
  5329. /*
  5330. * <i>No summary yet...</i>
  5331. */
  5332. DEFINE_INTERFACE( IDirectFBVideoProvider,
  5333. /** Retrieving information **/
  5334. /*
  5335. * Retrieve information about the video provider's
  5336. * capabilities.
  5337. */
  5338. DFBResult (*GetCapabilities) (
  5339. IDirectFBVideoProvider *thiz,
  5340. DFBVideoProviderCapabilities *ret_caps
  5341. );
  5342. /*
  5343. * Get a surface description that best matches the video
  5344. * contained in the file.
  5345. */
  5346. DFBResult (*GetSurfaceDescription) (
  5347. IDirectFBVideoProvider *thiz,
  5348. DFBSurfaceDescription *ret_dsc
  5349. );
  5350. /*
  5351. * Get a description of the video stream.
  5352. */
  5353. DFBResult (*GetStreamDescription) (
  5354. IDirectFBVideoProvider *thiz,
  5355. DFBStreamDescription *ret_dsc
  5356. );
  5357. /** Playback **/
  5358. /*
  5359. * Play the video rendering it into the specified rectangle
  5360. * of the destination surface.
  5361. *
  5362. * Optionally a callback can be registered that is called
  5363. * for each rendered frame. This is especially important if
  5364. * you are playing to a flipping surface. In this case, you
  5365. * should flip the destination surface in your callback.
  5366. */
  5367. DFBResult (*PlayTo) (
  5368. IDirectFBVideoProvider *thiz,
  5369. IDirectFBSurface *destination,
  5370. const DFBRectangle *destination_rect,
  5371. DVFrameCallback callback,
  5372. void *ctx
  5373. );
  5374. /*
  5375. * Stop rendering into the destination surface.
  5376. */
  5377. DFBResult (*Stop) (
  5378. IDirectFBVideoProvider *thiz
  5379. );
  5380. /*
  5381. * Get the status of the playback.
  5382. */
  5383. DFBResult (*GetStatus) (
  5384. IDirectFBVideoProvider *thiz,
  5385. DFBVideoProviderStatus *ret_status
  5386. );
  5387. /** Media Control **/
  5388. /*
  5389. * Seeks to a position within the stream.
  5390. */
  5391. DFBResult (*SeekTo) (
  5392. IDirectFBVideoProvider *thiz,
  5393. double seconds
  5394. );
  5395. /*
  5396. * Gets current position within the stream.
  5397. */
  5398. DFBResult (*GetPos) (
  5399. IDirectFBVideoProvider *thiz,
  5400. double *ret_seconds
  5401. );
  5402. /*
  5403. * Gets the length of the stream.
  5404. */
  5405. DFBResult (*GetLength) (
  5406. IDirectFBVideoProvider *thiz,
  5407. double *ret_seconds
  5408. );
  5409. /** Color Adjustment **/
  5410. /*
  5411. * Gets the current video color settings.
  5412. */
  5413. DFBResult (*GetColorAdjustment) (
  5414. IDirectFBVideoProvider *thiz,
  5415. DFBColorAdjustment *ret_adj
  5416. );
  5417. /*
  5418. * Adjusts the video colors.
  5419. *
  5420. * This function only has an effect if the video provider
  5421. * supports this operation. Check the providers capabilities
  5422. * to find out if this is the case.
  5423. */
  5424. DFBResult (*SetColorAdjustment) (
  5425. IDirectFBVideoProvider *thiz,
  5426. const DFBColorAdjustment *adj
  5427. );
  5428. /** Interactivity **/
  5429. /*
  5430. * Send an input or window event.
  5431. *
  5432. * This method allows to redirect events to an interactive
  5433. * video provider. Events must be relative to the specified
  5434. * rectangle of the destination surface.
  5435. */
  5436. DFBResult (*SendEvent) (
  5437. IDirectFBVideoProvider *thiz,
  5438. const DFBEvent *event
  5439. );
  5440. /** Advanced control **/
  5441. /*
  5442. * Set the flags controlling playback mode.
  5443. */
  5444. DFBResult (*SetPlaybackFlags) (
  5445. IDirectFBVideoProvider *thiz,
  5446. DFBVideoProviderPlaybackFlags flags
  5447. );
  5448. /*
  5449. * Set the speed multiplier.
  5450. *
  5451. * Values below 1.0 reduce playback speed
  5452. * while values over 1.0 increase it.<br>
  5453. * Specifying a value of 0.0 has the effect of
  5454. * putting the playback in pause mode without
  5455. * stopping the video provider.
  5456. */
  5457. DFBResult (*SetSpeed) (
  5458. IDirectFBVideoProvider *thiz,
  5459. double multiplier
  5460. );
  5461. /*
  5462. * Get current speed multiplier.
  5463. */
  5464. DFBResult (*GetSpeed) (
  5465. IDirectFBVideoProvider *thiz,
  5466. double *ret_multiplier
  5467. );
  5468. /*
  5469. * Set volume level.
  5470. *
  5471. * Values between 0.0f and 1.0f adjust the volume level.
  5472. * Values over 1.0f increase the amplification level.
  5473. */
  5474. DFBResult (*SetVolume) (
  5475. IDirectFBVideoProvider *thiz,
  5476. float level
  5477. );
  5478. /*
  5479. * Get volume level.
  5480. */
  5481. DFBResult (*GetVolume) (
  5482. IDirectFBVideoProvider *thiz,
  5483. float *ret_level
  5484. );
  5485. /*
  5486. * Set the stream attributes.
  5487. * May have a wrapper with different media types types encapsulated.
  5488. * Can use this method to indicate the content type.
  5489. */
  5490. DFBResult (*SetStreamAttributes) (
  5491. IDirectFBVideoProvider *thiz,
  5492. DFBStreamAttributes attr
  5493. );
  5494. /*
  5495. * Set the audio units that are being used for output.
  5496. * May have multiple audio outputs and need to configure them on/off
  5497. * dynamically.
  5498. */
  5499. DFBResult (*SetAudioOutputs) (
  5500. IDirectFBVideoProvider *thiz,
  5501. DFBVideoProviderAudioUnits *audioUnits
  5502. );
  5503. /*
  5504. * Get the audio units that are being used for output.
  5505. */
  5506. DFBResult (*GetAudioOutputs) (
  5507. IDirectFBVideoProvider *thiz,
  5508. DFBVideoProviderAudioUnits *audioUnits
  5509. );
  5510. /*
  5511. * Set the audio delay
  5512. *
  5513. * The parameter is in microseconds. Values < 0 make audio earlier, > 0 make audio later.
  5514. */
  5515. DFBResult (*SetAudioDelay) (
  5516. IDirectFBVideoProvider *thiz,
  5517. long delay
  5518. );
  5519. /** Event buffers **/
  5520. /*
  5521. * Create an event buffer for this video provider and attach it.
  5522. */
  5523. DFBResult (*CreateEventBuffer) (
  5524. IDirectFBVideoProvider *thiz,
  5525. IDirectFBEventBuffer **ret_buffer
  5526. );
  5527. /*
  5528. * Attach an existing event buffer to this video provider.
  5529. *
  5530. * NOTE: Attaching multiple times generates multiple events.
  5531. */
  5532. DFBResult (*AttachEventBuffer) (
  5533. IDirectFBVideoProvider *thiz,
  5534. IDirectFBEventBuffer *buffer
  5535. );
  5536. /*
  5537. * Enable specific events to be sent from the video provider.
  5538. *
  5539. * The argument is a mask of events that will be set in the
  5540. * videoproviders's event mask. The default event mask is DVPET_ALL.
  5541. */
  5542. DFBResult (*EnableEvents) (
  5543. IDirectFBVideoProvider *thiz,
  5544. DFBVideoProviderEventType mask
  5545. );
  5546. /*
  5547. * Disable specific events from being sent from the video provider
  5548. *
  5549. * The argument is a mask of events that will be cleared in
  5550. * the video providers's event mask. The default event mask is DWET_ALL.
  5551. */
  5552. DFBResult (*DisableEvents) (
  5553. IDirectFBVideoProvider *thiz,
  5554. DFBVideoProviderEventType mask
  5555. );
  5556. /*
  5557. * Detach an event buffer from this video provider.
  5558. */
  5559. DFBResult (*DetachEventBuffer) (
  5560. IDirectFBVideoProvider *thiz,
  5561. IDirectFBEventBuffer *buffer
  5562. );
  5563. /** Buffer control **/
  5564. /*
  5565. * Get buffer occupancy (A/V) when playing this stream.
  5566. */
  5567. DFBResult (*GetBufferOccupancy) (
  5568. IDirectFBVideoProvider *thiz,
  5569. DFBBufferOccupancy *ret_occ
  5570. );
  5571. /*
  5572. * Set buffer thresholds for the Audio / Video playback.
  5573. */
  5574. DFBResult (*SetBufferThresholds) (
  5575. IDirectFBVideoProvider *thiz,
  5576. DFBBufferThresholds thresh
  5577. );
  5578. /*
  5579. * Get buffer thresholds for the Audio / Video playback.
  5580. */
  5581. DFBResult (*GetBufferThresholds) (
  5582. IDirectFBVideoProvider *thiz,
  5583. DFBBufferThresholds *ret_thresh
  5584. );
  5585. )
  5586. /***********************
  5587. * IDirectFBDataBuffer *
  5588. ***********************/
  5589. /*
  5590. * <i>No summary yet...</i>
  5591. */
  5592. DEFINE_INTERFACE( IDirectFBDataBuffer,
  5593. /** Buffer handling **/
  5594. /*
  5595. * Flushes all data in this buffer.
  5596. *
  5597. * This method only applies to streaming buffers.
  5598. */
  5599. DFBResult (*Flush) (
  5600. IDirectFBDataBuffer *thiz
  5601. );
  5602. /*
  5603. * Finish writing into a streaming buffer.
  5604. *
  5605. * Subsequent calls to PutData will fail,
  5606. * while attempts to fetch data from the buffer will return EOF
  5607. * unless there is still data available.
  5608. */
  5609. DFBResult (*Finish) (
  5610. IDirectFBDataBuffer *thiz
  5611. );
  5612. /*
  5613. * Seeks to a given byte position.
  5614. *
  5615. * This method only applies to static buffers.
  5616. */
  5617. DFBResult (*SeekTo) (
  5618. IDirectFBDataBuffer *thiz,
  5619. unsigned int offset
  5620. );
  5621. /*
  5622. * Get the current byte position within a static buffer.
  5623. *
  5624. * This method only applies to static buffers.
  5625. */
  5626. DFBResult (*GetPosition) (
  5627. IDirectFBDataBuffer *thiz,
  5628. unsigned int *ret_offset
  5629. );
  5630. /*
  5631. * Get the length of a static or streaming buffer in bytes.
  5632. *
  5633. * The length of a static buffer is its static size.
  5634. * A streaming buffer has a variable length reflecting
  5635. * the amount of buffered data.
  5636. */
  5637. DFBResult (*GetLength) (
  5638. IDirectFBDataBuffer *thiz,
  5639. unsigned int *ret_length
  5640. );
  5641. /** Waiting for data **/
  5642. /*
  5643. * Wait for data to be available.
  5644. * Thread is idle in the meantime.
  5645. *
  5646. * This method blocks until at least the specified number of bytes
  5647. * is available.
  5648. */
  5649. DFBResult (*WaitForData) (
  5650. IDirectFBDataBuffer *thiz,
  5651. unsigned int length
  5652. );
  5653. /*
  5654. * Wait for data to be available within an amount of time.
  5655. * Thread is idle in the meantime.
  5656. *
  5657. * This method blocks until at least the specified number of bytes
  5658. * is available or the timeout is reached.
  5659. */
  5660. DFBResult (*WaitForDataWithTimeout) (
  5661. IDirectFBDataBuffer *thiz,
  5662. unsigned int length,
  5663. unsigned int seconds,
  5664. unsigned int milli_seconds
  5665. );
  5666. /** Retrieving data **/
  5667. /*
  5668. * Fetch data from a streaming or static buffer.
  5669. *
  5670. * Static buffers will increase the data pointer.
  5671. * Streaming buffers will flush the data portion.
  5672. *
  5673. * The maximum number of bytes to fetch is specified by "length",
  5674. * the actual number of bytes fetched is returned via "read".
  5675. */
  5676. DFBResult (*GetData) (
  5677. IDirectFBDataBuffer *thiz,
  5678. unsigned int length,
  5679. void *ret_data,
  5680. unsigned int *ret_read
  5681. );
  5682. /*
  5683. * Peek data from a streaming or static buffer.
  5684. *
  5685. * Unlike GetData() this method won't increase the data
  5686. * pointer or flush any portions of the data held.
  5687. *
  5688. * Additionally an offset relative to the current data pointer
  5689. * or beginning of the streaming buffer can be specified.
  5690. *
  5691. * The maximum number of bytes to peek is specified by "length",
  5692. * the actual number of bytes peeked is returned via "read".
  5693. */
  5694. DFBResult (*PeekData) (
  5695. IDirectFBDataBuffer *thiz,
  5696. unsigned int length,
  5697. int offset,
  5698. void *ret_data,
  5699. unsigned int *ret_read
  5700. );
  5701. /*
  5702. * Check if there is data available.
  5703. *
  5704. * This method returns DFB_OK if there is data available,
  5705. * DFB_BUFFER_EMPTY otherwise.
  5706. */
  5707. DFBResult (*HasData) (
  5708. IDirectFBDataBuffer *thiz
  5709. );
  5710. /** Providing data **/
  5711. /*
  5712. * Appends a block of data to a streaming buffer.
  5713. *
  5714. * This method does not wait until the data got fetched.
  5715. *
  5716. * Static buffers don't support this method.
  5717. */
  5718. DFBResult (*PutData) (
  5719. IDirectFBDataBuffer *thiz,
  5720. const void *data,
  5721. unsigned int length
  5722. );
  5723. /** Media from data **/
  5724. /*
  5725. * Creates an image provider using the buffers data.
  5726. */
  5727. DFBResult (*CreateImageProvider) (
  5728. IDirectFBDataBuffer *thiz,
  5729. IDirectFBImageProvider **interface
  5730. );
  5731. /*
  5732. * Creates a video provider using the buffers data.
  5733. */
  5734. DFBResult (*CreateVideoProvider) (
  5735. IDirectFBDataBuffer *thiz,
  5736. IDirectFBVideoProvider **interface
  5737. );
  5738. /*
  5739. * Load a font using the buffer's data, given a description
  5740. * of how to load the glyphs.
  5741. */
  5742. DFBResult (*CreateFont) (
  5743. IDirectFBDataBuffer *thiz,
  5744. const DFBFontDescription *desc,
  5745. IDirectFBFont **interface
  5746. );
  5747. )
  5748. #ifdef __cplusplus
  5749. }
  5750. #endif
  5751. #endif