classes.h 666 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999
  1. /**
  2. This file was auto-generated by mupdfwrap.py.
  3. */
  4. #ifndef MUPDF_CLASSES_H
  5. #define MUPDF_CLASSES_H
  6. #include "mupdf/fitz.h"
  7. #include "mupdf/functions.h"
  8. #include "mupdf/pdf.h"
  9. #include <map>
  10. #include <string>
  11. #include <vector>
  12. namespace mupdf
  13. {
  14. /* Forward declarations of all classes that we define. */
  15. struct FzAaContext;
  16. struct FzActivityContext;
  17. struct FzAes;
  18. struct FzAllocContext;
  19. struct FzArc4;
  20. struct FzArchive;
  21. struct FzArchiveHandler;
  22. struct FzArchiveHandlerContext;
  23. struct FzBandWriter;
  24. struct FzBitmap;
  25. struct FzBuffer;
  26. struct FzColorParams;
  27. struct FzColorspace;
  28. struct FzColorspaceContext;
  29. struct FzCompressedBuffer;
  30. struct FzCompressedImage;
  31. struct FzCompressionParams;
  32. struct FzContext;
  33. struct FzCookie;
  34. struct FzDefaultColorspaces;
  35. struct FzDevice;
  36. struct FzDeviceContainerStack;
  37. struct FzDisplayList;
  38. struct FzDocument;
  39. struct FzDocumentHandler;
  40. struct FzDocumentHandlerContext;
  41. struct FzDocumentWriter;
  42. struct FzDrawOptions;
  43. struct FzErrorContext;
  44. struct FzErrorStackSlot;
  45. struct FzFont;
  46. struct FzFontContext;
  47. struct FzFontFlagsT;
  48. struct FzFunction;
  49. struct FzGetoptLongOptions;
  50. struct FzGlyph;
  51. struct FzGlyphCache;
  52. struct FzHalftone;
  53. struct FzHashTable;
  54. struct FzIccProfile;
  55. struct FzImage;
  56. struct FzInstallLoadSystemFontFuncsArgs;
  57. struct FzInt2;
  58. struct FzInt2Heap;
  59. struct FzIntHeap;
  60. struct FzIntptr;
  61. struct FzIntptrHeap;
  62. struct FzIrect;
  63. struct FzJbig2Globals;
  64. struct FzJson;
  65. struct FzJsonArray;
  66. struct FzJsonObject;
  67. struct FzKeyStorable;
  68. struct FzLayoutBlock;
  69. struct FzLayoutChar;
  70. struct FzLayoutLine;
  71. struct FzLink;
  72. struct FzLinkDest;
  73. struct FzLocation;
  74. struct FzLocksContext;
  75. struct FzMatrix;
  76. struct FzMd5;
  77. struct FzOutline;
  78. struct FzOutlineItem;
  79. struct FzOutlineIterator;
  80. struct FzOutput;
  81. struct FzOverprint;
  82. struct FzPage;
  83. struct FzPath;
  84. struct FzPathWalker;
  85. struct FzPclOptions;
  86. struct FzPclmOptions;
  87. struct FzPdfocrOptions;
  88. struct FzPixmap;
  89. struct FzPixmapImage;
  90. struct FzPoint;
  91. struct FzPool;
  92. struct FzPoolArray;
  93. struct FzPtrHeap;
  94. struct FzPwgOptions;
  95. struct FzQuad;
  96. struct FzRange;
  97. struct FzRect;
  98. struct FzSeparations;
  99. struct FzSha256;
  100. struct FzSha384;
  101. struct FzSha512;
  102. struct FzShade;
  103. struct FzShadeColorCache;
  104. struct FzShaperDataT;
  105. struct FzStextBlock;
  106. struct FzStextChar;
  107. struct FzStextGridPositions;
  108. struct FzStextLine;
  109. struct FzStextOptions;
  110. struct FzStextPage;
  111. struct FzStextPageBlockIterator;
  112. struct FzStextPageDetails;
  113. struct FzStextStruct;
  114. struct FzStorable;
  115. struct FzStore;
  116. struct FzStoreHash;
  117. struct FzStoreType;
  118. struct FzStory;
  119. struct FzStoryElementPosition;
  120. struct FzStream;
  121. struct FzString;
  122. struct FzStrokeState;
  123. struct FzStyleContext;
  124. struct FzText;
  125. struct FzTextDecoder;
  126. struct FzTextItem;
  127. struct FzTextSpan;
  128. struct FzTransition;
  129. struct FzTree;
  130. struct FzTuningContext;
  131. struct FzVertex;
  132. struct FzWarnContext;
  133. struct FzWriteStoryPosition;
  134. struct FzWriteStoryPositions;
  135. struct FzXml;
  136. struct FzXmlDoc;
  137. struct FzZipWriter;
  138. struct PdfAlertEvent;
  139. struct PdfAnnot;
  140. struct PdfCleanOptions;
  141. struct PdfCmap;
  142. struct PdfColorFilterOptions;
  143. struct PdfColorspaceResourceKey;
  144. struct PdfCrypt;
  145. struct PdfCsi;
  146. struct PdfCycleList;
  147. struct PdfDocEvent;
  148. struct PdfDocument;
  149. struct PdfFilespecParams;
  150. struct PdfFilterFactory;
  151. struct PdfFilterOptions;
  152. struct PdfFontDesc;
  153. struct PdfFontResourceKey;
  154. struct PdfFunction;
  155. struct PdfGraftMap;
  156. struct PdfGstate;
  157. struct PdfHintPage;
  158. struct PdfHintShared;
  159. struct PdfHmtx;
  160. struct PdfImageRewriterOptions;
  161. struct PdfJournal;
  162. struct PdfJs;
  163. struct PdfJsConsole;
  164. struct PdfKeystrokeEvent;
  165. struct PdfLaunchUrlEvent;
  166. struct PdfLayerConfig;
  167. struct PdfLayerConfigUi;
  168. struct PdfLexbuf;
  169. struct PdfLexbufLarge;
  170. struct PdfLockedFields;
  171. struct PdfMailDocEvent;
  172. struct PdfMarkBits;
  173. struct PdfMarkList;
  174. struct PdfMrange;
  175. struct PdfObj;
  176. struct PdfObjectLabels;
  177. struct PdfOcgDescriptor;
  178. struct PdfPage;
  179. struct PdfPattern;
  180. struct PdfPkcs7DistinguishedName;
  181. struct PdfPkcs7Signer;
  182. struct PdfPkcs7Verifier;
  183. struct PdfProcessor;
  184. struct PdfRange;
  185. struct PdfRecolorOptions;
  186. struct PdfRedactOptions;
  187. struct PdfResourceStack;
  188. struct PdfRevPageMap;
  189. struct PdfSanitizeFilterOptions;
  190. struct PdfTextObjectState;
  191. struct PdfTextState;
  192. struct PdfUnsavedSig;
  193. struct PdfVmtx;
  194. struct PdfWriteOptions;
  195. struct PdfXrange;
  196. struct PdfXref;
  197. struct PdfXrefEntry;
  198. struct PdfXrefSubsec;
  199. /** Wrapper class for struct `fz_aa_context`. */
  200. struct FzAaContext
  201. {
  202. /** We use default copy constructor and operator=. */
  203. /** Default constructor, sets each member to default value. */
  204. FZ_FUNCTION FzAaContext();
  205. /** Constructor using raw copy of pre-existing `::fz_aa_context`. */
  206. FZ_FUNCTION FzAaContext(const ::fz_aa_context* internal);
  207. /** Constructor using raw copy of pre-existing `::fz_aa_context`. */
  208. FZ_FUNCTION FzAaContext(const ::fz_aa_context internal);
  209. /** Access as underlying struct. */
  210. FZ_FUNCTION ::fz_aa_context* internal();
  211. /** Access as underlying struct. */
  212. FZ_FUNCTION const ::fz_aa_context* internal() const;
  213. #ifndef NDEBUG
  214. /** Destructor only decrements s_num_instances. */
  215. FZ_FUNCTION ~FzAaContext();
  216. #else
  217. /** We use default destructor. */
  218. #endif
  219. /* == Member data. */
  220. /* These members are the same as the members of ::fz_aa_context. */
  221. int hscale;
  222. int vscale;
  223. int scale;
  224. int bits;
  225. int text_bits;
  226. float min_line_width;
  227. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  228. generate code regardless so we always need to have this available. */
  229. FZ_DATA static int s_num_instances;
  230. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  231. FZ_FUNCTION std::string to_string();
  232. /** Comparison method. */
  233. FZ_FUNCTION bool operator==(const FzAaContext& rhs);
  234. /** Comparison method. */
  235. FZ_FUNCTION bool operator!=(const FzAaContext& rhs);
  236. };
  237. /** Wrapper class for struct `fz_activity_context`. Not copyable or assignable. */
  238. struct FzActivityContext
  239. {
  240. /** Default constructor, sets `m_internal` to null. */
  241. FZ_FUNCTION FzActivityContext();
  242. /** Constructor using raw copy of pre-existing `::fz_activity_context`. */
  243. FZ_FUNCTION FzActivityContext(::fz_activity_context* internal);
  244. #ifndef NDEBUG
  245. /** Destructor only decrements s_num_instances. */
  246. FZ_FUNCTION ~FzActivityContext();
  247. #else
  248. /** We use default destructor. */
  249. #endif
  250. /** Return numerical value of .m_internal; helps with Python debugging. */
  251. FZ_FUNCTION long long m_internal_value();
  252. /** Return true iff `m_internal` is not null. */
  253. FZ_FUNCTION operator bool();
  254. /* == Member data. */
  255. /** Pointer to wrapped data. */
  256. ::fz_activity_context* m_internal;
  257. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  258. generate code regardless so we always need to have this available. */
  259. FZ_DATA static int s_num_instances;
  260. private:
  261. /** This class is not copyable or assignable. */
  262. FzActivityContext(const FzActivityContext& rhs);
  263. FzActivityContext& operator=(const FzActivityContext& rhs);
  264. };
  265. /** Wrapper class for struct `fz_aes`. Not copyable or assignable. */
  266. /**
  267. Structure definitions are public to enable stack
  268. based allocation. Do not access the members directly.
  269. */
  270. struct FzAes
  271. {
  272. /** Default constructor, sets `m_internal` to null. */
  273. FZ_FUNCTION FzAes();
  274. /* == Methods. */
  275. /** Class-aware wrapper for `::fz_aes_crypt_cbc()`. */
  276. /**
  277. AES block processing. Encrypts or Decrypts (according to mode,
  278. which must match what was initially set up) length bytes (which
  279. must be a multiple of 16), using (and modifying) the insertion
  280. vector iv, reading from input, and writing to output.
  281. Never throws an exception.
  282. */
  283. FZ_FUNCTION void fz_aes_crypt_cbc(int mode, size_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output) const;
  284. /** Class-aware wrapper for `::fz_aes_setkey_dec()`. */
  285. /**
  286. AES decryption initialization. Fills in the supplied context
  287. and prepares for decryption using the given key.
  288. Returns non-zero for error (key size other than 128/192/256).
  289. Never throws an exception.
  290. */
  291. FZ_FUNCTION int fz_aes_setkey_dec(const unsigned char *key, int keysize) const;
  292. /** Class-aware wrapper for `::fz_aes_setkey_enc()`. */
  293. /**
  294. AES encryption initialization. Fills in the supplied context
  295. and prepares for encryption using the given key.
  296. Returns non-zero for error (key size other than 128/192/256).
  297. Never throws an exception.
  298. */
  299. FZ_FUNCTION int fz_aes_setkey_enc(const unsigned char *key, int keysize) const;
  300. /** Constructor using raw copy of pre-existing `::fz_aes`. */
  301. FZ_FUNCTION FzAes(::fz_aes* internal);
  302. #ifndef NDEBUG
  303. /** Destructor only decrements s_num_instances. */
  304. FZ_FUNCTION ~FzAes();
  305. #else
  306. /** We use default destructor. */
  307. #endif
  308. /** Return numerical value of .m_internal; helps with Python debugging. */
  309. FZ_FUNCTION long long m_internal_value();
  310. /** Return true iff `m_internal` is not null. */
  311. FZ_FUNCTION operator bool();
  312. /* == Member data. */
  313. /** Pointer to wrapped data. */
  314. ::fz_aes* m_internal;
  315. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  316. generate code regardless so we always need to have this available. */
  317. FZ_DATA static int s_num_instances;
  318. private:
  319. /** This class is not copyable or assignable. */
  320. FzAes(const FzAes& rhs);
  321. FzAes& operator=(const FzAes& rhs);
  322. };
  323. /** Wrapper class for struct `fz_alloc_context`. Not copyable or assignable. */
  324. /**
  325. Allocator structure; holds callbacks and private data pointer.
  326. */
  327. struct FzAllocContext
  328. {
  329. /** Default constructor, sets `m_internal` to null. */
  330. FZ_FUNCTION FzAllocContext();
  331. /** Constructor using raw copy of pre-existing `::fz_alloc_context`. */
  332. FZ_FUNCTION FzAllocContext(::fz_alloc_context* internal);
  333. #ifndef NDEBUG
  334. /** Destructor only decrements s_num_instances. */
  335. FZ_FUNCTION ~FzAllocContext();
  336. #else
  337. /** We use default destructor. */
  338. #endif
  339. /** Return numerical value of .m_internal; helps with Python debugging. */
  340. FZ_FUNCTION long long m_internal_value();
  341. /** Return true iff `m_internal` is not null. */
  342. FZ_FUNCTION operator bool();
  343. /* == Member data. */
  344. /** Pointer to wrapped data. */
  345. ::fz_alloc_context* m_internal;
  346. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  347. generate code regardless so we always need to have this available. */
  348. FZ_DATA static int s_num_instances;
  349. private:
  350. /** This class is not copyable or assignable. */
  351. FzAllocContext(const FzAllocContext& rhs);
  352. FzAllocContext& operator=(const FzAllocContext& rhs);
  353. };
  354. /** Wrapper class for struct `fz_arc4`. Not copyable or assignable. */
  355. /**
  356. Structure definition is public to enable stack
  357. based allocation. Do not access the members directly.
  358. */
  359. struct FzArc4
  360. {
  361. /** Default constructor, sets `m_internal` to null. */
  362. FZ_FUNCTION FzArc4();
  363. /* == Methods. */
  364. /** Class-aware wrapper for `::fz_arc4_encrypt()`. */
  365. /**
  366. RC4 block encrypt operation; encrypt src into dst (both of
  367. length len) updating the RC4 state as we go.
  368. Never throws an exception.
  369. */
  370. FZ_FUNCTION void fz_arc4_encrypt(unsigned char *dest, const unsigned char *src, size_t len) const;
  371. /** Class-aware wrapper for `::fz_arc4_final()`. */
  372. /**
  373. RC4 finalization. Zero the context.
  374. Never throws an exception.
  375. */
  376. FZ_FUNCTION void fz_arc4_final() const;
  377. /** Class-aware wrapper for `::fz_arc4_init()`. */
  378. /**
  379. RC4 initialization. Begins an RC4 operation, writing a new
  380. context.
  381. Never throws an exception.
  382. */
  383. FZ_FUNCTION void fz_arc4_init(const unsigned char *key, size_t len) const;
  384. /** Constructor using raw copy of pre-existing `::fz_arc4`. */
  385. FZ_FUNCTION FzArc4(::fz_arc4* internal);
  386. #ifndef NDEBUG
  387. /** Destructor only decrements s_num_instances. */
  388. FZ_FUNCTION ~FzArc4();
  389. #else
  390. /** We use default destructor. */
  391. #endif
  392. /** Return numerical value of .m_internal; helps with Python debugging. */
  393. FZ_FUNCTION long long m_internal_value();
  394. /** Return true iff `m_internal` is not null. */
  395. FZ_FUNCTION operator bool();
  396. /* == Member data. */
  397. /** Pointer to wrapped data. */
  398. ::fz_arc4* m_internal;
  399. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  400. generate code regardless so we always need to have this available. */
  401. FZ_DATA static int s_num_instances;
  402. private:
  403. /** This class is not copyable or assignable. */
  404. FzArc4(const FzArc4& rhs);
  405. FzArc4& operator=(const FzArc4& rhs);
  406. };
  407. /** Wrapper class for struct `fz_archive`. */
  408. /**
  409. fz_archive:
  410. fz_archive provides methods for accessing "archive" files.
  411. An archive file is a conceptual entity that contains multiple
  412. files, which can be counted, enumerated, and read.
  413. Implementations of fz_archive based upon directories, zip
  414. and tar files are included.
  415. */
  416. struct FzArchive
  417. {
  418. /** == Constructors. */
  419. /** Constructor using `fz_new_archive_of_size()`. */
  420. FZ_FUNCTION FzArchive(const FzStream& file, int size);
  421. /** Constructor using `fz_new_multi_archive()`. */
  422. /**
  423. Create a new multi archive (initially empty).
  424. */
  425. FZ_FUNCTION FzArchive();
  426. /** Constructor using `fz_new_tree_archive()`. */
  427. /**
  428. Create an archive that holds named buffers.
  429. tree can either be a preformed tree with fz_buffers as values,
  430. or it can be NULL for an empty tree.
  431. */
  432. FZ_FUNCTION FzArchive(const FzTree& tree);
  433. /** Copy constructor using `fz_keep_archive()`. */
  434. FZ_FUNCTION FzArchive(const FzArchive& rhs);
  435. /** operator= using `fz_keep_archive()` and `fz_drop_archive()`. */
  436. FZ_FUNCTION FzArchive& operator=(const FzArchive& rhs);
  437. /* == Methods. */
  438. /** Class-aware wrapper for `::fz_archive_format()`. */
  439. /**
  440. Return a pointer to a string describing the format of the
  441. archive.
  442. The lifetime of the string is unspecified (in current
  443. implementations the string will persist until the archive
  444. is closed, but this is not guaranteed).
  445. */
  446. FZ_FUNCTION const char *fz_archive_format() const;
  447. /** Class-aware wrapper for `::fz_count_archive_entries()`. */
  448. /**
  449. Number of entries in archive.
  450. Will always return a value >= 0.
  451. May throw an exception if this type of archive cannot count the
  452. entries (such as a directory).
  453. */
  454. FZ_FUNCTION int fz_count_archive_entries() const;
  455. /** Class-aware wrapper for `::fz_has_archive_entry()`. */
  456. /**
  457. Check if entry by given name exists.
  458. If named entry does not exist 0 will be returned, if it does
  459. exist 1 is returned.
  460. name: Entry name to look for, this must be an exact match to
  461. the entry name in the archive.
  462. */
  463. FZ_FUNCTION int fz_has_archive_entry(const char *name) const;
  464. /** Class-aware wrapper for `::fz_list_archive_entry()`. */
  465. /**
  466. Get listed name of entry position idx.
  467. idx: Must be a value >= 0 < return value from
  468. fz_count_archive_entries. If not in range NULL will be
  469. returned.
  470. May throw an exception if this type of archive cannot list the
  471. entries (such as a directory).
  472. */
  473. FZ_FUNCTION const char *fz_list_archive_entry(int idx) const;
  474. /** Class-aware wrapper for `::fz_mount_multi_archive()`. */
  475. /**
  476. Add an archive to the set of archives handled by a multi
  477. archive.
  478. If path is NULL, then the archive contents will appear at the
  479. top level, otherwise, the archives contents will appear prefixed
  480. by path.
  481. */
  482. FZ_FUNCTION void fz_mount_multi_archive(const FzArchive& sub, const char *path) const;
  483. /** Class-aware wrapper for `::fz_open_archive_entry()`. */
  484. /**
  485. Opens an archive entry as a stream.
  486. name: Entry name to look for, this must be an exact match to
  487. the entry name in the archive.
  488. Throws an exception if a matching entry cannot be found.
  489. */
  490. FZ_FUNCTION FzStream fz_open_archive_entry(const char *name) const;
  491. /** Class-aware wrapper for `::fz_parse_xml_archive_entry()`. */
  492. /**
  493. Parse the contents of an archive entry into a tree of xml nodes.
  494. preserve_white: whether to keep or delete all-whitespace nodes.
  495. */
  496. FZ_FUNCTION FzXml fz_parse_xml_archive_entry(const char *filename, int preserve_white) const;
  497. /** Class-aware wrapper for `::fz_read_archive_entry()`. */
  498. /**
  499. Reads all bytes in an archive entry
  500. into a buffer.
  501. name: Entry name to look for, this must be an exact match to
  502. the entry name in the archive.
  503. Throws an exception if a matching entry cannot be found.
  504. */
  505. FZ_FUNCTION FzBuffer fz_read_archive_entry(const char *name) const;
  506. /** Class-aware wrapper for `::fz_tree_archive_add_buffer()`. */
  507. /**
  508. Add a named buffer to an existing tree archive.
  509. The tree will take a new reference to the buffer. Ownership
  510. is not transferred.
  511. */
  512. FZ_FUNCTION void fz_tree_archive_add_buffer(const char *name, const FzBuffer& buf) const;
  513. /** Class-aware wrapper for `::fz_tree_archive_add_data()`. */
  514. /**
  515. Add a named block of data to an existing tree archive.
  516. The data will be copied into a buffer, and so the caller
  517. may free it as soon as this returns.
  518. */
  519. FZ_FUNCTION void fz_tree_archive_add_data(const char *name, const void *data, size_t size) const;
  520. /** Class-aware wrapper for `::fz_try_open_archive_entry()`. */
  521. /**
  522. Opens an archive entry as a stream.
  523. Returns NULL if a matching entry cannot be found, otherwise
  524. behaves exactly as fz_open_archive_entry.
  525. */
  526. FZ_FUNCTION FzStream fz_try_open_archive_entry(const char *name) const;
  527. /** Class-aware wrapper for `::fz_try_parse_xml_archive_entry()`. */
  528. /**
  529. Try and parse the contents of an archive entry into a tree of xml nodes.
  530. preserve_white: whether to keep or delete all-whitespace nodes.
  531. Will return NULL if the archive entry can't be found. Otherwise behaves
  532. the same as fz_parse_xml_archive_entry. May throw exceptions.
  533. */
  534. FZ_FUNCTION FzXml fz_try_parse_xml_archive_entry(const char *filename, int preserve_white) const;
  535. /** Class-aware wrapper for `::fz_try_read_archive_entry()`. */
  536. /**
  537. Reads all bytes in an archive entry
  538. into a buffer.
  539. name: Entry name to look for, this must be an exact match to
  540. the entry name in the archive.
  541. Returns NULL if a matching entry cannot be found. Otherwise behaves
  542. the same as fz_read_archive_entry. Exceptions may be thrown.
  543. */
  544. FZ_FUNCTION FzBuffer fz_try_read_archive_entry(const char *name) const;
  545. /** Constructor using raw copy of pre-existing `::fz_archive`. */
  546. /* This constructor is marked as `explicit` because wrapper classes do not
  547. call `keep`in constructors, but do call `drop` in destructors. So
  548. automatic construction from a fz_archive* will generally cause an
  549. unbalanced `drop` resulting in errors such as SEGV. */
  550. FZ_FUNCTION explicit FzArchive(::fz_archive* internal);
  551. /** Destructor using fz_drop_archive(). */
  552. FZ_FUNCTION ~FzArchive();
  553. /** Return numerical value of .m_internal; helps with Python debugging. */
  554. FZ_FUNCTION long long m_internal_value();
  555. /** Return true iff `m_internal` is not null. */
  556. FZ_FUNCTION operator bool();
  557. /* == Member data. */
  558. /** Pointer to wrapped data. */
  559. ::fz_archive* m_internal;
  560. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  561. generate code regardless so we always need to have this available. */
  562. FZ_DATA static int s_num_instances;
  563. };
  564. /** Wrapper class for struct `fz_archive_handler`. Not copyable or assignable. */
  565. struct FzArchiveHandler
  566. {
  567. /** Default constructor, sets `m_internal` to null. */
  568. FZ_FUNCTION FzArchiveHandler();
  569. /* == Methods. */
  570. /** Class-aware wrapper for `::fz_register_archive_handler()`. */
  571. FZ_FUNCTION void fz_register_archive_handler() const;
  572. /** Constructor using raw copy of pre-existing `::fz_archive_handler`. */
  573. FZ_FUNCTION FzArchiveHandler(::fz_archive_handler* internal);
  574. #ifndef NDEBUG
  575. /** Destructor only decrements s_num_instances. */
  576. FZ_FUNCTION ~FzArchiveHandler();
  577. #else
  578. /** We use default destructor. */
  579. #endif
  580. /** Return numerical value of .m_internal; helps with Python debugging. */
  581. FZ_FUNCTION long long m_internal_value();
  582. /** Return true iff `m_internal` is not null. */
  583. FZ_FUNCTION operator bool();
  584. /* == Member data. */
  585. /** Pointer to wrapped data. */
  586. ::fz_archive_handler* m_internal;
  587. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  588. generate code regardless so we always need to have this available. */
  589. FZ_DATA static int s_num_instances;
  590. private:
  591. /** This class is not copyable or assignable. */
  592. FzArchiveHandler(const FzArchiveHandler& rhs);
  593. FzArchiveHandler& operator=(const FzArchiveHandler& rhs);
  594. };
  595. /** Wrapper class for struct `fz_archive_handler_context`. Not copyable or assignable. */
  596. struct FzArchiveHandlerContext
  597. {
  598. /** Default constructor, sets `m_internal` to null. */
  599. FZ_FUNCTION FzArchiveHandlerContext();
  600. /** Constructor using raw copy of pre-existing `::fz_archive_handler_context`. */
  601. FZ_FUNCTION FzArchiveHandlerContext(::fz_archive_handler_context* internal);
  602. #ifndef NDEBUG
  603. /** Destructor only decrements s_num_instances. */
  604. FZ_FUNCTION ~FzArchiveHandlerContext();
  605. #else
  606. /** We use default destructor. */
  607. #endif
  608. /** Return numerical value of .m_internal; helps with Python debugging. */
  609. FZ_FUNCTION long long m_internal_value();
  610. /** Return true iff `m_internal` is not null. */
  611. FZ_FUNCTION operator bool();
  612. /* == Member data. */
  613. /** Pointer to wrapped data. */
  614. ::fz_archive_handler_context* m_internal;
  615. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  616. generate code regardless so we always need to have this available. */
  617. FZ_DATA static int s_num_instances;
  618. private:
  619. /** This class is not copyable or assignable. */
  620. FzArchiveHandlerContext(const FzArchiveHandlerContext& rhs);
  621. FzArchiveHandlerContext& operator=(const FzArchiveHandlerContext& rhs);
  622. };
  623. /** Wrapper class for struct `fz_band_writer`. Not copyable or assignable. */
  624. /**
  625. fz_band_writer
  626. */
  627. struct FzBandWriter
  628. {
  629. /* We use these enums to support construction via all the relevant MuPDF functions. */
  630. enum Cm
  631. {
  632. MONO,
  633. COLOR,
  634. };
  635. enum P
  636. {
  637. PNG,
  638. PNM,
  639. PAM,
  640. PBM,
  641. PKM,
  642. PS,
  643. PSD,
  644. };
  645. /** == Constructors. */
  646. /** Constructor using `fz_new_band_writer_of_size()`. */
  647. FZ_FUNCTION FzBandWriter(size_t size, const FzOutput& out);
  648. /** Constructor using `fz_new_color_pcl_band_writer()`. */
  649. /**
  650. Create a new band writer, outputting color pcl.
  651. */
  652. /* Disabled because same args as fz_new_mono_pcl_band_writer.
  653. FZ_FUNCTION FzBandWriter(const FzOutput& out, const FzPclOptions& options);
  654. */
  655. /** Constructor using `fz_new_mono_pcl_band_writer()`. */
  656. /**
  657. Create a new band writer, outputting monochrome pcl.
  658. */
  659. FZ_FUNCTION FzBandWriter(const FzOutput& out, const FzPclOptions& options);
  660. /** Constructor using `fz_new_mono_pwg_band_writer()`. */
  661. /**
  662. Create a new monochrome pwg band writer.
  663. */
  664. FZ_FUNCTION FzBandWriter(const FzOutput& out, FzPwgOptions& pwg);
  665. /** Constructor using `fz_new_pam_band_writer()`. */
  666. /**
  667. Create a band writer targeting pnm (greyscale, rgb or cmyk,
  668. with or without alpha).
  669. */
  670. /* Disabled because same args as fz_new_png_band_writer.
  671. FZ_FUNCTION FzBandWriter(const FzOutput& out);
  672. */
  673. /** Constructor using `fz_new_pbm_band_writer()`. */
  674. /**
  675. Create a new band writer, targeting pbm.
  676. */
  677. /* Disabled because same args as fz_new_png_band_writer.
  678. FZ_FUNCTION FzBandWriter(const FzOutput& out);
  679. */
  680. /** Constructor using `fz_new_pclm_band_writer()`. */
  681. /**
  682. Create a new band writer, outputting pclm
  683. */
  684. FZ_FUNCTION FzBandWriter(const FzOutput& out, const FzPclmOptions& options);
  685. /** Constructor using `fz_new_pdfocr_band_writer()`. */
  686. /**
  687. Create a new band writer, outputting pdfocr.
  688. Ownership of output stays with the caller, the band writer
  689. borrows the reference. The caller must keep the output around
  690. for the duration of the band writer, and then close/drop as
  691. appropriate.
  692. */
  693. FZ_FUNCTION FzBandWriter(const FzOutput& out, FzPdfocrOptions& options);
  694. /** Constructor using `fz_new_pkm_band_writer()`. */
  695. /**
  696. Create a new pkm band writer for CMYK pixmaps.
  697. */
  698. /* Disabled because same args as fz_new_png_band_writer.
  699. FZ_FUNCTION FzBandWriter(const FzOutput& out);
  700. */
  701. /** Constructor using `fz_new_png_band_writer()`. */
  702. /**
  703. Create a new png band writer (greyscale or RGB, with or without
  704. alpha).
  705. */
  706. FZ_FUNCTION FzBandWriter(const FzOutput& out);
  707. /** Constructor using `fz_new_pnm_band_writer()`. */
  708. /**
  709. Create a band writer targeting pnm (greyscale or rgb, no
  710. alpha).
  711. */
  712. /* Disabled because same args as fz_new_png_band_writer.
  713. FZ_FUNCTION FzBandWriter(const FzOutput& out);
  714. */
  715. /** Constructor using `fz_new_ps_band_writer()`. */
  716. /**
  717. Create a postscript band writer for gray, rgb, or cmyk, no
  718. alpha.
  719. */
  720. /* Disabled because same args as fz_new_png_band_writer.
  721. FZ_FUNCTION FzBandWriter(const FzOutput& out);
  722. */
  723. /** Constructor using `fz_new_psd_band_writer()`. */
  724. /**
  725. Open a PSD band writer.
  726. */
  727. /* Disabled because same args as fz_new_png_band_writer.
  728. FZ_FUNCTION FzBandWriter(const FzOutput& out);
  729. */
  730. /** Constructor using `fz_new_pwg_band_writer()`. */
  731. /**
  732. Create a new color pwg band writer.
  733. */
  734. /* Disabled because same args as fz_new_mono_pwg_band_writer.
  735. FZ_FUNCTION FzBandWriter(const FzOutput& out, FzPwgOptions& pwg);
  736. */
  737. /** Constructor using fz_new_mono_pcl_band_writer() or fz_new_color_pcl_band_writer(). */
  738. FZ_FUNCTION FzBandWriter(FzOutput& out, Cm cm, const FzPclOptions& options);
  739. /** Constructor using fz_new_p*_band_writer(). */
  740. FZ_FUNCTION FzBandWriter(FzOutput& out, P p);
  741. /** Constructor using fz_new_mono_pwg_band_writer() or fz_new_pwg_band_writer(). */
  742. FZ_FUNCTION FzBandWriter(FzOutput& out, Cm cm, const FzPwgOptions& options);
  743. /** Default constructor, sets `m_internal` to null. */
  744. FZ_FUNCTION FzBandWriter();
  745. /* == Methods. */
  746. /** Class-aware wrapper for `::fz_close_band_writer()`. */
  747. /**
  748. Finishes up the output and closes the band writer. After this
  749. call no more headers or bands may be written.
  750. */
  751. FZ_FUNCTION void fz_close_band_writer() const;
  752. /** Class-aware wrapper for `::fz_pdfocr_band_writer_set_progress()`. */
  753. /**
  754. Set the progress callback for a pdfocr bandwriter.
  755. */
  756. FZ_FUNCTION void fz_pdfocr_band_writer_set_progress(::fz_pdfocr_progress_fn *progress_fn, void *progress_arg) const;
  757. /** Class-aware wrapper for `::fz_write_band()`. */
  758. /**
  759. Cause a band writer to write the next band
  760. of data for an image.
  761. stride: The byte offset from the first byte of the data
  762. for a pixel to the first byte of the data for the same pixel
  763. on the row below.
  764. band_height: The number of lines in this band.
  765. samples: Pointer to first byte of the data.
  766. */
  767. FZ_FUNCTION void fz_write_band(int stride, int band_height, const unsigned char *samples) const;
  768. /** Class-aware wrapper for `::fz_write_header()`. */
  769. /**
  770. Cause a band writer to write the header for
  771. a banded image with the given properties/dimensions etc. This
  772. also configures the bandwriter for the format of the data to be
  773. passed in future calls.
  774. w, h: Width and Height of the entire page.
  775. n: Number of components (including spots and alphas).
  776. alpha: Number of alpha components.
  777. xres, yres: X and Y resolutions in dpi.
  778. cs: Colorspace (NULL for bitmaps)
  779. seps: Separation details (or NULL).
  780. */
  781. FZ_FUNCTION void fz_write_header(int w, int h, int n, int alpha, int xres, int yres, int pagenum, const FzColorspace& cs, const FzSeparations& seps) const;
  782. /** Constructor using raw copy of pre-existing `::fz_band_writer`. */
  783. FZ_FUNCTION FzBandWriter(::fz_band_writer* internal);
  784. /** Destructor using fz_drop_band_writer(). */
  785. FZ_FUNCTION ~FzBandWriter();
  786. /** Return numerical value of .m_internal; helps with Python debugging. */
  787. FZ_FUNCTION long long m_internal_value();
  788. /** Return true iff `m_internal` is not null. */
  789. FZ_FUNCTION operator bool();
  790. /* == Member data. */
  791. /** Pointer to wrapped data. */
  792. ::fz_band_writer* m_internal;
  793. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  794. generate code regardless so we always need to have this available. */
  795. FZ_DATA static int s_num_instances;
  796. private:
  797. /** This class is not copyable or assignable. */
  798. FzBandWriter(const FzBandWriter& rhs);
  799. FzBandWriter& operator=(const FzBandWriter& rhs);
  800. };
  801. /** Wrapper class for struct `fz_bitmap`. */
  802. /**
  803. Bitmaps have 1 bit per component. Only used for creating
  804. halftoned versions of contone buffers, and saving out. Samples
  805. are stored msb first, akin to pbms.
  806. The internals of this struct are considered implementation
  807. details and subject to change. Where possible, accessor
  808. functions should be used in preference.
  809. */
  810. struct FzBitmap
  811. {
  812. /** == Constructors. */
  813. /** Constructor using `fz_new_bitmap()`. */
  814. /**
  815. Create a new bitmap.
  816. w, h: Width and Height for the bitmap
  817. n: Number of color components (assumed to be a divisor of 8)
  818. xres, yres: X and Y resolutions (in pixels per inch).
  819. Returns pointer to created bitmap structure. The bitmap
  820. data is uninitialised.
  821. */
  822. FZ_FUNCTION FzBitmap(int w, int h, int n, int xres, int yres);
  823. /** Constructor using `fz_new_bitmap_from_image()`. */
  824. /**
  825. Make a bitmap from a pixmap and a halftone.
  826. img: The image to generate from. Currently must be a single
  827. color component with no alpha.
  828. ht: The halftone to use. NULL implies the default halftone.
  829. Returns the resultant bitmap. Throws exceptions in the case of
  830. failure to allocate.
  831. */
  832. FZ_FUNCTION FzBitmap(const FzImage& img, const FzHalftone& ht);
  833. /** Constructor using `fz_new_bitmap_from_pixmap()`. */
  834. /**
  835. Make a bitmap from a pixmap and a halftone.
  836. pix: The pixmap to generate from. Currently must be a single
  837. color component with no alpha.
  838. ht: The halftone to use. NULL implies the default halftone.
  839. Returns the resultant bitmap. Throws exceptions in the case of
  840. failure to allocate.
  841. */
  842. FZ_FUNCTION FzBitmap(const FzPixmap& pix, const FzHalftone& ht);
  843. /** Constructor using `fz_new_bitmap_from_pixmap_band()`. */
  844. /**
  845. Make a bitmap from a pixmap and a
  846. halftone, allowing for the position of the pixmap within an
  847. overall banded rendering.
  848. pix: The pixmap to generate from. Currently must be a single
  849. color component with no alpha.
  850. ht: The halftone to use. NULL implies the default halftone.
  851. band_start: Vertical offset within the overall banded rendering
  852. (in pixels)
  853. Returns the resultant bitmap. Throws exceptions in the case of
  854. failure to allocate.
  855. */
  856. FZ_FUNCTION FzBitmap(const FzPixmap& pix, const FzHalftone& ht, int band_start);
  857. /** Copy constructor using `fz_keep_bitmap()`. */
  858. FZ_FUNCTION FzBitmap(const FzBitmap& rhs);
  859. /** operator= using `fz_keep_bitmap()` and `fz_drop_bitmap()`. */
  860. FZ_FUNCTION FzBitmap& operator=(const FzBitmap& rhs);
  861. /** Default constructor, sets `m_internal` to null. */
  862. FZ_FUNCTION FzBitmap();
  863. /* == Methods. */
  864. /** Class-aware wrapper for `::fz_bitmap_details()`.
  865. This method has out-params. Python/C# wrappers look like:
  866. `fz_bitmap_details()` => `(int w, int h, int n, int stride)`
  867. */
  868. /**
  869. Retrieve details of a given bitmap.
  870. bitmap: The bitmap to query.
  871. w: Pointer to storage to retrieve width (or NULL).
  872. h: Pointer to storage to retrieve height (or NULL).
  873. n: Pointer to storage to retrieve number of color components (or
  874. NULL).
  875. stride: Pointer to storage to retrieve bitmap stride (or NULL).
  876. */
  877. FZ_FUNCTION void fz_bitmap_details(int *w, int *h, int *n, int *stride) const;
  878. /** Class-aware wrapper for `::fz_clear_bitmap()`. */
  879. /**
  880. Set the entire bitmap to 0.
  881. Never throws exceptions.
  882. */
  883. FZ_FUNCTION void fz_clear_bitmap() const;
  884. /** Class-aware wrapper for `::fz_invert_bitmap()`. */
  885. /**
  886. Invert bitmap.
  887. Never throws exceptions.
  888. */
  889. FZ_FUNCTION void fz_invert_bitmap() const;
  890. /** Class-aware wrapper for `::fz_save_bitmap_as_pbm()`. */
  891. /**
  892. Save a bitmap as a pbm.
  893. */
  894. FZ_FUNCTION void fz_save_bitmap_as_pbm(const char *filename) const;
  895. /** Class-aware wrapper for `::fz_save_bitmap_as_pcl()`. */
  896. /**
  897. Save a bitmap as mono PCL.
  898. */
  899. FZ_FUNCTION void fz_save_bitmap_as_pcl(char *filename, int append, const FzPclOptions& pcl) const;
  900. /** Class-aware wrapper for `::fz_save_bitmap_as_pkm()`. */
  901. /**
  902. Save a CMYK bitmap as a pkm.
  903. */
  904. FZ_FUNCTION void fz_save_bitmap_as_pkm(const char *filename) const;
  905. /** Class-aware wrapper for `::fz_save_bitmap_as_pwg()`. */
  906. /**
  907. Save a bitmap as a PWG.
  908. */
  909. FZ_FUNCTION void fz_save_bitmap_as_pwg(char *filename, int append, FzPwgOptions& pwg) const;
  910. /** Constructor using raw copy of pre-existing `::fz_bitmap`. */
  911. /* This constructor is marked as `explicit` because wrapper classes do not
  912. call `keep`in constructors, but do call `drop` in destructors. So
  913. automatic construction from a fz_bitmap* will generally cause an
  914. unbalanced `drop` resulting in errors such as SEGV. */
  915. FZ_FUNCTION explicit FzBitmap(::fz_bitmap* internal);
  916. /* == Accessors to members of ::fz_bitmap m_internal. */
  917. FZ_FUNCTION int refs();
  918. FZ_FUNCTION int w();
  919. FZ_FUNCTION int h();
  920. FZ_FUNCTION int stride();
  921. FZ_FUNCTION int n();
  922. FZ_FUNCTION int xres();
  923. FZ_FUNCTION int yres();
  924. FZ_FUNCTION const unsigned char *samples();
  925. /** Destructor using fz_drop_bitmap(). */
  926. FZ_FUNCTION ~FzBitmap();
  927. /** Return numerical value of .m_internal; helps with Python debugging. */
  928. FZ_FUNCTION long long m_internal_value();
  929. /** Return true iff `m_internal` is not null. */
  930. FZ_FUNCTION operator bool();
  931. /* == Member data. */
  932. /** Pointer to wrapped data. */
  933. ::fz_bitmap* m_internal;
  934. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  935. generate code regardless so we always need to have this available. */
  936. FZ_DATA static int s_num_instances;
  937. };
  938. /** Wrapper class for struct `fz_buffer`. */
  939. /**
  940. fz_buffer is a wrapper around a dynamically allocated array of
  941. bytes.
  942. Buffers have a capacity (the number of bytes storage immediately
  943. available) and a current size.
  944. The contents of the structure are considered implementation
  945. details and are subject to change. Users should use the accessor
  946. functions in preference.
  947. */
  948. struct FzBuffer
  949. {
  950. /** == Constructors. */
  951. /** Constructor using `fz_new_buffer()`. */
  952. FZ_FUNCTION FzBuffer(size_t capacity);
  953. /** Constructor using `fz_new_buffer_from_base64()`. */
  954. /**
  955. Create a new buffer with data decoded from a base64 input string.
  956. */
  957. FZ_FUNCTION FzBuffer(const char *data, size_t size);
  958. /** Constructor using `fz_new_buffer_from_data()`. */
  959. /**
  960. Create a new buffer with existing data.
  961. data: Pointer to existing data.
  962. size: Size of existing data.
  963. Takes ownership of data. Does not make a copy. Calls fz_free on
  964. the data when the buffer is deallocated. Do not use 'data' after
  965. passing to this function.
  966. Returns pointer to new buffer. Throws exception on allocation
  967. failure.
  968. */
  969. FZ_FUNCTION FzBuffer(unsigned char *data, size_t size);
  970. /** Constructor using `fz_new_buffer_from_display_list()`. */
  971. FZ_FUNCTION FzBuffer(const FzDisplayList& list, FzStextOptions& options);
  972. /** Constructor using `fz_new_buffer_from_image_as_jpeg()`. */
  973. FZ_FUNCTION FzBuffer(const FzImage& image, const FzColorParams& color_params, int quality, int invert_cmyk);
  974. /** Constructor using `fz_new_buffer_from_image_as_jpx()`. */
  975. FZ_FUNCTION FzBuffer(const FzImage& image, const FzColorParams& color_params, int quality);
  976. /** Constructor using `fz_new_buffer_from_image_as_png()`. */
  977. /**
  978. Re-encode a given image as a PNG into a buffer.
  979. Ownership of the buffer is returned.
  980. */
  981. FZ_FUNCTION FzBuffer(const FzImage& image, const FzColorParams& color_params);
  982. /** Constructor using `fz_new_buffer_from_page()`. */
  983. FZ_FUNCTION FzBuffer(const FzPage& page, FzStextOptions& options);
  984. /** Constructor using `fz_new_buffer_from_page_number()`. */
  985. FZ_FUNCTION FzBuffer(const FzDocument& doc, int number, FzStextOptions& options);
  986. /** Constructor using `fz_new_buffer_from_page_with_format()`. */
  987. /**
  988. Returns an fz_buffer containing a page after conversion to specified format.
  989. page: The page to convert.
  990. format, options: Passed to fz_new_document_writer_with_output() internally.
  991. transform, cookie: Passed to fz_run_page() internally.
  992. */
  993. FZ_FUNCTION FzBuffer(const FzPage& page, const char *format, const char *options, const FzMatrix& transform, FzCookie& cookie);
  994. /** Constructor using `fz_new_buffer_from_pixmap_as_jpeg()`. */
  995. FZ_FUNCTION FzBuffer(const FzPixmap& pixmap, const FzColorParams& color_params, int quality, int invert_cmyk);
  996. /** Constructor using `fz_new_buffer_from_pixmap_as_jpx()`. */
  997. FZ_FUNCTION FzBuffer(const FzPixmap& pix, const FzColorParams& color_params, int quality);
  998. /** Constructor using `fz_new_buffer_from_pixmap_as_png()`. */
  999. /**
  1000. Re-encode a given pixmap as a PNG into a buffer.
  1001. Ownership of the buffer is returned.
  1002. */
  1003. FZ_FUNCTION FzBuffer(const FzPixmap& pixmap, const FzColorParams& color_params);
  1004. /** Constructor using `fz_new_buffer_from_shared_data()`. */
  1005. /**
  1006. Like fz_new_buffer, but does not take ownership.
  1007. */
  1008. FZ_FUNCTION FzBuffer(const unsigned char *data, size_t size);
  1009. /** Constructor using `fz_new_buffer_from_stext_page()`. */
  1010. /**
  1011. Convert structured text into plain text.
  1012. */
  1013. FZ_FUNCTION FzBuffer(const FzStextPage& text);
  1014. /** Constructor using `fz_read_file()`. */
  1015. /**
  1016. Read all the contents of a file into a buffer.
  1017. */
  1018. FZ_FUNCTION FzBuffer(const char *filename);
  1019. /** Copy constructor using `fz_keep_buffer()`. */
  1020. FZ_FUNCTION FzBuffer(const FzBuffer& rhs);
  1021. /** operator= using `fz_keep_buffer()` and `fz_drop_buffer()`. */
  1022. FZ_FUNCTION FzBuffer& operator=(const FzBuffer& rhs);
  1023. /* == Static methods. */
  1024. /** Class-aware wrapper for `::fz_new_buffer_from_copied_data()`. */
  1025. /**
  1026. Create a new buffer containing a copy of the passed data.
  1027. */
  1028. FZ_FUNCTION static FzBuffer fz_new_buffer_from_copied_data(const unsigned char *data, size_t size);
  1029. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pbm()`. */
  1030. FZ_FUNCTION static FzBuffer fz_new_buffer_from_image_as_pbm(const FzImage& image, const FzColorParams& color_params);
  1031. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pkm()`. */
  1032. FZ_FUNCTION static FzBuffer fz_new_buffer_from_image_as_pkm(const FzImage& image, const FzColorParams& color_params);
  1033. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pnm()`. */
  1034. FZ_FUNCTION static FzBuffer fz_new_buffer_from_image_as_pnm(const FzImage& image, const FzColorParams& color_params);
  1035. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pam()`. */
  1036. FZ_FUNCTION static FzBuffer fz_new_buffer_from_image_as_pam(const FzImage& image, const FzColorParams& color_params);
  1037. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_psd()`. */
  1038. FZ_FUNCTION static FzBuffer fz_new_buffer_from_image_as_psd(const FzImage& image, const FzColorParams& color_params);
  1039. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pbm()`. */
  1040. FZ_FUNCTION static FzBuffer fz_new_buffer_from_pixmap_as_pbm(const FzPixmap& pixmap, const FzColorParams& color_params);
  1041. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pkm()`. */
  1042. FZ_FUNCTION static FzBuffer fz_new_buffer_from_pixmap_as_pkm(const FzPixmap& pixmap, const FzColorParams& color_params);
  1043. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pnm()`. */
  1044. FZ_FUNCTION static FzBuffer fz_new_buffer_from_pixmap_as_pnm(const FzPixmap& pixmap, const FzColorParams& color_params);
  1045. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pam()`. */
  1046. FZ_FUNCTION static FzBuffer fz_new_buffer_from_pixmap_as_pam(const FzPixmap& pixmap, const FzColorParams& color_params);
  1047. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_psd()`. */
  1048. FZ_FUNCTION static FzBuffer fz_new_buffer_from_pixmap_as_psd(const FzPixmap& pix, const FzColorParams& color_params);
  1049. /* == Methods. */
  1050. /** Class-aware wrapper for `::fz_append_base64()`. */
  1051. /**
  1052. Write a base64 encoded data block, optionally with periodic newlines.
  1053. */
  1054. FZ_FUNCTION void fz_append_base64(const unsigned char *data, size_t size, int newline) const;
  1055. /** Class-aware wrapper for `::fz_append_base64_buffer()`. */
  1056. /**
  1057. Append a base64 encoded fz_buffer, optionally with periodic newlines.
  1058. */
  1059. FZ_FUNCTION void fz_append_base64_buffer(const FzBuffer& data, int newline) const;
  1060. /** Class-aware wrapper for `::fz_append_bits()`. */
  1061. FZ_FUNCTION void fz_append_bits(int value, int count) const;
  1062. /** Class-aware wrapper for `::fz_append_bits_pad()`. */
  1063. FZ_FUNCTION void fz_append_bits_pad() const;
  1064. /** Class-aware wrapper for `::fz_append_buffer()`. */
  1065. /**
  1066. Append the contents of the source buffer onto the end of the
  1067. destination buffer, extending automatically as required.
  1068. Ownership of buffers does not change.
  1069. */
  1070. FZ_FUNCTION void fz_append_buffer(const FzBuffer& source) const;
  1071. /** Class-aware wrapper for `::fz_append_byte()`. */
  1072. FZ_FUNCTION void fz_append_byte(int c) const;
  1073. /** Class-aware wrapper for `::fz_append_data()`. */
  1074. /**
  1075. fz_append_*: Append data to a buffer.
  1076. The buffer will automatically grow as required.
  1077. */
  1078. FZ_FUNCTION void fz_append_data(const void *data, size_t len) const;
  1079. /** Class-aware wrapper for `::fz_append_image_as_data_uri()`. */
  1080. FZ_FUNCTION void fz_append_image_as_data_uri(const FzImage& image) const;
  1081. /** Class-aware wrapper for `::fz_append_int16_be()`. */
  1082. FZ_FUNCTION void fz_append_int16_be(int x) const;
  1083. /** Class-aware wrapper for `::fz_append_int16_le()`. */
  1084. FZ_FUNCTION void fz_append_int16_le(int x) const;
  1085. /** Class-aware wrapper for `::fz_append_int32_be()`. */
  1086. FZ_FUNCTION void fz_append_int32_be(int x) const;
  1087. /** Class-aware wrapper for `::fz_append_int32_le()`. */
  1088. FZ_FUNCTION void fz_append_int32_le(int x) const;
  1089. /** Class-aware wrapper for `::fz_append_json()`. */
  1090. FZ_FUNCTION void fz_append_json(const FzJson& value) const;
  1091. /** Class-aware wrapper for `::fz_append_pdf_string()`. */
  1092. /**
  1093. fz_append_pdf_string: Append a string with PDF syntax quotes and
  1094. escapes.
  1095. The buffer will automatically grow as required.
  1096. */
  1097. FZ_FUNCTION void fz_append_pdf_string(const char *text) const;
  1098. /** Class-aware wrapper for `::fz_append_pixmap_as_data_uri()`. */
  1099. FZ_FUNCTION void fz_append_pixmap_as_data_uri(const FzPixmap& pixmap) const;
  1100. /** Class-aware wrapper for `::fz_append_rune()`. */
  1101. FZ_FUNCTION void fz_append_rune(int c) const;
  1102. /** Class-aware wrapper for `::fz_append_string()`. */
  1103. FZ_FUNCTION void fz_append_string(const char *data) const;
  1104. /** Class-aware wrapper for `::fz_append_vprintf()`. */
  1105. /**
  1106. fz_append_vprintf: Format and append data to buffer using
  1107. printf-like formatting with varargs (see fz_vsnprintf).
  1108. */
  1109. FZ_FUNCTION void fz_append_vprintf(const char *fmt, va_list args) const;
  1110. /** Class-aware wrapper for `::fz_buffer_extract()`.
  1111. This method has out-params. Python/C# wrappers look like:
  1112. `fz_buffer_extract()` => `(size_t, unsigned char *data)`
  1113. */
  1114. /**
  1115. Take ownership of buffer contents.
  1116. Performs the same task as fz_buffer_storage, but ownership of
  1117. the data buffer returns with this call. The buffer is left
  1118. empty.
  1119. Note: Bad things may happen if this is called on a buffer with
  1120. multiple references that is being used from multiple threads.
  1121. data: Pointer to place to retrieve data pointer.
  1122. Returns length of stream.
  1123. */
  1124. FZ_FUNCTION size_t fz_buffer_extract(unsigned char **data) const;
  1125. /** Class-aware wrapper for `::fz_buffer_storage()`.
  1126. This method has out-params. Python/C# wrappers look like:
  1127. `fz_buffer_storage()` => `(size_t, unsigned char *datap)`
  1128. */
  1129. /**
  1130. Retrieve internal memory of buffer.
  1131. datap: Output parameter that will be pointed to the data.
  1132. Returns the current size of the data in bytes.
  1133. */
  1134. FZ_FUNCTION size_t fz_buffer_storage(unsigned char **datap) const;
  1135. /** Class-aware wrapper for `::fz_clear_buffer()`. */
  1136. /**
  1137. Empties the buffer. Storage is not freed, but is held ready
  1138. to be reused as the buffer is refilled.
  1139. Never throws exceptions.
  1140. */
  1141. FZ_FUNCTION void fz_clear_buffer() const;
  1142. /** Class-aware wrapper for `::fz_clone_buffer()`. */
  1143. /**
  1144. Make a new buffer, containing a copy of the data used in
  1145. the original.
  1146. */
  1147. FZ_FUNCTION FzBuffer fz_clone_buffer() const;
  1148. /** Class-aware wrapper for `::fz_grow_buffer()`. */
  1149. /**
  1150. Make some space within a buffer (i.e. ensure that
  1151. capacity > size).
  1152. */
  1153. FZ_FUNCTION void fz_grow_buffer() const;
  1154. /** Class-aware wrapper for `::fz_load_jbig2_globals()`. */
  1155. /**
  1156. Create a jbig2 globals record from a buffer.
  1157. Immutable once created.
  1158. */
  1159. FZ_FUNCTION FzJbig2Globals fz_load_jbig2_globals() const;
  1160. /** Class-aware wrapper for `::fz_md5_buffer()`. */
  1161. /**
  1162. Create an MD5 digest from buffer contents.
  1163. Never throws exceptions.
  1164. */
  1165. FZ_FUNCTION void fz_md5_buffer(unsigned char digest[16]) const;
  1166. /** Class-aware wrapper for `::fz_new_display_list_from_svg()`.
  1167. This method has out-params. Python/C# wrappers look like:
  1168. `fz_new_display_list_from_svg(const char *base_uri, ::fz_archive *dir)` => `(fz_display_list *, float w, float h)`
  1169. */
  1170. /**
  1171. Parse an SVG document into a display-list.
  1172. */
  1173. FZ_FUNCTION FzDisplayList fz_new_display_list_from_svg(const char *base_uri, const FzArchive& dir, float *w, float *h) const;
  1174. /** Class-aware wrapper for `::fz_new_image_from_buffer()`. */
  1175. /**
  1176. Create a new image from a
  1177. buffer of data, inferring its type from the format
  1178. of the data.
  1179. */
  1180. FZ_FUNCTION FzImage fz_new_image_from_buffer() const;
  1181. /** Class-aware wrapper for `::fz_new_image_from_svg()`. */
  1182. /**
  1183. Create a scalable image from an SVG document.
  1184. */
  1185. FZ_FUNCTION FzImage fz_new_image_from_svg(const char *base_uri, const FzArchive& dir) const;
  1186. /** Class-aware wrapper for `::fz_open_buffer()`. */
  1187. /**
  1188. Open a buffer as a stream.
  1189. buf: The buffer to open. Ownership of the buffer is NOT passed
  1190. in (this function takes its own reference).
  1191. Returns pointer to newly created stream. May throw exceptions on
  1192. failure to allocate.
  1193. */
  1194. FZ_FUNCTION FzStream fz_open_buffer() const;
  1195. /** Class-aware wrapper for `::fz_parse_xml()`. */
  1196. /**
  1197. Parse the contents of buffer into a tree of xml nodes.
  1198. preserve_white: whether to keep or delete all-whitespace nodes.
  1199. */
  1200. FZ_FUNCTION FzXml fz_parse_xml(int preserve_white) const;
  1201. /** Class-aware wrapper for `::fz_parse_xml_from_html5()`. */
  1202. /**
  1203. Parse the contents of a buffer into a tree of XML nodes,
  1204. using the HTML5 parsing algorithm.
  1205. */
  1206. FZ_FUNCTION FzXml fz_parse_xml_from_html5() const;
  1207. /** Class-aware wrapper for `::fz_resize_buffer()`. */
  1208. /**
  1209. Ensure that a buffer has a given capacity,
  1210. truncating data if required.
  1211. capacity: The desired capacity for the buffer. If the current
  1212. size of the buffer contents is smaller than capacity, it is
  1213. truncated.
  1214. */
  1215. FZ_FUNCTION void fz_resize_buffer(size_t capacity) const;
  1216. /** Class-aware wrapper for `::fz_save_buffer()`. */
  1217. /**
  1218. Save the contents of a buffer to a file.
  1219. */
  1220. FZ_FUNCTION void fz_save_buffer(const char *filename) const;
  1221. /** Class-aware wrapper for `::fz_slice_buffer()`. */
  1222. /**
  1223. Create a new buffer with a (subset of) the data from the buffer.
  1224. start: if >= 0, offset from start of buffer, if < 0 offset from end of buffer.
  1225. end: if >= 0, offset from start of buffer, if < 0 offset from end of buffer.
  1226. */
  1227. FZ_FUNCTION FzBuffer fz_slice_buffer(int64_t start, int64_t end) const;
  1228. /** Class-aware wrapper for `::fz_string_from_buffer()`. */
  1229. /**
  1230. Ensure that a buffer's data ends in a
  1231. 0 byte, and return a pointer to it.
  1232. */
  1233. FZ_FUNCTION const char *fz_string_from_buffer() const;
  1234. /** Class-aware wrapper for `::fz_subset_cff_for_gids()`.
  1235. This method has out-params. Python/C# wrappers look like:
  1236. `fz_subset_cff_for_gids(int num_gids, int symbolic, int cidfont)` => `(fz_buffer *, int gids)`
  1237. */
  1238. FZ_FUNCTION FzBuffer fz_subset_cff_for_gids(int *gids, int num_gids, int symbolic, int cidfont) const;
  1239. /** Class-aware wrapper for `::fz_subset_ttf_for_gids()`.
  1240. This method has out-params. Python/C# wrappers look like:
  1241. `fz_subset_ttf_for_gids(int num_gids, int symbolic, int cidfont)` => `(fz_buffer *, int gids)`
  1242. */
  1243. FZ_FUNCTION FzBuffer fz_subset_ttf_for_gids(int *gids, int num_gids, int symbolic, int cidfont) const;
  1244. /** Class-aware wrapper for `::fz_terminate_buffer()`. */
  1245. /**
  1246. Zero-terminate buffer in order to use as a C string.
  1247. This byte is invisible and does not affect the length of the
  1248. buffer as returned by fz_buffer_storage. The zero byte is
  1249. written *after* the data, and subsequent writes will overwrite
  1250. the terminating byte.
  1251. Subsequent changes to the size of the buffer (such as by
  1252. fz_buffer_trim, fz_buffer_grow, fz_resize_buffer, etc) may
  1253. invalidate this.
  1254. */
  1255. FZ_FUNCTION void fz_terminate_buffer() const;
  1256. /** Class-aware wrapper for `::fz_trim_buffer()`. */
  1257. /**
  1258. Trim wasted capacity from a buffer by resizing internal memory.
  1259. */
  1260. FZ_FUNCTION void fz_trim_buffer() const;
  1261. /** Class-aware wrapper for `::pdf_append_token()`. */
  1262. FZ_FUNCTION void pdf_append_token(int tok, const PdfLexbuf& lex) const;
  1263. /** Class-aware wrapper for `::pdf_new_buffer_processor()`. */
  1264. FZ_FUNCTION PdfProcessor pdf_new_buffer_processor(int ahxencode, int newlines) const;
  1265. /** Constructor using raw copy of pre-existing `::fz_buffer`. */
  1266. /* This constructor is marked as `explicit` because wrapper classes do not
  1267. call `keep`in constructors, but do call `drop` in destructors. So
  1268. automatic construction from a fz_buffer* will generally cause an
  1269. unbalanced `drop` resulting in errors such as SEGV. */
  1270. FZ_FUNCTION explicit FzBuffer(::fz_buffer* internal=NULL);
  1271. /** Destructor using fz_drop_buffer(). */
  1272. FZ_FUNCTION ~FzBuffer();
  1273. /** Return numerical value of .m_internal; helps with Python debugging. */
  1274. FZ_FUNCTION long long m_internal_value();
  1275. /** Return true iff `m_internal` is not null. */
  1276. FZ_FUNCTION operator bool();
  1277. /* == Member data. */
  1278. /** Pointer to wrapped data. */
  1279. ::fz_buffer* m_internal;
  1280. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1281. generate code regardless so we always need to have this available. */
  1282. FZ_DATA static int s_num_instances;
  1283. };
  1284. /** Wrapper class for struct `fz_color_params`. */
  1285. struct FzColorParams
  1286. {
  1287. /** Equivalent to fz_default_color_params. */
  1288. FZ_FUNCTION FzColorParams();
  1289. /** We use default copy constructor and operator=. */
  1290. /** Constructor using raw copy of pre-existing `::fz_color_params`. */
  1291. FZ_FUNCTION FzColorParams(const ::fz_color_params* internal);
  1292. /** Constructor using raw copy of pre-existing `::fz_color_params`. */
  1293. FZ_FUNCTION FzColorParams(const ::fz_color_params internal);
  1294. /** Access as underlying struct. */
  1295. FZ_FUNCTION ::fz_color_params* internal();
  1296. /** Access as underlying struct. */
  1297. FZ_FUNCTION const ::fz_color_params* internal() const;
  1298. #ifndef NDEBUG
  1299. /** Destructor only decrements s_num_instances. */
  1300. FZ_FUNCTION ~FzColorParams();
  1301. #else
  1302. /** We use default destructor. */
  1303. #endif
  1304. /* == Member data. */
  1305. /* These members are the same as the members of ::fz_color_params. */
  1306. uint8_t ri;
  1307. uint8_t bp;
  1308. uint8_t op;
  1309. uint8_t opm;
  1310. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1311. generate code regardless so we always need to have this available. */
  1312. FZ_DATA static int s_num_instances;
  1313. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  1314. FZ_FUNCTION std::string to_string();
  1315. /** Comparison method. */
  1316. FZ_FUNCTION bool operator==(const FzColorParams& rhs);
  1317. /** Comparison method. */
  1318. FZ_FUNCTION bool operator!=(const FzColorParams& rhs);
  1319. };
  1320. /** Wrapper class for struct `fz_colorspace`. */
  1321. /**
  1322. Describes a given colorspace.
  1323. */
  1324. struct FzColorspace
  1325. {
  1326. /* We use this enums to support construction via all the relevant MuPDF functions. */
  1327. enum Fixed
  1328. {
  1329. Fixed_GRAY,
  1330. Fixed_RGB,
  1331. Fixed_BGR,
  1332. Fixed_CMYK,
  1333. Fixed_LAB,
  1334. };
  1335. /** == Constructors. */
  1336. /** Constructor using `fz_new_cal_gray_colorspace()`. */
  1337. /**
  1338. Create a calibrated gray colorspace.
  1339. The returned reference should be dropped when it is finished
  1340. with.
  1341. Colorspaces are immutable once created.
  1342. */
  1343. FZ_FUNCTION FzColorspace(float wp[3], float bp[3], float gamma);
  1344. /** Constructor using `fz_new_cal_rgb_colorspace()`. */
  1345. /**
  1346. Create a calibrated rgb colorspace.
  1347. The returned reference should be dropped when it is finished
  1348. with.
  1349. Colorspaces are immutable once created.
  1350. */
  1351. FZ_FUNCTION FzColorspace(float wp[3], float bp[3], float gamma[3], float matrix[9]);
  1352. /** Constructor using `fz_new_colorspace()`. */
  1353. /**
  1354. Creates a new colorspace instance and returns a reference.
  1355. No internal checking is done that the colorspace type (e.g.
  1356. CMYK) matches with the flags (e.g. FZ_COLORSPACE_HAS_CMYK) or
  1357. colorant count (n) or name.
  1358. The reference should be dropped when it is finished with.
  1359. Colorspaces are immutable once created (with the exception of
  1360. setting up colorant names for separation spaces).
  1361. */
  1362. FZ_FUNCTION FzColorspace(enum fz_colorspace_type type, int flags, int n, const char *name);
  1363. /** Constructor using `fz_new_icc_colorspace()`. */
  1364. /**
  1365. Create a colorspace from an ICC profile supplied in buf.
  1366. Limited checking is done to ensure that the colorspace type is
  1367. appropriate for the supplied ICC profile.
  1368. An additional reference is taken to buf, which will be dropped
  1369. on destruction. Ownership is NOT passed in.
  1370. The returned reference should be dropped when it is finished
  1371. with.
  1372. Colorspaces are immutable once created.
  1373. */
  1374. FZ_FUNCTION FzColorspace(enum fz_colorspace_type type, int flags, const char *name, const FzBuffer& buf);
  1375. /** Constructor using `fz_new_indexed_colorspace()`. */
  1376. /**
  1377. Create an indexed colorspace.
  1378. The supplied lookup table is high palette entries long. Each
  1379. entry is n bytes long, where n is given by the number of
  1380. colorants in the base colorspace, one byte per colorant.
  1381. Ownership of lookup is passed it; it will be freed on
  1382. destruction, so must be heap allocated.
  1383. The colorspace will keep an additional reference to the base
  1384. colorspace that will be dropped on destruction.
  1385. The returned reference should be dropped when it is finished
  1386. with.
  1387. Colorspaces are immutable once created.
  1388. */
  1389. FZ_FUNCTION FzColorspace(const FzColorspace& base, int high, unsigned char *lookup);
  1390. /** Construct using one of: fz_device_gray(), fz_device_rgb(), fz_device_bgr(), fz_device_cmyk(), fz_device_lab(). */
  1391. FZ_FUNCTION FzColorspace(Fixed fixed);
  1392. /** Copy constructor using `fz_keep_colorspace()`. */
  1393. FZ_FUNCTION FzColorspace(const FzColorspace& rhs);
  1394. /** operator= using `fz_keep_colorspace()` and `fz_drop_colorspace()`. */
  1395. FZ_FUNCTION FzColorspace& operator=(const FzColorspace& rhs);
  1396. /** Default constructor, sets `m_internal` to null. */
  1397. FZ_FUNCTION FzColorspace();
  1398. /* == Methods. */
  1399. /** Class-aware wrapper for `::fz_base_colorspace()`. */
  1400. /**
  1401. Get the 'base' colorspace for a colorspace.
  1402. For indexed colorspaces, this is the colorspace the index
  1403. decodes into. For all other colorspaces, it is the colorspace
  1404. itself.
  1405. The returned colorspace is 'borrowed' (i.e. no additional
  1406. references are taken or dropped).
  1407. */
  1408. FZ_FUNCTION FzColorspace fz_base_colorspace() const;
  1409. /** Class-aware wrapper for `::fz_clamp_color()`.
  1410. This method has out-params. Python/C# wrappers look like:
  1411. `fz_clamp_color(const float *in)` => float out
  1412. */
  1413. /**
  1414. Clamp the samples in a color to the correct ranges for a
  1415. given colorspace.
  1416. */
  1417. FZ_FUNCTION void fz_clamp_color(const float *in, float *out) const;
  1418. /** Class-aware wrapper for `::fz_colorspace_colorant()`. */
  1419. /**
  1420. Retrieve a the name for a colorant.
  1421. Returns a pointer with the same lifespan as the colorspace.
  1422. */
  1423. FZ_FUNCTION const char *fz_colorspace_colorant(int n) const;
  1424. /** Class-aware wrapper for `::fz_colorspace_device_n_has_cmyk()`. */
  1425. /**
  1426. True if DeviceN color space has cyan magenta yellow or black as
  1427. one of its colorants.
  1428. */
  1429. FZ_FUNCTION int fz_colorspace_device_n_has_cmyk() const;
  1430. /** Class-aware wrapper for `::fz_colorspace_device_n_has_only_cmyk()`. */
  1431. /**
  1432. True if DeviceN color space has only colorants from the CMYK set.
  1433. */
  1434. FZ_FUNCTION int fz_colorspace_device_n_has_only_cmyk() const;
  1435. /** Class-aware wrapper for `::fz_colorspace_digest()`. */
  1436. /**
  1437. Get checksum of underlying ICC profile.
  1438. */
  1439. FZ_FUNCTION void fz_colorspace_digest(unsigned char digest[16]) const;
  1440. /** Class-aware wrapper for `::fz_colorspace_is_cmyk()`. */
  1441. FZ_FUNCTION int fz_colorspace_is_cmyk() const;
  1442. /** Class-aware wrapper for `::fz_colorspace_is_device()`. */
  1443. FZ_FUNCTION int fz_colorspace_is_device() const;
  1444. /** Class-aware wrapper for `::fz_colorspace_is_device_cmyk()`. */
  1445. FZ_FUNCTION int fz_colorspace_is_device_cmyk() const;
  1446. /** Class-aware wrapper for `::fz_colorspace_is_device_gray()`. */
  1447. FZ_FUNCTION int fz_colorspace_is_device_gray() const;
  1448. /** Class-aware wrapper for `::fz_colorspace_is_device_n()`. */
  1449. FZ_FUNCTION int fz_colorspace_is_device_n() const;
  1450. /** Class-aware wrapper for `::fz_colorspace_is_gray()`. */
  1451. /**
  1452. Tests for particular types of colorspaces
  1453. */
  1454. FZ_FUNCTION int fz_colorspace_is_gray() const;
  1455. /** Class-aware wrapper for `::fz_colorspace_is_icc()`. */
  1456. FZ_FUNCTION int fz_colorspace_is_icc() const;
  1457. /** Class-aware wrapper for `::fz_colorspace_is_indexed()`. */
  1458. FZ_FUNCTION int fz_colorspace_is_indexed() const;
  1459. /** Class-aware wrapper for `::fz_colorspace_is_lab()`. */
  1460. FZ_FUNCTION int fz_colorspace_is_lab() const;
  1461. /** Class-aware wrapper for `::fz_colorspace_is_lab_icc()`. */
  1462. FZ_FUNCTION int fz_colorspace_is_lab_icc() const;
  1463. /** Class-aware wrapper for `::fz_colorspace_is_rgb()`. */
  1464. FZ_FUNCTION int fz_colorspace_is_rgb() const;
  1465. /** Class-aware wrapper for `::fz_colorspace_is_subtractive()`. */
  1466. /**
  1467. True for CMYK, Separation and DeviceN colorspaces.
  1468. */
  1469. FZ_FUNCTION int fz_colorspace_is_subtractive() const;
  1470. /** Class-aware wrapper for `::fz_colorspace_n()`. */
  1471. /**
  1472. Query the number of colorants in a colorspace.
  1473. */
  1474. FZ_FUNCTION int fz_colorspace_n() const;
  1475. /** Class-aware wrapper for `::fz_colorspace_name()`. */
  1476. /**
  1477. Query the name of a colorspace.
  1478. The returned string has the same lifespan as the colorspace
  1479. does. Caller should not free it.
  1480. */
  1481. FZ_FUNCTION const char *fz_colorspace_name() const;
  1482. /** Class-aware wrapper for `::fz_colorspace_name_colorant()`. */
  1483. /**
  1484. Assign a name for a given colorant in a colorspace.
  1485. Used while initially setting up a colorspace. The string is
  1486. copied into local storage, so need not be retained by the
  1487. caller.
  1488. */
  1489. FZ_FUNCTION void fz_colorspace_name_colorant(int n, const char *name) const;
  1490. /** Class-aware wrapper for `::fz_colorspace_type()`. */
  1491. /**
  1492. Query the type of colorspace.
  1493. */
  1494. FZ_FUNCTION enum fz_colorspace_type fz_colorspace_type() const;
  1495. /** Class-aware wrapper for `::fz_convert_color()`.
  1496. This method has out-params. Python/C# wrappers look like:
  1497. `fz_convert_color(const float *sv, ::fz_colorspace *ds, ::fz_colorspace *is, ::fz_color_params params)` => float dv
  1498. */
  1499. /**
  1500. Convert color values sv from colorspace ss into colorvalues dv
  1501. for colorspace ds, via an optional intervening space is,
  1502. respecting the given color_params.
  1503. */
  1504. FZ_FUNCTION void fz_convert_color(const float *sv, const FzColorspace& ds, float *dv, const FzColorspace& is, const FzColorParams& params) const;
  1505. /** Class-aware wrapper for `::fz_convert_separation_colors()`.
  1506. This method has out-params. Python/C# wrappers look like:
  1507. `fz_convert_separation_colors(const float *src_color, ::fz_separations *dst_seps, ::fz_colorspace *dst_cs, ::fz_color_params color_params)` => float dst_color
  1508. */
  1509. /**
  1510. Convert a color given in terms of one colorspace,
  1511. to a color in terms of another colorspace/separations.
  1512. */
  1513. FZ_FUNCTION void fz_convert_separation_colors(const float *src_color, const FzSeparations& dst_seps, const FzColorspace& dst_cs, float *dst_color, const FzColorParams& color_params) const;
  1514. /** Class-aware wrapper for `::fz_is_valid_blend_colorspace()`. */
  1515. /**
  1516. Check to see that a colorspace is appropriate to be used as
  1517. a blending space (i.e. only grey, rgb or cmyk).
  1518. */
  1519. FZ_FUNCTION int fz_is_valid_blend_colorspace() const;
  1520. /** Class-aware wrapper for `::fz_new_indexed_colorspace()`. */
  1521. /**
  1522. Create an indexed colorspace.
  1523. The supplied lookup table is high palette entries long. Each
  1524. entry is n bytes long, where n is given by the number of
  1525. colorants in the base colorspace, one byte per colorant.
  1526. Ownership of lookup is passed it; it will be freed on
  1527. destruction, so must be heap allocated.
  1528. The colorspace will keep an additional reference to the base
  1529. colorspace that will be dropped on destruction.
  1530. The returned reference should be dropped when it is finished
  1531. with.
  1532. Colorspaces are immutable once created.
  1533. */
  1534. FZ_FUNCTION FzColorspace fz_new_indexed_colorspace(int high, unsigned char *lookup) const;
  1535. /** Class-aware wrapper for `::fz_new_pixmap()`. */
  1536. /**
  1537. Create a new pixmap, with its origin at (0,0)
  1538. cs: The colorspace to use for the pixmap, or NULL for an alpha
  1539. plane/mask.
  1540. w: The width of the pixmap (in pixels)
  1541. h: The height of the pixmap (in pixels)
  1542. seps: Details of separations.
  1543. alpha: 0 for no alpha, 1 for alpha.
  1544. Returns a pointer to the new pixmap. Throws exception on failure
  1545. to allocate.
  1546. */
  1547. FZ_FUNCTION FzPixmap fz_new_pixmap(int w, int h, const FzSeparations& seps, int alpha) const;
  1548. /** Class-aware wrapper for `::fz_new_pixmap_with_bbox()`. */
  1549. /**
  1550. Create a pixmap of a given size, location and pixel format.
  1551. The bounding box specifies the size of the created pixmap and
  1552. where it will be located. The colorspace determines the number
  1553. of components per pixel. Alpha is always present. Pixmaps are
  1554. reference counted, so drop references using fz_drop_pixmap.
  1555. colorspace: Colorspace format used for the created pixmap. The
  1556. pixmap will keep a reference to the colorspace.
  1557. bbox: Bounding box specifying location/size of created pixmap.
  1558. seps: Details of separations.
  1559. alpha: 0 for no alpha, 1 for alpha.
  1560. Returns a pointer to the new pixmap. Throws exception on failure
  1561. to allocate.
  1562. */
  1563. FZ_FUNCTION FzPixmap fz_new_pixmap_with_bbox(const FzIrect& bbox, const FzSeparations& seps, int alpha) const;
  1564. /** Class-aware wrapper for `::fz_new_pixmap_with_bbox_and_data()`. */
  1565. /**
  1566. Create a pixmap of a given size, location and pixel format,
  1567. using the supplied data block.
  1568. The bounding box specifies the size of the created pixmap and
  1569. where it will be located. The colorspace determines the number
  1570. of components per pixel. Alpha is always present. Pixmaps are
  1571. reference counted, so drop references using fz_drop_pixmap.
  1572. colorspace: Colorspace format used for the created pixmap. The
  1573. pixmap will keep a reference to the colorspace.
  1574. rect: Bounding box specifying location/size of created pixmap.
  1575. seps: Details of separations.
  1576. alpha: Number of alpha planes (0 or 1).
  1577. samples: The data block to keep the samples in.
  1578. Returns a pointer to the new pixmap. Throws exception on failure
  1579. to allocate.
  1580. */
  1581. FZ_FUNCTION FzPixmap fz_new_pixmap_with_bbox_and_data(const FzIrect& rect, const FzSeparations& seps, int alpha, unsigned char *samples) const;
  1582. /** Class-aware wrapper for `::fz_new_pixmap_with_data()`. */
  1583. /**
  1584. Create a new pixmap, with its origin at
  1585. (0,0) using the supplied data block.
  1586. cs: The colorspace to use for the pixmap, or NULL for an alpha
  1587. plane/mask.
  1588. w: The width of the pixmap (in pixels)
  1589. h: The height of the pixmap (in pixels)
  1590. seps: Details of separations.
  1591. alpha: 0 for no alpha, 1 for alpha.
  1592. stride: The byte offset from the pixel data in a row to the
  1593. pixel data in the next row.
  1594. samples: The data block to keep the samples in.
  1595. Returns a pointer to the new pixmap. Throws exception on failure to
  1596. allocate.
  1597. */
  1598. FZ_FUNCTION FzPixmap fz_new_pixmap_with_data(int w, int h, const FzSeparations& seps, int alpha, int stride, unsigned char *samples) const;
  1599. /** Class-aware wrapper for `::pdf_is_tint_colorspace()`. */
  1600. FZ_FUNCTION int pdf_is_tint_colorspace() const;
  1601. /** Constructor using raw copy of pre-existing `::fz_colorspace`. */
  1602. /* This constructor is marked as `explicit` because wrapper classes do not
  1603. call `keep`in constructors, but do call `drop` in destructors. So
  1604. automatic construction from a fz_colorspace* will generally cause an
  1605. unbalanced `drop` resulting in errors such as SEGV. */
  1606. FZ_FUNCTION explicit FzColorspace(::fz_colorspace* internal);
  1607. /** Destructor using fz_drop_colorspace(). */
  1608. FZ_FUNCTION ~FzColorspace();
  1609. /** Return numerical value of .m_internal; helps with Python debugging. */
  1610. FZ_FUNCTION long long m_internal_value();
  1611. /** Return true iff `m_internal` is not null. */
  1612. FZ_FUNCTION operator bool();
  1613. /* == Member data. */
  1614. /** Pointer to wrapped data. */
  1615. ::fz_colorspace* m_internal;
  1616. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1617. generate code regardless so we always need to have this available. */
  1618. FZ_DATA static int s_num_instances;
  1619. };
  1620. /** Wrapper class for struct `fz_colorspace_context`. Not copyable or assignable. */
  1621. struct FzColorspaceContext
  1622. {
  1623. /** Default constructor, sets `m_internal` to null. */
  1624. FZ_FUNCTION FzColorspaceContext();
  1625. /** Constructor using raw copy of pre-existing `::fz_colorspace_context`. */
  1626. FZ_FUNCTION FzColorspaceContext(::fz_colorspace_context* internal);
  1627. #ifndef NDEBUG
  1628. /** Destructor only decrements s_num_instances. */
  1629. FZ_FUNCTION ~FzColorspaceContext();
  1630. #else
  1631. /** We use default destructor. */
  1632. #endif
  1633. /** Return numerical value of .m_internal; helps with Python debugging. */
  1634. FZ_FUNCTION long long m_internal_value();
  1635. /** Return true iff `m_internal` is not null. */
  1636. FZ_FUNCTION operator bool();
  1637. /* == Member data. */
  1638. /** Pointer to wrapped data. */
  1639. ::fz_colorspace_context* m_internal;
  1640. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1641. generate code regardless so we always need to have this available. */
  1642. FZ_DATA static int s_num_instances;
  1643. private:
  1644. /** This class is not copyable or assignable. */
  1645. FzColorspaceContext(const FzColorspaceContext& rhs);
  1646. FzColorspaceContext& operator=(const FzColorspaceContext& rhs);
  1647. };
  1648. /** Wrapper class for struct `fz_compressed_buffer`. */
  1649. /**
  1650. Buffers of compressed data; typically for the source data
  1651. for images.
  1652. */
  1653. struct FzCompressedBuffer
  1654. {
  1655. /** == Constructors. */
  1656. /** Constructor using `fz_new_compressed_buffer()`. */
  1657. /**
  1658. Create a new, UNKNOWN format, compressed_buffer.
  1659. */
  1660. FZ_FUNCTION FzCompressedBuffer();
  1661. /** Copy constructor using `fz_keep_compressed_buffer()`. */
  1662. FZ_FUNCTION FzCompressedBuffer(const FzCompressedBuffer& rhs);
  1663. /** operator= using `fz_keep_compressed_buffer()` and `fz_drop_compressed_buffer()`. */
  1664. FZ_FUNCTION FzCompressedBuffer& operator=(const FzCompressedBuffer& rhs);
  1665. /* == Methods. */
  1666. /** Class-aware wrapper for `::fz_compressed_buffer_size()`. */
  1667. /**
  1668. Return the storage size used for a buffer and its data.
  1669. Used in implementing store handling.
  1670. Never throws exceptions.
  1671. */
  1672. FZ_FUNCTION size_t fz_compressed_buffer_size() const;
  1673. /** Class-aware wrapper for `::fz_open_compressed_buffer()`. */
  1674. /**
  1675. Open a stream to read the decompressed version of a buffer.
  1676. */
  1677. FZ_FUNCTION FzStream fz_open_compressed_buffer() const;
  1678. /** Class-aware wrapper for `::fz_open_image_decomp_stream_from_buffer()`.
  1679. This method has out-params. Python/C# wrappers look like:
  1680. `fz_open_image_decomp_stream_from_buffer()` => `(fz_stream *, int l2factor)`
  1681. */
  1682. /**
  1683. Open a stream to read the decompressed version of a buffer,
  1684. with optional log2 subsampling.
  1685. l2factor = NULL for no subsampling, or a pointer to an integer
  1686. containing the maximum log2 subsample factor acceptable (0 =
  1687. none, 1 = halve dimensions, 2 = quarter dimensions etc). If
  1688. non-NULL, then *l2factor will be updated on exit with the actual
  1689. log2 subsample factor achieved.
  1690. */
  1691. FZ_FUNCTION FzStream fz_open_image_decomp_stream_from_buffer(int *l2factor) const;
  1692. /** Returns wrapper class for fz_buffer *m_internal.buffer. */
  1693. FZ_FUNCTION FzBuffer get_buffer();
  1694. /** Constructor using raw copy of pre-existing `::fz_compressed_buffer`. */
  1695. /* This constructor is marked as `explicit` because wrapper classes do not
  1696. call `keep`in constructors, but do call `drop` in destructors. So
  1697. automatic construction from a fz_compressed_buffer* will generally cause an
  1698. unbalanced `drop` resulting in errors such as SEGV. */
  1699. FZ_FUNCTION explicit FzCompressedBuffer(::fz_compressed_buffer* internal);
  1700. /** Destructor using fz_drop_compressed_buffer(). */
  1701. FZ_FUNCTION ~FzCompressedBuffer();
  1702. /** Return numerical value of .m_internal; helps with Python debugging. */
  1703. FZ_FUNCTION long long m_internal_value();
  1704. /** Return true iff `m_internal` is not null. */
  1705. FZ_FUNCTION operator bool();
  1706. /* == Member data. */
  1707. /** Pointer to wrapped data. */
  1708. ::fz_compressed_buffer* m_internal;
  1709. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1710. generate code regardless so we always need to have this available. */
  1711. FZ_DATA static int s_num_instances;
  1712. };
  1713. /** Wrapper class for struct `fz_compressed_image`. Not copyable or assignable. */
  1714. struct FzCompressedImage
  1715. {
  1716. /** Default constructor, sets `m_internal` to null. */
  1717. FZ_FUNCTION FzCompressedImage();
  1718. /* == Methods. */
  1719. /** Class-aware wrapper for `::fz_set_compressed_image_buffer()`. */
  1720. FZ_FUNCTION void fz_set_compressed_image_buffer(const FzCompressedBuffer& buf) const;
  1721. /** Constructor using raw copy of pre-existing `::fz_compressed_image`. */
  1722. FZ_FUNCTION FzCompressedImage(::fz_compressed_image* internal);
  1723. #ifndef NDEBUG
  1724. /** Destructor only decrements s_num_instances. */
  1725. FZ_FUNCTION ~FzCompressedImage();
  1726. #else
  1727. /** We use default destructor. */
  1728. #endif
  1729. /** Return numerical value of .m_internal; helps with Python debugging. */
  1730. FZ_FUNCTION long long m_internal_value();
  1731. /** Return true iff `m_internal` is not null. */
  1732. FZ_FUNCTION operator bool();
  1733. /* == Member data. */
  1734. /** Pointer to wrapped data. */
  1735. ::fz_compressed_image* m_internal;
  1736. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1737. generate code regardless so we always need to have this available. */
  1738. FZ_DATA static int s_num_instances;
  1739. private:
  1740. /** This class is not copyable or assignable. */
  1741. FzCompressedImage(const FzCompressedImage& rhs);
  1742. FzCompressedImage& operator=(const FzCompressedImage& rhs);
  1743. };
  1744. /** Wrapper class for struct `fz_compression_params`. Not copyable or assignable. */
  1745. /**
  1746. Compression parameters used for buffers of compressed data;
  1747. typically for the source data for images.
  1748. */
  1749. struct FzCompressionParams
  1750. {
  1751. /** Default constructor, sets `m_internal` to null. */
  1752. FZ_FUNCTION FzCompressionParams();
  1753. /** Constructor using raw copy of pre-existing `::fz_compression_params`. */
  1754. FZ_FUNCTION FzCompressionParams(::fz_compression_params* internal);
  1755. #ifndef NDEBUG
  1756. /** Destructor only decrements s_num_instances. */
  1757. FZ_FUNCTION ~FzCompressionParams();
  1758. #else
  1759. /** We use default destructor. */
  1760. #endif
  1761. /** Return numerical value of .m_internal; helps with Python debugging. */
  1762. FZ_FUNCTION long long m_internal_value();
  1763. /** Return true iff `m_internal` is not null. */
  1764. FZ_FUNCTION operator bool();
  1765. /* == Member data. */
  1766. /** Pointer to wrapped data. */
  1767. ::fz_compression_params* m_internal;
  1768. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1769. generate code regardless so we always need to have this available. */
  1770. FZ_DATA static int s_num_instances;
  1771. private:
  1772. /** This class is not copyable or assignable. */
  1773. FzCompressionParams(const FzCompressionParams& rhs);
  1774. FzCompressionParams& operator=(const FzCompressionParams& rhs);
  1775. };
  1776. /** Wrapper class for struct `fz_context`. Not copyable or assignable. */
  1777. struct FzContext
  1778. {
  1779. /** == Constructors. */
  1780. /** Constructor using `fz_new_context_imp()`. */
  1781. FZ_FUNCTION FzContext(const FzAllocContext& alloc, const FzLocksContext& locks, size_t max_store, const char *version);
  1782. /** Default constructor, sets `m_internal` to null. */
  1783. FZ_FUNCTION FzContext();
  1784. /** Constructor using raw copy of pre-existing `::fz_context`. */
  1785. FZ_FUNCTION FzContext(::fz_context* internal);
  1786. #ifndef NDEBUG
  1787. /** Destructor only decrements s_num_instances. */
  1788. FZ_FUNCTION ~FzContext();
  1789. #else
  1790. /** We use default destructor. */
  1791. #endif
  1792. /** Return numerical value of .m_internal; helps with Python debugging. */
  1793. FZ_FUNCTION long long m_internal_value();
  1794. /** Return true iff `m_internal` is not null. */
  1795. FZ_FUNCTION operator bool();
  1796. /* == Member data. */
  1797. /** Pointer to wrapped data. */
  1798. ::fz_context* m_internal;
  1799. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1800. generate code regardless so we always need to have this available. */
  1801. FZ_DATA static int s_num_instances;
  1802. private:
  1803. /** This class is not copyable or assignable. */
  1804. FzContext(const FzContext& rhs);
  1805. FzContext& operator=(const FzContext& rhs);
  1806. };
  1807. /** Wrapper class for struct `fz_cookie`. Not copyable or assignable. */
  1808. /**
  1809. Provide two-way communication between application and library.
  1810. Intended for multi-threaded applications where one thread is
  1811. rendering pages and another thread wants to read progress
  1812. feedback or abort a job that takes a long time to finish. The
  1813. communication is unsynchronized without locking.
  1814. abort: The application should set this field to 0 before
  1815. calling fz_run_page to render a page. At any point when the
  1816. page is being rendered the application my set this field to 1
  1817. which will cause the rendering to finish soon. This field is
  1818. checked periodically when the page is rendered, but exactly
  1819. when is not known, therefore there is no upper bound on
  1820. exactly when the rendering will abort. If the application
  1821. did not provide a set of locks to fz_new_context, it must also
  1822. await the completion of fz_run_page before issuing another
  1823. call to fz_run_page. Note that once the application has set
  1824. this field to 1 after it called fz_run_page it may not change
  1825. the value again.
  1826. progress: Communicates rendering progress back to the
  1827. application and is read only. Increments as a page is being
  1828. rendered. The value starts out at 0 and is limited to less
  1829. than or equal to progress_max, unless progress_max is -1.
  1830. progress_max: Communicates the known upper bound of rendering
  1831. back to the application and is read only. The maximum value
  1832. that the progress field may take. If there is no known upper
  1833. bound on how long the rendering may take this value is -1 and
  1834. progress is not limited. Note that the value of progress_max
  1835. may change from -1 to a positive value once an upper bound is
  1836. known, so take this into consideration when comparing the
  1837. value of progress to that of progress_max.
  1838. errors: count of errors during current rendering.
  1839. incomplete: Initially should be set to 0. Will be set to
  1840. non-zero if a TRYLATER error is thrown during rendering.
  1841. */
  1842. struct FzCookie
  1843. {
  1844. /** Default constructor sets all fields to default values. */
  1845. FZ_FUNCTION FzCookie();
  1846. /* == Methods. */
  1847. /** Sets m_internal.abort to 1. */
  1848. FZ_FUNCTION void set_abort();
  1849. /** Increments m_internal.errors by <delta>. */
  1850. FZ_FUNCTION void increment_errors(int delta);
  1851. /* == Accessors to members of ::fz_cookie m_internal. */
  1852. FZ_FUNCTION int abort();
  1853. FZ_FUNCTION int progress();
  1854. FZ_FUNCTION size_t progress_max();
  1855. FZ_FUNCTION int errors();
  1856. FZ_FUNCTION int incomplete();
  1857. #ifndef NDEBUG
  1858. /** Destructor only decrements s_num_instances. */
  1859. FZ_FUNCTION ~FzCookie();
  1860. #else
  1861. /** We use default destructor. */
  1862. #endif
  1863. /* == Member data. */
  1864. ::fz_cookie m_internal; /** Wrapped data is held by value. */
  1865. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1866. generate code regardless so we always need to have this available. */
  1867. FZ_DATA static int s_num_instances;
  1868. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  1869. FZ_FUNCTION std::string to_string();
  1870. /** Comparison method. */
  1871. FZ_FUNCTION bool operator==(const FzCookie& rhs);
  1872. /** Comparison method. */
  1873. FZ_FUNCTION bool operator!=(const FzCookie& rhs);
  1874. private:
  1875. /** This class is not copyable or assignable. */
  1876. FzCookie(const FzCookie& rhs);
  1877. FzCookie& operator=(const FzCookie& rhs);
  1878. };
  1879. /** Wrapper class for struct `fz_default_colorspaces`. */
  1880. /**
  1881. Structure to hold default colorspaces.
  1882. */
  1883. struct FzDefaultColorspaces
  1884. {
  1885. /** == Constructors. */
  1886. /** Constructor using `fz_new_default_colorspaces()`. */
  1887. /**
  1888. Create a new default colorspace structure with values inherited
  1889. from the context, and return a reference to it.
  1890. These can be overridden using fz_set_default_xxxx.
  1891. These should not be overridden while more than one caller has
  1892. the reference for fear of race conditions.
  1893. The caller should drop this reference once finished with it.
  1894. */
  1895. FZ_FUNCTION FzDefaultColorspaces();
  1896. /** Copy constructor using `fz_keep_default_colorspaces()`. */
  1897. FZ_FUNCTION FzDefaultColorspaces(const FzDefaultColorspaces& rhs);
  1898. /** operator= using `fz_keep_default_colorspaces()` and `fz_drop_default_colorspaces()`. */
  1899. FZ_FUNCTION FzDefaultColorspaces& operator=(const FzDefaultColorspaces& rhs);
  1900. /* == Methods. */
  1901. /** Class-aware wrapper for `::fz_clone_default_colorspaces()`. */
  1902. /**
  1903. Returns a reference to a newly cloned default colorspaces
  1904. structure.
  1905. The new clone may safely be altered without fear of race
  1906. conditions as the caller is the only reference holder.
  1907. */
  1908. FZ_FUNCTION FzDefaultColorspaces fz_clone_default_colorspaces() const;
  1909. /** Class-aware wrapper for `::fz_default_cmyk()`. */
  1910. FZ_FUNCTION FzColorspace fz_default_cmyk() const;
  1911. /** Class-aware wrapper for `::fz_default_gray()`. */
  1912. /**
  1913. Retrieve default colorspaces (typically page local).
  1914. If default_cs is non NULL, the default is retrieved from there,
  1915. otherwise the global default is retrieved.
  1916. These return borrowed references that should not be dropped,
  1917. unless they are kept first.
  1918. */
  1919. FZ_FUNCTION FzColorspace fz_default_gray() const;
  1920. /** Class-aware wrapper for `::fz_default_output_intent()`. */
  1921. FZ_FUNCTION FzColorspace fz_default_output_intent() const;
  1922. /** Class-aware wrapper for `::fz_default_rgb()`. */
  1923. FZ_FUNCTION FzColorspace fz_default_rgb() const;
  1924. /** Class-aware wrapper for `::fz_set_default_cmyk()`. */
  1925. FZ_FUNCTION void fz_set_default_cmyk(const FzColorspace& cs) const;
  1926. /** Class-aware wrapper for `::fz_set_default_gray()`. */
  1927. /**
  1928. Set new defaults within the default colorspace structure.
  1929. New references are taken to the new default, and references to
  1930. the old defaults dropped.
  1931. Never throws exceptions.
  1932. */
  1933. FZ_FUNCTION void fz_set_default_gray(const FzColorspace& cs) const;
  1934. /** Class-aware wrapper for `::fz_set_default_output_intent()`. */
  1935. FZ_FUNCTION void fz_set_default_output_intent(const FzColorspace& cs) const;
  1936. /** Class-aware wrapper for `::fz_set_default_rgb()`. */
  1937. FZ_FUNCTION void fz_set_default_rgb(const FzColorspace& cs) const;
  1938. /** Class-aware wrapper for `::pdf_update_default_colorspaces()`. */
  1939. FZ_FUNCTION FzDefaultColorspaces pdf_update_default_colorspaces(const PdfObj& res) const;
  1940. /** Constructor using raw copy of pre-existing `::fz_default_colorspaces`. */
  1941. /* This constructor is marked as `explicit` because wrapper classes do not
  1942. call `keep`in constructors, but do call `drop` in destructors. So
  1943. automatic construction from a fz_default_colorspaces* will generally cause an
  1944. unbalanced `drop` resulting in errors such as SEGV. */
  1945. FZ_FUNCTION explicit FzDefaultColorspaces(::fz_default_colorspaces* internal);
  1946. /** Destructor using fz_drop_default_colorspaces(). */
  1947. FZ_FUNCTION ~FzDefaultColorspaces();
  1948. /** Return numerical value of .m_internal; helps with Python debugging. */
  1949. FZ_FUNCTION long long m_internal_value();
  1950. /** Return true iff `m_internal` is not null. */
  1951. FZ_FUNCTION operator bool();
  1952. /* == Member data. */
  1953. /** Pointer to wrapped data. */
  1954. ::fz_default_colorspaces* m_internal;
  1955. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  1956. generate code regardless so we always need to have this available. */
  1957. FZ_DATA static int s_num_instances;
  1958. };
  1959. /** Wrapper class for struct `fz_device`. */
  1960. /**
  1961. The different format handlers (pdf, xps etc) interpret pages to
  1962. a device. These devices can then process the stream of calls
  1963. they receive in various ways:
  1964. The trace device outputs debugging information for the calls.
  1965. The draw device will render them.
  1966. The list device stores them in a list to play back later.
  1967. The text device performs text extraction and searching.
  1968. The bbox device calculates the bounding box for the page.
  1969. Other devices can (and will) be written in the future.
  1970. */
  1971. struct FzDevice
  1972. {
  1973. /** == Constructors. */
  1974. /** Constructor using `fz_new_bbox_device()`. */
  1975. /**
  1976. Create a device to compute the bounding
  1977. box of all marks on a page.
  1978. The returned bounding box will be the union of all bounding
  1979. boxes of all objects on a page.
  1980. */
  1981. FZ_FUNCTION FzDevice(FzRect& rectp);
  1982. /** Constructor using `fz_new_device_of_size()`. */
  1983. /**
  1984. Devices are created by calls to device implementations, for
  1985. instance: foo_new_device(). These will be implemented by calling
  1986. fz_new_derived_device(ctx, foo_device) where foo_device is a
  1987. structure "derived from" fz_device, for instance
  1988. typedef struct { fz_device base; ...extras...} foo_device;
  1989. */
  1990. FZ_FUNCTION FzDevice(int size);
  1991. /** Constructor using `fz_new_draw_device()`. */
  1992. /**
  1993. Create a device to draw on a pixmap.
  1994. dest: Target pixmap for the draw device. See fz_new_pixmap*
  1995. for how to obtain a pixmap. The pixmap is not cleared by the
  1996. draw device, see fz_clear_pixmap* for how to clear it prior to
  1997. calling fz_new_draw_device. Free the device by calling
  1998. fz_drop_device.
  1999. transform: Transform from user space in points to device space
  2000. in pixels.
  2001. */
  2002. FZ_FUNCTION FzDevice(const FzMatrix& transform, const FzPixmap& dest);
  2003. /** Constructor using `fz_new_draw_device_with_bbox()`. */
  2004. /**
  2005. Create a device to draw on a pixmap.
  2006. dest: Target pixmap for the draw device. See fz_new_pixmap*
  2007. for how to obtain a pixmap. The pixmap is not cleared by the
  2008. draw device, see fz_clear_pixmap* for how to clear it prior to
  2009. calling fz_new_draw_device. Free the device by calling
  2010. fz_drop_device.
  2011. transform: Transform from user space in points to device space
  2012. in pixels.
  2013. clip: Bounding box to restrict any marking operations of the
  2014. draw device.
  2015. */
  2016. FZ_FUNCTION FzDevice(const FzMatrix& transform, const FzPixmap& dest, FzIrect& clip);
  2017. /** Constructor using `fz_new_draw_device_with_bbox_proof()`. */
  2018. /**
  2019. Create a device to draw on a pixmap.
  2020. dest: Target pixmap for the draw device. See fz_new_pixmap*
  2021. for how to obtain a pixmap. The pixmap is not cleared by the
  2022. draw device, see fz_clear_pixmap* for how to clear it prior to
  2023. calling fz_new_draw_device. Free the device by calling
  2024. fz_drop_device.
  2025. transform: Transform from user space in points to device space
  2026. in pixels.
  2027. clip: Bounding box to restrict any marking operations of the
  2028. draw device.
  2029. proof_cs: Color space to render to prior to mapping to color
  2030. space defined by pixmap.
  2031. */
  2032. FZ_FUNCTION FzDevice(const FzMatrix& transform, const FzPixmap& dest, FzIrect& clip, const FzColorspace& cs);
  2033. /** Constructor using `fz_new_draw_device_with_options()`. */
  2034. /**
  2035. Create a new pixmap and draw device, using the specified options.
  2036. options: Options to configure the draw device, and choose the
  2037. resolution and colorspace.
  2038. mediabox: The bounds of the page in points.
  2039. pixmap: An out parameter containing the newly created pixmap.
  2040. */
  2041. FZ_FUNCTION FzDevice(FzDrawOptions& options, const FzRect& mediabox, FzPixmap& pixmap);
  2042. /** Constructor using `fz_new_draw_device_with_proof()`. */
  2043. /**
  2044. Create a device to draw on a pixmap.
  2045. dest: Target pixmap for the draw device. See fz_new_pixmap*
  2046. for how to obtain a pixmap. The pixmap is not cleared by the
  2047. draw device, see fz_clear_pixmap* for how to clear it prior to
  2048. calling fz_new_draw_device. Free the device by calling
  2049. fz_drop_device.
  2050. transform: Transform from user space in points to device space
  2051. in pixels.
  2052. proof_cs: Intermediate color space to map though when mapping to
  2053. color space defined by pixmap.
  2054. */
  2055. FZ_FUNCTION FzDevice(const FzMatrix& transform, const FzPixmap& dest, const FzColorspace& proof_cs);
  2056. /** Constructor using `fz_new_list_device()`. */
  2057. /**
  2058. Create a rendering device for a display list.
  2059. When the device is rendering a page it will populate the
  2060. display list with drawing commands (text, images, etc.). The
  2061. display list can later be reused to render a page many times
  2062. without having to re-interpret the page from the document file
  2063. for each rendering. Once the device is no longer needed, free
  2064. it with fz_drop_device.
  2065. list: A display list that the list device takes a reference to.
  2066. */
  2067. FZ_FUNCTION FzDevice(const FzDisplayList& list);
  2068. /** Constructor using `fz_new_ocr_device()`. */
  2069. /**
  2070. Create a device to OCR the text on the page.
  2071. Renders the page internally to a bitmap that is then OCRd. Text
  2072. is then forwarded onto the target device.
  2073. target: The target device to receive the OCRd text.
  2074. ctm: The transform to apply to the mediabox to get the size for
  2075. the rendered page image. Also used to calculate the resolution
  2076. for the page image. In general, this will be the same as the CTM
  2077. that you pass to fz_run_page (or fz_run_display_list) to feed
  2078. this device.
  2079. mediabox: The mediabox (in points). Combined with the CTM to get
  2080. the bounds of the pixmap used internally for the rendered page
  2081. image.
  2082. with_list: If with_list is false, then all non-text operations
  2083. are forwarded instantly to the target device. This results in
  2084. the target device seeing all NON-text operations, followed by
  2085. all the text operations (derived from OCR).
  2086. If with_list is true, then all the marking operations are
  2087. collated into a display list which is then replayed to the
  2088. target device at the end.
  2089. language: NULL (for "eng"), or a pointer to a string to describe
  2090. the languages/scripts that should be used for OCR (e.g.
  2091. "eng,ara").
  2092. datadir: NULL (for ""), or a pointer to a path string otherwise
  2093. provided to Tesseract in the TESSDATA_PREFIX environment variable.
  2094. progress: NULL, or function to be called periodically to indicate
  2095. progress. Return 0 to continue, or 1 to cancel. progress_arg is
  2096. returned as the void *. The int is a value between 0 and 100 to
  2097. indicate progress.
  2098. progress_arg: A void * value to be parrotted back to the progress
  2099. function.
  2100. */
  2101. FZ_FUNCTION FzDevice(const FzDevice& target, const FzMatrix& ctm, const FzRect& mediabox, int with_list, const char *language, const char *datadir, int (*progress)(::fz_context *, void *, int ), void *progress_arg);
  2102. /** Constructor using `fz_new_stext_device()`. */
  2103. /**
  2104. Create a device to extract the text on a page.
  2105. Gather the text on a page into blocks and lines.
  2106. The reading order is taken from the order the text is drawn in
  2107. the source file, so may not be accurate.
  2108. page: The text page to which content should be added. This will
  2109. usually be a newly created (empty) text page, but it can be one
  2110. containing data already (for example when merging multiple
  2111. pages, or watermarking).
  2112. options: Options to configure the stext device.
  2113. */
  2114. FZ_FUNCTION FzDevice(const FzStextPage& page, FzStextOptions& options);
  2115. /** Constructor using `fz_new_stext_device_for_page()`. */
  2116. /**
  2117. Create a device to extract the text on a page into an existing
  2118. fz_stext_page structure.
  2119. Gather the text on a page into blocks and lines.
  2120. The reading order is taken from the order the text is drawn in
  2121. the source file, so may not be accurate.
  2122. stext_page: The text page to which content should be added. This will
  2123. usually be a newly created (empty) text page, but it can be one
  2124. containing data already (for example when merging multiple
  2125. pages, or watermarking).
  2126. options: Options to configure the stext device.
  2127. The next 2 parameters are copied into the fz_stext_page structure's
  2128. ids section, so only have to be valid if you expect to interrogate
  2129. that section later.
  2130. chapter_num: The chapter number that this page came from.
  2131. page_num: The page number that this page came from.
  2132. The final parameter is copied into the fz_stext_page structure's
  2133. ids section. The mediabox for the enture fz_stext_page is unioned
  2134. with this, so pass fz_empty_bbox if you don't care about getting
  2135. a valid value back from the ids section, but you don't want to
  2136. upset the value in the page->mediabox field.
  2137. mediabox: The mediabox for this page.
  2138. */
  2139. FZ_FUNCTION FzDevice(const FzStextPage& stext_page, FzStextOptions& opts, int chapter_num, int page_num, const FzRect& mediabox);
  2140. /** Constructor using `fz_new_svg_device()`. */
  2141. /**
  2142. Create a device that outputs (single page) SVG files to
  2143. the given output stream.
  2144. Equivalent to fz_new_svg_device_with_id passing id = NULL.
  2145. */
  2146. FZ_FUNCTION FzDevice(const FzOutput& out, float page_width, float page_height, int text_format, int reuse_images);
  2147. /** Constructor using `fz_new_svg_device_with_id()`. */
  2148. /**
  2149. Create a device that outputs (single page) SVG files to
  2150. the given output stream.
  2151. output: The output stream to send the constructed SVG page to.
  2152. page_width, page_height: The page dimensions to use (in points).
  2153. text_format: How to emit text. One of the following values:
  2154. FZ_SVG_TEXT_AS_TEXT: As <text> elements with possible
  2155. layout errors and mismatching fonts.
  2156. FZ_SVG_TEXT_AS_PATH: As <path> elements with exact
  2157. visual appearance.
  2158. reuse_images: Share image resources using <symbol> definitions.
  2159. id: ID parameter to keep generated IDs unique across SVG files.
  2160. */
  2161. FZ_FUNCTION FzDevice(const FzOutput& out, float page_width, float page_height, int text_format, int reuse_images, int *id);
  2162. /** Constructor using `fz_new_test_device()`. */
  2163. /**
  2164. Create a device to test for features.
  2165. Currently only tests for the presence of non-grayscale colors.
  2166. is_color: Possible values returned:
  2167. 0: Definitely greyscale
  2168. 1: Probably color (all colors were grey, but there
  2169. were images or shadings in a non grey colorspace).
  2170. 2: Definitely color
  2171. threshold: The difference from grayscale that will be tolerated.
  2172. Typical values to use are either 0 (be exact) and 0.02 (allow an
  2173. imperceptible amount of slop).
  2174. options: A set of bitfield options, from the FZ_TEST_OPT set.
  2175. passthrough: A device to pass all calls through to, or NULL.
  2176. If set, then the test device can both test and pass through to
  2177. an underlying device (like, say, the display list device). This
  2178. means that a display list can be created and at the end we'll
  2179. know if it's colored or not.
  2180. In the absence of a passthrough device, the device will throw
  2181. an exception to stop page interpretation when color is found.
  2182. */
  2183. FZ_FUNCTION FzDevice(int *is_color, float threshold, int options, const FzDevice& passthrough);
  2184. /** Constructor using `fz_new_trace_device()`. */
  2185. /**
  2186. Create a device to print a debug trace of all device calls.
  2187. */
  2188. FZ_FUNCTION FzDevice(const FzOutput& out);
  2189. /** Constructor using `pdf_new_pdf_device()`. */
  2190. FZ_FUNCTION FzDevice(const PdfDocument& doc, const FzMatrix& topctm, const PdfObj& resources, const FzBuffer& contents);
  2191. /** Copy constructor using `fz_keep_device()`. */
  2192. FZ_FUNCTION FzDevice(const FzDevice& rhs);
  2193. /** operator= using `fz_keep_device()` and `fz_drop_device()`. */
  2194. FZ_FUNCTION FzDevice& operator=(const FzDevice& rhs);
  2195. /** Default constructor, sets `m_internal` to null. */
  2196. FZ_FUNCTION FzDevice();
  2197. /* == Static methods. */
  2198. /** Class-aware wrapper for `::fz_new_xmltext_device()`. */
  2199. /**
  2200. Create a device to output raw information.
  2201. */
  2202. FZ_FUNCTION static FzDevice fz_new_xmltext_device(const FzOutput& out);
  2203. /** Class-aware wrapper for `::fz_new_draw_device_type3()`. */
  2204. FZ_FUNCTION static FzDevice fz_new_draw_device_type3(const FzMatrix& transform, const FzPixmap& dest);
  2205. /* == Methods. */
  2206. /** Class-aware wrapper for `::fz_begin_group()`. */
  2207. FZ_FUNCTION void fz_begin_group(const FzRect& area, const FzColorspace& cs, int isolated, int knockout, int blendmode, float alpha) const;
  2208. /** Class-aware wrapper for `::fz_begin_layer()`. */
  2209. FZ_FUNCTION void fz_begin_layer(const char *layer_name) const;
  2210. /** Class-aware wrapper for `::fz_begin_mask()`. */
  2211. FZ_FUNCTION void fz_begin_mask(const FzRect& area, int luminosity, const FzColorspace& colorspace, const float *bc, const FzColorParams& color_params) const;
  2212. /** Class-aware wrapper for `::fz_begin_metatext()`. */
  2213. FZ_FUNCTION void fz_begin_metatext(::fz_metatext meta, const char *text) const;
  2214. /** Class-aware wrapper for `::fz_begin_structure()`. */
  2215. FZ_FUNCTION void fz_begin_structure(::fz_structure standard, const char *raw, int idx) const;
  2216. /** Class-aware wrapper for `::fz_begin_tile()`. */
  2217. FZ_FUNCTION void fz_begin_tile(const FzRect& area, const FzRect& view, float xstep, float ystep, const FzMatrix& ctm) const;
  2218. /** Class-aware wrapper for `::fz_begin_tile_id()`. */
  2219. FZ_FUNCTION int fz_begin_tile_id(const FzRect& area, const FzRect& view, float xstep, float ystep, const FzMatrix& ctm, int id) const;
  2220. /** Class-aware wrapper for `::fz_begin_tile_tid()`. */
  2221. FZ_FUNCTION int fz_begin_tile_tid(const FzRect& area, const FzRect& view, float xstep, float ystep, const FzMatrix& ctm, int id, int doc_id) const;
  2222. /** Class-aware wrapper for `::fz_clip_image_mask()`. */
  2223. FZ_FUNCTION void fz_clip_image_mask(const FzImage& image, const FzMatrix& ctm, const FzRect& scissor) const;
  2224. /** Class-aware wrapper for `::fz_clip_path()`. */
  2225. FZ_FUNCTION void fz_clip_path(const FzPath& path, int even_odd, const FzMatrix& ctm, const FzRect& scissor) const;
  2226. /** Class-aware wrapper for `::fz_clip_stroke_path()`. */
  2227. FZ_FUNCTION void fz_clip_stroke_path(const FzPath& path, const FzStrokeState& stroke, const FzMatrix& ctm, const FzRect& scissor) const;
  2228. /** Class-aware wrapper for `::fz_clip_stroke_text()`. */
  2229. FZ_FUNCTION void fz_clip_stroke_text(const FzText& text, const FzStrokeState& stroke, const FzMatrix& ctm, const FzRect& scissor) const;
  2230. /** Class-aware wrapper for `::fz_clip_text()`. */
  2231. FZ_FUNCTION void fz_clip_text(const FzText& text, const FzMatrix& ctm, const FzRect& scissor) const;
  2232. /** Class-aware wrapper for `::fz_close_device()`. */
  2233. /**
  2234. Signal the end of input, and flush any buffered output.
  2235. This is NOT called implicitly on fz_drop_device. This
  2236. may throw exceptions.
  2237. */
  2238. FZ_FUNCTION void fz_close_device() const;
  2239. /** Class-aware wrapper for `::fz_device_current_scissor()`. */
  2240. /**
  2241. Find current scissor region as tracked by the device.
  2242. */
  2243. FZ_FUNCTION FzRect fz_device_current_scissor() const;
  2244. /** Class-aware wrapper for `::fz_disable_device_hints()`. */
  2245. /**
  2246. Disable (clear) hint bits within the hint bitfield for a device.
  2247. */
  2248. FZ_FUNCTION void fz_disable_device_hints(int hints) const;
  2249. /** Class-aware wrapper for `::fz_enable_device_hints()`. */
  2250. /**
  2251. Enable (set) hint bits within the hint bitfield for a device.
  2252. */
  2253. FZ_FUNCTION void fz_enable_device_hints(int hints) const;
  2254. /** Class-aware wrapper for `::fz_end_group()`. */
  2255. FZ_FUNCTION void fz_end_group() const;
  2256. /** Class-aware wrapper for `::fz_end_layer()`. */
  2257. FZ_FUNCTION void fz_end_layer() const;
  2258. /** Class-aware wrapper for `::fz_end_mask()`. */
  2259. FZ_FUNCTION void fz_end_mask() const;
  2260. /** Class-aware wrapper for `::fz_end_mask_tr()`. */
  2261. FZ_FUNCTION void fz_end_mask_tr(const FzFunction& fn) const;
  2262. /** Class-aware wrapper for `::fz_end_metatext()`. */
  2263. FZ_FUNCTION void fz_end_metatext() const;
  2264. /** Class-aware wrapper for `::fz_end_structure()`. */
  2265. FZ_FUNCTION void fz_end_structure() const;
  2266. /** Class-aware wrapper for `::fz_end_tile()`. */
  2267. FZ_FUNCTION void fz_end_tile() const;
  2268. /** Class-aware wrapper for `::fz_fill_image()`. */
  2269. FZ_FUNCTION void fz_fill_image(const FzImage& image, const FzMatrix& ctm, float alpha, const FzColorParams& color_params) const;
  2270. /** Class-aware wrapper for `::fz_fill_image_mask()`. */
  2271. FZ_FUNCTION void fz_fill_image_mask(const FzImage& image, const FzMatrix& ctm, const FzColorspace& colorspace, const float *color, float alpha, const FzColorParams& color_params) const;
  2272. /** Class-aware wrapper for `::fz_fill_path()`. */
  2273. /**
  2274. Device calls; graphics primitives and containers.
  2275. */
  2276. FZ_FUNCTION void fz_fill_path(const FzPath& path, int even_odd, const FzMatrix& ctm, const FzColorspace& colorspace, const float *color, float alpha, const FzColorParams& color_params) const;
  2277. /** Class-aware wrapper for `::fz_fill_shade()`. */
  2278. FZ_FUNCTION void fz_fill_shade(const FzShade& shade, const FzMatrix& ctm, float alpha, const FzColorParams& color_params) const;
  2279. /** Class-aware wrapper for `::fz_fill_text()`. */
  2280. FZ_FUNCTION void fz_fill_text(const FzText& text, const FzMatrix& ctm, const FzColorspace& colorspace, const float *color, float alpha, const FzColorParams& color_params) const;
  2281. /** Class-aware wrapper for `::fz_ignore_text()`. */
  2282. FZ_FUNCTION void fz_ignore_text(const FzText& text, const FzMatrix& ctm) const;
  2283. /** Class-aware wrapper for `::fz_new_ocr_device()`. */
  2284. /**
  2285. Create a device to OCR the text on the page.
  2286. Renders the page internally to a bitmap that is then OCRd. Text
  2287. is then forwarded onto the target device.
  2288. target: The target device to receive the OCRd text.
  2289. ctm: The transform to apply to the mediabox to get the size for
  2290. the rendered page image. Also used to calculate the resolution
  2291. for the page image. In general, this will be the same as the CTM
  2292. that you pass to fz_run_page (or fz_run_display_list) to feed
  2293. this device.
  2294. mediabox: The mediabox (in points). Combined with the CTM to get
  2295. the bounds of the pixmap used internally for the rendered page
  2296. image.
  2297. with_list: If with_list is false, then all non-text operations
  2298. are forwarded instantly to the target device. This results in
  2299. the target device seeing all NON-text operations, followed by
  2300. all the text operations (derived from OCR).
  2301. If with_list is true, then all the marking operations are
  2302. collated into a display list which is then replayed to the
  2303. target device at the end.
  2304. language: NULL (for "eng"), or a pointer to a string to describe
  2305. the languages/scripts that should be used for OCR (e.g.
  2306. "eng,ara").
  2307. datadir: NULL (for ""), or a pointer to a path string otherwise
  2308. provided to Tesseract in the TESSDATA_PREFIX environment variable.
  2309. progress: NULL, or function to be called periodically to indicate
  2310. progress. Return 0 to continue, or 1 to cancel. progress_arg is
  2311. returned as the void *. The int is a value between 0 and 100 to
  2312. indicate progress.
  2313. progress_arg: A void * value to be parrotted back to the progress
  2314. function.
  2315. */
  2316. FZ_FUNCTION FzDevice fz_new_ocr_device(const FzMatrix& ctm, const FzRect& mediabox, int with_list, const char *language, const char *datadir, int (*progress)(::fz_context *, void *, int ), void *progress_arg) const;
  2317. /** Class-aware wrapper for `::fz_pop_clip()`. */
  2318. FZ_FUNCTION void fz_pop_clip() const;
  2319. /** Class-aware wrapper for `::fz_render_flags()`. */
  2320. FZ_FUNCTION void fz_render_flags(int set, int clear) const;
  2321. /** Class-aware wrapper for `::fz_render_t3_glyph_direct()`. */
  2322. /**
  2323. Nasty PDF interpreter specific hernia, required to allow the
  2324. interpreter to replay glyphs from a type3 font directly into
  2325. the target device.
  2326. This is only used in exceptional circumstances (such as type3
  2327. glyphs that inherit current graphics state, or nested type3
  2328. glyphs).
  2329. */
  2330. FZ_FUNCTION void fz_render_t3_glyph_direct(const FzFont& font, int gid, const FzMatrix& trm, void *gstate, const FzDefaultColorspaces& def_cs, void *fill_gstate, void *stroke_gstate) const;
  2331. /** Class-aware wrapper for `::fz_set_default_colorspaces()`. */
  2332. FZ_FUNCTION void fz_set_default_colorspaces(const FzDefaultColorspaces& default_cs) const;
  2333. /** Class-aware wrapper for `::fz_stroke_path()`. */
  2334. FZ_FUNCTION void fz_stroke_path(const FzPath& path, const FzStrokeState& stroke, const FzMatrix& ctm, const FzColorspace& colorspace, const float *color, float alpha, const FzColorParams& color_params) const;
  2335. /** Class-aware wrapper for `::fz_stroke_text()`. */
  2336. FZ_FUNCTION void fz_stroke_text(const FzText& text, const FzStrokeState& stroke, const FzMatrix& ctm, const FzColorspace& colorspace, const float *color, float alpha, const FzColorParams& color_params) const;
  2337. /** Constructor using raw copy of pre-existing `::fz_device`. */
  2338. /* This constructor is marked as `explicit` because wrapper classes do not
  2339. call `keep`in constructors, but do call `drop` in destructors. So
  2340. automatic construction from a fz_device* will generally cause an
  2341. unbalanced `drop` resulting in errors such as SEGV. */
  2342. FZ_FUNCTION explicit FzDevice(::fz_device* internal);
  2343. /** Destructor using fz_drop_device(). */
  2344. FZ_FUNCTION ~FzDevice();
  2345. /** Return numerical value of .m_internal; helps with Python debugging. */
  2346. FZ_FUNCTION long long m_internal_value();
  2347. /** Return true iff `m_internal` is not null. */
  2348. FZ_FUNCTION operator bool();
  2349. /* == Member data. */
  2350. /** Pointer to wrapped data. */
  2351. ::fz_device* m_internal;
  2352. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  2353. generate code regardless so we always need to have this available. */
  2354. FZ_DATA static int s_num_instances;
  2355. };
  2356. /** Wrapper class for struct fz_device with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  2357. struct FzDevice2 : FzDevice
  2358. {
  2359. /** == Constructor. */
  2360. FZ_FUNCTION FzDevice2();
  2361. /** == Destructor. */
  2362. FZ_FUNCTION virtual ~FzDevice2();
  2363. /** These methods set the function pointers in *m_internal
  2364. to point to internal callbacks that call our virtual methods. */
  2365. FZ_FUNCTION void use_virtual_close_device( bool use=true);
  2366. FZ_FUNCTION void use_virtual_drop_device( bool use=true);
  2367. FZ_FUNCTION void use_virtual_fill_path( bool use=true);
  2368. FZ_FUNCTION void use_virtual_stroke_path( bool use=true);
  2369. FZ_FUNCTION void use_virtual_clip_path( bool use=true);
  2370. FZ_FUNCTION void use_virtual_clip_stroke_path( bool use=true);
  2371. FZ_FUNCTION void use_virtual_fill_text( bool use=true);
  2372. FZ_FUNCTION void use_virtual_stroke_text( bool use=true);
  2373. FZ_FUNCTION void use_virtual_clip_text( bool use=true);
  2374. FZ_FUNCTION void use_virtual_clip_stroke_text( bool use=true);
  2375. FZ_FUNCTION void use_virtual_ignore_text( bool use=true);
  2376. FZ_FUNCTION void use_virtual_fill_shade( bool use=true);
  2377. FZ_FUNCTION void use_virtual_fill_image( bool use=true);
  2378. FZ_FUNCTION void use_virtual_fill_image_mask( bool use=true);
  2379. FZ_FUNCTION void use_virtual_clip_image_mask( bool use=true);
  2380. FZ_FUNCTION void use_virtual_pop_clip( bool use=true);
  2381. FZ_FUNCTION void use_virtual_begin_mask( bool use=true);
  2382. FZ_FUNCTION void use_virtual_end_mask( bool use=true);
  2383. FZ_FUNCTION void use_virtual_begin_group( bool use=true);
  2384. FZ_FUNCTION void use_virtual_end_group( bool use=true);
  2385. FZ_FUNCTION void use_virtual_begin_tile( bool use=true);
  2386. FZ_FUNCTION void use_virtual_end_tile( bool use=true);
  2387. FZ_FUNCTION void use_virtual_render_flags( bool use=true);
  2388. FZ_FUNCTION void use_virtual_set_default_colorspaces( bool use=true);
  2389. FZ_FUNCTION void use_virtual_begin_layer( bool use=true);
  2390. FZ_FUNCTION void use_virtual_end_layer( bool use=true);
  2391. FZ_FUNCTION void use_virtual_begin_structure( bool use=true);
  2392. FZ_FUNCTION void use_virtual_end_structure( bool use=true);
  2393. FZ_FUNCTION void use_virtual_begin_metatext( bool use=true);
  2394. FZ_FUNCTION void use_virtual_end_metatext( bool use=true);
  2395. /** Default virtual method implementations; these all throw an exception. */
  2396. FZ_FUNCTION virtual void close_device(::fz_context *arg_0);
  2397. FZ_FUNCTION virtual void drop_device(::fz_context *arg_0);
  2398. FZ_FUNCTION virtual void fill_path(::fz_context *arg_0, const ::fz_path *arg_2, int arg_3, ::fz_matrix arg_4, ::fz_colorspace *arg_5, const float *arg_6, float arg_7, ::fz_color_params arg_8);
  2399. FZ_FUNCTION virtual void stroke_path(::fz_context *arg_0, const ::fz_path *arg_2, const ::fz_stroke_state *arg_3, ::fz_matrix arg_4, ::fz_colorspace *arg_5, const float *arg_6, float arg_7, ::fz_color_params arg_8);
  2400. FZ_FUNCTION virtual void clip_path(::fz_context *arg_0, const ::fz_path *arg_2, int arg_3, ::fz_matrix arg_4, ::fz_rect arg_5);
  2401. FZ_FUNCTION virtual void clip_stroke_path(::fz_context *arg_0, const ::fz_path *arg_2, const ::fz_stroke_state *arg_3, ::fz_matrix arg_4, ::fz_rect arg_5);
  2402. FZ_FUNCTION virtual void fill_text(::fz_context *arg_0, const ::fz_text *arg_2, ::fz_matrix arg_3, ::fz_colorspace *arg_4, const float *arg_5, float arg_6, ::fz_color_params arg_7);
  2403. FZ_FUNCTION virtual void stroke_text(::fz_context *arg_0, const ::fz_text *arg_2, const ::fz_stroke_state *arg_3, ::fz_matrix arg_4, ::fz_colorspace *arg_5, const float *arg_6, float arg_7, ::fz_color_params arg_8);
  2404. FZ_FUNCTION virtual void clip_text(::fz_context *arg_0, const ::fz_text *arg_2, ::fz_matrix arg_3, ::fz_rect arg_4);
  2405. FZ_FUNCTION virtual void clip_stroke_text(::fz_context *arg_0, const ::fz_text *arg_2, const ::fz_stroke_state *arg_3, ::fz_matrix arg_4, ::fz_rect arg_5);
  2406. FZ_FUNCTION virtual void ignore_text(::fz_context *arg_0, const ::fz_text *arg_2, ::fz_matrix arg_3);
  2407. FZ_FUNCTION virtual void fill_shade(::fz_context *arg_0, ::fz_shade *arg_2, ::fz_matrix arg_3, float arg_4, ::fz_color_params arg_5);
  2408. FZ_FUNCTION virtual void fill_image(::fz_context *arg_0, ::fz_image *arg_2, ::fz_matrix arg_3, float arg_4, ::fz_color_params arg_5);
  2409. FZ_FUNCTION virtual void fill_image_mask(::fz_context *arg_0, ::fz_image *arg_2, ::fz_matrix arg_3, ::fz_colorspace *arg_4, const float *arg_5, float arg_6, ::fz_color_params arg_7);
  2410. FZ_FUNCTION virtual void clip_image_mask(::fz_context *arg_0, ::fz_image *arg_2, ::fz_matrix arg_3, ::fz_rect arg_4);
  2411. FZ_FUNCTION virtual void pop_clip(::fz_context *arg_0);
  2412. FZ_FUNCTION virtual void begin_mask(::fz_context *arg_0, ::fz_rect arg_2, int arg_3, ::fz_colorspace *arg_4, const float *arg_5, ::fz_color_params arg_6);
  2413. FZ_FUNCTION virtual void end_mask(::fz_context *arg_0, ::fz_function *arg_2);
  2414. FZ_FUNCTION virtual void begin_group(::fz_context *arg_0, ::fz_rect arg_2, ::fz_colorspace *arg_3, int arg_4, int arg_5, int arg_6, float arg_7);
  2415. FZ_FUNCTION virtual void end_group(::fz_context *arg_0);
  2416. FZ_FUNCTION virtual int begin_tile(::fz_context *arg_0, ::fz_rect arg_2, ::fz_rect arg_3, float arg_4, float arg_5, ::fz_matrix arg_6, int arg_7, int arg_8);
  2417. FZ_FUNCTION virtual void end_tile(::fz_context *arg_0);
  2418. FZ_FUNCTION virtual void render_flags(::fz_context *arg_0, int arg_2, int arg_3);
  2419. FZ_FUNCTION virtual void set_default_colorspaces(::fz_context *arg_0, ::fz_default_colorspaces *arg_2);
  2420. FZ_FUNCTION virtual void begin_layer(::fz_context *arg_0, const char *arg_2);
  2421. FZ_FUNCTION virtual void end_layer(::fz_context *arg_0);
  2422. FZ_FUNCTION virtual void begin_structure(::fz_context *arg_0, ::fz_structure arg_2, const char *arg_3, int arg_4);
  2423. FZ_FUNCTION virtual void end_structure(::fz_context *arg_0);
  2424. FZ_FUNCTION virtual void begin_metatext(::fz_context *arg_0, ::fz_metatext arg_2, const char *arg_3);
  2425. FZ_FUNCTION virtual void end_metatext(::fz_context *arg_0);
  2426. };
  2427. /** Wrapper class for struct `fz_device_container_stack`. Not copyable or assignable. */
  2428. /**
  2429. Devices can keep track of containers (clips/masks/groups/tiles)
  2430. as they go to save callers having to do it.
  2431. */
  2432. struct FzDeviceContainerStack
  2433. {
  2434. /** Default constructor, sets `m_internal` to null. */
  2435. FZ_FUNCTION FzDeviceContainerStack();
  2436. /** Constructor using raw copy of pre-existing `::fz_device_container_stack`. */
  2437. FZ_FUNCTION FzDeviceContainerStack(::fz_device_container_stack* internal);
  2438. #ifndef NDEBUG
  2439. /** Destructor only decrements s_num_instances. */
  2440. FZ_FUNCTION ~FzDeviceContainerStack();
  2441. #else
  2442. /** We use default destructor. */
  2443. #endif
  2444. /** Return numerical value of .m_internal; helps with Python debugging. */
  2445. FZ_FUNCTION long long m_internal_value();
  2446. /** Return true iff `m_internal` is not null. */
  2447. FZ_FUNCTION operator bool();
  2448. /* == Member data. */
  2449. /** Pointer to wrapped data. */
  2450. ::fz_device_container_stack* m_internal;
  2451. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  2452. generate code regardless so we always need to have this available. */
  2453. FZ_DATA static int s_num_instances;
  2454. private:
  2455. /** This class is not copyable or assignable. */
  2456. FzDeviceContainerStack(const FzDeviceContainerStack& rhs);
  2457. FzDeviceContainerStack& operator=(const FzDeviceContainerStack& rhs);
  2458. };
  2459. /** Wrapper class for struct `fz_display_list`. */
  2460. /**
  2461. fz_display_list is a list containing drawing commands (text,
  2462. images, etc.). The intent is two-fold: as a caching-mechanism
  2463. to reduce parsing of a page, and to be used as a data
  2464. structure in multi-threading where one thread parses the page
  2465. and another renders pages.
  2466. Create a display list with fz_new_display_list, hand it over to
  2467. fz_new_list_device to have it populated, and later replay the
  2468. list (once or many times) by calling fz_run_display_list. When
  2469. the list is no longer needed drop it with fz_drop_display_list.
  2470. */
  2471. struct FzDisplayList
  2472. {
  2473. /** == Constructors. */
  2474. /** Constructor using `fz_new_display_list()`. */
  2475. /**
  2476. Create an empty display list.
  2477. A display list contains drawing commands (text, images, etc.).
  2478. Use fz_new_list_device for populating the list.
  2479. mediabox: Bounds of the page (in points) represented by the
  2480. display list.
  2481. */
  2482. FZ_FUNCTION FzDisplayList(const FzRect& mediabox);
  2483. /** Constructor using `fz_new_display_list_from_page()`. */
  2484. /**
  2485. Create a display list.
  2486. Ownership of the display list is returned to the caller.
  2487. */
  2488. FZ_FUNCTION FzDisplayList(const FzPage& page);
  2489. /** Constructor using `fz_new_display_list_from_page_number()`. */
  2490. FZ_FUNCTION FzDisplayList(const FzDocument& doc, int number);
  2491. /** Constructor using `fz_new_display_list_from_svg()`. */
  2492. /**
  2493. Parse an SVG document into a display-list.
  2494. */
  2495. FZ_FUNCTION FzDisplayList(const FzBuffer& buf, const char *base_uri, const FzArchive& dir, float *w, float *h);
  2496. /** Constructor using `fz_new_display_list_from_svg_xml()`. */
  2497. /**
  2498. Parse an SVG document into a display-list.
  2499. */
  2500. FZ_FUNCTION FzDisplayList(const FzXml& xmldoc, const FzXml& xml, const char *base_uri, const FzArchive& dir, float *w, float *h);
  2501. /** Constructor using `pdf_new_display_list_from_annot()`. */
  2502. FZ_FUNCTION FzDisplayList(const PdfAnnot& annot);
  2503. /** Copy constructor using `fz_keep_display_list()`. */
  2504. FZ_FUNCTION FzDisplayList(const FzDisplayList& rhs);
  2505. /** operator= using `fz_keep_display_list()` and `fz_drop_display_list()`. */
  2506. FZ_FUNCTION FzDisplayList& operator=(const FzDisplayList& rhs);
  2507. /** Default constructor, sets `m_internal` to null. */
  2508. FZ_FUNCTION FzDisplayList();
  2509. /* == Static methods. */
  2510. /** Class-aware wrapper for `::fz_new_display_list_from_page_contents()`. */
  2511. /**
  2512. Create a display list from page contents (no annotations).
  2513. Ownership of the display list is returned to the caller.
  2514. */
  2515. FZ_FUNCTION static FzDisplayList fz_new_display_list_from_page_contents(const FzPage& page);
  2516. /* == Methods. */
  2517. /** Class-aware wrapper for `::fz_bound_display_list()`. */
  2518. /**
  2519. Return the bounding box of the page recorded in a display list.
  2520. */
  2521. FZ_FUNCTION FzRect fz_bound_display_list() const;
  2522. /** Class-aware wrapper for `::fz_display_list_is_empty()`. */
  2523. /**
  2524. Check for a display list being empty
  2525. list: The list to check.
  2526. Returns true if empty, false otherwise.
  2527. */
  2528. FZ_FUNCTION int fz_display_list_is_empty() const;
  2529. /** Class-aware wrapper for `::fz_fill_pixmap_from_display_list()`. */
  2530. FZ_FUNCTION FzPixmap fz_fill_pixmap_from_display_list(const FzMatrix& ctm, const FzPixmap& pix) const;
  2531. /** Class-aware wrapper for `::fz_new_buffer_from_display_list()`. */
  2532. FZ_FUNCTION FzBuffer fz_new_buffer_from_display_list(FzStextOptions& options) const;
  2533. /** Class-aware wrapper for `::fz_new_list_device()`. */
  2534. /**
  2535. Create a rendering device for a display list.
  2536. When the device is rendering a page it will populate the
  2537. display list with drawing commands (text, images, etc.). The
  2538. display list can later be reused to render a page many times
  2539. without having to re-interpret the page from the document file
  2540. for each rendering. Once the device is no longer needed, free
  2541. it with fz_drop_device.
  2542. list: A display list that the list device takes a reference to.
  2543. */
  2544. FZ_FUNCTION FzDevice fz_new_list_device() const;
  2545. /** Class-aware wrapper for `::fz_new_pixmap_from_display_list()`. */
  2546. /**
  2547. Render the page to a pixmap using the transform and colorspace.
  2548. Ownership of the pixmap is returned to the caller.
  2549. */
  2550. FZ_FUNCTION FzPixmap fz_new_pixmap_from_display_list(const FzMatrix& ctm, const FzColorspace& cs, int alpha) const;
  2551. /** Class-aware wrapper for `::fz_new_pixmap_from_display_list_with_separations()`. */
  2552. /**
  2553. Render the page contents with control over spot colors.
  2554. Ownership of the pixmap is returned to the caller.
  2555. */
  2556. FZ_FUNCTION FzPixmap fz_new_pixmap_from_display_list_with_separations(const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha) const;
  2557. /** Class-aware wrapper for `::fz_run_display_list()`. */
  2558. /**
  2559. (Re)-run a display list through a device.
  2560. list: A display list, created by fz_new_display_list and
  2561. populated with objects from a page by running fz_run_page on a
  2562. device obtained from fz_new_list_device.
  2563. ctm: Transform to apply to display list contents. May include
  2564. for example scaling and rotation, see fz_scale, fz_rotate and
  2565. fz_concat. Set to fz_identity if no transformation is desired.
  2566. scissor: Only the part of the contents of the display list
  2567. visible within this area will be considered when the list is
  2568. run through the device. This does not imply for tile objects
  2569. contained in the display list.
  2570. cookie: Communication mechanism between caller and library
  2571. running the page. Intended for multi-threaded applications,
  2572. while single-threaded applications set cookie to NULL. The
  2573. caller may abort an ongoing page run. Cookie also communicates
  2574. progress information back to the caller. The fields inside
  2575. cookie are continually updated while the page is being run.
  2576. */
  2577. FZ_FUNCTION void fz_run_display_list(const FzDevice& dev, const FzMatrix& ctm, const FzRect& scissor, FzCookie& cookie) const;
  2578. /** Class-aware wrapper for `::fz_search_display_list()`.
  2579. This method has out-params. Python/C# wrappers look like:
  2580. `fz_search_display_list(const char *needle, ::fz_quad *hit_bbox, int hit_max)` => `(int, int hit_mark)`
  2581. */
  2582. FZ_FUNCTION int fz_search_display_list(const char *needle, int *hit_mark, FzQuad& hit_bbox, int hit_max) const;
  2583. /** Class-aware wrapper for `::fz_search_display_list_cb()`. */
  2584. FZ_FUNCTION int fz_search_display_list_cb(const char *needle, ::fz_search_callback_fn *cb, void *opaque) const;
  2585. /** Constructor using raw copy of pre-existing `::fz_display_list`. */
  2586. /* This constructor is marked as `explicit` because wrapper classes do not
  2587. call `keep`in constructors, but do call `drop` in destructors. So
  2588. automatic construction from a fz_display_list* will generally cause an
  2589. unbalanced `drop` resulting in errors such as SEGV. */
  2590. FZ_FUNCTION explicit FzDisplayList(::fz_display_list* internal);
  2591. /** Destructor using fz_drop_display_list(). */
  2592. FZ_FUNCTION ~FzDisplayList();
  2593. /** Return numerical value of .m_internal; helps with Python debugging. */
  2594. FZ_FUNCTION long long m_internal_value();
  2595. /** Return true iff `m_internal` is not null. */
  2596. FZ_FUNCTION operator bool();
  2597. /* == Member data. */
  2598. /** Pointer to wrapped data. */
  2599. ::fz_display_list* m_internal;
  2600. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  2601. generate code regardless so we always need to have this available. */
  2602. FZ_DATA static int s_num_instances;
  2603. };
  2604. /** Wrapper class for struct `fz_document`. */
  2605. struct FzDocument
  2606. {
  2607. /** == Constructors. */
  2608. /** Constructor using `fz_open_accelerated_document()`. */
  2609. /**
  2610. Open a document file and read its basic structure so pages and
  2611. objects can be located. MuPDF will try to repair broken
  2612. documents (without actually changing the file contents).
  2613. The returned fz_document is used when calling most other
  2614. document related functions.
  2615. filename: a path to a file as it would be given to open(2).
  2616. */
  2617. FZ_FUNCTION FzDocument(const char *filename, const char *accel);
  2618. /** Constructor using `fz_open_accelerated_document_with_stream()`. */
  2619. /**
  2620. Open a document using the specified stream object rather than
  2621. opening a file on disk.
  2622. magic: a string used to detect document type; either a file name
  2623. or mime-type.
  2624. stream: a stream of the document contents.
  2625. accel: NULL, or a stream of the 'accelerator' contents for this document.
  2626. NOTE: The caller retains ownership of 'stream' and 'accel' - the document will
  2627. take its own references if required.
  2628. */
  2629. FZ_FUNCTION FzDocument(const char *magic, const FzStream& stream, const FzStream& accel);
  2630. /** Constructor using `fz_open_accelerated_document_with_stream_and_dir()`. */
  2631. /**
  2632. Open a document using the specified stream object rather than
  2633. opening a file on disk.
  2634. magic: a string used to detect document type; either a file name
  2635. or mime-type.
  2636. stream: a stream of the document contents.
  2637. accel: NULL, or a stream of the 'accelerator' contents for this document.
  2638. dir: NULL, or the 'directory context' for the stream contents.
  2639. NOTE: The caller retains ownership of 'stream', 'accel' and 'dir' - the document will
  2640. take its own references if required.
  2641. */
  2642. FZ_FUNCTION FzDocument(const char *magic, const FzStream& stream, const FzStream& accel, const FzArchive& dir);
  2643. /** Constructor using `fz_open_document()`. */
  2644. /**
  2645. Open a document file and read its basic structure so pages and
  2646. objects can be located. MuPDF will try to repair broken
  2647. documents (without actually changing the file contents).
  2648. The returned fz_document is used when calling most other
  2649. document related functions.
  2650. filename: a path to a file as it would be given to open(2).
  2651. */
  2652. FZ_FUNCTION FzDocument(const char *filename);
  2653. /** Constructor using `fz_open_document_with_buffer()`. */
  2654. /**
  2655. Open a document using a buffer rather than opening a file on disk.
  2656. */
  2657. FZ_FUNCTION FzDocument(const char *magic, const FzBuffer& buffer);
  2658. /** Constructor using `fz_open_document_with_stream()`. */
  2659. /**
  2660. Open a document using the specified stream object rather than
  2661. opening a file on disk.
  2662. magic: a string used to detect document type; either a file name
  2663. or mime-type.
  2664. stream: a stream representing the contents of the document file.
  2665. NOTE: The caller retains ownership of 'stream' - the document will take its
  2666. own reference if required.
  2667. */
  2668. FZ_FUNCTION FzDocument(const char *magic, const FzStream& stream);
  2669. /** Constructor using `fz_open_document_with_stream_and_dir()`. */
  2670. /**
  2671. Open a document using the specified stream object rather than
  2672. opening a file on disk.
  2673. magic: a string used to detect document type; either a file name
  2674. or mime-type.
  2675. stream: a stream representing the contents of the document file.
  2676. dir: a 'directory context' for those filetypes that need it.
  2677. NOTE: The caller retains ownership of 'stream' and 'dir' - the document will
  2678. take its own references if required.
  2679. */
  2680. FZ_FUNCTION FzDocument(const char *magic, const FzStream& stream, const FzArchive& dir);
  2681. /** Returns a FzDocument for pdfdocument.m_internal.super. */
  2682. FZ_FUNCTION FzDocument(PdfDocument& pdfdocument);
  2683. /** Copy constructor using `fz_keep_document()`. */
  2684. FZ_FUNCTION FzDocument(const FzDocument& rhs);
  2685. /** operator= using `fz_keep_document()` and `fz_drop_document()`. */
  2686. FZ_FUNCTION FzDocument& operator=(const FzDocument& rhs);
  2687. /* == Static methods. */
  2688. /** Class-aware wrapper for `::fz_new_xhtml_document_from_document()`. */
  2689. /**
  2690. Use text extraction to convert the input document into XHTML,
  2691. then open the result as a new document that can be reflowed.
  2692. */
  2693. FZ_FUNCTION static FzDocument fz_new_xhtml_document_from_document(const FzDocument& old_doc, FzStextOptions& opts);
  2694. /* == Methods. */
  2695. /** Class-aware wrapper for `::fz_authenticate_password()`. */
  2696. /**
  2697. Test if the given password can decrypt the document.
  2698. password: The password string to be checked. Some document
  2699. specifications do not specify any particular text encoding, so
  2700. neither do we.
  2701. Returns 0 for failure to authenticate, non-zero for success.
  2702. For PDF documents, further information can be given by examining
  2703. the bits in the return code.
  2704. Bit 0 => No password required
  2705. Bit 1 => User password authenticated
  2706. Bit 2 => Owner password authenticated
  2707. */
  2708. FZ_FUNCTION int fz_authenticate_password(const char *password) const;
  2709. /** Class-aware wrapper for `::fz_clamp_location()`. */
  2710. /**
  2711. Clamps a location into valid chapter/page range. (First clamps
  2712. the chapter into range, then the page into range).
  2713. */
  2714. FZ_FUNCTION FzLocation fz_clamp_location(const FzLocation& loc) const;
  2715. /** Class-aware wrapper for `::fz_count_chapter_pages()`. */
  2716. /**
  2717. Return the number of pages in a chapter.
  2718. May return 0.
  2719. */
  2720. FZ_FUNCTION int fz_count_chapter_pages(int chapter) const;
  2721. /** Class-aware wrapper for `::fz_count_chapters()`. */
  2722. /**
  2723. Return the number of chapters in the document.
  2724. At least 1.
  2725. */
  2726. FZ_FUNCTION int fz_count_chapters() const;
  2727. /** Class-aware wrapper for `::fz_count_pages()`. */
  2728. /**
  2729. Return the number of pages in document
  2730. May return 0 for documents with no pages.
  2731. */
  2732. FZ_FUNCTION int fz_count_pages() const;
  2733. /** Class-aware wrapper for `::fz_document_output_intent()`. */
  2734. /**
  2735. Find the output intent colorspace if the document has defined
  2736. one.
  2737. Returns a borrowed reference that should not be dropped, unless
  2738. it is kept first.
  2739. */
  2740. FZ_FUNCTION FzColorspace fz_document_output_intent() const;
  2741. /** Class-aware wrapper for `::fz_document_supports_accelerator()`. */
  2742. /**
  2743. Query if the document supports the saving of accelerator data.
  2744. */
  2745. FZ_FUNCTION int fz_document_supports_accelerator() const;
  2746. /** Class-aware wrapper for `::fz_format_link_uri()`. */
  2747. /**
  2748. Format an internal link to a page number, location, and possible viewing parameters,
  2749. suitable for use with fz_create_link.
  2750. Returns a newly allocated string that the caller must free.
  2751. */
  2752. FZ_FUNCTION char *fz_format_link_uri(const FzLinkDest& dest) const;
  2753. /** Class-aware wrapper for `::fz_has_permission()`. */
  2754. /**
  2755. Check permission flags on document.
  2756. */
  2757. FZ_FUNCTION int fz_has_permission(::fz_permission p) const;
  2758. /** Class-aware wrapper for `::fz_is_document_reflowable()`. */
  2759. /**
  2760. Is the document reflowable.
  2761. Returns 1 to indicate reflowable documents, otherwise 0.
  2762. */
  2763. FZ_FUNCTION int fz_is_document_reflowable() const;
  2764. /** Class-aware wrapper for `::fz_last_page()`. */
  2765. /**
  2766. Function to get the location for the last page in the document.
  2767. Using this can be far more efficient in some cases than calling
  2768. fz_count_pages and using the page number.
  2769. */
  2770. FZ_FUNCTION FzLocation fz_last_page() const;
  2771. /** Class-aware wrapper for `::fz_layout_document()`. */
  2772. /**
  2773. Layout reflowable document types.
  2774. w, h: Page size in points.
  2775. em: Default font size in points.
  2776. */
  2777. FZ_FUNCTION void fz_layout_document(float w, float h, float em) const;
  2778. /** Class-aware wrapper for `::fz_load_chapter_page()`. */
  2779. /**
  2780. Load a page.
  2781. After fz_load_page is it possible to retrieve the size of the
  2782. page using fz_bound_page, or to render the page using
  2783. fz_run_page_*. Free the page by calling fz_drop_page.
  2784. chapter: chapter number, 0 is the first chapter of the document.
  2785. number: page number, 0 is the first page of the chapter.
  2786. */
  2787. FZ_FUNCTION FzPage fz_load_chapter_page(int chapter, int page) const;
  2788. /** Class-aware wrapper for `::fz_load_outline()`. */
  2789. /**
  2790. Load the hierarchical document outline.
  2791. Should be freed by fz_drop_outline.
  2792. */
  2793. FZ_FUNCTION FzOutline fz_load_outline() const;
  2794. /** Class-aware wrapper for `::fz_load_page()`. */
  2795. /**
  2796. Load a given page number from a document. This may be much less
  2797. efficient than loading by location (chapter+page) for some
  2798. document types.
  2799. */
  2800. FZ_FUNCTION FzPage fz_load_page(int number) const;
  2801. /** Class-aware wrapper for `::fz_location_from_page_number()`. */
  2802. /**
  2803. Converts from page number to chapter+page. This may cause many
  2804. chapters to be laid out in order to calculate the number of
  2805. pages within those chapters.
  2806. */
  2807. FZ_FUNCTION FzLocation fz_location_from_page_number(int number) const;
  2808. /** Class-aware wrapper for `::fz_lookup_bookmark()`. */
  2809. /**
  2810. Find a bookmark and return its page number.
  2811. */
  2812. FZ_FUNCTION FzLocation fz_lookup_bookmark(::fz_bookmark mark) const;
  2813. /** Class-aware wrapper for `::fz_lookup_metadata()`. */
  2814. /**
  2815. Retrieve document meta data strings.
  2816. doc: The document to query.
  2817. key: Which meta data key to retrieve...
  2818. Basic information:
  2819. 'format' -- Document format and version.
  2820. 'encryption' -- Description of the encryption used.
  2821. From the document information dictionary:
  2822. 'info:Title'
  2823. 'info:Author'
  2824. 'info:Subject'
  2825. 'info:Keywords'
  2826. 'info:Creator'
  2827. 'info:Producer'
  2828. 'info:CreationDate'
  2829. 'info:ModDate'
  2830. buf: The buffer to hold the results (a nul-terminated UTF-8
  2831. string).
  2832. size: Size of 'buf'.
  2833. Returns the number of bytes need to store the string plus terminator
  2834. (will be larger than 'size' if the output was truncated), or -1 if the
  2835. key is not recognized or found.
  2836. */
  2837. FZ_FUNCTION int fz_lookup_metadata(const char *key, char *buf, size_t size) const;
  2838. /** Class-aware wrapper for `::fz_lookup_metadata2()`. */
  2839. /**
  2840. C++ alternative to `fz_lookup_metadata()` that returns a `std::string`
  2841. or calls `fz_throw()` if not found.
  2842. */
  2843. FZ_FUNCTION std::string fz_lookup_metadata2(const char *key) const;
  2844. /** Class-aware wrapper for `::fz_needs_password()`. */
  2845. /**
  2846. Check if a document is encrypted with a
  2847. non-blank password.
  2848. */
  2849. FZ_FUNCTION int fz_needs_password() const;
  2850. /** Class-aware wrapper for `::fz_new_buffer_from_page_number()`. */
  2851. FZ_FUNCTION FzBuffer fz_new_buffer_from_page_number(int number, FzStextOptions& options) const;
  2852. /** Class-aware wrapper for `::fz_new_display_list_from_page_number()`. */
  2853. FZ_FUNCTION FzDisplayList fz_new_display_list_from_page_number(int number) const;
  2854. /** Class-aware wrapper for `::fz_new_pdf_document_from_fz_document()`. */
  2855. FZ_FUNCTION PdfDocument fz_new_pdf_document_from_fz_document() const;
  2856. /** Class-aware wrapper for `::fz_new_pixmap_from_page_number()`. */
  2857. FZ_FUNCTION FzPixmap fz_new_pixmap_from_page_number(int number, const FzMatrix& ctm, const FzColorspace& cs, int alpha) const;
  2858. /** Class-aware wrapper for `::fz_new_pixmap_from_page_number_with_separations()`. */
  2859. FZ_FUNCTION FzPixmap fz_new_pixmap_from_page_number_with_separations(int number, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha) const;
  2860. /** Class-aware wrapper for `::fz_new_xhtml_document_from_document()`. */
  2861. /**
  2862. Use text extraction to convert the input document into XHTML,
  2863. then open the result as a new document that can be reflowed.
  2864. */
  2865. FZ_FUNCTION FzDocument fz_new_xhtml_document_from_document(FzStextOptions& opts) const;
  2866. /** Class-aware wrapper for `::fz_next_page()`. */
  2867. /**
  2868. Function to get the location of the next page (allowing for the
  2869. end of chapters etc). If at the end of the document, returns the
  2870. current location.
  2871. */
  2872. FZ_FUNCTION FzLocation fz_next_page(const FzLocation& loc) const;
  2873. /** Class-aware wrapper for `::fz_open_reflowed_document()`. */
  2874. FZ_FUNCTION FzDocument fz_open_reflowed_document(FzStextOptions& opts) const;
  2875. /** Class-aware wrapper for `::fz_output_accelerator()`. */
  2876. /**
  2877. Output accelerator data for the document to a given output
  2878. stream.
  2879. */
  2880. FZ_FUNCTION void fz_output_accelerator(const FzOutput& accel) const;
  2881. /** Class-aware wrapper for `::fz_page_number_from_location()`. */
  2882. /**
  2883. Converts from chapter+page to page number. This may cause many
  2884. chapters to be laid out in order to calculate the number of
  2885. pages within those chapters.
  2886. */
  2887. FZ_FUNCTION int fz_page_number_from_location(const FzLocation& loc) const;
  2888. /** Class-aware wrapper for `::fz_previous_page()`. */
  2889. /**
  2890. Function to get the location of the previous page (allowing for
  2891. the end of chapters etc). If already at the start of the
  2892. document, returns the current page.
  2893. */
  2894. FZ_FUNCTION FzLocation fz_previous_page(const FzLocation& loc) const;
  2895. /** Class-aware wrapper for `::fz_process_opened_pages()`. */
  2896. /**
  2897. Iterates over all opened pages of the document, calling the
  2898. provided callback for each page for processing. If the callback
  2899. returns non-NULL then the iteration stops and that value is returned
  2900. to the called of fz_process_opened_pages().
  2901. The state pointer provided to fz_process_opened_pages() is
  2902. passed on to the callback but is owned by the caller.
  2903. Returns the first non-NULL value returned by the callback,
  2904. or NULL if the callback returned NULL for all opened pages.
  2905. */
  2906. FZ_FUNCTION void *fz_process_opened_pages(::fz_process_opened_page_fn *process_openend_page, void *state) const;
  2907. /** Class-aware wrapper for `::fz_resolve_link()`.
  2908. This method has out-params. Python/C# wrappers look like:
  2909. `fz_resolve_link(const char *uri)` => `(fz_location, float xp, float yp)`
  2910. */
  2911. /**
  2912. Resolve an internal link to a page number.
  2913. xp, yp: Pointer to store coordinate of destination on the page.
  2914. Returns (-1,-1) if the URI cannot be resolved.
  2915. */
  2916. FZ_FUNCTION FzLocation fz_resolve_link(const char *uri, float *xp, float *yp) const;
  2917. /** Class-aware wrapper for `::fz_run_document_structure()`. */
  2918. /**
  2919. Run the document structure through a device.
  2920. doc: Document in question.
  2921. dev: Device obtained from fz_new_*_device.
  2922. cookie: Communication mechanism between caller and library.
  2923. Intended for multi-threaded applications, while
  2924. single-threaded applications set cookie to NULL. The
  2925. caller may abort an ongoing rendering of a page. Cookie also
  2926. communicates progress information back to the caller. The
  2927. fields inside cookie are continually updated while the page is
  2928. rendering.
  2929. */
  2930. FZ_FUNCTION void fz_run_document_structure(const FzDevice& dev, FzCookie& cookie) const;
  2931. /** Class-aware wrapper for `::fz_save_accelerator()`. */
  2932. /**
  2933. Save accelerator data for the document to a given file.
  2934. */
  2935. FZ_FUNCTION void fz_save_accelerator(const char *accel) const;
  2936. /** Class-aware wrapper for `::fz_search_chapter_page_number()`.
  2937. This method has out-params. Python/C# wrappers look like:
  2938. `fz_search_chapter_page_number(int chapter, int page, const char *needle, ::fz_quad *hit_bbox, int hit_max)` => `(int, int hit_mark)`
  2939. */
  2940. FZ_FUNCTION int fz_search_chapter_page_number(int chapter, int page, const char *needle, int *hit_mark, FzQuad& hit_bbox, int hit_max) const;
  2941. /** Class-aware wrapper for `::fz_search_chapter_page_number_cb()`. */
  2942. FZ_FUNCTION int fz_search_chapter_page_number_cb(int chapter, int page, const char *needle, ::fz_search_callback_fn *cb, void *opaque) const;
  2943. /** Class-aware wrapper for `::fz_search_page2()`. */
  2944. /**
  2945. C++ alternative to fz_search_page() that returns information in a std::vector.
  2946. */
  2947. FZ_FUNCTION std::vector<fz_search_page2_hit> fz_search_page2(int number, const char *needle, int hit_max) const;
  2948. /** Class-aware wrapper for `::fz_search_page_number()`.
  2949. This method has out-params. Python/C# wrappers look like:
  2950. `fz_search_page_number(int number, const char *needle, ::fz_quad *hit_bbox, int hit_max)` => `(int, int hit_mark)`
  2951. */
  2952. FZ_FUNCTION int fz_search_page_number(int number, const char *needle, int *hit_mark, FzQuad& hit_bbox, int hit_max) const;
  2953. /** Class-aware wrapper for `::fz_search_page_number_cb()`. */
  2954. FZ_FUNCTION int fz_search_page_number_cb(int number, const char *needle, ::fz_search_callback_fn *cb, void *opaque) const;
  2955. /** Class-aware wrapper for `::fz_set_metadata()`. */
  2956. FZ_FUNCTION void fz_set_metadata(const char *key, const char *value) const;
  2957. /** Class-aware wrapper for `::pdf_count_pages_imp()`. */
  2958. FZ_FUNCTION int pdf_count_pages_imp(int chapter) const;
  2959. /** Class-aware wrapper for `::pdf_document_from_fz_document()`. */
  2960. FZ_FUNCTION PdfDocument pdf_document_from_fz_document() const;
  2961. /** Class-aware wrapper for `::pdf_load_page_imp()`. */
  2962. FZ_FUNCTION FzPage pdf_load_page_imp(int chapter, int number) const;
  2963. /** Class-aware wrapper for `::pdf_page_label_imp()`. */
  2964. FZ_FUNCTION void pdf_page_label_imp(int chapter, int page, char *buf, size_t size) const;
  2965. /** Class-aware wrapper for `::pdf_specifics()`. */
  2966. FZ_FUNCTION PdfDocument pdf_specifics() const;
  2967. /** Constructor using raw copy of pre-existing `::fz_document`. */
  2968. /* This constructor is marked as `explicit` because wrapper classes do not
  2969. call `keep`in constructors, but do call `drop` in destructors. So
  2970. automatic construction from a fz_document* will generally cause an
  2971. unbalanced `drop` resulting in errors such as SEGV. */
  2972. FZ_FUNCTION explicit FzDocument(::fz_document* internal=NULL);
  2973. /** Destructor using fz_drop_document(). */
  2974. FZ_FUNCTION ~FzDocument();
  2975. /** Return numerical value of .m_internal; helps with Python debugging. */
  2976. FZ_FUNCTION long long m_internal_value();
  2977. /** Return true iff `m_internal` is not null. */
  2978. FZ_FUNCTION operator bool();
  2979. /* == Member data. */
  2980. /** Pointer to wrapped data. */
  2981. ::fz_document* m_internal;
  2982. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  2983. generate code regardless so we always need to have this available. */
  2984. FZ_DATA static int s_num_instances;
  2985. };
  2986. /** Wrapper class for struct `fz_document_handler`. Not copyable or assignable. */
  2987. struct FzDocumentHandler
  2988. {
  2989. /** Default constructor, sets `m_internal` to null. */
  2990. FZ_FUNCTION FzDocumentHandler();
  2991. /* == Methods. */
  2992. /** Class-aware wrapper for `::fz_document_handler_open()`. */
  2993. /** Helper for calling `fz_document_handler::open` function pointer via
  2994. Swig from Python/C#. */
  2995. FZ_FUNCTION FzDocument fz_document_handler_open(const FzStream& stream, const FzStream& accel, const FzArchive& dir, void *recognize_state) const;
  2996. /** Class-aware wrapper for `::fz_document_handler_recognize()`. */
  2997. /** Helper for calling a `fz_document_handler::recognize` function
  2998. pointer via Swig from Python/C#. */
  2999. FZ_FUNCTION int fz_document_handler_recognize(const char *magic) const;
  3000. /** Class-aware wrapper for `::fz_register_document_handler()`. */
  3001. /**
  3002. Register a handler for a document type.
  3003. handler: The handler to register. This must live on for the duration of the
  3004. use of this handler. It will be passed back to the handler for calls so
  3005. the caller can use it to retrieve state.
  3006. */
  3007. FZ_FUNCTION void fz_register_document_handler() const;
  3008. /** Constructor using raw copy of pre-existing `::fz_document_handler`. */
  3009. FZ_FUNCTION FzDocumentHandler(::fz_document_handler* internal);
  3010. #ifndef NDEBUG
  3011. /** Destructor only decrements s_num_instances. */
  3012. FZ_FUNCTION ~FzDocumentHandler();
  3013. #else
  3014. /** We use default destructor. */
  3015. #endif
  3016. /** Return numerical value of .m_internal; helps with Python debugging. */
  3017. FZ_FUNCTION long long m_internal_value();
  3018. /** Return true iff `m_internal` is not null. */
  3019. FZ_FUNCTION operator bool();
  3020. /* == Member data. */
  3021. /** Pointer to wrapped data. */
  3022. ::fz_document_handler* m_internal;
  3023. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3024. generate code regardless so we always need to have this available. */
  3025. FZ_DATA static int s_num_instances;
  3026. private:
  3027. /** This class is not copyable or assignable. */
  3028. FzDocumentHandler(const FzDocumentHandler& rhs);
  3029. FzDocumentHandler& operator=(const FzDocumentHandler& rhs);
  3030. };
  3031. /** Wrapper class for struct `fz_document_handler_context`. Not copyable or assignable. */
  3032. struct FzDocumentHandlerContext
  3033. {
  3034. /** Default constructor, sets `m_internal` to null. */
  3035. FZ_FUNCTION FzDocumentHandlerContext();
  3036. /** Constructor using raw copy of pre-existing `::fz_document_handler_context`. */
  3037. FZ_FUNCTION FzDocumentHandlerContext(::fz_document_handler_context* internal);
  3038. #ifndef NDEBUG
  3039. /** Destructor only decrements s_num_instances. */
  3040. FZ_FUNCTION ~FzDocumentHandlerContext();
  3041. #else
  3042. /** We use default destructor. */
  3043. #endif
  3044. /** Return numerical value of .m_internal; helps with Python debugging. */
  3045. FZ_FUNCTION long long m_internal_value();
  3046. /** Return true iff `m_internal` is not null. */
  3047. FZ_FUNCTION operator bool();
  3048. /* == Member data. */
  3049. /** Pointer to wrapped data. */
  3050. ::fz_document_handler_context* m_internal;
  3051. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3052. generate code regardless so we always need to have this available. */
  3053. FZ_DATA static int s_num_instances;
  3054. private:
  3055. /** This class is not copyable or assignable. */
  3056. FzDocumentHandlerContext(const FzDocumentHandlerContext& rhs);
  3057. FzDocumentHandlerContext& operator=(const FzDocumentHandlerContext& rhs);
  3058. };
  3059. /** Wrapper class for struct `fz_document_writer`. Not copyable or assignable. */
  3060. struct FzDocumentWriter
  3061. {
  3062. /* Used for constructor that wraps fz_ functions taking (const char *path, const char *options). */
  3063. enum PathType
  3064. {
  3065. PathType_CBZ,
  3066. PathType_DOCX,
  3067. PathType_ODT,
  3068. PathType_PAM_PIXMAP,
  3069. PathType_PBM_PIXMAP,
  3070. PathType_PCL,
  3071. PathType_PCLM,
  3072. PathType_PDF,
  3073. PathType_PDFOCR,
  3074. PathType_PGM_PIXMAP,
  3075. PathType_PKM_PIXMAP,
  3076. PathType_PNG_PIXMAP,
  3077. PathType_PNM_PIXMAP,
  3078. PathType_PPM_PIXMAP,
  3079. PathType_PS,
  3080. PathType_PWG,
  3081. PathType_SVG,
  3082. };
  3083. /* Used for constructor that wraps fz_ functions taking (Output& out, const char *options). */
  3084. enum OutputType
  3085. {
  3086. OutputType_CBZ,
  3087. OutputType_DOCX,
  3088. OutputType_ODT,
  3089. OutputType_PCL,
  3090. OutputType_PCLM,
  3091. OutputType_PDF,
  3092. OutputType_PDFOCR,
  3093. OutputType_PS,
  3094. OutputType_PWG,
  3095. };
  3096. /* Used for constructor that wraps fz_ functions taking (const char *format, const char *path, const char *options). */
  3097. enum FormatPathType
  3098. {
  3099. FormatPathType_DOCUMENT,
  3100. FormatPathType_TEXT,
  3101. };
  3102. /** == Constructors. */
  3103. /** Constructor using `fz_new_csv_writer()`. */
  3104. FZ_FUNCTION FzDocumentWriter(const char *path, const char *options);
  3105. /** Constructor using `fz_new_csv_writer_with_output()`. */
  3106. /* Disabled because same args as fz_new_svg_writer_with_output.
  3107. FZ_FUNCTION FzDocumentWriter(const FzOutput& out, const char *options);
  3108. */
  3109. /** Constructor using `fz_new_document_writer_of_size()`. */
  3110. /**
  3111. Internal function to allocate a
  3112. block for a derived document_writer structure, with the base
  3113. structure's function pointers populated correctly, and the extra
  3114. space zero initialised.
  3115. */
  3116. FZ_FUNCTION FzDocumentWriter(size_t size, ::fz_document_writer_begin_page_fn *begin_page, ::fz_document_writer_end_page_fn *end_page, ::fz_document_writer_close_writer_fn *close, ::fz_document_writer_drop_writer_fn *drop);
  3117. /** Constructor using `fz_new_document_writer_with_buffer()`. */
  3118. FZ_FUNCTION FzDocumentWriter(const FzBuffer& buf, const char *format, const char *options);
  3119. /** Constructor using `fz_new_jpeg_pixmap_writer()`. */
  3120. /* Disabled because same args as fz_new_csv_writer.
  3121. FZ_FUNCTION FzDocumentWriter(const char *path, const char *options);
  3122. */
  3123. /** Constructor using `fz_new_pixmap_writer()`. */
  3124. FZ_FUNCTION FzDocumentWriter(const char *path, const char *options, const char *default_path, int n, void (*save)(::fz_context *, ::fz_pixmap *, const char *));
  3125. /** Constructor using `fz_new_svg_writer_with_output()`. */
  3126. FZ_FUNCTION FzDocumentWriter(const FzOutput& out, const char *options);
  3127. /** Constructor using one of:
  3128. fz_new_cbz_writer()
  3129. fz_new_docx_writer()
  3130. fz_new_odt_writer()
  3131. fz_new_pam_pixmap_writer()
  3132. fz_new_pbm_pixmap_writer()
  3133. fz_new_pcl_writer()
  3134. fz_new_pclm_writer()
  3135. fz_new_pdf_writer()
  3136. fz_new_pdfocr_writer()
  3137. fz_new_pgm_pixmap_writer()
  3138. fz_new_pkm_pixmap_writer()
  3139. fz_new_png_pixmap_writer()
  3140. fz_new_pnm_pixmap_writer()
  3141. fz_new_ppm_pixmap_writer()
  3142. fz_new_ps_writer()
  3143. fz_new_pwg_writer()
  3144. fz_new_svg_writer()
  3145. */
  3146. FZ_FUNCTION FzDocumentWriter(const char *path, const char *options, PathType path_type);
  3147. /** Constructor using one of:
  3148. fz_new_cbz_writer_with_output()
  3149. fz_new_docx_writer_with_output()
  3150. fz_new_odt_writer_with_output()
  3151. fz_new_pcl_writer_with_output()
  3152. fz_new_pclm_writer_with_output()
  3153. fz_new_pdf_writer_with_output()
  3154. fz_new_pdfocr_writer_with_output()
  3155. fz_new_ps_writer_with_output()
  3156. fz_new_pwg_writer_with_output()
  3157. This constructor takes ownership of <out> -
  3158. out.m_internal is set to NULL after this constructor
  3159. returns so <out> must not be used again.
  3160. */
  3161. FZ_FUNCTION FzDocumentWriter(FzOutput& out, const char *options, OutputType output_type);
  3162. /** Constructor using one of:
  3163. fz_new_document_writer()
  3164. fz_new_text_writer()
  3165. */
  3166. FZ_FUNCTION FzDocumentWriter(const char *format, const char *path, const char *options, FormatPathType format_path_type);
  3167. /** Constructor using fz_new_document_writer_with_output().
  3168. This constructor takes ownership of <out> -
  3169. out.m_internal is set to NULL after this constructor
  3170. returns so <out> must not be used again.
  3171. */
  3172. FZ_FUNCTION FzDocumentWriter(FzOutput& out, const char *format, const char *options);
  3173. /** Constructor using fz_new_text_writer_with_output().
  3174. This constructor takes ownership of <out> -
  3175. out.m_internal is set to NULL after this constructor
  3176. returns so <out> must not be used again.
  3177. */
  3178. FZ_FUNCTION FzDocumentWriter(const char *format, FzOutput& out, const char *options);
  3179. /** Default constructor, sets `m_internal` to null. */
  3180. FZ_FUNCTION FzDocumentWriter();
  3181. /* == Methods. */
  3182. /** Class-aware wrapper for `::fz_begin_page()`. */
  3183. /**
  3184. Called to start the process of writing a page to
  3185. a document.
  3186. mediabox: page size rectangle in points.
  3187. Returns a borrowed fz_device to write page contents to. This
  3188. should be kept if required, and only dropped if it was kept.
  3189. */
  3190. FZ_FUNCTION FzDevice fz_begin_page(const FzRect& mediabox) const;
  3191. /** Class-aware wrapper for `::fz_close_document_writer()`. */
  3192. /**
  3193. Called to end the process of writing
  3194. pages to a document.
  3195. This writes any file level trailers required. After this
  3196. completes successfully the file is up to date and complete.
  3197. */
  3198. FZ_FUNCTION void fz_close_document_writer() const;
  3199. /** Class-aware wrapper for `::fz_end_page()`. */
  3200. /**
  3201. Called to end the process of writing a page to a
  3202. document.
  3203. */
  3204. FZ_FUNCTION void fz_end_page() const;
  3205. /** Class-aware wrapper for `::fz_pdfocr_writer_set_progress()`. */
  3206. FZ_FUNCTION void fz_pdfocr_writer_set_progress(::fz_pdfocr_progress_fn *progress, void *arg_2) const;
  3207. /** Class-aware wrapper for `::fz_write_document()`. */
  3208. /**
  3209. Convenience function to feed all the pages of a document to
  3210. fz_begin_page/fz_run_page/fz_end_page.
  3211. */
  3212. FZ_FUNCTION void fz_write_document(const FzDocument& doc) const;
  3213. /** Class-aware wrapper for `::fz_write_stabilized_story()`. */
  3214. FZ_FUNCTION void fz_write_stabilized_story(const char *user_css, float em, ::fz_write_story_contentfn contentfn, void *contentfn_ref, ::fz_write_story_rectfn rectfn, void *rectfn_ref, ::fz_write_story_pagefn pagefn, void *pagefn_ref, const FzArchive& dir) const;
  3215. /** Class-aware wrapper for `::fz_write_story()`. */
  3216. FZ_FUNCTION void fz_write_story(const FzStory& story, ::fz_write_story_rectfn rectfn, void *rectfn_ref, ::fz_write_story_positionfn positionfn, void *positionfn_ref, ::fz_write_story_pagefn pagefn, void *pagefn_ref) const;
  3217. /** Constructor using raw copy of pre-existing `::fz_document_writer`. */
  3218. FZ_FUNCTION FzDocumentWriter(::fz_document_writer* internal);
  3219. /** Destructor using fz_drop_document_writer(). */
  3220. FZ_FUNCTION ~FzDocumentWriter();
  3221. /** Return numerical value of .m_internal; helps with Python debugging. */
  3222. FZ_FUNCTION long long m_internal_value();
  3223. /** Return true iff `m_internal` is not null. */
  3224. FZ_FUNCTION operator bool();
  3225. /* == Member data. */
  3226. /** Pointer to wrapped data. */
  3227. ::fz_document_writer* m_internal;
  3228. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3229. generate code regardless so we always need to have this available. */
  3230. FZ_DATA static int s_num_instances;
  3231. private:
  3232. /** This class is not copyable or assignable. */
  3233. FzDocumentWriter(const FzDocumentWriter& rhs);
  3234. FzDocumentWriter& operator=(const FzDocumentWriter& rhs);
  3235. };
  3236. /** Wrapper class for struct `fz_draw_options`. Not copyable or assignable. */
  3237. /**
  3238. struct fz_draw_options: Options for creating a pixmap and draw
  3239. device.
  3240. */
  3241. struct FzDrawOptions
  3242. {
  3243. /** == Constructors. */
  3244. /** Constructor using `fz_parse_draw_options()`. */
  3245. /**
  3246. Parse draw device options from a comma separated key-value string.
  3247. */
  3248. FZ_FUNCTION FzDrawOptions(FzDrawOptions& options, const char *string);
  3249. /** Default constructor, sets each member to default value. */
  3250. FZ_FUNCTION FzDrawOptions();
  3251. /** Constructor using raw copy of pre-existing `::fz_draw_options`. */
  3252. FZ_FUNCTION FzDrawOptions(const ::fz_draw_options* internal);
  3253. /** Constructor using raw copy of pre-existing `::fz_draw_options`. */
  3254. FZ_FUNCTION FzDrawOptions(const ::fz_draw_options internal);
  3255. /** Access as underlying struct. */
  3256. FZ_FUNCTION ::fz_draw_options* internal();
  3257. /** Access as underlying struct. */
  3258. FZ_FUNCTION const ::fz_draw_options* internal() const;
  3259. #ifndef NDEBUG
  3260. /** Destructor only decrements s_num_instances. */
  3261. FZ_FUNCTION ~FzDrawOptions();
  3262. #else
  3263. /** We use default destructor. */
  3264. #endif
  3265. /* == Member data. */
  3266. /* These members are the same as the members of ::fz_draw_options. */
  3267. int rotate;
  3268. int x_resolution;
  3269. int y_resolution;
  3270. int width;
  3271. int height;
  3272. ::fz_colorspace *colorspace;
  3273. int alpha;
  3274. int graphics;
  3275. int text;
  3276. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3277. generate code regardless so we always need to have this available. */
  3278. FZ_DATA static int s_num_instances;
  3279. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  3280. FZ_FUNCTION std::string to_string();
  3281. /** Comparison method. */
  3282. FZ_FUNCTION bool operator==(const FzDrawOptions& rhs);
  3283. /** Comparison method. */
  3284. FZ_FUNCTION bool operator!=(const FzDrawOptions& rhs);
  3285. private:
  3286. /** This class is not copyable or assignable. */
  3287. FzDrawOptions(const FzDrawOptions& rhs);
  3288. FzDrawOptions& operator=(const FzDrawOptions& rhs);
  3289. };
  3290. /** Wrapper class for struct `fz_error_context`. Not copyable or assignable. */
  3291. struct FzErrorContext
  3292. {
  3293. /** Default constructor, sets `m_internal` to null. */
  3294. FZ_FUNCTION FzErrorContext();
  3295. /** Constructor using raw copy of pre-existing `::fz_error_context`. */
  3296. FZ_FUNCTION FzErrorContext(::fz_error_context* internal);
  3297. #ifndef NDEBUG
  3298. /** Destructor only decrements s_num_instances. */
  3299. FZ_FUNCTION ~FzErrorContext();
  3300. #else
  3301. /** We use default destructor. */
  3302. #endif
  3303. /** Return numerical value of .m_internal; helps with Python debugging. */
  3304. FZ_FUNCTION long long m_internal_value();
  3305. /** Return true iff `m_internal` is not null. */
  3306. FZ_FUNCTION operator bool();
  3307. /* == Member data. */
  3308. /** Pointer to wrapped data. */
  3309. ::fz_error_context* m_internal;
  3310. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3311. generate code regardless so we always need to have this available. */
  3312. FZ_DATA static int s_num_instances;
  3313. private:
  3314. /** This class is not copyable or assignable. */
  3315. FzErrorContext(const FzErrorContext& rhs);
  3316. FzErrorContext& operator=(const FzErrorContext& rhs);
  3317. };
  3318. /** Wrapper class for struct `fz_error_stack_slot`. Not copyable or assignable. */
  3319. struct FzErrorStackSlot
  3320. {
  3321. /** Default constructor, sets `m_internal` to null. */
  3322. FZ_FUNCTION FzErrorStackSlot();
  3323. /** Constructor using raw copy of pre-existing `::fz_error_stack_slot`. */
  3324. FZ_FUNCTION FzErrorStackSlot(::fz_error_stack_slot* internal);
  3325. #ifndef NDEBUG
  3326. /** Destructor only decrements s_num_instances. */
  3327. FZ_FUNCTION ~FzErrorStackSlot();
  3328. #else
  3329. /** We use default destructor. */
  3330. #endif
  3331. /** Return numerical value of .m_internal; helps with Python debugging. */
  3332. FZ_FUNCTION long long m_internal_value();
  3333. /** Return true iff `m_internal` is not null. */
  3334. FZ_FUNCTION operator bool();
  3335. /* == Member data. */
  3336. /** Pointer to wrapped data. */
  3337. ::fz_error_stack_slot* m_internal;
  3338. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3339. generate code regardless so we always need to have this available. */
  3340. FZ_DATA static int s_num_instances;
  3341. private:
  3342. /** This class is not copyable or assignable. */
  3343. FzErrorStackSlot(const FzErrorStackSlot& rhs);
  3344. FzErrorStackSlot& operator=(const FzErrorStackSlot& rhs);
  3345. };
  3346. /** Wrapper class for struct `fz_font`. */
  3347. /**
  3348. An abstract font handle.
  3349. */
  3350. struct FzFont
  3351. {
  3352. /** == Constructors. */
  3353. /** Constructor using `fz_new_base14_font()`. */
  3354. /**
  3355. Create a new font from one of the built-in fonts.
  3356. */
  3357. FZ_FUNCTION FzFont(const char *name);
  3358. /** Constructor using `fz_new_builtin_font()`. */
  3359. FZ_FUNCTION FzFont(const char *name, int is_bold, int is_italic);
  3360. /** Constructor using `fz_new_cjk_font()`. */
  3361. FZ_FUNCTION FzFont(int ordering);
  3362. /** Constructor using `fz_new_font_from_buffer()`. */
  3363. /**
  3364. Create a new font from a font file in a fz_buffer.
  3365. Fonts created in this way, will be eligible for embedding by default.
  3366. name: Name of font (leave NULL to use name from font).
  3367. buffer: Buffer to load from.
  3368. index: Which font from the file to load (0 for default).
  3369. use_glyph_box: 1 if we should use the glyph bbox, 0 otherwise.
  3370. Returns new font handle, or throws exception on error.
  3371. */
  3372. FZ_FUNCTION FzFont(const char *name, const FzBuffer& buffer, int index, int use_glyph_bbox);
  3373. /** Constructor using `fz_new_font_from_file()`. */
  3374. /**
  3375. Create a new font from a font file.
  3376. Fonts created in this way, will be eligible for embedding by default.
  3377. name: Name of font (leave NULL to use name from font).
  3378. path: File path to load from.
  3379. index: Which font from the file to load (0 for default).
  3380. use_glyph_box: 1 if we should use the glyph bbox, 0 otherwise.
  3381. Returns new font handle, or throws exception on error.
  3382. */
  3383. FZ_FUNCTION FzFont(const char *name, const char *path, int index, int use_glyph_bbox);
  3384. /** Constructor using `fz_new_font_from_memory()`. */
  3385. /**
  3386. Create a new font from a font file in memory.
  3387. Fonts created in this way, will be eligible for embedding by default.
  3388. name: Name of font (leave NULL to use name from font).
  3389. data: Pointer to the font file data.
  3390. len: Length of the font file data.
  3391. index: Which font from the file to load (0 for default).
  3392. use_glyph_box: 1 if we should use the glyph bbox, 0 otherwise.
  3393. Returns new font handle, or throws exception on error.
  3394. */
  3395. FZ_FUNCTION FzFont(const char *name, const unsigned char *data, int len, int index, int use_glyph_bbox);
  3396. /** Constructor using `fz_new_type3_font()`. */
  3397. /**
  3398. Create a new (empty) type3 font.
  3399. name: Name of font (or NULL).
  3400. matrix: Font matrix.
  3401. Returns a new font handle, or throws exception on
  3402. allocation failure.
  3403. */
  3404. FZ_FUNCTION FzFont(const char *name, const FzMatrix& matrix);
  3405. /** Copy constructor using `fz_keep_font()`. */
  3406. FZ_FUNCTION FzFont(const FzFont& rhs);
  3407. /** operator= using `fz_keep_font()` and `fz_drop_font()`. */
  3408. FZ_FUNCTION FzFont& operator=(const FzFont& rhs);
  3409. /** Default constructor, sets `m_internal` to null. */
  3410. FZ_FUNCTION FzFont();
  3411. /* == Methods. */
  3412. /** Class-aware wrapper for `::fz_advance_glyph()`. */
  3413. /**
  3414. Return the advance for a given glyph.
  3415. font: The font to look for the glyph in.
  3416. glyph: The glyph to find the advance for.
  3417. wmode: 1 for vertical mode, 0 for horizontal.
  3418. Returns the advance for the glyph.
  3419. */
  3420. FZ_FUNCTION float fz_advance_glyph(int glyph, int wmode) const;
  3421. /** Class-aware wrapper for `::fz_bound_glyph()`. */
  3422. /**
  3423. Return a bbox for a given glyph in a font.
  3424. font: The font to look for the glyph in.
  3425. gid: The glyph to bound.
  3426. trm: The matrix to apply to the glyph before bounding.
  3427. Returns rectangle by value containing the bounds of the given
  3428. glyph.
  3429. */
  3430. FZ_FUNCTION FzRect fz_bound_glyph(int gid, const FzMatrix& trm) const;
  3431. /** Class-aware wrapper for `::fz_calculate_font_ascender_descender()`. */
  3432. /**
  3433. Ensure that a font has its ascender/descender values calculated
  3434. from the actual bbox of the glyphs.
  3435. Note, that we combine the declared values from the font (or the
  3436. default values if those are not present) with the actual bbox to
  3437. get the final result. So this can only cause ascender/descender
  3438. to move further apart!
  3439. */
  3440. FZ_FUNCTION void fz_calculate_font_ascender_descender() const;
  3441. /** Class-aware wrapper for `::fz_decouple_type3_font()`. */
  3442. FZ_FUNCTION void fz_decouple_type3_font(void *t3doc) const;
  3443. /** Class-aware wrapper for `::fz_encode_character()`. */
  3444. /**
  3445. Find the glyph id for a given unicode
  3446. character within a font.
  3447. font: The font to look for the unicode character in.
  3448. unicode: The unicode character to encode.
  3449. Returns the glyph id for the given unicode value, or 0 if
  3450. unknown.
  3451. */
  3452. FZ_FUNCTION int fz_encode_character(int unicode) const;
  3453. /** Class-aware wrapper for `::fz_encode_character_by_glyph_name()`. */
  3454. /**
  3455. Encode character.
  3456. Either by direct lookup of glyphname within a font, or, failing
  3457. that, by mapping glyphname to unicode and thence to the glyph
  3458. index within the given font.
  3459. Returns zero for type3 fonts.
  3460. */
  3461. FZ_FUNCTION int fz_encode_character_by_glyph_name(const char *glyphname) const;
  3462. /** Class-aware wrapper for `::fz_encode_character_sc()`. */
  3463. /**
  3464. Encode character, preferring small-caps variant if available.
  3465. font: The font to look for the unicode character in.
  3466. unicode: The unicode character to encode.
  3467. Returns the glyph id for the given unicode value, or 0 if
  3468. unknown.
  3469. */
  3470. FZ_FUNCTION int fz_encode_character_sc(int unicode) const;
  3471. /** Class-aware wrapper for `::fz_encode_character_with_fallback()`.
  3472. This method has out-params. Python/C# wrappers look like:
  3473. `fz_encode_character_with_fallback(int unicode, int script, int language, ::fz_font **out_font)` => `(int)`
  3474. */
  3475. /**
  3476. Find the glyph id for
  3477. a given unicode character within a font, falling back to
  3478. an alternative if not found.
  3479. font: The font to look for the unicode character in.
  3480. unicode: The unicode character to encode.
  3481. script: The script in use.
  3482. language: The language in use.
  3483. out_font: The font handle in which the given glyph represents
  3484. the requested unicode character. The caller does not own the
  3485. reference it is passed, so should call fz_keep_font if it is
  3486. not simply to be used immediately.
  3487. Returns the glyph id for the given unicode value in the supplied
  3488. font (and sets *out_font to font) if it is present. Otherwise
  3489. an alternative fallback font (based on script/language) is
  3490. searched for. If the glyph is found therein, *out_font is set
  3491. to this reference, and the glyph reference is returned. If it
  3492. cannot be found anywhere, the function returns 0.
  3493. */
  3494. FZ_FUNCTION int fz_encode_character_with_fallback(int unicode, int script, int language, FzFont& out_font) const;
  3495. /** Class-aware wrapper for `::fz_enumerate_font_cmap()`. */
  3496. /**
  3497. Enumerate a cmap using a callback.
  3498. */
  3499. FZ_FUNCTION void fz_enumerate_font_cmap(::fz_cmap_callback *cb, void *opaque) const;
  3500. /** Class-aware wrapper for `::fz_enumerate_font_cmap2()`. */
  3501. /** SWIG-friendly wrapper for fz_enumerate_font_cmap(). */
  3502. FZ_FUNCTION std::vector<fz_font_ucs_gid> fz_enumerate_font_cmap2() const;
  3503. /** Class-aware wrapper for `::fz_extract_ttf_from_ttc()`. */
  3504. FZ_FUNCTION FzBuffer fz_extract_ttf_from_ttc() const;
  3505. /** Class-aware wrapper for `::fz_font_ascender()`. */
  3506. /**
  3507. Retrieve font ascender in ems.
  3508. */
  3509. FZ_FUNCTION float fz_font_ascender() const;
  3510. /** Class-aware wrapper for `::fz_font_bbox()`. */
  3511. /**
  3512. Retrieve the font bbox.
  3513. font: The font to query.
  3514. Returns the font bbox by value; it is valid only if
  3515. fz_font_flags(font)->invalid_bbox is zero.
  3516. */
  3517. FZ_FUNCTION FzRect fz_font_bbox() const;
  3518. /** Class-aware wrapper for `::fz_font_descender()`. */
  3519. /**
  3520. Retrieve font descender in ems.
  3521. */
  3522. FZ_FUNCTION float fz_font_descender() const;
  3523. /** Class-aware wrapper for `::fz_font_digest()`. */
  3524. /**
  3525. Retrieve the MD5 digest for the font's data.
  3526. */
  3527. FZ_FUNCTION void fz_font_digest(unsigned char digest[16]) const;
  3528. /** Class-aware wrapper for `::fz_font_ft_face()`. */
  3529. /**
  3530. Retrieve the FT_Face handle
  3531. for the font.
  3532. font: The font to query
  3533. Returns the FT_Face handle for the font, or NULL
  3534. if not a freetype handled font. (Cast to void *
  3535. to avoid nasty header exposure).
  3536. */
  3537. FZ_FUNCTION void *fz_font_ft_face() const;
  3538. /** Class-aware wrapper for `::fz_font_is_bold()`. */
  3539. /**
  3540. Query whether the font flags say that this font is bold.
  3541. */
  3542. FZ_FUNCTION int fz_font_is_bold() const;
  3543. /** Class-aware wrapper for `::fz_font_is_italic()`. */
  3544. /**
  3545. Query whether the font flags say that this font is italic.
  3546. */
  3547. FZ_FUNCTION int fz_font_is_italic() const;
  3548. /** Class-aware wrapper for `::fz_font_is_monospaced()`. */
  3549. /**
  3550. Query whether the font flags say that this font is monospaced.
  3551. */
  3552. FZ_FUNCTION int fz_font_is_monospaced() const;
  3553. /** Class-aware wrapper for `::fz_font_is_serif()`. */
  3554. /**
  3555. Query whether the font flags say that this font is serif.
  3556. */
  3557. FZ_FUNCTION int fz_font_is_serif() const;
  3558. /** Class-aware wrapper for `::fz_font_name()`. */
  3559. /**
  3560. Retrieve a pointer to the name of the font.
  3561. font: The font to query.
  3562. Returns a pointer to an internal copy of the font name.
  3563. Will never be NULL, but may be the empty string.
  3564. */
  3565. FZ_FUNCTION const char *fz_font_name() const;
  3566. /** Class-aware wrapper for `::fz_font_t3_procs()`. */
  3567. /**
  3568. Retrieve the Type3 procs
  3569. for a font.
  3570. font: The font to query
  3571. Returns the t3_procs pointer. Will be NULL for a
  3572. non type-3 font.
  3573. */
  3574. FZ_FUNCTION ::fz_buffer **fz_font_t3_procs() const;
  3575. /** Class-aware wrapper for `::fz_get_glyph_name()`. */
  3576. /**
  3577. Find the name of a glyph
  3578. font: The font to look for the glyph in.
  3579. glyph: The glyph id to look for.
  3580. buf: Pointer to a buffer for the name to be inserted into.
  3581. size: The size of the buffer.
  3582. If a font contains a name table, then the name of the glyph
  3583. will be returned in the supplied buffer. Otherwise a name
  3584. is synthesised. The name will be truncated to fit in
  3585. the buffer.
  3586. */
  3587. FZ_FUNCTION void fz_get_glyph_name(int glyph, char *buf, int size) const;
  3588. /** Class-aware wrapper for `::fz_get_glyph_name2()`. */
  3589. /**
  3590. C++ alternative to fz_get_glyph_name() that returns information in a std::string.
  3591. */
  3592. FZ_FUNCTION std::string fz_get_glyph_name2(int glyph) const;
  3593. /** Class-aware wrapper for `::fz_glyph_cacheable()`. */
  3594. /**
  3595. Determine if a given glyph in a font
  3596. is cacheable. Certain glyphs in a type 3 font cannot safely
  3597. be cached, as their appearance depends on the enclosing
  3598. graphic state.
  3599. font: The font to look for the glyph in.
  3600. gif: The glyph to query.
  3601. Returns non-zero if cacheable, 0 if not.
  3602. */
  3603. FZ_FUNCTION int fz_glyph_cacheable(int gid) const;
  3604. /** Class-aware wrapper for `::fz_measure_string()`. */
  3605. /**
  3606. Measure the advance width of a UTF8 string should it be added to a text object.
  3607. This uses the same layout algorithms as fz_show_string, and can be used
  3608. to calculate text alignment adjustments.
  3609. */
  3610. FZ_FUNCTION FzMatrix fz_measure_string(const FzMatrix& trm, const char *s, int wmode, int bidi_level, ::fz_bidi_direction markup_dir, ::fz_text_language language) const;
  3611. /** Class-aware wrapper for `::fz_outline_glyph()`. */
  3612. /**
  3613. Look a glyph up from a font, and return the outline of the
  3614. glyph using the given transform.
  3615. The caller owns the returned path, and so is responsible for
  3616. ensuring that it eventually gets dropped.
  3617. */
  3618. FZ_FUNCTION FzPath fz_outline_glyph(int gid, const FzMatrix& ctm) const;
  3619. /** Class-aware wrapper for `::fz_prepare_t3_glyph()`. */
  3620. /**
  3621. Force a type3 font to cache the displaylist for a given glyph
  3622. id.
  3623. This caching can involve reading the underlying file, so must
  3624. happen ahead of time, so we aren't suddenly forced to read the
  3625. file while playing a displaylist back.
  3626. */
  3627. FZ_FUNCTION void fz_prepare_t3_glyph(int gid) const;
  3628. /** Class-aware wrapper for `::fz_render_glyph_pixmap()`. */
  3629. /**
  3630. Create a pixmap containing a rendered glyph.
  3631. Lookup gid from font, clip it with scissor, and rendering it
  3632. with aa bits of antialiasing into a new pixmap.
  3633. The caller takes ownership of the pixmap and so must free it.
  3634. Note: This function is no longer used for normal rendering
  3635. operations, and is kept around just because we use it in the
  3636. app. It should be considered "at risk" of removal from the API.
  3637. */
  3638. FZ_FUNCTION FzPixmap fz_render_glyph_pixmap(int gid, FzMatrix& ctm, FzIrect& scissor, int aa) const;
  3639. /** Class-aware wrapper for `::fz_run_t3_glyph()`. */
  3640. /**
  3641. Run a glyph from a Type3 font to
  3642. a given device.
  3643. font: The font to find the glyph in.
  3644. gid: The glyph to run.
  3645. trm: The transform to apply.
  3646. dev: The device to render onto.
  3647. */
  3648. FZ_FUNCTION void fz_run_t3_glyph(int gid, const FzMatrix& trm, const FzDevice& dev) const;
  3649. /** Class-aware wrapper for `::fz_set_font_bbox()`. */
  3650. /**
  3651. Set the font bbox.
  3652. font: The font to set the bbox for.
  3653. xmin, ymin, xmax, ymax: The bounding box.
  3654. */
  3655. FZ_FUNCTION void fz_set_font_bbox(float xmin, float ymin, float xmax, float ymax) const;
  3656. /** Class-aware wrapper for `::fz_set_font_embedding()`. */
  3657. /**
  3658. Control whether a given font should be embedded or not when writing.
  3659. */
  3660. FZ_FUNCTION void fz_set_font_embedding(int embed) const;
  3661. /** Class-aware wrapper for `::pdf_font_writing_supported()`. */
  3662. FZ_FUNCTION int pdf_font_writing_supported() const;
  3663. /** Class-aware wrapper for `::pdf_layout_fit_text()`. */
  3664. FZ_FUNCTION FzText pdf_layout_fit_text(::fz_text_language lang, const char *str, const FzRect& bounds) const;
  3665. /** Constructor using raw copy of pre-existing `::fz_font`. */
  3666. /* This constructor is marked as `explicit` because wrapper classes do not
  3667. call `keep`in constructors, but do call `drop` in destructors. So
  3668. automatic construction from a fz_font* will generally cause an
  3669. unbalanced `drop` resulting in errors such as SEGV. */
  3670. FZ_FUNCTION explicit FzFont(::fz_font* internal);
  3671. /** Destructor using fz_drop_font(). */
  3672. FZ_FUNCTION ~FzFont();
  3673. /** Return numerical value of .m_internal; helps with Python debugging. */
  3674. FZ_FUNCTION long long m_internal_value();
  3675. /** Return true iff `m_internal` is not null. */
  3676. FZ_FUNCTION operator bool();
  3677. /* == Member data. */
  3678. /** Pointer to wrapped data. */
  3679. ::fz_font* m_internal;
  3680. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3681. generate code regardless so we always need to have this available. */
  3682. FZ_DATA static int s_num_instances;
  3683. };
  3684. /** Wrapper class for struct `fz_font_context`. Not copyable or assignable. */
  3685. struct FzFontContext
  3686. {
  3687. /** Default constructor, sets `m_internal` to null. */
  3688. FZ_FUNCTION FzFontContext();
  3689. /** Constructor using raw copy of pre-existing `::fz_font_context`. */
  3690. FZ_FUNCTION FzFontContext(::fz_font_context* internal);
  3691. #ifndef NDEBUG
  3692. /** Destructor only decrements s_num_instances. */
  3693. FZ_FUNCTION ~FzFontContext();
  3694. #else
  3695. /** We use default destructor. */
  3696. #endif
  3697. /** Return numerical value of .m_internal; helps with Python debugging. */
  3698. FZ_FUNCTION long long m_internal_value();
  3699. /** Return true iff `m_internal` is not null. */
  3700. FZ_FUNCTION operator bool();
  3701. /* == Member data. */
  3702. /** Pointer to wrapped data. */
  3703. ::fz_font_context* m_internal;
  3704. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3705. generate code regardless so we always need to have this available. */
  3706. FZ_DATA static int s_num_instances;
  3707. private:
  3708. /** This class is not copyable or assignable. */
  3709. FzFontContext(const FzFontContext& rhs);
  3710. FzFontContext& operator=(const FzFontContext& rhs);
  3711. };
  3712. /** Wrapper class for struct `fz_font_flags_t`. Not copyable or assignable. */
  3713. /**
  3714. Every fz_font carries a set of flags
  3715. within it, in a fz_font_flags_t structure.
  3716. */
  3717. struct FzFontFlagsT
  3718. {
  3719. /** Default constructor, sets `m_internal` to null. */
  3720. FZ_FUNCTION FzFontFlagsT();
  3721. /** Constructor using raw copy of pre-existing `::fz_font_flags_t`. */
  3722. FZ_FUNCTION FzFontFlagsT(::fz_font_flags_t* internal);
  3723. #ifndef NDEBUG
  3724. /** Destructor only decrements s_num_instances. */
  3725. FZ_FUNCTION ~FzFontFlagsT();
  3726. #else
  3727. /** We use default destructor. */
  3728. #endif
  3729. /** Return numerical value of .m_internal; helps with Python debugging. */
  3730. FZ_FUNCTION long long m_internal_value();
  3731. /** Return true iff `m_internal` is not null. */
  3732. FZ_FUNCTION operator bool();
  3733. /* == Member data. */
  3734. /** Pointer to wrapped data. */
  3735. ::fz_font_flags_t* m_internal;
  3736. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3737. generate code regardless so we always need to have this available. */
  3738. FZ_DATA static int s_num_instances;
  3739. private:
  3740. /** This class is not copyable or assignable. */
  3741. FzFontFlagsT(const FzFontFlagsT& rhs);
  3742. FzFontFlagsT& operator=(const FzFontFlagsT& rhs);
  3743. };
  3744. /** Wrapper class for struct `fz_function`. */
  3745. struct FzFunction
  3746. {
  3747. /** == Constructors. */
  3748. /** Constructor using `fz_new_function_of_size()`. */
  3749. FZ_FUNCTION FzFunction(int size, size_t size2, int m, int n, ::fz_function_eval_fn *eval, ::fz_store_drop_fn *drop);
  3750. /** Copy constructor using `fz_keep_function()`. */
  3751. FZ_FUNCTION FzFunction(const FzFunction& rhs);
  3752. /** operator= using `fz_keep_function()` and `fz_drop_function()`. */
  3753. FZ_FUNCTION FzFunction& operator=(const FzFunction& rhs);
  3754. /** Default constructor, sets `m_internal` to null. */
  3755. FZ_FUNCTION FzFunction();
  3756. /* == Methods. */
  3757. /** Class-aware wrapper for `::fz_eval_function()`.
  3758. This method has out-params. Python/C# wrappers look like:
  3759. `fz_eval_function(const float *in, int inlen, int outlen)` => float out
  3760. */
  3761. FZ_FUNCTION void fz_eval_function(const float *in, int inlen, float *out, int outlen) const;
  3762. /** Class-aware wrapper for `::fz_function_size()`. */
  3763. FZ_FUNCTION size_t fz_function_size() const;
  3764. /** Constructor using raw copy of pre-existing `::fz_function`. */
  3765. /* This constructor is marked as `explicit` because wrapper classes do not
  3766. call `keep`in constructors, but do call `drop` in destructors. So
  3767. automatic construction from a fz_function* will generally cause an
  3768. unbalanced `drop` resulting in errors such as SEGV. */
  3769. FZ_FUNCTION explicit FzFunction(::fz_function* internal);
  3770. /** Destructor using fz_drop_function(). */
  3771. FZ_FUNCTION ~FzFunction();
  3772. /** Return numerical value of .m_internal; helps with Python debugging. */
  3773. FZ_FUNCTION long long m_internal_value();
  3774. /** Return true iff `m_internal` is not null. */
  3775. FZ_FUNCTION operator bool();
  3776. /* == Member data. */
  3777. /** Pointer to wrapped data. */
  3778. ::fz_function* m_internal;
  3779. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3780. generate code regardless so we always need to have this available. */
  3781. FZ_DATA static int s_num_instances;
  3782. };
  3783. /** Wrapper class for struct `fz_getopt_long_options`. Not copyable or assignable. */
  3784. struct FzGetoptLongOptions
  3785. {
  3786. /** Default constructor, sets `m_internal` to null. */
  3787. FZ_FUNCTION FzGetoptLongOptions();
  3788. /** Constructor using raw copy of pre-existing `::fz_getopt_long_options`. */
  3789. FZ_FUNCTION FzGetoptLongOptions(::fz_getopt_long_options* internal);
  3790. #ifndef NDEBUG
  3791. /** Destructor only decrements s_num_instances. */
  3792. FZ_FUNCTION ~FzGetoptLongOptions();
  3793. #else
  3794. /** We use default destructor. */
  3795. #endif
  3796. /** Return numerical value of .m_internal; helps with Python debugging. */
  3797. FZ_FUNCTION long long m_internal_value();
  3798. /** Return true iff `m_internal` is not null. */
  3799. FZ_FUNCTION operator bool();
  3800. /* == Member data. */
  3801. /** Pointer to wrapped data. */
  3802. ::fz_getopt_long_options* m_internal;
  3803. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3804. generate code regardless so we always need to have this available. */
  3805. FZ_DATA static int s_num_instances;
  3806. private:
  3807. /** This class is not copyable or assignable. */
  3808. FzGetoptLongOptions(const FzGetoptLongOptions& rhs);
  3809. FzGetoptLongOptions& operator=(const FzGetoptLongOptions& rhs);
  3810. };
  3811. /** Wrapper class for struct `fz_glyph`. */
  3812. /**
  3813. Glyphs represent a run length encoded set of pixels for a 2
  3814. dimensional region of a plane.
  3815. */
  3816. struct FzGlyph
  3817. {
  3818. /** Copy constructor using `fz_keep_glyph()`. */
  3819. FZ_FUNCTION FzGlyph(const FzGlyph& rhs);
  3820. /** operator= using `fz_keep_glyph()` and `fz_drop_glyph()`. */
  3821. FZ_FUNCTION FzGlyph& operator=(const FzGlyph& rhs);
  3822. /** Default constructor, sets `m_internal` to null. */
  3823. FZ_FUNCTION FzGlyph();
  3824. /* == Methods. */
  3825. /** Class-aware wrapper for `::fz_glyph_bbox()`. */
  3826. /**
  3827. Return the bounding box of the glyph in pixels.
  3828. */
  3829. FZ_FUNCTION FzIrect fz_glyph_bbox() const;
  3830. /** Class-aware wrapper for `::fz_glyph_bbox_no_ctx()`. */
  3831. FZ_FUNCTION FzIrect fz_glyph_bbox_no_ctx() const;
  3832. /** Class-aware wrapper for `::fz_glyph_height()`. */
  3833. /**
  3834. Return the height of the glyph in pixels.
  3835. */
  3836. FZ_FUNCTION int fz_glyph_height() const;
  3837. /** Class-aware wrapper for `::fz_glyph_width()`. */
  3838. /**
  3839. Return the width of the glyph in pixels.
  3840. */
  3841. FZ_FUNCTION int fz_glyph_width() const;
  3842. /** Constructor using raw copy of pre-existing `::fz_glyph`. */
  3843. /* This constructor is marked as `explicit` because wrapper classes do not
  3844. call `keep`in constructors, but do call `drop` in destructors. So
  3845. automatic construction from a fz_glyph* will generally cause an
  3846. unbalanced `drop` resulting in errors such as SEGV. */
  3847. FZ_FUNCTION explicit FzGlyph(::fz_glyph* internal);
  3848. /** Destructor using fz_drop_glyph(). */
  3849. FZ_FUNCTION ~FzGlyph();
  3850. /** Return numerical value of .m_internal; helps with Python debugging. */
  3851. FZ_FUNCTION long long m_internal_value();
  3852. /** Return true iff `m_internal` is not null. */
  3853. FZ_FUNCTION operator bool();
  3854. /* == Member data. */
  3855. /** Pointer to wrapped data. */
  3856. ::fz_glyph* m_internal;
  3857. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3858. generate code regardless so we always need to have this available. */
  3859. FZ_DATA static int s_num_instances;
  3860. };
  3861. /** Wrapper class for struct `fz_glyph_cache`. Not copyable or assignable. */
  3862. struct FzGlyphCache
  3863. {
  3864. /** Default constructor, sets `m_internal` to null. */
  3865. FZ_FUNCTION FzGlyphCache();
  3866. /** Constructor using raw copy of pre-existing `::fz_glyph_cache`. */
  3867. FZ_FUNCTION FzGlyphCache(::fz_glyph_cache* internal);
  3868. #ifndef NDEBUG
  3869. /** Destructor only decrements s_num_instances. */
  3870. FZ_FUNCTION ~FzGlyphCache();
  3871. #else
  3872. /** We use default destructor. */
  3873. #endif
  3874. /** Return numerical value of .m_internal; helps with Python debugging. */
  3875. FZ_FUNCTION long long m_internal_value();
  3876. /** Return true iff `m_internal` is not null. */
  3877. FZ_FUNCTION operator bool();
  3878. /* == Member data. */
  3879. /** Pointer to wrapped data. */
  3880. ::fz_glyph_cache* m_internal;
  3881. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3882. generate code regardless so we always need to have this available. */
  3883. FZ_DATA static int s_num_instances;
  3884. private:
  3885. /** This class is not copyable or assignable. */
  3886. FzGlyphCache(const FzGlyphCache& rhs);
  3887. FzGlyphCache& operator=(const FzGlyphCache& rhs);
  3888. };
  3889. /** Wrapper class for struct `fz_halftone`. */
  3890. /**
  3891. A halftone is a set of threshold tiles, one per component. Each
  3892. threshold tile is a pixmap, possibly of varying sizes and
  3893. phases. Currently, we only provide one 'default' halftone tile
  3894. for operating on 1 component plus alpha pixmaps (where the alpha
  3895. is ignored). This is signified by a fz_halftone pointer to NULL.
  3896. */
  3897. struct FzHalftone
  3898. {
  3899. /** Copy constructor using `fz_keep_halftone()`. */
  3900. FZ_FUNCTION FzHalftone(const FzHalftone& rhs);
  3901. /** operator= using `fz_keep_halftone()` and `fz_drop_halftone()`. */
  3902. FZ_FUNCTION FzHalftone& operator=(const FzHalftone& rhs);
  3903. /** Constructor using raw copy of pre-existing `::fz_halftone`. */
  3904. /* This constructor is marked as `explicit` because wrapper classes do not
  3905. call `keep`in constructors, but do call `drop` in destructors. So
  3906. automatic construction from a fz_halftone* will generally cause an
  3907. unbalanced `drop` resulting in errors such as SEGV. */
  3908. FZ_FUNCTION explicit FzHalftone(::fz_halftone* internal=NULL);
  3909. /** Destructor using fz_drop_halftone(). */
  3910. FZ_FUNCTION ~FzHalftone();
  3911. /** Return numerical value of .m_internal; helps with Python debugging. */
  3912. FZ_FUNCTION long long m_internal_value();
  3913. /** Return true iff `m_internal` is not null. */
  3914. FZ_FUNCTION operator bool();
  3915. /* == Member data. */
  3916. /** Pointer to wrapped data. */
  3917. ::fz_halftone* m_internal;
  3918. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3919. generate code regardless so we always need to have this available. */
  3920. FZ_DATA static int s_num_instances;
  3921. };
  3922. /** Wrapper class for struct `fz_hash_table`. Not copyable or assignable. */
  3923. /**
  3924. Generic hash-table with fixed-length keys.
  3925. The keys and values are NOT reference counted by the hash table.
  3926. Callers are responsible for taking care the reference counts are
  3927. correct. Inserting a duplicate entry will NOT overwrite the old
  3928. value, and will return the old value.
  3929. The drop_val callback function is only used to release values
  3930. when the hash table is destroyed.
  3931. */
  3932. struct FzHashTable
  3933. {
  3934. /** == Constructors. */
  3935. /** Constructor using `fz_new_hash_table()`. */
  3936. /**
  3937. Create a new hash table.
  3938. initialsize: The initial size of the hashtable. The hashtable
  3939. may grow (double in size) if it starts to get crowded (80%
  3940. full).
  3941. keylen: byte length for each key.
  3942. lock: -1 for no lock, otherwise the FZ_LOCK to use to protect
  3943. this table.
  3944. drop_val: Function to use to destroy values on table drop.
  3945. */
  3946. FZ_FUNCTION FzHashTable(int initialsize, int keylen, int lock, ::fz_hash_table_drop_fn *drop_val);
  3947. /** Default constructor, sets `m_internal` to null. */
  3948. FZ_FUNCTION FzHashTable();
  3949. /* == Methods. */
  3950. /** Class-aware wrapper for `::fz_hash_filter()`. */
  3951. /**
  3952. Iterate over the entries in a hash table, removing all the ones where callback returns true.
  3953. Does NOT free the value of the entry, so the caller is expected to take care of this.
  3954. */
  3955. FZ_FUNCTION void fz_hash_filter(void *state, ::fz_hash_table_filter_fn *callback) const;
  3956. /** Class-aware wrapper for `::fz_hash_find()`. */
  3957. /**
  3958. Search for a matching hash within the table, and return the
  3959. associated value.
  3960. */
  3961. FZ_FUNCTION void *fz_hash_find(const void *key) const;
  3962. /** Class-aware wrapper for `::fz_hash_for_each()`. */
  3963. /**
  3964. Iterate over the entries in a hash table.
  3965. */
  3966. FZ_FUNCTION void fz_hash_for_each(void *state, ::fz_hash_table_for_each_fn *callback) const;
  3967. /** Class-aware wrapper for `::fz_hash_insert()`. */
  3968. /**
  3969. Insert a new key/value pair into the hash table.
  3970. If an existing entry with the same key is found, no change is
  3971. made to the hash table, and a pointer to the existing value is
  3972. returned.
  3973. If no existing entry with the same key is found, ownership of
  3974. val passes in, key is copied, and NULL is returned.
  3975. */
  3976. FZ_FUNCTION void *fz_hash_insert(const void *key, void *val) const;
  3977. /** Class-aware wrapper for `::fz_hash_remove()`. */
  3978. /**
  3979. Remove the entry for a given key.
  3980. The value is NOT freed, so the caller is expected to take care
  3981. of this.
  3982. */
  3983. FZ_FUNCTION void fz_hash_remove(const void *key) const;
  3984. /** Constructor using raw copy of pre-existing `::fz_hash_table`. */
  3985. FZ_FUNCTION FzHashTable(::fz_hash_table* internal);
  3986. /** Destructor using fz_drop_hash_table(). */
  3987. FZ_FUNCTION ~FzHashTable();
  3988. /** Return numerical value of .m_internal; helps with Python debugging. */
  3989. FZ_FUNCTION long long m_internal_value();
  3990. /** Return true iff `m_internal` is not null. */
  3991. FZ_FUNCTION operator bool();
  3992. /* == Member data. */
  3993. /** Pointer to wrapped data. */
  3994. ::fz_hash_table* m_internal;
  3995. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  3996. generate code regardless so we always need to have this available. */
  3997. FZ_DATA static int s_num_instances;
  3998. private:
  3999. /** This class is not copyable or assignable. */
  4000. FzHashTable(const FzHashTable& rhs);
  4001. FzHashTable& operator=(const FzHashTable& rhs);
  4002. };
  4003. /** Wrapper class for struct `fz_icc_profile`. Not copyable or assignable. */
  4004. /**
  4005. Opaque type for an ICC Profile.
  4006. */
  4007. struct FzIccProfile
  4008. {
  4009. /** Default constructor, sets `m_internal` to null. */
  4010. FZ_FUNCTION FzIccProfile();
  4011. /** Constructor using raw copy of pre-existing `::fz_icc_profile`. */
  4012. FZ_FUNCTION FzIccProfile(::fz_icc_profile* internal);
  4013. #ifndef NDEBUG
  4014. /** Destructor only decrements s_num_instances. */
  4015. FZ_FUNCTION ~FzIccProfile();
  4016. #else
  4017. /** We use default destructor. */
  4018. #endif
  4019. /** Return numerical value of .m_internal; helps with Python debugging. */
  4020. FZ_FUNCTION long long m_internal_value();
  4021. /** Return true iff `m_internal` is not null. */
  4022. FZ_FUNCTION operator bool();
  4023. /* == Member data. */
  4024. /** Pointer to wrapped data. */
  4025. ::fz_icc_profile* m_internal;
  4026. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4027. generate code regardless so we always need to have this available. */
  4028. FZ_DATA static int s_num_instances;
  4029. private:
  4030. /** This class is not copyable or assignable. */
  4031. FzIccProfile(const FzIccProfile& rhs);
  4032. FzIccProfile& operator=(const FzIccProfile& rhs);
  4033. };
  4034. /** Wrapper class for struct `fz_image`. */
  4035. /**
  4036. Images are storable objects from which we can obtain fz_pixmaps.
  4037. These may be implemented as simple wrappers around a pixmap, or
  4038. as more complex things that decode at different subsample
  4039. settings on demand.
  4040. */
  4041. struct FzImage
  4042. {
  4043. /** == Constructors. */
  4044. /** Constructor using `fz_new_barcode_image()`. */
  4045. /**
  4046. Create an fz_image from a barcode definition.
  4047. type: The type of barcode to create.
  4048. value: The value of the barcode.
  4049. size: The size of the barcode.
  4050. ec_level: error correction level 0-8.
  4051. quiet: whether to include quiet zones (0 or 1).
  4052. hrt: whether to include human readable text below the barcode (0 or 1).
  4053. returns a created fz_image.
  4054. */
  4055. FZ_FUNCTION FzImage(::fz_barcode_type type, const char *value, int size, int ec_level, int quiet, int hrt);
  4056. /** Constructor using `fz_new_image_from_buffer()`. */
  4057. /**
  4058. Create a new image from a
  4059. buffer of data, inferring its type from the format
  4060. of the data.
  4061. */
  4062. FZ_FUNCTION FzImage(const FzBuffer& buffer);
  4063. /** Constructor using `fz_new_image_from_compressed_buffer()`. */
  4064. /**
  4065. Create an image based on
  4066. the data in the supplied compressed buffer.
  4067. w,h: Width and height of the created image.
  4068. bpc: Bits per component.
  4069. colorspace: The colorspace (determines the number of components,
  4070. and any color conversions required while decoding).
  4071. xres, yres: The X and Y resolutions respectively.
  4072. interpolate: 1 if interpolation should be used when decoding
  4073. this image, 0 otherwise.
  4074. imagemask: 1 if this is an imagemask (i.e. transparency bitmap
  4075. mask), 0 otherwise.
  4076. decode: NULL, or a pointer to to a decode array. The default
  4077. decode array is [0 1] (repeated n times, for n color components).
  4078. colorkey: NULL, or a pointer to a colorkey array. The default
  4079. colorkey array is [0 255] (repeated n times, for n color
  4080. components).
  4081. buffer: Buffer of compressed data and compression parameters.
  4082. Ownership of this reference is passed in.
  4083. mask: NULL, or another image to use as a mask for this one.
  4084. A new reference is taken to this image. Supplying a masked
  4085. image as a mask to another image is illegal!
  4086. */
  4087. FZ_FUNCTION FzImage(int w, int h, int bpc, const FzColorspace& colorspace, int xres, int yres, int interpolate, int imagemask, const float *decode, const int *colorkey, const FzCompressedBuffer& buffer, const FzImage& mask);
  4088. /** Constructor using `fz_new_image_from_compressed_buffer2()`. */
  4089. /** Swig-friendly wrapper for fz_new_image_from_compressed_buffer(),
  4090. uses specified `decode` and `colorkey` if they are not null (in which
  4091. case we assert that they have size `2*fz_colorspace_n(colorspace)`). */
  4092. FZ_FUNCTION FzImage(int w, int h, int bpc, const FzColorspace& colorspace, int xres, int yres, int interpolate, int imagemask, const std::vector<float> &decode, const std::vector<int> &colorkey, const FzCompressedBuffer& buffer, const FzImage& mask);
  4093. /** Constructor using `fz_new_image_from_display_list()`. */
  4094. /**
  4095. Create a new image from a display list.
  4096. w, h: The conceptual width/height of the image.
  4097. transform: The matrix that needs to be applied to the given
  4098. list to make it render to the unit square.
  4099. list: The display list.
  4100. */
  4101. FZ_FUNCTION FzImage(float w, float h, const FzDisplayList& list);
  4102. /** Constructor using `fz_new_image_from_file()`. */
  4103. /**
  4104. Create a new image from the contents
  4105. of a file, inferring its type from the format of the
  4106. data.
  4107. */
  4108. FZ_FUNCTION FzImage(const char *path);
  4109. /** Constructor using `fz_new_image_from_pixmap()`. */
  4110. /**
  4111. Create an image from the given
  4112. pixmap.
  4113. pixmap: The pixmap to base the image upon. A new reference
  4114. to this is taken.
  4115. mask: NULL, or another image to use as a mask for this one.
  4116. A new reference is taken to this image. Supplying a masked
  4117. image as a mask to another image is illegal!
  4118. */
  4119. FZ_FUNCTION FzImage(const FzPixmap& pixmap, const FzImage& mask);
  4120. /** Constructor using `fz_new_image_from_svg()`. */
  4121. /**
  4122. Create a scalable image from an SVG document.
  4123. */
  4124. FZ_FUNCTION FzImage(const FzBuffer& buf, const char *base_uri, const FzArchive& dir);
  4125. /** Constructor using `fz_new_image_from_svg_xml()`. */
  4126. /**
  4127. Create a scalable image from an SVG document.
  4128. */
  4129. FZ_FUNCTION FzImage(const FzXml& xmldoc, const FzXml& xml, const char *base_uri, const FzArchive& dir);
  4130. /** Constructor using `fz_new_image_of_size()`. */
  4131. /**
  4132. Internal function to make a new fz_image structure
  4133. for a derived class.
  4134. w,h: Width and height of the created image.
  4135. bpc: Bits per component.
  4136. colorspace: The colorspace (determines the number of components,
  4137. and any color conversions required while decoding).
  4138. xres, yres: The X and Y resolutions respectively.
  4139. interpolate: 1 if interpolation should be used when decoding
  4140. this image, 0 otherwise.
  4141. imagemask: 1 if this is an imagemask (i.e. transparent), 0
  4142. otherwise.
  4143. decode: NULL, or a pointer to to a decode array. The default
  4144. decode array is [0 1] (repeated n times, for n color components).
  4145. colorkey: NULL, or a pointer to a colorkey array. The default
  4146. colorkey array is [0 255] (repeated n times, for n color
  4147. components).
  4148. mask: NULL, or another image to use as a mask for this one.
  4149. A new reference is taken to this image. Supplying a masked
  4150. image as a mask to another image is illegal!
  4151. size: The size of the required allocated structure (the size of
  4152. the derived structure).
  4153. get: The function to be called to obtain a decoded pixmap.
  4154. get_size: The function to be called to return the storage size
  4155. used by this image.
  4156. drop: The function to be called to dispose of this image once
  4157. the last reference is dropped.
  4158. Returns a pointer to an allocated structure of the required size,
  4159. with the first sizeof(fz_image) bytes initialised as appropriate
  4160. given the supplied parameters, and the other bytes set to zero.
  4161. */
  4162. FZ_FUNCTION FzImage(int w, int h, int bpc, const FzColorspace& colorspace, int xres, int yres, int interpolate, int imagemask, const float *decode, const int *colorkey, const FzImage& mask, size_t size, ::fz_image_get_pixmap_fn *get_pixmap, ::fz_image_get_size_fn *get_size, ::fz_drop_image_fn *drop);
  4163. /** Copy constructor using `fz_keep_image()`. */
  4164. FZ_FUNCTION FzImage(const FzImage& rhs);
  4165. /** operator= using `fz_keep_image()` and `fz_drop_image()`. */
  4166. FZ_FUNCTION FzImage& operator=(const FzImage& rhs);
  4167. /** Default constructor, sets `m_internal` to null. */
  4168. FZ_FUNCTION FzImage();
  4169. /* == Methods. */
  4170. /** Class-aware wrapper for `::fz_compressed_image_buffer()`. */
  4171. /**
  4172. Retrieve the underlying compressed data for an image.
  4173. Returns a pointer to the underlying data buffer for an image,
  4174. or NULL if this image is not based upon a compressed data
  4175. buffer.
  4176. This is not a reference counted structure, so no reference is
  4177. returned. Lifespan is limited to that of the image itself.
  4178. */
  4179. FZ_FUNCTION FzCompressedBuffer fz_compressed_image_buffer() const;
  4180. /** Class-aware wrapper for `::fz_compressed_image_type()`. */
  4181. /**
  4182. Return the type of a compressed image.
  4183. Any non-compressed image will have the type returned as UNKNOWN.
  4184. */
  4185. FZ_FUNCTION int fz_compressed_image_type() const;
  4186. /** Class-aware wrapper for `::fz_get_pixmap_from_image()`.
  4187. This method has out-params. Python/C# wrappers look like:
  4188. `fz_get_pixmap_from_image(const ::fz_irect *subarea, ::fz_matrix *ctm)` => `(fz_pixmap *, int w, int h)`
  4189. */
  4190. /**
  4191. Called to get a handle to a pixmap from an image.
  4192. image: The image to retrieve a pixmap from.
  4193. subarea: The subarea of the image that we actually care about
  4194. (or NULL to indicate the whole image).
  4195. ctm: Optional, unless subarea is given. If given, then on
  4196. entry this is the transform that will be applied to the complete
  4197. image. It should be updated on exit to the transform to apply to
  4198. the given subarea of the image. This is used to calculate the
  4199. desired width/height for subsampling.
  4200. w: If non-NULL, a pointer to an int to be updated on exit to the
  4201. width (in pixels) that the scaled output will cover.
  4202. h: If non-NULL, a pointer to an int to be updated on exit to the
  4203. height (in pixels) that the scaled output will cover.
  4204. Returns a non NULL kept pixmap pointer. May throw exceptions.
  4205. */
  4206. FZ_FUNCTION FzPixmap fz_get_pixmap_from_image(FzIrect& subarea, FzMatrix& ctm, int *w, int *h) const;
  4207. /** Class-aware wrapper for `::fz_get_unscaled_pixmap_from_image()`. */
  4208. /**
  4209. Calls fz_get_pixmap_from_image() with ctm, subarea, w and h all set to NULL.
  4210. */
  4211. FZ_FUNCTION FzPixmap fz_get_unscaled_pixmap_from_image() const;
  4212. /** Class-aware wrapper for `::fz_image_orientation()`. */
  4213. /**
  4214. Request the natural orientation of an image.
  4215. This is for images (such as JPEG) that can contain internal
  4216. specifications of rotation/flips. This is ignored by all the
  4217. internal decode/rendering routines, but can be used by callers
  4218. (such as the image document handler) to respect such
  4219. specifications.
  4220. The values used by MuPDF are as follows, with the equivalent
  4221. Exif specifications given for information:
  4222. 0: Undefined
  4223. 1: 0 degree ccw rotation. (Exif = 1)
  4224. 2: 90 degree ccw rotation. (Exif = 8)
  4225. 3: 180 degree ccw rotation. (Exif = 3)
  4226. 4: 270 degree ccw rotation. (Exif = 6)
  4227. 5: flip on X. (Exif = 2)
  4228. 6: flip on X, then rotate ccw by 90 degrees. (Exif = 5)
  4229. 7: flip on X, then rotate ccw by 180 degrees. (Exif = 4)
  4230. 8: flip on X, then rotate ccw by 270 degrees. (Exif = 7)
  4231. */
  4232. FZ_FUNCTION uint8_t fz_image_orientation() const;
  4233. /** Class-aware wrapper for `::fz_image_orientation_matrix()`. */
  4234. FZ_FUNCTION FzMatrix fz_image_orientation_matrix() const;
  4235. /** Class-aware wrapper for `::fz_image_resolution()`.
  4236. This method has out-params. Python/C# wrappers look like:
  4237. `fz_image_resolution()` => `(int xres, int yres)`
  4238. */
  4239. /**
  4240. Request the natural resolution
  4241. of an image.
  4242. xres, yres: Pointers to ints to be updated with the
  4243. natural resolution of an image (or a sensible default
  4244. if not encoded).
  4245. */
  4246. FZ_FUNCTION void fz_image_resolution(int *xres, int *yres) const;
  4247. /** Class-aware wrapper for `::fz_image_size()`. */
  4248. /**
  4249. Return the size of the storage used by an image.
  4250. */
  4251. FZ_FUNCTION size_t fz_image_size() const;
  4252. /** Class-aware wrapper for `::fz_is_lossy_image()`. */
  4253. FZ_FUNCTION int fz_is_lossy_image() const;
  4254. /** Class-aware wrapper for `::fz_new_bitmap_from_image()`. */
  4255. /**
  4256. Make a bitmap from a pixmap and a halftone.
  4257. img: The image to generate from. Currently must be a single
  4258. color component with no alpha.
  4259. ht: The halftone to use. NULL implies the default halftone.
  4260. Returns the resultant bitmap. Throws exceptions in the case of
  4261. failure to allocate.
  4262. */
  4263. FZ_FUNCTION FzBitmap fz_new_bitmap_from_image(const FzHalftone& ht) const;
  4264. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_jpeg()`. */
  4265. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_jpeg(const FzColorParams& color_params, int quality, int invert_cmyk) const;
  4266. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_jpx()`. */
  4267. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_jpx(const FzColorParams& color_params, int quality) const;
  4268. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pam()`. */
  4269. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_pam(const FzColorParams& color_params) const;
  4270. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pbm()`. */
  4271. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_pbm(const FzColorParams& color_params) const;
  4272. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pkm()`. */
  4273. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_pkm(const FzColorParams& color_params) const;
  4274. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_png()`. */
  4275. /**
  4276. Re-encode a given image as a PNG into a buffer.
  4277. Ownership of the buffer is returned.
  4278. */
  4279. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_png(const FzColorParams& color_params) const;
  4280. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_pnm()`. */
  4281. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_pnm(const FzColorParams& color_params) const;
  4282. /** Class-aware wrapper for `::fz_new_buffer_from_image_as_psd()`. */
  4283. FZ_FUNCTION FzBuffer fz_new_buffer_from_image_as_psd(const FzColorParams& color_params) const;
  4284. /** Constructor using raw copy of pre-existing `::fz_image`. */
  4285. /* This constructor is marked as `explicit` because wrapper classes do not
  4286. call `keep`in constructors, but do call `drop` in destructors. So
  4287. automatic construction from a fz_image* will generally cause an
  4288. unbalanced `drop` resulting in errors such as SEGV. */
  4289. FZ_FUNCTION explicit FzImage(::fz_image* internal);
  4290. /* == Accessors to members of ::fz_image m_internal. */
  4291. FZ_FUNCTION ::fz_key_storable key_storable();
  4292. FZ_FUNCTION int w();
  4293. FZ_FUNCTION int h();
  4294. FZ_FUNCTION uint8_t n();
  4295. FZ_FUNCTION uint8_t bpc();
  4296. FZ_FUNCTION unsigned int imagemask();
  4297. FZ_FUNCTION unsigned int interpolate();
  4298. FZ_FUNCTION unsigned int use_colorkey();
  4299. FZ_FUNCTION unsigned int use_decode();
  4300. FZ_FUNCTION unsigned int decoded();
  4301. FZ_FUNCTION unsigned int scalable();
  4302. FZ_FUNCTION unsigned int intent();
  4303. FZ_FUNCTION unsigned int has_intent();
  4304. FZ_FUNCTION uint8_t orientation();
  4305. FZ_FUNCTION FzImage mask();
  4306. FZ_FUNCTION int xres();
  4307. FZ_FUNCTION int yres();
  4308. FZ_FUNCTION FzColorspace colorspace();
  4309. FZ_FUNCTION int * colorkey();
  4310. FZ_FUNCTION float * decode();
  4311. /** Destructor using fz_drop_image(). */
  4312. FZ_FUNCTION ~FzImage();
  4313. /** Return numerical value of .m_internal; helps with Python debugging. */
  4314. FZ_FUNCTION long long m_internal_value();
  4315. /** Return true iff `m_internal` is not null. */
  4316. FZ_FUNCTION operator bool();
  4317. /* == Member data. */
  4318. /** Pointer to wrapped data. */
  4319. ::fz_image* m_internal;
  4320. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4321. generate code regardless so we always need to have this available. */
  4322. FZ_DATA static int s_num_instances;
  4323. };
  4324. /** Wrapper class for struct `fz_install_load_system_font_funcs_args`. */
  4325. /**
  4326. Extra struct containing fz_install_load_system_font_funcs()'s args,
  4327. which we wrap with virtual_fnptrs set to allow use from Python/C# via
  4328. Swig Directors.
  4329. */
  4330. struct FzInstallLoadSystemFontFuncsArgs
  4331. {
  4332. /** We use default copy constructor and operator=. */
  4333. /** Default constructor, sets each member to default value. */
  4334. FZ_FUNCTION FzInstallLoadSystemFontFuncsArgs();
  4335. /* == Methods. */
  4336. /** Class-aware wrapper for `::fz_install_load_system_font_funcs2()`. */
  4337. /**
  4338. Alternative to fz_install_load_system_font_funcs() that takes args in a
  4339. struct, to allow use from Python/C# via Swig Directors.
  4340. */
  4341. FZ_FUNCTION void fz_install_load_system_font_funcs2();
  4342. /** Constructor using raw copy of pre-existing `::fz_install_load_system_font_funcs_args`. */
  4343. FZ_FUNCTION FzInstallLoadSystemFontFuncsArgs(const ::fz_install_load_system_font_funcs_args* internal);
  4344. /* == Accessors to members of ::fz_install_load_system_font_funcs_args m_internal. */
  4345. #ifndef NDEBUG
  4346. /** Destructor only decrements s_num_instances. */
  4347. FZ_FUNCTION ~FzInstallLoadSystemFontFuncsArgs();
  4348. #else
  4349. /** We use default destructor. */
  4350. #endif
  4351. /* == Member data. */
  4352. ::fz_install_load_system_font_funcs_args m_internal; /** Wrapped data is held by value. */
  4353. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4354. generate code regardless so we always need to have this available. */
  4355. FZ_DATA static int s_num_instances;
  4356. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  4357. FZ_FUNCTION std::string to_string();
  4358. /** Comparison method. */
  4359. FZ_FUNCTION bool operator==(const FzInstallLoadSystemFontFuncsArgs& rhs);
  4360. /** Comparison method. */
  4361. FZ_FUNCTION bool operator!=(const FzInstallLoadSystemFontFuncsArgs& rhs);
  4362. };
  4363. /** Wrapper class for struct fz_install_load_system_font_funcs_args with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  4364. struct FzInstallLoadSystemFontFuncsArgs2 : FzInstallLoadSystemFontFuncsArgs
  4365. {
  4366. /** == Constructor. */
  4367. FZ_FUNCTION FzInstallLoadSystemFontFuncsArgs2();
  4368. /** == Destructor. */
  4369. FZ_FUNCTION virtual ~FzInstallLoadSystemFontFuncsArgs2();
  4370. /** These methods set the function pointers in *m_internal
  4371. to point to internal callbacks that call our virtual methods. */
  4372. FZ_FUNCTION void use_virtual_f( bool use=true);
  4373. FZ_FUNCTION void use_virtual_f_cjk( bool use=true);
  4374. FZ_FUNCTION void use_virtual_f_fallback( bool use=true);
  4375. /** Default virtual method implementations; these all throw an exception. */
  4376. FZ_FUNCTION virtual ::fz_font * f(::fz_context *arg_0, const char *arg_1, int arg_2, int arg_3, int arg_4);
  4377. FZ_FUNCTION virtual ::fz_font * f_cjk(::fz_context *arg_0, const char *arg_1, int arg_2, int arg_3);
  4378. FZ_FUNCTION virtual ::fz_font * f_fallback(::fz_context *arg_0, int arg_1, int arg_2, int arg_3, int arg_4, int arg_5);
  4379. };
  4380. /** Wrapper class for struct `fz_int2`. Not copyable or assignable. */
  4381. struct FzInt2
  4382. {
  4383. /** Default constructor, sets `m_internal` to null. */
  4384. FZ_FUNCTION FzInt2();
  4385. /** Constructor using raw copy of pre-existing `::fz_int2`. */
  4386. FZ_FUNCTION FzInt2(::fz_int2* internal);
  4387. #ifndef NDEBUG
  4388. /** Destructor only decrements s_num_instances. */
  4389. FZ_FUNCTION ~FzInt2();
  4390. #else
  4391. /** We use default destructor. */
  4392. #endif
  4393. /** Return numerical value of .m_internal; helps with Python debugging. */
  4394. FZ_FUNCTION long long m_internal_value();
  4395. /** Return true iff `m_internal` is not null. */
  4396. FZ_FUNCTION operator bool();
  4397. /* == Member data. */
  4398. /** Pointer to wrapped data. */
  4399. ::fz_int2* m_internal;
  4400. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4401. generate code regardless so we always need to have this available. */
  4402. FZ_DATA static int s_num_instances;
  4403. private:
  4404. /** This class is not copyable or assignable. */
  4405. FzInt2(const FzInt2& rhs);
  4406. FzInt2& operator=(const FzInt2& rhs);
  4407. };
  4408. /** Wrapper class for struct `fz_int2_heap`. Not copyable or assignable. */
  4409. struct FzInt2Heap
  4410. {
  4411. /** Default constructor, sets `m_internal` to null. */
  4412. FZ_FUNCTION FzInt2Heap();
  4413. /* == Methods. */
  4414. /** Class-aware wrapper for `::fz_int2_heap_debug()`. */
  4415. FZ_FUNCTION void fz_int2_heap_debug() const;
  4416. /** Class-aware wrapper for `::fz_int2_heap_insert()`. */
  4417. FZ_FUNCTION void fz_int2_heap_insert(const FzInt2& v) const;
  4418. /** Class-aware wrapper for `::fz_int2_heap_sort()`. */
  4419. FZ_FUNCTION void fz_int2_heap_sort() const;
  4420. /** Class-aware wrapper for `::fz_int2_heap_uniq()`. */
  4421. FZ_FUNCTION void fz_int2_heap_uniq() const;
  4422. /** Constructor using raw copy of pre-existing `::fz_int2_heap`. */
  4423. FZ_FUNCTION FzInt2Heap(::fz_int2_heap* internal);
  4424. #ifndef NDEBUG
  4425. /** Destructor only decrements s_num_instances. */
  4426. FZ_FUNCTION ~FzInt2Heap();
  4427. #else
  4428. /** We use default destructor. */
  4429. #endif
  4430. /** Return numerical value of .m_internal; helps with Python debugging. */
  4431. FZ_FUNCTION long long m_internal_value();
  4432. /** Return true iff `m_internal` is not null. */
  4433. FZ_FUNCTION operator bool();
  4434. /* == Member data. */
  4435. /** Pointer to wrapped data. */
  4436. ::fz_int2_heap* m_internal;
  4437. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4438. generate code regardless so we always need to have this available. */
  4439. FZ_DATA static int s_num_instances;
  4440. private:
  4441. /** This class is not copyable or assignable. */
  4442. FzInt2Heap(const FzInt2Heap& rhs);
  4443. FzInt2Heap& operator=(const FzInt2Heap& rhs);
  4444. };
  4445. /** Wrapper class for struct `fz_int_heap`. Not copyable or assignable. */
  4446. struct FzIntHeap
  4447. {
  4448. /** Default constructor, sets `m_internal` to null. */
  4449. FZ_FUNCTION FzIntHeap();
  4450. /* == Methods. */
  4451. /** Class-aware wrapper for `::fz_int_heap_debug()`. */
  4452. FZ_FUNCTION void fz_int_heap_debug() const;
  4453. /** Class-aware wrapper for `::fz_int_heap_insert()`. */
  4454. FZ_FUNCTION void fz_int_heap_insert(int v) const;
  4455. /** Class-aware wrapper for `::fz_int_heap_sort()`. */
  4456. FZ_FUNCTION void fz_int_heap_sort() const;
  4457. /** Class-aware wrapper for `::fz_int_heap_uniq()`. */
  4458. FZ_FUNCTION void fz_int_heap_uniq() const;
  4459. /** Constructor using raw copy of pre-existing `::fz_int_heap`. */
  4460. FZ_FUNCTION FzIntHeap(::fz_int_heap* internal);
  4461. #ifndef NDEBUG
  4462. /** Destructor only decrements s_num_instances. */
  4463. FZ_FUNCTION ~FzIntHeap();
  4464. #else
  4465. /** We use default destructor. */
  4466. #endif
  4467. /** Return numerical value of .m_internal; helps with Python debugging. */
  4468. FZ_FUNCTION long long m_internal_value();
  4469. /** Return true iff `m_internal` is not null. */
  4470. FZ_FUNCTION operator bool();
  4471. /* == Member data. */
  4472. /** Pointer to wrapped data. */
  4473. ::fz_int_heap* m_internal;
  4474. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4475. generate code regardless so we always need to have this available. */
  4476. FZ_DATA static int s_num_instances;
  4477. private:
  4478. /** This class is not copyable or assignable. */
  4479. FzIntHeap(const FzIntHeap& rhs);
  4480. FzIntHeap& operator=(const FzIntHeap& rhs);
  4481. };
  4482. /** Wrapper class for struct `fz_intptr`. Not copyable or assignable. */
  4483. struct FzIntptr
  4484. {
  4485. /** Default constructor, sets `m_internal` to null. */
  4486. FZ_FUNCTION FzIntptr();
  4487. /** Constructor using raw copy of pre-existing `::fz_intptr`. */
  4488. FZ_FUNCTION FzIntptr(::fz_intptr* internal);
  4489. #ifndef NDEBUG
  4490. /** Destructor only decrements s_num_instances. */
  4491. FZ_FUNCTION ~FzIntptr();
  4492. #else
  4493. /** We use default destructor. */
  4494. #endif
  4495. /** Return numerical value of .m_internal; helps with Python debugging. */
  4496. FZ_FUNCTION long long m_internal_value();
  4497. /** Return true iff `m_internal` is not null. */
  4498. FZ_FUNCTION operator bool();
  4499. /* == Member data. */
  4500. /** Pointer to wrapped data. */
  4501. ::fz_intptr* m_internal;
  4502. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4503. generate code regardless so we always need to have this available. */
  4504. FZ_DATA static int s_num_instances;
  4505. private:
  4506. /** This class is not copyable or assignable. */
  4507. FzIntptr(const FzIntptr& rhs);
  4508. FzIntptr& operator=(const FzIntptr& rhs);
  4509. };
  4510. /** Wrapper class for struct `fz_intptr_heap`. Not copyable or assignable. */
  4511. struct FzIntptrHeap
  4512. {
  4513. /** Default constructor, sets `m_internal` to null. */
  4514. FZ_FUNCTION FzIntptrHeap();
  4515. /* == Methods. */
  4516. /** Class-aware wrapper for `::fz_intptr_heap_debug()`. */
  4517. FZ_FUNCTION void fz_intptr_heap_debug() const;
  4518. /** Class-aware wrapper for `::fz_intptr_heap_insert()`. */
  4519. FZ_FUNCTION void fz_intptr_heap_insert(const FzIntptr& v) const;
  4520. /** Class-aware wrapper for `::fz_intptr_heap_sort()`. */
  4521. FZ_FUNCTION void fz_intptr_heap_sort() const;
  4522. /** Class-aware wrapper for `::fz_intptr_heap_uniq()`. */
  4523. FZ_FUNCTION void fz_intptr_heap_uniq() const;
  4524. /** Constructor using raw copy of pre-existing `::fz_intptr_heap`. */
  4525. FZ_FUNCTION FzIntptrHeap(::fz_intptr_heap* internal);
  4526. #ifndef NDEBUG
  4527. /** Destructor only decrements s_num_instances. */
  4528. FZ_FUNCTION ~FzIntptrHeap();
  4529. #else
  4530. /** We use default destructor. */
  4531. #endif
  4532. /** Return numerical value of .m_internal; helps with Python debugging. */
  4533. FZ_FUNCTION long long m_internal_value();
  4534. /** Return true iff `m_internal` is not null. */
  4535. FZ_FUNCTION operator bool();
  4536. /* == Member data. */
  4537. /** Pointer to wrapped data. */
  4538. ::fz_intptr_heap* m_internal;
  4539. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4540. generate code regardless so we always need to have this available. */
  4541. FZ_DATA static int s_num_instances;
  4542. private:
  4543. /** This class is not copyable or assignable. */
  4544. FzIntptrHeap(const FzIntptrHeap& rhs);
  4545. FzIntptrHeap& operator=(const FzIntptrHeap& rhs);
  4546. };
  4547. /** Wrapper class for struct `fz_irect`. */
  4548. /**
  4549. fz_irect is a rectangle using integers instead of floats.
  4550. It's used in the draw device and for pixmap dimensions.
  4551. */
  4552. struct FzIrect
  4553. {
  4554. /** == Constructors. */
  4555. /** Constructor using `fz_irect_from_rect()`. */
  4556. /**
  4557. Convert a rect into the minimal bounding box
  4558. that covers the rectangle.
  4559. Coordinates in a bounding box are integers, so rounding of the
  4560. rects coordinates takes place. The top left corner is rounded
  4561. upwards and left while the bottom right corner is rounded
  4562. downwards and to the right.
  4563. */
  4564. FZ_FUNCTION FzIrect(const FzRect& rect);
  4565. /** Constructor using `fz_make_irect()`. */
  4566. FZ_FUNCTION FzIrect(int x0, int y0, int x1, int y1);
  4567. /** We use default copy constructor and operator=. */
  4568. /** Default constructor, sets each member to default value. */
  4569. FZ_FUNCTION FzIrect();
  4570. /* == Methods. */
  4571. /** Class-aware wrapper for `::fz_expand_irect()`. */
  4572. FZ_FUNCTION FzIrect fz_expand_irect(int expand);
  4573. /** Class-aware wrapper for `::fz_intersect_irect()`. */
  4574. /**
  4575. Compute intersection of two bounding boxes.
  4576. Similar to fz_intersect_rect but operates on two bounding
  4577. boxes instead of two rectangles.
  4578. */
  4579. FZ_FUNCTION FzIrect fz_intersect_irect(const FzIrect& b);
  4580. /** Class-aware wrapper for `::fz_irect_height()`. */
  4581. /**
  4582. Return the height of an irect. Invalid irects return 0.
  4583. */
  4584. FZ_FUNCTION int fz_irect_height();
  4585. /** Class-aware wrapper for `::fz_irect_width()`. */
  4586. /**
  4587. Return the width of an irect. Invalid irects return 0.
  4588. */
  4589. FZ_FUNCTION unsigned int fz_irect_width();
  4590. /** Class-aware wrapper for `::fz_is_empty_irect()`. */
  4591. FZ_FUNCTION int fz_is_empty_irect();
  4592. /** Class-aware wrapper for `::fz_is_infinite_irect()`. */
  4593. /**
  4594. Check if an integer rectangle
  4595. is infinite.
  4596. */
  4597. FZ_FUNCTION int fz_is_infinite_irect();
  4598. /** Class-aware wrapper for `::fz_is_irect_inside_irect()`. */
  4599. /**
  4600. Inclusion test for irects.
  4601. rects are assumed to be both open or both closed.
  4602. No invalid rect can include any other rect.
  4603. No invalid rect can be included by any rect.
  4604. Empty (point) rects can include themselves.
  4605. Empty (line) rects can include many (subline) rects.
  4606. */
  4607. FZ_FUNCTION int fz_is_irect_inside_irect(const FzIrect& outer);
  4608. /** Class-aware wrapper for `::fz_is_valid_irect()`. */
  4609. /**
  4610. Check if an integer rectangle is valid.
  4611. */
  4612. FZ_FUNCTION int fz_is_valid_irect();
  4613. /** Class-aware wrapper for `::fz_rect_from_irect()`. */
  4614. /**
  4615. Convert a bbox into a rect.
  4616. For our purposes, a rect can represent all the values we meet in
  4617. a bbox, so nothing can go wrong.
  4618. rect: A place to store the generated rectangle.
  4619. bbox: The bbox to convert.
  4620. Returns rect (updated).
  4621. */
  4622. FZ_FUNCTION FzRect fz_rect_from_irect();
  4623. /** Class-aware wrapper for `::fz_translate_irect()`. */
  4624. FZ_FUNCTION FzIrect fz_translate_irect(int xoff, int yoff);
  4625. /** Constructor using raw copy of pre-existing `::fz_irect`. */
  4626. FZ_FUNCTION FzIrect(const ::fz_irect* internal);
  4627. /** Constructor using raw copy of pre-existing `::fz_irect`. */
  4628. FZ_FUNCTION FzIrect(const ::fz_irect internal);
  4629. /** Access as underlying struct. */
  4630. FZ_FUNCTION ::fz_irect* internal();
  4631. /** Access as underlying struct. */
  4632. FZ_FUNCTION const ::fz_irect* internal() const;
  4633. #ifndef NDEBUG
  4634. /** Destructor only decrements s_num_instances. */
  4635. FZ_FUNCTION ~FzIrect();
  4636. #else
  4637. /** We use default destructor. */
  4638. #endif
  4639. /* == Member data. */
  4640. /* These members are the same as the members of ::fz_irect. */
  4641. int x0;
  4642. int y0;
  4643. int x1;
  4644. int y1;
  4645. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4646. generate code regardless so we always need to have this available. */
  4647. FZ_DATA static int s_num_instances;
  4648. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  4649. FZ_FUNCTION std::string to_string();
  4650. /** Comparison method. */
  4651. FZ_FUNCTION bool operator==(const FzIrect& rhs);
  4652. /** Comparison method. */
  4653. FZ_FUNCTION bool operator!=(const FzIrect& rhs);
  4654. };
  4655. /** Wrapper class for struct `fz_jbig2_globals`. */
  4656. struct FzJbig2Globals
  4657. {
  4658. /** Copy constructor using `fz_keep_jbig2_globals()`. */
  4659. FZ_FUNCTION FzJbig2Globals(const FzJbig2Globals& rhs);
  4660. /** operator= using `fz_keep_jbig2_globals()` and `fz_drop_jbig2_globals()`. */
  4661. FZ_FUNCTION FzJbig2Globals& operator=(const FzJbig2Globals& rhs);
  4662. /** Default constructor, sets `m_internal` to null. */
  4663. FZ_FUNCTION FzJbig2Globals();
  4664. /* == Methods. */
  4665. /** Class-aware wrapper for `::fz_jbig2_globals_data()`. */
  4666. /**
  4667. Return buffer containing jbig2 globals data stream.
  4668. */
  4669. FZ_FUNCTION FzBuffer fz_jbig2_globals_data() const;
  4670. /** Constructor using raw copy of pre-existing `::fz_jbig2_globals`. */
  4671. /* This constructor is marked as `explicit` because wrapper classes do not
  4672. call `keep`in constructors, but do call `drop` in destructors. So
  4673. automatic construction from a fz_jbig2_globals* will generally cause an
  4674. unbalanced `drop` resulting in errors such as SEGV. */
  4675. FZ_FUNCTION explicit FzJbig2Globals(::fz_jbig2_globals* internal);
  4676. /** Destructor using fz_drop_jbig2_globals(). */
  4677. FZ_FUNCTION ~FzJbig2Globals();
  4678. /** Return numerical value of .m_internal; helps with Python debugging. */
  4679. FZ_FUNCTION long long m_internal_value();
  4680. /** Return true iff `m_internal` is not null. */
  4681. FZ_FUNCTION operator bool();
  4682. /* == Member data. */
  4683. /** Pointer to wrapped data. */
  4684. ::fz_jbig2_globals* m_internal;
  4685. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4686. generate code regardless so we always need to have this available. */
  4687. FZ_DATA static int s_num_instances;
  4688. };
  4689. /** Wrapper class for struct `fz_json`. Not copyable or assignable. */
  4690. struct FzJson
  4691. {
  4692. /** Default constructor, sets `m_internal` to null. */
  4693. FZ_FUNCTION FzJson();
  4694. /* == Methods. */
  4695. /** Class-aware wrapper for `::fz_json_array_length()`. */
  4696. FZ_FUNCTION int fz_json_array_length() const;
  4697. /** Class-aware wrapper for `::fz_json_is_array()`. */
  4698. FZ_FUNCTION int fz_json_is_array() const;
  4699. /** Class-aware wrapper for `::fz_json_is_boolean()`. */
  4700. FZ_FUNCTION int fz_json_is_boolean() const;
  4701. /** Class-aware wrapper for `::fz_json_is_null()`. */
  4702. FZ_FUNCTION int fz_json_is_null() const;
  4703. /** Class-aware wrapper for `::fz_json_is_number()`. */
  4704. FZ_FUNCTION int fz_json_is_number() const;
  4705. /** Class-aware wrapper for `::fz_json_is_object()`. */
  4706. FZ_FUNCTION int fz_json_is_object() const;
  4707. /** Class-aware wrapper for `::fz_json_is_string()`. */
  4708. FZ_FUNCTION int fz_json_is_string() const;
  4709. /** Class-aware wrapper for `::fz_json_to_boolean()`. */
  4710. FZ_FUNCTION int fz_json_to_boolean() const;
  4711. /** Class-aware wrapper for `::fz_json_to_number()`. */
  4712. FZ_FUNCTION double fz_json_to_number() const;
  4713. /** Class-aware wrapper for `::fz_json_to_string()`. */
  4714. FZ_FUNCTION const char *fz_json_to_string() const;
  4715. /** Constructor using raw copy of pre-existing `::fz_json`. */
  4716. FZ_FUNCTION FzJson(::fz_json* internal);
  4717. #ifndef NDEBUG
  4718. /** Destructor only decrements s_num_instances. */
  4719. FZ_FUNCTION ~FzJson();
  4720. #else
  4721. /** We use default destructor. */
  4722. #endif
  4723. /** Return numerical value of .m_internal; helps with Python debugging. */
  4724. FZ_FUNCTION long long m_internal_value();
  4725. /** Return true iff `m_internal` is not null. */
  4726. FZ_FUNCTION operator bool();
  4727. /* == Member data. */
  4728. /** Pointer to wrapped data. */
  4729. ::fz_json* m_internal;
  4730. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4731. generate code regardless so we always need to have this available. */
  4732. FZ_DATA static int s_num_instances;
  4733. private:
  4734. /** This class is not copyable or assignable. */
  4735. FzJson(const FzJson& rhs);
  4736. FzJson& operator=(const FzJson& rhs);
  4737. };
  4738. /** Wrapper class for struct `fz_json_array`. Not copyable or assignable. */
  4739. struct FzJsonArray
  4740. {
  4741. /** Default constructor, sets `m_internal` to null. */
  4742. FZ_FUNCTION FzJsonArray();
  4743. /** Constructor using raw copy of pre-existing `::fz_json_array`. */
  4744. FZ_FUNCTION FzJsonArray(::fz_json_array* internal);
  4745. #ifndef NDEBUG
  4746. /** Destructor only decrements s_num_instances. */
  4747. FZ_FUNCTION ~FzJsonArray();
  4748. #else
  4749. /** We use default destructor. */
  4750. #endif
  4751. /** Return numerical value of .m_internal; helps with Python debugging. */
  4752. FZ_FUNCTION long long m_internal_value();
  4753. /** Return true iff `m_internal` is not null. */
  4754. FZ_FUNCTION operator bool();
  4755. /* == Member data. */
  4756. /** Pointer to wrapped data. */
  4757. ::fz_json_array* m_internal;
  4758. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4759. generate code regardless so we always need to have this available. */
  4760. FZ_DATA static int s_num_instances;
  4761. private:
  4762. /** This class is not copyable or assignable. */
  4763. FzJsonArray(const FzJsonArray& rhs);
  4764. FzJsonArray& operator=(const FzJsonArray& rhs);
  4765. };
  4766. /** Wrapper class for struct `fz_json_object`. Not copyable or assignable. */
  4767. struct FzJsonObject
  4768. {
  4769. /** Default constructor, sets `m_internal` to null. */
  4770. FZ_FUNCTION FzJsonObject();
  4771. /** Constructor using raw copy of pre-existing `::fz_json_object`. */
  4772. FZ_FUNCTION FzJsonObject(::fz_json_object* internal);
  4773. #ifndef NDEBUG
  4774. /** Destructor only decrements s_num_instances. */
  4775. FZ_FUNCTION ~FzJsonObject();
  4776. #else
  4777. /** We use default destructor. */
  4778. #endif
  4779. /** Return numerical value of .m_internal; helps with Python debugging. */
  4780. FZ_FUNCTION long long m_internal_value();
  4781. /** Return true iff `m_internal` is not null. */
  4782. FZ_FUNCTION operator bool();
  4783. /* == Member data. */
  4784. /** Pointer to wrapped data. */
  4785. ::fz_json_object* m_internal;
  4786. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4787. generate code regardless so we always need to have this available. */
  4788. FZ_DATA static int s_num_instances;
  4789. private:
  4790. /** This class is not copyable or assignable. */
  4791. FzJsonObject(const FzJsonObject& rhs);
  4792. FzJsonObject& operator=(const FzJsonObject& rhs);
  4793. };
  4794. /** Wrapper class for struct `fz_key_storable`. */
  4795. /**
  4796. Any storable object that can appear in the key of another
  4797. storable object should include an fz_key_storable structure
  4798. at the start (by convention at least) of their structure.
  4799. */
  4800. struct FzKeyStorable
  4801. {
  4802. /** Copy constructor using `fz_keep_key_storable()`. */
  4803. FZ_FUNCTION FzKeyStorable(const FzKeyStorable& rhs);
  4804. /** operator= using `fz_keep_key_storable()` and `fz_drop_key_storable()`. */
  4805. FZ_FUNCTION FzKeyStorable& operator=(const FzKeyStorable& rhs);
  4806. /** Default constructor, sets `m_internal` to null. */
  4807. FZ_FUNCTION FzKeyStorable();
  4808. /** Constructor using raw copy of pre-existing `::fz_key_storable`. */
  4809. /* This constructor is marked as `explicit` because wrapper classes do not
  4810. call `keep`in constructors, but do call `drop` in destructors. So
  4811. automatic construction from a fz_key_storable* will generally cause an
  4812. unbalanced `drop` resulting in errors such as SEGV. */
  4813. FZ_FUNCTION explicit FzKeyStorable(::fz_key_storable* internal);
  4814. /** Destructor using fz_drop_key_storable(). */
  4815. FZ_FUNCTION ~FzKeyStorable();
  4816. /** Return numerical value of .m_internal; helps with Python debugging. */
  4817. FZ_FUNCTION long long m_internal_value();
  4818. /** Return true iff `m_internal` is not null. */
  4819. FZ_FUNCTION operator bool();
  4820. /* == Member data. */
  4821. /** Pointer to wrapped data. */
  4822. ::fz_key_storable* m_internal;
  4823. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4824. generate code regardless so we always need to have this available. */
  4825. FZ_DATA static int s_num_instances;
  4826. };
  4827. /** Wrapper class for struct `fz_layout_block`. Not copyable or assignable. */
  4828. struct FzLayoutBlock
  4829. {
  4830. /** == Constructors. */
  4831. /** Constructor using `fz_new_layout()`. */
  4832. /**
  4833. Create a new layout block, with new allocation pool, zero
  4834. matrices, and initialise linked pointers.
  4835. */
  4836. FZ_FUNCTION FzLayoutBlock();
  4837. /* == Methods. */
  4838. /** Class-aware wrapper for `::fz_add_layout_char()`. */
  4839. /**
  4840. Add a new char to the line at the end of the layout block.
  4841. */
  4842. FZ_FUNCTION void fz_add_layout_char(float x, float w, const char *p) const;
  4843. /** Class-aware wrapper for `::fz_add_layout_line()`. */
  4844. /**
  4845. Add a new line to the end of the layout block.
  4846. */
  4847. FZ_FUNCTION void fz_add_layout_line(float x, float y, float h, const char *p) const;
  4848. /** Constructor using raw copy of pre-existing `::fz_layout_block`. */
  4849. FZ_FUNCTION FzLayoutBlock(::fz_layout_block* internal);
  4850. #ifndef NDEBUG
  4851. /** Destructor only decrements s_num_instances. */
  4852. FZ_FUNCTION ~FzLayoutBlock();
  4853. #else
  4854. /** We use default destructor. */
  4855. #endif
  4856. /** Return numerical value of .m_internal; helps with Python debugging. */
  4857. FZ_FUNCTION long long m_internal_value();
  4858. /** Return true iff `m_internal` is not null. */
  4859. FZ_FUNCTION operator bool();
  4860. /* == Member data. */
  4861. /** Pointer to wrapped data. */
  4862. ::fz_layout_block* m_internal;
  4863. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4864. generate code regardless so we always need to have this available. */
  4865. FZ_DATA static int s_num_instances;
  4866. private:
  4867. /** This class is not copyable or assignable. */
  4868. FzLayoutBlock(const FzLayoutBlock& rhs);
  4869. FzLayoutBlock& operator=(const FzLayoutBlock& rhs);
  4870. };
  4871. /** Wrapper class for struct `fz_layout_char`. Not copyable or assignable. */
  4872. /**
  4873. Simple text layout (for use with annotation editing primarily).
  4874. */
  4875. struct FzLayoutChar
  4876. {
  4877. /** Default constructor, sets `m_internal` to null. */
  4878. FZ_FUNCTION FzLayoutChar();
  4879. /** Constructor using raw copy of pre-existing `::fz_layout_char`. */
  4880. FZ_FUNCTION FzLayoutChar(::fz_layout_char* internal);
  4881. #ifndef NDEBUG
  4882. /** Destructor only decrements s_num_instances. */
  4883. FZ_FUNCTION ~FzLayoutChar();
  4884. #else
  4885. /** We use default destructor. */
  4886. #endif
  4887. /** Return numerical value of .m_internal; helps with Python debugging. */
  4888. FZ_FUNCTION long long m_internal_value();
  4889. /** Return true iff `m_internal` is not null. */
  4890. FZ_FUNCTION operator bool();
  4891. /* == Member data. */
  4892. /** Pointer to wrapped data. */
  4893. ::fz_layout_char* m_internal;
  4894. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4895. generate code regardless so we always need to have this available. */
  4896. FZ_DATA static int s_num_instances;
  4897. private:
  4898. /** This class is not copyable or assignable. */
  4899. FzLayoutChar(const FzLayoutChar& rhs);
  4900. FzLayoutChar& operator=(const FzLayoutChar& rhs);
  4901. };
  4902. /** Wrapper class for struct `fz_layout_line`. Not copyable or assignable. */
  4903. struct FzLayoutLine
  4904. {
  4905. /** Default constructor, sets `m_internal` to null. */
  4906. FZ_FUNCTION FzLayoutLine();
  4907. /** Constructor using raw copy of pre-existing `::fz_layout_line`. */
  4908. FZ_FUNCTION FzLayoutLine(::fz_layout_line* internal);
  4909. #ifndef NDEBUG
  4910. /** Destructor only decrements s_num_instances. */
  4911. FZ_FUNCTION ~FzLayoutLine();
  4912. #else
  4913. /** We use default destructor. */
  4914. #endif
  4915. /** Return numerical value of .m_internal; helps with Python debugging. */
  4916. FZ_FUNCTION long long m_internal_value();
  4917. /** Return true iff `m_internal` is not null. */
  4918. FZ_FUNCTION operator bool();
  4919. /* == Member data. */
  4920. /** Pointer to wrapped data. */
  4921. ::fz_layout_line* m_internal;
  4922. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4923. generate code regardless so we always need to have this available. */
  4924. FZ_DATA static int s_num_instances;
  4925. private:
  4926. /** This class is not copyable or assignable. */
  4927. FzLayoutLine(const FzLayoutLine& rhs);
  4928. FzLayoutLine& operator=(const FzLayoutLine& rhs);
  4929. };
  4930. struct FzLinkIterator;
  4931. /** Wrapper class for struct `fz_link`. */
  4932. /**
  4933. fz_link is a list of interactive links on a page.
  4934. There is no relation between the order of the links in the
  4935. list and the order they appear on the page. The list of links
  4936. for a given page can be obtained from fz_load_links.
  4937. A link is reference counted. Dropping a reference to a link is
  4938. done by calling fz_drop_link.
  4939. rect: The hot zone. The area that can be clicked in
  4940. untransformed coordinates.
  4941. uri: Link destinations come in two forms: internal and external.
  4942. Internal links refer to other pages in the same document.
  4943. External links are URLs to other documents.
  4944. next: A pointer to the next link on the same page.
  4945. */
  4946. struct FzLink
  4947. {
  4948. /** == Constructors. */
  4949. /** Constructor using `fz_new_link_of_size()`. */
  4950. /**
  4951. Create a new link record.
  4952. next is set to NULL with the expectation that the caller will
  4953. handle the linked list setup. Internal function.
  4954. Different document types will be implemented by deriving from
  4955. fz_link. This macro allocates such derived structures, and
  4956. initialises the base sections.
  4957. */
  4958. FZ_FUNCTION FzLink(int size, const FzRect& rect, const char *uri);
  4959. /** Constructor using `pdf_new_link()`. */
  4960. FZ_FUNCTION FzLink(const PdfPage& page, const FzRect& rect, const char *uri, const PdfObj& obj);
  4961. /** Construct by calling fz_new_link_of_size() with size=sizeof(fz_link). */
  4962. FZ_FUNCTION FzLink(FzRect& rect, const char *uri);
  4963. /** Copy constructor using `fz_keep_link()`. */
  4964. FZ_FUNCTION FzLink(const FzLink& rhs);
  4965. /** operator= using `fz_keep_link()` and `fz_drop_link()`. */
  4966. FZ_FUNCTION FzLink& operator=(const FzLink& rhs);
  4967. /* == Methods. */
  4968. /** Class-aware wrapper for `::fz_set_link_rect()`. */
  4969. FZ_FUNCTION void fz_set_link_rect(const FzRect& rect) const;
  4970. /** Class-aware wrapper for `::fz_set_link_uri()`. */
  4971. FZ_FUNCTION void fz_set_link_uri(const char *uri) const;
  4972. /** Used for iteration over linked list of FzLink items starting at fz_link::. */
  4973. FZ_FUNCTION FzLinkIterator begin();
  4974. /** Used for iteration over linked list of FzLink items starting at fz_link::. */
  4975. FZ_FUNCTION FzLinkIterator end();
  4976. /** Constructor using raw copy of pre-existing `::fz_link`. */
  4977. /* This constructor is marked as `explicit` because wrapper classes do not
  4978. call `keep`in constructors, but do call `drop` in destructors. So
  4979. automatic construction from a fz_link* will generally cause an
  4980. unbalanced `drop` resulting in errors such as SEGV. */
  4981. FZ_FUNCTION explicit FzLink(::fz_link* internal=NULL);
  4982. /* == Accessors to members of ::fz_link m_internal. */
  4983. FZ_FUNCTION int refs();
  4984. FZ_FUNCTION FzLink next();
  4985. FZ_FUNCTION ::fz_rect rect();
  4986. FZ_FUNCTION const char *uri();
  4987. /** Destructor using fz_drop_link(). */
  4988. FZ_FUNCTION ~FzLink();
  4989. /** Return numerical value of .m_internal; helps with Python debugging. */
  4990. FZ_FUNCTION long long m_internal_value();
  4991. /** Return true iff `m_internal` is not null. */
  4992. FZ_FUNCTION operator bool();
  4993. /* == Member data. */
  4994. /** Pointer to wrapped data. */
  4995. ::fz_link* m_internal;
  4996. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  4997. generate code regardless so we always need to have this available. */
  4998. FZ_DATA static int s_num_instances;
  4999. typedef FzLinkIterator iterator;
  5000. };
  5001. /** Wrapper class for struct `fz_link_dest`. Not copyable or assignable. */
  5002. struct FzLinkDest
  5003. {
  5004. /** Default constructor, sets `m_internal` to null. */
  5005. FZ_FUNCTION FzLinkDest();
  5006. /* == Methods. */
  5007. /** Class-aware wrapper for `::pdf_new_uri_from_explicit_dest()`. */
  5008. FZ_FUNCTION char *pdf_new_uri_from_explicit_dest() const;
  5009. /** Constructor using raw copy of pre-existing `::fz_link_dest`. */
  5010. FZ_FUNCTION FzLinkDest(::fz_link_dest* internal);
  5011. #ifndef NDEBUG
  5012. /** Destructor only decrements s_num_instances. */
  5013. FZ_FUNCTION ~FzLinkDest();
  5014. #else
  5015. /** We use default destructor. */
  5016. #endif
  5017. /** Return numerical value of .m_internal; helps with Python debugging. */
  5018. FZ_FUNCTION long long m_internal_value();
  5019. /** Return true iff `m_internal` is not null. */
  5020. FZ_FUNCTION operator bool();
  5021. /* == Member data. */
  5022. /** Pointer to wrapped data. */
  5023. ::fz_link_dest* m_internal;
  5024. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5025. generate code regardless so we always need to have this available. */
  5026. FZ_DATA static int s_num_instances;
  5027. private:
  5028. /** This class is not copyable or assignable. */
  5029. FzLinkDest(const FzLinkDest& rhs);
  5030. FzLinkDest& operator=(const FzLinkDest& rhs);
  5031. };
  5032. /** Wrapper class for struct `fz_location`. */
  5033. /**
  5034. Locations within the document are referred to in terms of
  5035. chapter and page, rather than just a page number. For some
  5036. documents (such as epub documents with large numbers of pages
  5037. broken into many chapters) this can make navigation much faster
  5038. as only the required chapter needs to be decoded at a time.
  5039. */
  5040. struct FzLocation
  5041. {
  5042. /** == Constructors. */
  5043. /** Constructor using `fz_make_location()`. */
  5044. /**
  5045. Simple constructor for fz_locations.
  5046. */
  5047. FZ_FUNCTION FzLocation(int chapter, int page);
  5048. /** We use default copy constructor and operator=. */
  5049. /** Default constructor, sets each member to default value. */
  5050. FZ_FUNCTION FzLocation();
  5051. /** Constructor using raw copy of pre-existing `::fz_location`. */
  5052. FZ_FUNCTION FzLocation(const ::fz_location* internal);
  5053. /** Constructor using raw copy of pre-existing `::fz_location`. */
  5054. FZ_FUNCTION FzLocation(const ::fz_location internal);
  5055. /** Access as underlying struct. */
  5056. FZ_FUNCTION ::fz_location* internal();
  5057. /** Access as underlying struct. */
  5058. FZ_FUNCTION const ::fz_location* internal() const;
  5059. #ifndef NDEBUG
  5060. /** Destructor only decrements s_num_instances. */
  5061. FZ_FUNCTION ~FzLocation();
  5062. #else
  5063. /** We use default destructor. */
  5064. #endif
  5065. /* == Member data. */
  5066. /* These members are the same as the members of ::fz_location. */
  5067. int chapter;
  5068. int page;
  5069. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5070. generate code regardless so we always need to have this available. */
  5071. FZ_DATA static int s_num_instances;
  5072. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  5073. FZ_FUNCTION std::string to_string();
  5074. /** Comparison method. */
  5075. FZ_FUNCTION bool operator==(const FzLocation& rhs);
  5076. /** Comparison method. */
  5077. FZ_FUNCTION bool operator!=(const FzLocation& rhs);
  5078. };
  5079. /** Wrapper class for struct `fz_locks_context`. Not copyable or assignable. */
  5080. /**
  5081. Locking functions
  5082. MuPDF is kept deliberately free of any knowledge of particular
  5083. threading systems. As such, in order for safe multi-threaded
  5084. operation, we rely on callbacks to client provided functions.
  5085. A client is expected to provide FZ_LOCK_MAX number of mutexes,
  5086. and a function to lock/unlock each of them. These may be
  5087. recursive mutexes, but do not have to be.
  5088. If a client does not intend to use multiple threads, then it
  5089. may pass NULL instead of a lock structure.
  5090. In order to avoid deadlocks, we have one simple rule
  5091. internally as to how we use locks: We can never take lock n
  5092. when we already hold any lock i, where 0 <= i <= n. In order
  5093. to verify this, we have some debugging code, that can be
  5094. enabled by defining FITZ_DEBUG_LOCKING.
  5095. */
  5096. struct FzLocksContext
  5097. {
  5098. /** Default constructor, sets `m_internal` to null. */
  5099. FZ_FUNCTION FzLocksContext();
  5100. /** Constructor using raw copy of pre-existing `::fz_locks_context`. */
  5101. FZ_FUNCTION FzLocksContext(::fz_locks_context* internal);
  5102. #ifndef NDEBUG
  5103. /** Destructor only decrements s_num_instances. */
  5104. FZ_FUNCTION ~FzLocksContext();
  5105. #else
  5106. /** We use default destructor. */
  5107. #endif
  5108. /** Return numerical value of .m_internal; helps with Python debugging. */
  5109. FZ_FUNCTION long long m_internal_value();
  5110. /** Return true iff `m_internal` is not null. */
  5111. FZ_FUNCTION operator bool();
  5112. /* == Member data. */
  5113. /** Pointer to wrapped data. */
  5114. ::fz_locks_context* m_internal;
  5115. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5116. generate code regardless so we always need to have this available. */
  5117. FZ_DATA static int s_num_instances;
  5118. private:
  5119. /** This class is not copyable or assignable. */
  5120. FzLocksContext(const FzLocksContext& rhs);
  5121. FzLocksContext& operator=(const FzLocksContext& rhs);
  5122. };
  5123. /** Wrapper class for struct `fz_matrix`. */
  5124. /**
  5125. fz_matrix is a row-major 3x3 matrix used for representing
  5126. transformations of coordinates throughout MuPDF.
  5127. Since all points reside in a two-dimensional space, one vector
  5128. is always a constant unit vector; hence only some elements may
  5129. vary in a matrix. Below is how the elements map between
  5130. different representations.
  5131. / a b 0 \
  5132. | c d 0 | normally represented as [ a b c d e f ].
  5133. \ e f 1 /
  5134. */
  5135. struct FzMatrix
  5136. {
  5137. /** == Constructors. */
  5138. /** Constructor using `fz_make_matrix()`. */
  5139. FZ_FUNCTION FzMatrix(float a, float b, float c, float d, float e, float f);
  5140. /** Constructs identity matrix (like fz_identity). */
  5141. FZ_FUNCTION FzMatrix();
  5142. /** We use default copy constructor and operator=. */
  5143. /* == Static methods. */
  5144. /** Class-aware wrapper for `::fz_concat()`. */
  5145. /**
  5146. Multiply two matrices.
  5147. The order of the two matrices are important since matrix
  5148. multiplication is not commutative.
  5149. Returns result.
  5150. */
  5151. FZ_FUNCTION static FzMatrix fz_concat(const FzMatrix& left, const FzMatrix& right);
  5152. /** Class-aware wrapper for `::fz_scale()`. */
  5153. /**
  5154. Create a scaling matrix.
  5155. The returned matrix is of the form [ sx 0 0 sy 0 0 ].
  5156. m: Pointer to the matrix to populate
  5157. sx, sy: Scaling factors along the X- and Y-axes. A scaling
  5158. factor of 1.0 will not cause any scaling along the relevant
  5159. axis.
  5160. Returns m.
  5161. */
  5162. FZ_FUNCTION static FzMatrix fz_scale(float sx, float sy);
  5163. /** Class-aware wrapper for `::fz_shear()`. */
  5164. /**
  5165. Create a shearing matrix.
  5166. The returned matrix is of the form [ 1 sy sx 1 0 0 ].
  5167. m: pointer to place to store returned matrix
  5168. sx, sy: Shearing factors. A shearing factor of 0.0 will not
  5169. cause any shearing along the relevant axis.
  5170. Returns m.
  5171. */
  5172. FZ_FUNCTION static FzMatrix fz_shear(float sx, float sy);
  5173. /** Class-aware wrapper for `::fz_rotate()`. */
  5174. /**
  5175. Create a rotation matrix.
  5176. The returned matrix is of the form
  5177. [ cos(deg) sin(deg) -sin(deg) cos(deg) 0 0 ].
  5178. m: Pointer to place to store matrix
  5179. degrees: Degrees of counter clockwise rotation. Values less
  5180. than zero and greater than 360 are handled as expected.
  5181. Returns m.
  5182. */
  5183. FZ_FUNCTION static FzMatrix fz_rotate(float degrees);
  5184. /** Class-aware wrapper for `::fz_translate()`. */
  5185. /**
  5186. Create a translation matrix.
  5187. The returned matrix is of the form [ 1 0 0 1 tx ty ].
  5188. m: A place to store the created matrix.
  5189. tx, ty: Translation distances along the X- and Y-axes. A
  5190. translation of 0 will not cause any translation along the
  5191. relevant axis.
  5192. Returns m.
  5193. */
  5194. FZ_FUNCTION static FzMatrix fz_translate(float tx, float ty);
  5195. /** Class-aware wrapper for `::fz_transform_page()`. */
  5196. /**
  5197. Create transform matrix to draw page
  5198. at a given resolution and rotation. Adjusts the scaling
  5199. factors so that the page covers whole number of
  5200. pixels and adjust the page origin to be at 0,0.
  5201. */
  5202. FZ_FUNCTION static FzMatrix fz_transform_page(const FzRect& mediabox, float resolution, float rotate);
  5203. /* == Methods. */
  5204. /** Class-aware wrapper for `::fz_concat()`. */
  5205. /**
  5206. Multiply two matrices.
  5207. The order of the two matrices are important since matrix
  5208. multiplication is not commutative.
  5209. Returns result.
  5210. */
  5211. FZ_FUNCTION FzMatrix fz_concat(const FzMatrix& right);
  5212. /** Class-aware wrapper for `::fz_invert_matrix()`. */
  5213. /**
  5214. Create an inverse matrix.
  5215. matrix: Matrix to invert. A degenerate matrix, where the
  5216. determinant is equal to zero, can not be inverted and the
  5217. original matrix is returned instead.
  5218. Returns inverse.
  5219. */
  5220. FZ_FUNCTION FzMatrix fz_invert_matrix();
  5221. /** Class-aware wrapper for `::fz_is_identity()`. */
  5222. FZ_FUNCTION int fz_is_identity();
  5223. /** Class-aware wrapper for `::fz_is_rectilinear()`. */
  5224. /**
  5225. Check if a transformation is rectilinear.
  5226. Rectilinear means that no shearing is present and that any
  5227. rotations present are a multiple of 90 degrees. Usually this
  5228. is used to make sure that axis-aligned rectangles before the
  5229. transformation are still axis-aligned rectangles afterwards.
  5230. */
  5231. FZ_FUNCTION int fz_is_rectilinear();
  5232. /** Class-aware wrapper for `::fz_matrix_expansion()`. */
  5233. /**
  5234. Calculate average scaling factor of matrix.
  5235. */
  5236. FZ_FUNCTION float fz_matrix_expansion();
  5237. /** Class-aware wrapper for `::fz_matrix_max_expansion()`. */
  5238. /**
  5239. Find the largest expansion performed by this matrix.
  5240. (i.e. max(abs(m.a),abs(m.b),abs(m.c),abs(m.d))
  5241. */
  5242. FZ_FUNCTION float fz_matrix_max_expansion();
  5243. /** Class-aware wrapper for `::fz_post_scale()`. */
  5244. /**
  5245. Scale a matrix by postmultiplication.
  5246. m: Pointer to the matrix to scale
  5247. sx, sy: Scaling factors along the X- and Y-axes. A scaling
  5248. factor of 1.0 will not cause any scaling along the relevant
  5249. axis.
  5250. Returns m (updated).
  5251. */
  5252. FZ_FUNCTION FzMatrix fz_post_scale(float sx, float sy);
  5253. /** Class-aware wrapper for `::fz_pre_rotate()`. */
  5254. /**
  5255. Rotate a transformation by premultiplying.
  5256. The premultiplied matrix is of the form
  5257. [ cos(deg) sin(deg) -sin(deg) cos(deg) 0 0 ].
  5258. m: Pointer to matrix to premultiply.
  5259. degrees: Degrees of counter clockwise rotation. Values less
  5260. than zero and greater than 360 are handled as expected.
  5261. Returns m (updated).
  5262. */
  5263. FZ_FUNCTION FzMatrix fz_pre_rotate(float degrees);
  5264. /** Class-aware wrapper for `::fz_pre_scale()`. */
  5265. /**
  5266. Scale a matrix by premultiplication.
  5267. m: Pointer to the matrix to scale
  5268. sx, sy: Scaling factors along the X- and Y-axes. A scaling
  5269. factor of 1.0 will not cause any scaling along the relevant
  5270. axis.
  5271. Returns m (updated).
  5272. */
  5273. FZ_FUNCTION FzMatrix fz_pre_scale(float sx, float sy);
  5274. /** Class-aware wrapper for `::fz_pre_shear()`. */
  5275. /**
  5276. Premultiply a matrix with a shearing matrix.
  5277. The shearing matrix is of the form [ 1 sy sx 1 0 0 ].
  5278. m: pointer to matrix to premultiply
  5279. sx, sy: Shearing factors. A shearing factor of 0.0 will not
  5280. cause any shearing along the relevant axis.
  5281. Returns m (updated).
  5282. */
  5283. FZ_FUNCTION FzMatrix fz_pre_shear(float sx, float sy);
  5284. /** Class-aware wrapper for `::fz_pre_translate()`. */
  5285. /**
  5286. Translate a matrix by premultiplication.
  5287. m: The matrix to translate
  5288. tx, ty: Translation distances along the X- and Y-axes. A
  5289. translation of 0 will not cause any translation along the
  5290. relevant axis.
  5291. Returns m.
  5292. */
  5293. FZ_FUNCTION FzMatrix fz_pre_translate(float tx, float ty);
  5294. /** Class-aware wrapper for `::fz_subpixel_adjust()`. */
  5295. /**
  5296. Perform subpixel quantisation and adjustment on a glyph matrix.
  5297. ctm: On entry, the desired 'ideal' transformation for a glyph.
  5298. On exit, adjusted to a (very similar) transformation quantised
  5299. for subpixel caching.
  5300. subpix_ctm: Initialised by the routine to the transform that
  5301. should be used to render the glyph.
  5302. qe, qf: which subpixel position we quantised to.
  5303. Returns: the size of the glyph.
  5304. Note: This is currently only exposed for use in our app. It
  5305. should be considered "at risk" of removal from the API.
  5306. */
  5307. FZ_FUNCTION float fz_subpixel_adjust(FzMatrix& subpix_ctm, unsigned char *qe, unsigned char *qf);
  5308. /** Class-aware wrapper for `::fz_try_invert_matrix()`. */
  5309. /**
  5310. Attempt to create an inverse matrix.
  5311. inv: Place to store inverse matrix.
  5312. src: Matrix to invert. A degenerate matrix, where the
  5313. determinant is equal to zero, can not be inverted.
  5314. Returns 1 if matrix is degenerate (singular), or 0 otherwise.
  5315. */
  5316. FZ_FUNCTION int fz_try_invert_matrix(const FzMatrix& src);
  5317. /** Constructor using raw copy of pre-existing `::fz_matrix`. */
  5318. FZ_FUNCTION FzMatrix(const ::fz_matrix* internal);
  5319. /** Constructor using raw copy of pre-existing `::fz_matrix`. */
  5320. FZ_FUNCTION FzMatrix(const ::fz_matrix internal);
  5321. /** Access as underlying struct. */
  5322. FZ_FUNCTION ::fz_matrix* internal();
  5323. /** Access as underlying struct. */
  5324. FZ_FUNCTION const ::fz_matrix* internal() const;
  5325. #ifndef NDEBUG
  5326. /** Destructor only decrements s_num_instances. */
  5327. FZ_FUNCTION ~FzMatrix();
  5328. #else
  5329. /** We use default destructor. */
  5330. #endif
  5331. /* == Member data. */
  5332. /* These members are the same as the members of ::fz_matrix. */
  5333. float a;
  5334. float b;
  5335. float c;
  5336. float d;
  5337. float e;
  5338. float f;
  5339. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5340. generate code regardless so we always need to have this available. */
  5341. FZ_DATA static int s_num_instances;
  5342. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  5343. FZ_FUNCTION std::string to_string();
  5344. /** Comparison method. */
  5345. FZ_FUNCTION bool operator==(const FzMatrix& rhs);
  5346. /** Comparison method. */
  5347. FZ_FUNCTION bool operator!=(const FzMatrix& rhs);
  5348. };
  5349. /** Wrapper class for struct `fz_md5`. */
  5350. /**
  5351. Structure definition is public to enable stack
  5352. based allocation. Do not access the members directly.
  5353. */
  5354. struct FzMd5
  5355. {
  5356. /** Default constructor calls md5_init(). */
  5357. FZ_FUNCTION FzMd5();
  5358. /** We use default copy constructor and operator=. */
  5359. /* == Methods. */
  5360. /** Class-aware wrapper for `::fz_md5_final()`. */
  5361. /**
  5362. MD5 finalization. Ends an MD5 message-digest operation, writing
  5363. the message digest and zeroizing the context.
  5364. Never throws an exception.
  5365. */
  5366. FZ_FUNCTION void fz_md5_final(unsigned char digest[16]);
  5367. /** Class-aware wrapper for `::fz_md5_final2()`. */
  5368. /**
  5369. C++ alternative to fz_md5_final() that returns the digest by value.
  5370. */
  5371. FZ_FUNCTION std::vector<unsigned char> fz_md5_final2();
  5372. /** Class-aware wrapper for `::fz_md5_init()`. */
  5373. /**
  5374. MD5 initialization. Begins an MD5 operation, writing a new
  5375. context.
  5376. Never throws an exception.
  5377. */
  5378. FZ_FUNCTION void fz_md5_init();
  5379. /** Class-aware wrapper for `::fz_md5_update()`. */
  5380. /**
  5381. MD5 block update operation. Continues an MD5 message-digest
  5382. operation, processing another message block, and updating the
  5383. context.
  5384. Never throws an exception.
  5385. */
  5386. FZ_FUNCTION void fz_md5_update(const unsigned char *input, size_t inlen);
  5387. /** Class-aware wrapper for `::fz_md5_update_int64()`. */
  5388. /**
  5389. MD5 block update operation. Continues an MD5 message-digest
  5390. operation, processing an int64, and updating the context.
  5391. Never throws an exception.
  5392. */
  5393. FZ_FUNCTION void fz_md5_update_int64(int64_t i);
  5394. /** Constructor using raw copy of pre-existing `::fz_md5`. */
  5395. FZ_FUNCTION FzMd5(const ::fz_md5* internal);
  5396. /* == Accessors to members of ::fz_md5 m_internal. */
  5397. FZ_FUNCTION uint32_t lo();
  5398. FZ_FUNCTION uint32_t hi();
  5399. FZ_FUNCTION uint32_t a();
  5400. FZ_FUNCTION uint32_t b();
  5401. FZ_FUNCTION uint32_t c();
  5402. FZ_FUNCTION uint32_t d();
  5403. FZ_FUNCTION unsigned char * buffer();
  5404. #ifndef NDEBUG
  5405. /** Destructor only decrements s_num_instances. */
  5406. FZ_FUNCTION ~FzMd5();
  5407. #else
  5408. /** We use default destructor. */
  5409. #endif
  5410. /* == Member data. */
  5411. ::fz_md5 m_internal; /** Wrapped data is held by value. */
  5412. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5413. generate code regardless so we always need to have this available. */
  5414. FZ_DATA static int s_num_instances;
  5415. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  5416. FZ_FUNCTION std::string to_string();
  5417. /** Comparison method. */
  5418. FZ_FUNCTION bool operator==(const FzMd5& rhs);
  5419. /** Comparison method. */
  5420. FZ_FUNCTION bool operator!=(const FzMd5& rhs);
  5421. };
  5422. /** Wrapper class for struct `fz_outline`. */
  5423. /**
  5424. fz_outline is a tree of the outline of a document (also known
  5425. as table of contents).
  5426. title: Title of outline item using UTF-8 encoding. May be NULL
  5427. if the outline item has no text string.
  5428. uri: Destination in the document to be displayed when this
  5429. outline item is activated. May be an internal or external
  5430. link, or NULL if the outline item does not have a destination.
  5431. page: The page number of an internal link, or -1 for external
  5432. links or links with no destination.
  5433. next: The next outline item at the same level as this outline
  5434. item. May be NULL if no more outline items exist at this level.
  5435. down: The outline items immediate children in the hierarchy.
  5436. May be NULL if no children exist.
  5437. is_open: If zero, the outline element is closed in the UI. If
  5438. 1, it should be open, showing any child elements.
  5439. flags: Bit 0 set -> Bold, Bit 1 set -> Italic. All other bits
  5440. reserved.
  5441. r, g, b: The RGB components of the color of this entry.
  5442. */
  5443. struct FzOutline
  5444. {
  5445. /** == Constructors. */
  5446. /** Constructor using `fz_load_outline()`. */
  5447. /**
  5448. Load the hierarchical document outline.
  5449. Should be freed by fz_drop_outline.
  5450. */
  5451. FZ_FUNCTION FzOutline(const FzDocument& doc);
  5452. /** Constructor using `fz_load_outline_from_iterator()`. */
  5453. /**
  5454. Routine to implement the old Structure based API from an iterator.
  5455. */
  5456. FZ_FUNCTION FzOutline(const FzOutlineIterator& iter);
  5457. /** Constructor using `fz_new_outline()`. */
  5458. /**
  5459. Create a new outline entry with zeroed fields for the caller
  5460. to fill in.
  5461. */
  5462. FZ_FUNCTION FzOutline();
  5463. /** Copy constructor using `fz_keep_outline()`. */
  5464. FZ_FUNCTION FzOutline(const FzOutline& rhs);
  5465. /** operator= using `fz_keep_outline()` and `fz_drop_outline()`. */
  5466. FZ_FUNCTION FzOutline& operator=(const FzOutline& rhs);
  5467. /** Constructor using raw copy of pre-existing `::fz_outline`. */
  5468. /* This constructor is marked as `explicit` because wrapper classes do not
  5469. call `keep`in constructors, but do call `drop` in destructors. So
  5470. automatic construction from a fz_outline* will generally cause an
  5471. unbalanced `drop` resulting in errors such as SEGV. */
  5472. FZ_FUNCTION explicit FzOutline(::fz_outline* internal);
  5473. /* == Accessors to members of ::fz_outline m_internal. */
  5474. FZ_FUNCTION int refs();
  5475. FZ_FUNCTION const char *title();
  5476. FZ_FUNCTION const char *uri();
  5477. FZ_FUNCTION ::fz_location page();
  5478. FZ_FUNCTION float x();
  5479. FZ_FUNCTION float y();
  5480. FZ_FUNCTION FzOutline next();
  5481. FZ_FUNCTION FzOutline down();
  5482. FZ_FUNCTION unsigned int is_open();
  5483. FZ_FUNCTION unsigned int flags();
  5484. FZ_FUNCTION unsigned int r();
  5485. FZ_FUNCTION unsigned int g();
  5486. FZ_FUNCTION unsigned int b();
  5487. /** Destructor using fz_drop_outline(). */
  5488. FZ_FUNCTION ~FzOutline();
  5489. /** Return numerical value of .m_internal; helps with Python debugging. */
  5490. FZ_FUNCTION long long m_internal_value();
  5491. /** Return true iff `m_internal` is not null. */
  5492. FZ_FUNCTION operator bool();
  5493. /* == Member data. */
  5494. /** Pointer to wrapped data. */
  5495. ::fz_outline* m_internal;
  5496. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5497. generate code regardless so we always need to have this available. */
  5498. FZ_DATA static int s_num_instances;
  5499. };
  5500. /** Wrapper class for struct `fz_outline_item`. */
  5501. struct FzOutlineItem
  5502. {
  5503. FZ_FUNCTION bool valid() const;
  5504. FZ_FUNCTION const std::string& title() const; /* Will throw if valid() is not true. */
  5505. FZ_FUNCTION const std::string& uri() const; /* Will throw if valid() is not true. */
  5506. FZ_FUNCTION int is_open() const; /* Will throw if valid() is not true. */
  5507. /** We use default copy constructor and operator=. */
  5508. /** Default constructor, sets each member to default value. */
  5509. FZ_FUNCTION FzOutlineItem();
  5510. /** Constructor using raw copy of pre-existing `::fz_outline_item`. */
  5511. FZ_FUNCTION FzOutlineItem(const ::fz_outline_item* internal);
  5512. #ifndef NDEBUG
  5513. /** Destructor only decrements s_num_instances. */
  5514. FZ_FUNCTION ~FzOutlineItem();
  5515. #else
  5516. /** We use default destructor. */
  5517. #endif
  5518. /* == Member data. */
  5519. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5520. generate code regardless so we always need to have this available. */
  5521. FZ_DATA static int s_num_instances;
  5522. private:
  5523. bool m_valid;
  5524. std::string m_title;
  5525. std::string m_uri;
  5526. int m_is_open;
  5527. };
  5528. /** Wrapper class for struct `fz_outline_iterator`. Not copyable or assignable. */
  5529. struct FzOutlineIterator
  5530. {
  5531. /** == Constructors. */
  5532. /** Constructor using `fz_new_outline_iterator()`. */
  5533. /**
  5534. Get an iterator for the document outline.
  5535. Should be freed by fz_drop_outline_iterator.
  5536. */
  5537. FZ_FUNCTION FzOutlineIterator(const FzDocument& doc);
  5538. /** Constructor using `fz_new_outline_iterator_of_size()`. */
  5539. FZ_FUNCTION FzOutlineIterator(size_t size, const FzDocument& doc);
  5540. /** Constructor using `pdf_new_outline_iterator()`. */
  5541. FZ_FUNCTION FzOutlineIterator(const PdfDocument& doc);
  5542. /** Default constructor, sets `m_internal` to null. */
  5543. FZ_FUNCTION FzOutlineIterator();
  5544. /* == Methods. */
  5545. /** Class-aware wrapper for `::fz_load_outline_from_iterator()`. */
  5546. /**
  5547. Routine to implement the old Structure based API from an iterator.
  5548. */
  5549. FZ_FUNCTION FzOutline fz_load_outline_from_iterator() const;
  5550. /** Class-aware wrapper for `::fz_outline_iterator_delete()`. */
  5551. /**
  5552. Delete the current item.
  5553. This implicitly moves us to the 'next' item, and the return code is as for fz_outline_iterator_next.
  5554. */
  5555. FZ_FUNCTION int fz_outline_iterator_delete() const;
  5556. /** Class-aware wrapper for `::fz_outline_iterator_down()`. */
  5557. FZ_FUNCTION int fz_outline_iterator_down() const;
  5558. /** Class-aware wrapper for `::fz_outline_iterator_item()`. */
  5559. /**
  5560. Call to get the current outline item.
  5561. Can return NULL. The item is only valid until the next call.
  5562. */
  5563. FZ_FUNCTION FzOutlineItem fz_outline_iterator_item() const;
  5564. /** Class-aware wrapper for `::fz_outline_iterator_next()`. */
  5565. /**
  5566. Calls to move the iterator position.
  5567. A negative return value means we could not move as requested. Otherwise:
  5568. 0 = the final position has a valid item.
  5569. 1 = not a valid item, but we can insert an item here.
  5570. */
  5571. FZ_FUNCTION int fz_outline_iterator_next() const;
  5572. /** Class-aware wrapper for `::fz_outline_iterator_prev()`. */
  5573. FZ_FUNCTION int fz_outline_iterator_prev() const;
  5574. /** Class-aware wrapper for `::fz_outline_iterator_up()`. */
  5575. FZ_FUNCTION int fz_outline_iterator_up() const;
  5576. /** Custom wrapper for fz_outline_iterator_insert(). */
  5577. FZ_FUNCTION int fz_outline_iterator_insert(FzOutlineItem& item);
  5578. /** Custom wrapper for fz_outline_iterator_update(). */
  5579. FZ_FUNCTION void fz_outline_iterator_update(FzOutlineItem& item);
  5580. /** Constructor using raw copy of pre-existing `::fz_outline_iterator`. */
  5581. FZ_FUNCTION FzOutlineIterator(::fz_outline_iterator* internal);
  5582. /** Destructor using fz_drop_outline_iterator(). */
  5583. FZ_FUNCTION ~FzOutlineIterator();
  5584. /** Return numerical value of .m_internal; helps with Python debugging. */
  5585. FZ_FUNCTION long long m_internal_value();
  5586. /** Return true iff `m_internal` is not null. */
  5587. FZ_FUNCTION operator bool();
  5588. /* == Member data. */
  5589. /** Pointer to wrapped data. */
  5590. ::fz_outline_iterator* m_internal;
  5591. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  5592. generate code regardless so we always need to have this available. */
  5593. FZ_DATA static int s_num_instances;
  5594. private:
  5595. /** This class is not copyable or assignable. */
  5596. FzOutlineIterator(const FzOutlineIterator& rhs);
  5597. FzOutlineIterator& operator=(const FzOutlineIterator& rhs);
  5598. };
  5599. /** Wrapper class for struct `fz_output`. Not copyable or assignable. */
  5600. struct FzOutput
  5601. {
  5602. enum Fixed
  5603. {
  5604. Fixed_STDOUT=1,
  5605. Fixed_STDERR=2,
  5606. };
  5607. enum Filter
  5608. {
  5609. Filter_HEX,
  5610. Filter_85,
  5611. Filter_RLE,
  5612. };
  5613. /** == Constructors. */
  5614. /** Constructor using `fz_new_arc4_output()`. */
  5615. FZ_FUNCTION FzOutput(const FzOutput& chain, unsigned char *key, size_t keylen);
  5616. /** Constructor using `fz_new_deflate_output()`. */
  5617. FZ_FUNCTION FzOutput(const FzOutput& chain, int effort, int raw);
  5618. /** Constructor using `fz_new_log_for_module()`. */
  5619. /**
  5620. Internal function to actually do the opening of the logfile.
  5621. Caller should close/drop the output when finished with it.
  5622. */
  5623. FZ_FUNCTION FzOutput(const char *module);
  5624. /** Constructor using `fz_new_output()`. */
  5625. /**
  5626. Create a new output object with the given
  5627. internal state and function pointers.
  5628. state: Internal state (opaque to everything but implementation).
  5629. write: Function to output a given buffer.
  5630. close: Cleanup function to destroy state when output closed.
  5631. May permissibly be null.
  5632. */
  5633. FZ_FUNCTION FzOutput(int bufsiz, void *state, ::fz_output_write_fn *write, ::fz_output_close_fn *close, ::fz_output_drop_fn *drop);
  5634. /** Constructor using `fz_new_output_with_buffer()`. */
  5635. /**
  5636. Open an output stream that appends
  5637. to a buffer.
  5638. buf: The buffer to append to.
  5639. */
  5640. FZ_FUNCTION FzOutput(const FzBuffer& buf);
  5641. /** Constructor using `fz_new_output_with_file_ptr()`. */
  5642. /**
  5643. Open an output stream that writes to a
  5644. given FILE *.
  5645. file: The file pointers to write to. NULL is interpreted as effectively
  5646. meaning /dev/null or similar.
  5647. */
  5648. FZ_FUNCTION FzOutput(FILE *file);
  5649. /** Constructor using `fz_new_output_with_path()`. */
  5650. /**
  5651. Open an output stream that writes to a
  5652. given path.
  5653. filename: The filename to write to (specified in UTF-8).
  5654. append: non-zero if we should append to the file, rather than
  5655. overwriting it.
  5656. */
  5657. FZ_FUNCTION FzOutput(const char *filename, int append);
  5658. /** Uses fz_stdout() or fz_stderr(). */
  5659. FZ_FUNCTION FzOutput(Fixed out);
  5660. /** Calls one of: fz_new_asciihex_output(), fz_new_ascii85_output(), fz_new_rle_output(). */
  5661. FZ_FUNCTION FzOutput(const FzOutput& chain, Filter filter);
  5662. /* == Methods. */
  5663. /** Class-aware wrapper for `::fz_close_output()`. */
  5664. /**
  5665. Flush pending output and close an output stream.
  5666. */
  5667. FZ_FUNCTION void fz_close_output() const;
  5668. /** Class-aware wrapper for `::fz_debug_store()`. */
  5669. /**
  5670. Output debugging information for the current state of the store
  5671. to the given output channel.
  5672. */
  5673. FZ_FUNCTION void fz_debug_store() const;
  5674. /** Class-aware wrapper for `::fz_dump_glyph_cache_stats()`. */
  5675. /**
  5676. Dump debug statistics for the glyph cache.
  5677. */
  5678. FZ_FUNCTION void fz_dump_glyph_cache_stats() const;
  5679. /** Class-aware wrapper for `::fz_flush_output()`. */
  5680. /**
  5681. Flush unwritten data.
  5682. */
  5683. FZ_FUNCTION void fz_flush_output() const;
  5684. /** Class-aware wrapper for `::fz_int2_heap_dump()`. */
  5685. FZ_FUNCTION void fz_int2_heap_dump(const FzInt2Heap& heap) const;
  5686. /** Class-aware wrapper for `::fz_int_heap_dump()`. */
  5687. FZ_FUNCTION void fz_int_heap_dump(const FzIntHeap& heap) const;
  5688. /** Class-aware wrapper for `::fz_intptr_heap_dump()`. */
  5689. FZ_FUNCTION void fz_intptr_heap_dump(const FzIntptrHeap& heap) const;
  5690. /** Class-aware wrapper for `::fz_new_svg_device()`. */
  5691. /**
  5692. Create a device that outputs (single page) SVG files to
  5693. the given output stream.
  5694. Equivalent to fz_new_svg_device_with_id passing id = NULL.
  5695. */
  5696. FZ_FUNCTION FzDevice fz_new_svg_device(float page_width, float page_height, int text_format, int reuse_images) const;
  5697. /** Class-aware wrapper for `::fz_new_svg_device_with_id()`.
  5698. This method has out-params. Python/C# wrappers look like:
  5699. `fz_new_svg_device_with_id(float page_width, float page_height, int text_format, int reuse_images)` => `(fz_device *, int id)`
  5700. */
  5701. /**
  5702. Create a device that outputs (single page) SVG files to
  5703. the given output stream.
  5704. output: The output stream to send the constructed SVG page to.
  5705. page_width, page_height: The page dimensions to use (in points).
  5706. text_format: How to emit text. One of the following values:
  5707. FZ_SVG_TEXT_AS_TEXT: As <text> elements with possible
  5708. layout errors and mismatching fonts.
  5709. FZ_SVG_TEXT_AS_PATH: As <path> elements with exact
  5710. visual appearance.
  5711. reuse_images: Share image resources using <symbol> definitions.
  5712. id: ID parameter to keep generated IDs unique across SVG files.
  5713. */
  5714. FZ_FUNCTION FzDevice fz_new_svg_device_with_id(float page_width, float page_height, int text_format, int reuse_images, int *id) const;
  5715. /** Class-aware wrapper for `::fz_new_trace_device()`. */
  5716. /**
  5717. Create a device to print a debug trace of all device calls.
  5718. */
  5719. FZ_FUNCTION FzDevice fz_new_trace_device() const;
  5720. /** Class-aware wrapper for `::fz_new_xmltext_device()`. */
  5721. /**
  5722. Create a device to output raw information.
  5723. */
  5724. FZ_FUNCTION FzDevice fz_new_xmltext_device() const;
  5725. /** Class-aware wrapper for `::fz_output_supports_stream()`. */
  5726. /**
  5727. Query whether a given fz_output supports fz_stream_from_output.
  5728. */
  5729. FZ_FUNCTION int fz_output_supports_stream() const;
  5730. /** Class-aware wrapper for `::fz_output_xml()`. */
  5731. /**
  5732. Pretty-print an XML tree to given output.
  5733. */
  5734. FZ_FUNCTION void fz_output_xml(const FzXml& item, int level) const;
  5735. /** Class-aware wrapper for `::fz_print_stext_header_as_html()`. */
  5736. FZ_FUNCTION void fz_print_stext_header_as_html() const;
  5737. /** Class-aware wrapper for `::fz_print_stext_header_as_xhtml()`. */
  5738. FZ_FUNCTION void fz_print_stext_header_as_xhtml() const;
  5739. /** Class-aware wrapper for `::fz_print_stext_page_as_html()`. */
  5740. /**
  5741. Output structured text to a file in HTML (visual) format.
  5742. */
  5743. FZ_FUNCTION void fz_print_stext_page_as_html(const FzStextPage& page, int id) const;
  5744. /** Class-aware wrapper for `::fz_print_stext_page_as_json()`. */
  5745. /**
  5746. Output structured text to a file in JSON format.
  5747. */
  5748. FZ_FUNCTION void fz_print_stext_page_as_json(const FzStextPage& page, float scale) const;
  5749. /** Class-aware wrapper for `::fz_print_stext_page_as_text()`. */
  5750. /**
  5751. Output structured text to a file in plain-text UTF-8 format.
  5752. */
  5753. FZ_FUNCTION void fz_print_stext_page_as_text(const FzStextPage& page) const;
  5754. /** Class-aware wrapper for `::fz_print_stext_page_as_xhtml()`. */
  5755. /**
  5756. Output structured text to a file in XHTML (semantic) format.
  5757. */
  5758. FZ_FUNCTION void fz_print_stext_page_as_xhtml(const FzStextPage& page, int id) const;
  5759. /** Class-aware wrapper for `::fz_print_stext_page_as_xml()`. */
  5760. /**
  5761. Output structured text to a file in XML format.
  5762. */
  5763. FZ_FUNCTION void fz_print_stext_page_as_xml(const FzStextPage& page, int id) const;
  5764. /** Class-aware wrapper for `::fz_print_stext_trailer_as_html()`. */
  5765. FZ_FUNCTION void fz_print_stext_trailer_as_html() const;
  5766. /** Class-aware wrapper for `::fz_print_stext_trailer_as_xhtml()`. */
  5767. FZ_FUNCTION void fz_print_stext_trailer_as_xhtml() const;
  5768. /** Class-aware wrapper for `::fz_reset_output()`. */
  5769. /**
  5770. Reset a closed output stream. Returns state to
  5771. (broadly) that which it was in when opened. Not
  5772. all outputs can be reset, so this may throw an
  5773. exception.
  5774. */
  5775. FZ_FUNCTION void fz_reset_output() const;
  5776. /** Class-aware wrapper for `::fz_seek_output()`. */
  5777. /**
  5778. Seek to the specified file position.
  5779. See fseek for arguments.
  5780. Throw an error on unseekable outputs.
  5781. */
  5782. FZ_FUNCTION void fz_seek_output(int64_t off, int whence) const;
  5783. /** Class-aware wrapper for `::fz_set_stddbg()`. */
  5784. /**
  5785. Set the output stream to be used for fz_stddbg. Set to NULL to
  5786. reset to default (stderr).
  5787. */
  5788. FZ_FUNCTION void fz_set_stddbg() const;
  5789. /** Class-aware wrapper for `::fz_stream_from_output()`. */
  5790. /**
  5791. Obtain the fz_output in the form of a fz_stream.
  5792. This allows data to be read back from some forms of fz_output
  5793. object. When finished reading, the fz_stream should be released
  5794. by calling fz_drop_stream. Until the fz_stream is dropped, no
  5795. further operations should be performed on the fz_output object.
  5796. */
  5797. FZ_FUNCTION FzStream fz_stream_from_output() const;
  5798. /** Class-aware wrapper for `::fz_tell_output()`. */
  5799. /**
  5800. Return the current file position.
  5801. Throw an error on untellable outputs.
  5802. */
  5803. FZ_FUNCTION int64_t fz_tell_output() const;
  5804. /** Class-aware wrapper for `::fz_truncate_output()`. */
  5805. /**
  5806. Truncate the output at the current position.
  5807. This allows output streams which have seeked back from the end
  5808. of their storage to be truncated at the current point.
  5809. */
  5810. FZ_FUNCTION void fz_truncate_output() const;
  5811. /** Class-aware wrapper for `::fz_write_base64()`. */
  5812. /**
  5813. Write a base64 encoded data block, optionally with periodic
  5814. newlines.
  5815. */
  5816. FZ_FUNCTION void fz_write_base64(const unsigned char *data, size_t size, int newline) const;
  5817. /** Class-aware wrapper for `::fz_write_base64_buffer()`. */
  5818. /**
  5819. Write a base64 encoded fz_buffer, optionally with periodic
  5820. newlines.
  5821. */
  5822. FZ_FUNCTION void fz_write_base64_buffer(const FzBuffer& data, int newline) const;
  5823. /** Class-aware wrapper for `::fz_write_bitmap_as_pbm()`. */
  5824. /**
  5825. Write a bitmap as a pbm.
  5826. */
  5827. FZ_FUNCTION void fz_write_bitmap_as_pbm(const FzBitmap& bitmap) const;
  5828. /** Class-aware wrapper for `::fz_write_bitmap_as_pcl()`. */
  5829. /**
  5830. Write a bitmap as mono PCL.
  5831. */
  5832. FZ_FUNCTION void fz_write_bitmap_as_pcl(const FzBitmap& bitmap, const FzPclOptions& pcl) const;
  5833. /** Class-aware wrapper for `::fz_write_bitmap_as_pkm()`. */
  5834. /**
  5835. Write a CMYK bitmap as a pkm.
  5836. */
  5837. FZ_FUNCTION void fz_write_bitmap_as_pkm(const FzBitmap& bitmap) const;
  5838. /** Class-aware wrapper for `::fz_write_bitmap_as_pwg()`. */
  5839. /**
  5840. Write a bitmap as a PWG.
  5841. */
  5842. FZ_FUNCTION void fz_write_bitmap_as_pwg(const FzBitmap& bitmap, FzPwgOptions& pwg) const;
  5843. /** Class-aware wrapper for `::fz_write_bitmap_as_pwg_page()`. */
  5844. /**
  5845. Write a bitmap as a PWG page.
  5846. Caller should provide a file header by calling
  5847. fz_write_pwg_file_header, but can then write several pages to
  5848. the same file.
  5849. */
  5850. FZ_FUNCTION void fz_write_bitmap_as_pwg_page(const FzBitmap& bitmap, FzPwgOptions& pwg) const;
  5851. /** Class-aware wrapper for `::fz_write_bits()`. */
  5852. /**
  5853. Write num_bits of data to the end of the output stream, assumed to be packed
  5854. most significant bits first.
  5855. */
  5856. FZ_FUNCTION void fz_write_bits(unsigned int data, int num_bits) const;
  5857. /** Class-aware wrapper for `::fz_write_bits_sync()`. */
  5858. /**
  5859. Sync to byte boundary after writing bits.
  5860. */
  5861. FZ_FUNCTION void fz_write_bits_sync() const;
  5862. /** Class-aware wrapper for `::fz_write_buffer()`. */
  5863. FZ_FUNCTION void fz_write_buffer(const FzBuffer& data) const;
  5864. /** Class-aware wrapper for `::fz_write_byte()`. */
  5865. FZ_FUNCTION void fz_write_byte(unsigned char x) const;
  5866. /** Class-aware wrapper for `::fz_write_char()`. */
  5867. FZ_FUNCTION void fz_write_char(char x) const;
  5868. /** Class-aware wrapper for `::fz_write_data()`. */
  5869. /**
  5870. Write data to output.
  5871. data: Pointer to data to write.
  5872. size: Size of data to write in bytes.
  5873. */
  5874. FZ_FUNCTION void fz_write_data(const void *data, size_t size) const;
  5875. /** Class-aware wrapper for `::fz_write_float_be()`. */
  5876. FZ_FUNCTION void fz_write_float_be(float f) const;
  5877. /** Class-aware wrapper for `::fz_write_float_le()`. */
  5878. FZ_FUNCTION void fz_write_float_le(float f) const;
  5879. /** Class-aware wrapper for `::fz_write_image_as_data_uri()`. */
  5880. /**
  5881. Write image as a data URI (for HTML and SVG output).
  5882. */
  5883. FZ_FUNCTION void fz_write_image_as_data_uri(const FzImage& image) const;
  5884. /** Class-aware wrapper for `::fz_write_int16_be()`. */
  5885. FZ_FUNCTION void fz_write_int16_be(int x) const;
  5886. /** Class-aware wrapper for `::fz_write_int16_le()`. */
  5887. FZ_FUNCTION void fz_write_int16_le(int x) const;
  5888. /** Class-aware wrapper for `::fz_write_int32_be()`. */
  5889. /**
  5890. Write different sized data to an output stream.
  5891. */
  5892. FZ_FUNCTION void fz_write_int32_be(int x) const;
  5893. /** Class-aware wrapper for `::fz_write_int32_le()`. */
  5894. FZ_FUNCTION void fz_write_int32_le(int x) const;
  5895. /** Class-aware wrapper for `::fz_write_json()`. */
  5896. FZ_FUNCTION void fz_write_json(const FzJson& value) const;
  5897. /** Class-aware wrapper for `::fz_write_pixmap_as_data_uri()`. */
  5898. FZ_FUNCTION void fz_write_pixmap_as_data_uri(const FzPixmap& pixmap) const;
  5899. /** Class-aware wrapper for `::fz_write_pixmap_as_jpeg()`. */
  5900. /**
  5901. Write a pixmap as a JPEG.
  5902. */
  5903. FZ_FUNCTION void fz_write_pixmap_as_jpeg(const FzPixmap& pix, int quality, int invert_cmyk) const;
  5904. /** Class-aware wrapper for `::fz_write_pixmap_as_jpx()`. */
  5905. /**
  5906. Pixmap data as JP2K with no subsampling.
  5907. quality = 100 = lossless
  5908. otherwise for a factor of x compression use 100-x. (so 80 is 1:20 compression)
  5909. */
  5910. FZ_FUNCTION void fz_write_pixmap_as_jpx(const FzPixmap& pix, int quality) const;
  5911. /** Class-aware wrapper for `::fz_write_pixmap_as_pam()`. */
  5912. /**
  5913. Write a pixmap as a pnm (greyscale, rgb or cmyk, with or without
  5914. alpha).
  5915. */
  5916. FZ_FUNCTION void fz_write_pixmap_as_pam(const FzPixmap& pixmap) const;
  5917. /** Class-aware wrapper for `::fz_write_pixmap_as_pcl()`. */
  5918. /**
  5919. Write an (RGB) pixmap as color PCL.
  5920. */
  5921. FZ_FUNCTION void fz_write_pixmap_as_pcl(const FzPixmap& pixmap, const FzPclOptions& pcl) const;
  5922. /** Class-aware wrapper for `::fz_write_pixmap_as_pclm()`. */
  5923. /**
  5924. Write a (Greyscale or RGB) pixmap as pclm.
  5925. */
  5926. FZ_FUNCTION void fz_write_pixmap_as_pclm(const FzPixmap& pixmap, const FzPclmOptions& options) const;
  5927. /** Class-aware wrapper for `::fz_write_pixmap_as_pdfocr()`. */
  5928. /**
  5929. Write a (Greyscale or RGB) pixmap as pdfocr.
  5930. */
  5931. FZ_FUNCTION void fz_write_pixmap_as_pdfocr(const FzPixmap& pixmap, FzPdfocrOptions& options) const;
  5932. /** Class-aware wrapper for `::fz_write_pixmap_as_png()`. */
  5933. /**
  5934. Write a (Greyscale or RGB) pixmap as a png.
  5935. */
  5936. FZ_FUNCTION void fz_write_pixmap_as_png(const FzPixmap& pixmap) const;
  5937. /** Class-aware wrapper for `::fz_write_pixmap_as_pnm()`. */
  5938. /**
  5939. Write a pixmap as a pnm (greyscale or rgb, no alpha).
  5940. */
  5941. FZ_FUNCTION void fz_write_pixmap_as_pnm(const FzPixmap& pixmap) const;
  5942. /** Class-aware wrapper for `::fz_write_pixmap_as_ps()`. */
  5943. /**
  5944. Write a (gray, rgb, or cmyk, no alpha) pixmap out as postscript.
  5945. */
  5946. FZ_FUNCTION void fz_write_pixmap_as_ps(const FzPixmap& pixmap) const;
  5947. /** Class-aware wrapper for `::fz_write_pixmap_as_psd()`. */
  5948. /**
  5949. Write a pixmap as a PSD file.
  5950. */
  5951. FZ_FUNCTION void fz_write_pixmap_as_psd(const FzPixmap& pixmap) const;
  5952. /** Class-aware wrapper for `::fz_write_pixmap_as_pwg()`. */
  5953. /**
  5954. Write a pixmap as a PWG.
  5955. */
  5956. FZ_FUNCTION void fz_write_pixmap_as_pwg(const FzPixmap& pixmap, FzPwgOptions& pwg) const;
  5957. /** Class-aware wrapper for `::fz_write_pixmap_as_pwg_page()`. */
  5958. /**
  5959. Write a pixmap as a PWG page.
  5960. Caller should provide a file header by calling
  5961. fz_write_pwg_file_header, but can then write several pages to
  5962. the same file.
  5963. */
  5964. FZ_FUNCTION void fz_write_pixmap_as_pwg_page(const FzPixmap& pixmap, FzPwgOptions& pwg) const;
  5965. /** Class-aware wrapper for `::fz_write_ps_file_header()`. */
  5966. /**
  5967. Write the file level header for ps band writer output.
  5968. */
  5969. FZ_FUNCTION void fz_write_ps_file_header() const;
  5970. /** Class-aware wrapper for `::fz_write_ps_file_trailer()`. */
  5971. /**
  5972. Write the file level trailer for ps band writer output.
  5973. */
  5974. FZ_FUNCTION void fz_write_ps_file_trailer(int pages) const;
  5975. /** Class-aware wrapper for `::fz_write_pwg_file_header()`. */
  5976. /**
  5977. Output the file header to a pwg stream, ready for pages to follow it.
  5978. */
  5979. FZ_FUNCTION void fz_write_pwg_file_header() const;
  5980. /** Class-aware wrapper for `::fz_write_rune()`. */
  5981. /**
  5982. Write a UTF-8 encoded unicode character.
  5983. */
  5984. FZ_FUNCTION void fz_write_rune(int rune) const;
  5985. /** Class-aware wrapper for `::fz_write_stream()`. */
  5986. /**
  5987. Copy the stream contents to the output.
  5988. */
  5989. FZ_FUNCTION void fz_write_stream(const FzStream& in) const;
  5990. /** Class-aware wrapper for `::fz_write_string()`. */
  5991. /**
  5992. Write a string. Does not write zero terminator.
  5993. */
  5994. FZ_FUNCTION void fz_write_string(const char *s) const;
  5995. /** Class-aware wrapper for `::fz_write_uint16_be()`. */
  5996. FZ_FUNCTION void fz_write_uint16_be(unsigned int x) const;
  5997. /** Class-aware wrapper for `::fz_write_uint16_le()`. */
  5998. FZ_FUNCTION void fz_write_uint16_le(unsigned int x) const;
  5999. /** Class-aware wrapper for `::fz_write_uint32_be()`. */
  6000. FZ_FUNCTION void fz_write_uint32_be(unsigned int x) const;
  6001. /** Class-aware wrapper for `::fz_write_uint32_le()`. */
  6002. FZ_FUNCTION void fz_write_uint32_le(unsigned int x) const;
  6003. /** Class-aware wrapper for `::fz_write_vprintf()`. */
  6004. /**
  6005. va_list version of fz_write_printf.
  6006. */
  6007. FZ_FUNCTION void fz_write_vprintf(const char *fmt, va_list ap) const;
  6008. /** Class-aware wrapper for `::pdf_new_output_processor()`. */
  6009. FZ_FUNCTION PdfProcessor pdf_new_output_processor(int ahxencode, int newlines) const;
  6010. /** Class-aware wrapper for `::pdf_print_crypt()`. */
  6011. FZ_FUNCTION void pdf_print_crypt(const PdfCrypt& crypt) const;
  6012. /** Class-aware wrapper for `::pdf_print_encrypted_obj()`.
  6013. This method has out-params. Python/C# wrappers look like:
  6014. `pdf_print_encrypted_obj(::pdf_obj *obj, int tight, int ascii, ::pdf_crypt *crypt, int num, int gen)` => int sep
  6015. */
  6016. FZ_FUNCTION void pdf_print_encrypted_obj(const PdfObj& obj, int tight, int ascii, const PdfCrypt& crypt, int num, int gen, int *sep) const;
  6017. /** Class-aware wrapper for `::pdf_print_font()`. */
  6018. FZ_FUNCTION void pdf_print_font(const PdfFontDesc& fontdesc) const;
  6019. /** Class-aware wrapper for `::pdf_print_obj()`. */
  6020. FZ_FUNCTION void pdf_print_obj(const PdfObj& obj, int tight, int ascii) const;
  6021. /** Class-aware wrapper for `::pdf_write_digest()`. */
  6022. FZ_FUNCTION void pdf_write_digest(const PdfObj& byte_range, const PdfObj& field, size_t digest_offset, size_t digest_length, const PdfPkcs7Signer& signer) const;
  6023. /** Constructor using raw copy of pre-existing `::fz_output`. */
  6024. FZ_FUNCTION FzOutput(::fz_output* internal=NULL);
  6025. /** Destructor using fz_drop_output(). */
  6026. FZ_FUNCTION ~FzOutput();
  6027. /** Return numerical value of .m_internal; helps with Python debugging. */
  6028. FZ_FUNCTION long long m_internal_value();
  6029. /** Return true iff `m_internal` is not null. */
  6030. FZ_FUNCTION operator bool();
  6031. /* == Member data. */
  6032. /** Pointer to wrapped data. */
  6033. ::fz_output* m_internal;
  6034. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6035. generate code regardless so we always need to have this available. */
  6036. FZ_DATA static int s_num_instances;
  6037. private:
  6038. /** This class is not copyable or assignable. */
  6039. FzOutput(const FzOutput& rhs);
  6040. FzOutput& operator=(const FzOutput& rhs);
  6041. };
  6042. /** Wrapper class for struct fz_output with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  6043. struct FzOutput2 : FzOutput
  6044. {
  6045. /** == Constructor. */
  6046. FZ_FUNCTION FzOutput2();
  6047. /** == Destructor. */
  6048. FZ_FUNCTION virtual ~FzOutput2();
  6049. /** These methods set the function pointers in *m_internal
  6050. to point to internal callbacks that call our virtual methods. */
  6051. FZ_FUNCTION void use_virtual_write( bool use=true);
  6052. FZ_FUNCTION void use_virtual_seek( bool use=true);
  6053. FZ_FUNCTION void use_virtual_tell( bool use=true);
  6054. FZ_FUNCTION void use_virtual_close( bool use=true);
  6055. FZ_FUNCTION void use_virtual_drop( bool use=true);
  6056. FZ_FUNCTION void use_virtual_reset( bool use=true);
  6057. FZ_FUNCTION void use_virtual_as_stream( bool use=true);
  6058. FZ_FUNCTION void use_virtual_truncate( bool use=true);
  6059. /** Default virtual method implementations; these all throw an exception. */
  6060. FZ_FUNCTION virtual void write(::fz_context *arg_0, const void *arg_2, unsigned long long arg_3);
  6061. FZ_FUNCTION virtual void seek(::fz_context *arg_0, long long arg_2, int arg_3);
  6062. FZ_FUNCTION virtual long long tell(::fz_context *arg_0);
  6063. FZ_FUNCTION virtual void close(::fz_context *arg_0);
  6064. FZ_FUNCTION virtual void drop(::fz_context *arg_0);
  6065. FZ_FUNCTION virtual void reset(::fz_context *arg_0);
  6066. FZ_FUNCTION virtual ::fz_stream * as_stream(::fz_context *arg_0);
  6067. FZ_FUNCTION virtual void truncate(::fz_context *arg_0);
  6068. };
  6069. /** Wrapper class for struct `fz_overprint`. Not copyable or assignable. */
  6070. /**
  6071. Pixmaps represent a set of pixels for a 2 dimensional region of
  6072. a plane. Each pixel has n components per pixel. The components
  6073. are in the order process-components, spot-colors, alpha, where
  6074. there can be 0 of any of those types. The data is in
  6075. premultiplied alpha when rendering, but non-premultiplied for
  6076. colorspace conversions and rescaling.
  6077. */
  6078. struct FzOverprint
  6079. {
  6080. /** Default constructor, sets `m_internal` to null. */
  6081. FZ_FUNCTION FzOverprint();
  6082. /** Constructor using raw copy of pre-existing `::fz_overprint`. */
  6083. FZ_FUNCTION FzOverprint(::fz_overprint* internal);
  6084. #ifndef NDEBUG
  6085. /** Destructor only decrements s_num_instances. */
  6086. FZ_FUNCTION ~FzOverprint();
  6087. #else
  6088. /** We use default destructor. */
  6089. #endif
  6090. /** Return numerical value of .m_internal; helps with Python debugging. */
  6091. FZ_FUNCTION long long m_internal_value();
  6092. /** Return true iff `m_internal` is not null. */
  6093. FZ_FUNCTION operator bool();
  6094. /* == Member data. */
  6095. /** Pointer to wrapped data. */
  6096. ::fz_overprint* m_internal;
  6097. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6098. generate code regardless so we always need to have this available. */
  6099. FZ_DATA static int s_num_instances;
  6100. private:
  6101. /** This class is not copyable or assignable. */
  6102. FzOverprint(const FzOverprint& rhs);
  6103. FzOverprint& operator=(const FzOverprint& rhs);
  6104. };
  6105. /** Wrapper class for struct `fz_page`. */
  6106. struct FzPage
  6107. {
  6108. /** == Constructors. */
  6109. /** Constructor using `fz_load_chapter_page()`. */
  6110. /**
  6111. Load a page.
  6112. After fz_load_page is it possible to retrieve the size of the
  6113. page using fz_bound_page, or to render the page using
  6114. fz_run_page_*. Free the page by calling fz_drop_page.
  6115. chapter: chapter number, 0 is the first chapter of the document.
  6116. number: page number, 0 is the first page of the chapter.
  6117. */
  6118. FZ_FUNCTION FzPage(const FzDocument& doc, int chapter, int page);
  6119. /** Constructor using `fz_load_page()`. */
  6120. /**
  6121. Load a given page number from a document. This may be much less
  6122. efficient than loading by location (chapter+page) for some
  6123. document types.
  6124. */
  6125. FZ_FUNCTION FzPage(const FzDocument& doc, int number);
  6126. /** Constructor using `fz_new_page_of_size()`. */
  6127. /**
  6128. Different document types will be implemented by deriving from
  6129. fz_page. This macro allocates such derived structures, and
  6130. initialises the base sections.
  6131. */
  6132. FZ_FUNCTION FzPage(int size, const FzDocument& doc);
  6133. /** Return FzPage for pdfpage.m_internal.super. */
  6134. FZ_FUNCTION FzPage(PdfPage& pdfpage);
  6135. /** Copy constructor using `fz_keep_page()`. */
  6136. FZ_FUNCTION FzPage(const FzPage& rhs);
  6137. /** operator= using `fz_keep_page()` and `fz_drop_page()`. */
  6138. FZ_FUNCTION FzPage& operator=(const FzPage& rhs);
  6139. /** Default constructor, sets `m_internal` to null. */
  6140. FZ_FUNCTION FzPage();
  6141. /* == Methods. */
  6142. /** Class-aware wrapper for `::fz_bound_page()`. */
  6143. /**
  6144. Determine the size of a page at 72 dpi.
  6145. */
  6146. FZ_FUNCTION FzRect fz_bound_page() const;
  6147. /** Class-aware wrapper for `::fz_bound_page_box()`. */
  6148. FZ_FUNCTION FzRect fz_bound_page_box(::fz_box_type box) const;
  6149. /** Class-aware wrapper for `::fz_create_link()`. */
  6150. /**
  6151. Create a new link on a page.
  6152. */
  6153. FZ_FUNCTION FzLink fz_create_link(const FzRect& bbox, const char *uri) const;
  6154. /** Class-aware wrapper for `::fz_delete_link()`. */
  6155. /**
  6156. Delete an existing link on a page.
  6157. */
  6158. FZ_FUNCTION void fz_delete_link(const FzLink& link) const;
  6159. /** Class-aware wrapper for `::fz_load_links()`. */
  6160. /**
  6161. Load the list of links for a page.
  6162. Returns a linked list of all the links on the page, each with
  6163. its clickable region and link destination. Each link is
  6164. reference counted so drop and free the list of links by
  6165. calling fz_drop_link on the pointer return from fz_load_links.
  6166. page: Page obtained from fz_load_page.
  6167. */
  6168. FZ_FUNCTION FzLink fz_load_links() const;
  6169. /** Class-aware wrapper for `::fz_new_buffer_from_page()`. */
  6170. FZ_FUNCTION FzBuffer fz_new_buffer_from_page(FzStextOptions& options) const;
  6171. /** Class-aware wrapper for `::fz_new_buffer_from_page_with_format()`. */
  6172. /**
  6173. Returns an fz_buffer containing a page after conversion to specified format.
  6174. page: The page to convert.
  6175. format, options: Passed to fz_new_document_writer_with_output() internally.
  6176. transform, cookie: Passed to fz_run_page() internally.
  6177. */
  6178. FZ_FUNCTION FzBuffer fz_new_buffer_from_page_with_format(const char *format, const char *options, const FzMatrix& transform, FzCookie& cookie) const;
  6179. /** Class-aware wrapper for `::fz_new_display_list_from_page()`. */
  6180. /**
  6181. Create a display list.
  6182. Ownership of the display list is returned to the caller.
  6183. */
  6184. FZ_FUNCTION FzDisplayList fz_new_display_list_from_page() const;
  6185. /** Class-aware wrapper for `::fz_new_display_list_from_page_contents()`. */
  6186. /**
  6187. Create a display list from page contents (no annotations).
  6188. Ownership of the display list is returned to the caller.
  6189. */
  6190. FZ_FUNCTION FzDisplayList fz_new_display_list_from_page_contents() const;
  6191. /** Class-aware wrapper for `::fz_new_pixmap_from_page()`. */
  6192. FZ_FUNCTION FzPixmap fz_new_pixmap_from_page(const FzMatrix& ctm, const FzColorspace& cs, int alpha) const;
  6193. /** Class-aware wrapper for `::fz_new_pixmap_from_page_contents()`. */
  6194. /**
  6195. Render the page contents without annotations.
  6196. Ownership of the pixmap is returned to the caller.
  6197. */
  6198. FZ_FUNCTION FzPixmap fz_new_pixmap_from_page_contents(const FzMatrix& ctm, const FzColorspace& cs, int alpha) const;
  6199. /** Class-aware wrapper for `::fz_new_pixmap_from_page_contents_with_separations()`. */
  6200. FZ_FUNCTION FzPixmap fz_new_pixmap_from_page_contents_with_separations(const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha) const;
  6201. /** Class-aware wrapper for `::fz_new_pixmap_from_page_with_separations()`. */
  6202. FZ_FUNCTION FzPixmap fz_new_pixmap_from_page_with_separations(const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha) const;
  6203. /** Class-aware wrapper for `::fz_page_label()`. */
  6204. /**
  6205. Get page label for a given page.
  6206. */
  6207. FZ_FUNCTION const char *fz_page_label(char *buf, int size) const;
  6208. /** Class-aware wrapper for `::fz_page_presentation()`.
  6209. This method has out-params. Python/C# wrappers look like:
  6210. `fz_page_presentation(::fz_transition *transition)` => `(fz_transition *, float duration)`
  6211. */
  6212. /**
  6213. Get the presentation details for a given page.
  6214. transition: A pointer to a transition struct to fill out.
  6215. duration: A pointer to a place to set the page duration in
  6216. seconds. Will be set to 0 if no transition is specified for the
  6217. page.
  6218. Returns: a pointer to the transition structure, or NULL if there
  6219. is no transition specified for the page.
  6220. */
  6221. FZ_FUNCTION FzTransition fz_page_presentation(FzTransition& transition, float *duration) const;
  6222. /** Class-aware wrapper for `::fz_page_separations()`. */
  6223. /**
  6224. Get the separations details for a page.
  6225. This will be NULL, unless the format specifically supports
  6226. separations (such as PDF files). May be NULL even
  6227. so, if there are no separations on a page.
  6228. Returns a reference that must be dropped.
  6229. */
  6230. FZ_FUNCTION FzSeparations fz_page_separations() const;
  6231. /** Class-aware wrapper for `::fz_page_uses_overprint()`. */
  6232. /**
  6233. Query if a given page requires overprint.
  6234. */
  6235. FZ_FUNCTION int fz_page_uses_overprint() const;
  6236. /** Class-aware wrapper for `::fz_run_page()`. */
  6237. /**
  6238. Run a page through a device.
  6239. page: Page obtained from fz_load_page.
  6240. dev: Device obtained from fz_new_*_device.
  6241. transform: Transform to apply to page. May include for example
  6242. scaling and rotation, see fz_scale, fz_rotate and fz_concat.
  6243. Set to fz_identity if no transformation is desired.
  6244. cookie: Communication mechanism between caller and library
  6245. rendering the page. Intended for multi-threaded applications,
  6246. while single-threaded applications set cookie to NULL. The
  6247. caller may abort an ongoing rendering of a page. Cookie also
  6248. communicates progress information back to the caller. The
  6249. fields inside cookie are continually updated while the page is
  6250. rendering.
  6251. */
  6252. FZ_FUNCTION void fz_run_page(const FzDevice& dev, const FzMatrix& transform, FzCookie& cookie) const;
  6253. /** Class-aware wrapper for `::fz_run_page_annots()`. */
  6254. /**
  6255. Run the annotations on a page through a device.
  6256. */
  6257. FZ_FUNCTION void fz_run_page_annots(const FzDevice& dev, const FzMatrix& transform, FzCookie& cookie) const;
  6258. /** Class-aware wrapper for `::fz_run_page_contents()`. */
  6259. /**
  6260. Run a page through a device. Just the main
  6261. page content, without the annotations, if any.
  6262. page: Page obtained from fz_load_page.
  6263. dev: Device obtained from fz_new_*_device.
  6264. transform: Transform to apply to page. May include for example
  6265. scaling and rotation, see fz_scale, fz_rotate and fz_concat.
  6266. Set to fz_identity if no transformation is desired.
  6267. cookie: Communication mechanism between caller and library
  6268. rendering the page. Intended for multi-threaded applications,
  6269. while single-threaded applications set cookie to NULL. The
  6270. caller may abort an ongoing rendering of a page. Cookie also
  6271. communicates progress information back to the caller. The
  6272. fields inside cookie are continually updated while the page is
  6273. rendering.
  6274. */
  6275. FZ_FUNCTION void fz_run_page_contents(const FzDevice& dev, const FzMatrix& transform, FzCookie& cookie) const;
  6276. /** Class-aware wrapper for `::fz_run_page_widgets()`. */
  6277. /**
  6278. Run the widgets on a page through a device.
  6279. */
  6280. FZ_FUNCTION void fz_run_page_widgets(const FzDevice& dev, const FzMatrix& transform, FzCookie& cookie) const;
  6281. /** Class-aware wrapper for `::fz_search_page()`.
  6282. This method has out-params. Python/C# wrappers look like:
  6283. `fz_search_page(const char *needle, ::fz_quad *hit_bbox, int hit_max)` => `(int, int hit_mark)`
  6284. */
  6285. /**
  6286. Search for the 'needle' text on the page.
  6287. Record the hits in the hit_bbox array and return the number of
  6288. hits. Will stop looking once it has filled hit_max rectangles.
  6289. */
  6290. FZ_FUNCTION int fz_search_page(const char *needle, int *hit_mark, FzQuad& hit_bbox, int hit_max) const;
  6291. /** Class-aware wrapper for `::fz_search_page_cb()`. */
  6292. /**
  6293. Search for the 'needle' text on the page.
  6294. */
  6295. FZ_FUNCTION int fz_search_page_cb(const char *needle, ::fz_search_callback_fn *cb, void *opaque) const;
  6296. /** Class-aware wrapper for `::pdf_page_from_fz_page()`. */
  6297. FZ_FUNCTION PdfPage pdf_page_from_fz_page() const;
  6298. /** Returns wrapper for .doc member. */
  6299. FZ_FUNCTION FzDocument doc();
  6300. /** Constructor using raw copy of pre-existing `::fz_page`. */
  6301. /* This constructor is marked as `explicit` because wrapper classes do not
  6302. call `keep`in constructors, but do call `drop` in destructors. So
  6303. automatic construction from a fz_page* will generally cause an
  6304. unbalanced `drop` resulting in errors such as SEGV. */
  6305. FZ_FUNCTION explicit FzPage(::fz_page* internal);
  6306. /** Destructor using fz_drop_page(). */
  6307. FZ_FUNCTION ~FzPage();
  6308. /** Return numerical value of .m_internal; helps with Python debugging. */
  6309. FZ_FUNCTION long long m_internal_value();
  6310. /** Return true iff `m_internal` is not null. */
  6311. FZ_FUNCTION operator bool();
  6312. /* == Member data. */
  6313. /** Pointer to wrapped data. */
  6314. ::fz_page* m_internal;
  6315. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6316. generate code regardless so we always need to have this available. */
  6317. FZ_DATA static int s_num_instances;
  6318. };
  6319. /** Wrapper class for struct `fz_path`. */
  6320. /**
  6321. * Vector path buffer.
  6322. * It can be stroked and dashed, or be filled.
  6323. * It has a fill rule (nonzero or even_odd).
  6324. *
  6325. * When rendering, they are flattened, stroked and dashed straight
  6326. * into the Global Edge List.
  6327. */
  6328. struct FzPath
  6329. {
  6330. /** == Constructors. */
  6331. /** Constructor using `fz_new_path()`. */
  6332. /**
  6333. Create a new (empty) path structure.
  6334. */
  6335. FZ_FUNCTION FzPath();
  6336. /** Copy constructor using `fz_keep_path()`. */
  6337. FZ_FUNCTION FzPath(const FzPath& rhs);
  6338. /** operator= using `fz_keep_path()` and `fz_drop_path()`. */
  6339. FZ_FUNCTION FzPath& operator=(const FzPath& rhs);
  6340. /* == Methods. */
  6341. /** Class-aware wrapper for `::fz_bound_path()`. */
  6342. /**
  6343. Return a bounding rectangle for a path.
  6344. path: The path to bound.
  6345. stroke: If NULL, the bounding rectangle given is for
  6346. the filled path. If non-NULL the bounding rectangle
  6347. given is for the path stroked with the given attributes.
  6348. ctm: The matrix to apply to the path during stroking.
  6349. r: Pointer to a fz_rect which will be used to hold
  6350. the result.
  6351. Returns r, updated to contain the bounding rectangle.
  6352. */
  6353. FZ_FUNCTION FzRect fz_bound_path(const FzStrokeState& stroke, const FzMatrix& ctm) const;
  6354. /** Class-aware wrapper for `::fz_clone_path()`. */
  6355. /**
  6356. Clone the data for a path.
  6357. This is used in preference to fz_keep_path when a whole
  6358. new copy of a path is required, rather than just a shared
  6359. pointer. This probably indicates that the path is about to
  6360. be modified.
  6361. path: path to clone.
  6362. Throws exceptions on failure to allocate.
  6363. */
  6364. FZ_FUNCTION FzPath fz_clone_path() const;
  6365. /** Class-aware wrapper for `::fz_closepath()`. */
  6366. /**
  6367. Close the current subpath.
  6368. path: The path to modify.
  6369. Throws exceptions on failure to allocate, attempting to modify
  6370. a packed path, and illegal path closes (i.e. closing a non open
  6371. path).
  6372. */
  6373. FZ_FUNCTION void fz_closepath() const;
  6374. /** Class-aware wrapper for `::fz_currentpoint()`. */
  6375. /**
  6376. Return the current point that a path has
  6377. reached or (0,0) if empty.
  6378. path: path to return the current point of.
  6379. */
  6380. FZ_FUNCTION FzPoint fz_currentpoint() const;
  6381. /** Class-aware wrapper for `::fz_curveto()`. */
  6382. /**
  6383. Append a 'curveto' command to an open path. (For a
  6384. cubic bezier).
  6385. path: The path to modify.
  6386. x0, y0: The coordinates of the first control point for the
  6387. curve.
  6388. x1, y1: The coordinates of the second control point for the
  6389. curve.
  6390. x2, y2: The end coordinates for the curve.
  6391. Throws exceptions on failure to allocate, or attempting to
  6392. modify a packed path.
  6393. */
  6394. FZ_FUNCTION void fz_curveto(float x0, float y0, float x1, float y1, float x2, float y2) const;
  6395. /** Class-aware wrapper for `::fz_curvetov()`. */
  6396. /**
  6397. Append a 'curvetov' command to an open path. (For a
  6398. cubic bezier with the first control coordinate equal to
  6399. the start point).
  6400. path: The path to modify.
  6401. x1, y1: The coordinates of the second control point for the
  6402. curve.
  6403. x2, y2: The end coordinates for the curve.
  6404. Throws exceptions on failure to allocate, or attempting to
  6405. modify a packed path.
  6406. */
  6407. FZ_FUNCTION void fz_curvetov(float x1, float y1, float x2, float y2) const;
  6408. /** Class-aware wrapper for `::fz_curvetoy()`. */
  6409. /**
  6410. Append a 'curvetoy' command to an open path. (For a
  6411. cubic bezier with the second control coordinate equal to
  6412. the end point).
  6413. path: The path to modify.
  6414. x0, y0: The coordinates of the first control point for the
  6415. curve.
  6416. x2, y2: The end coordinates for the curve (and the second
  6417. control coordinate).
  6418. Throws exceptions on failure to allocate, or attempting to
  6419. modify a packed path.
  6420. */
  6421. FZ_FUNCTION void fz_curvetoy(float x0, float y0, float x2, float y2) const;
  6422. /** Class-aware wrapper for `::fz_lineto()`. */
  6423. /**
  6424. Append a 'lineto' command to an open path.
  6425. path: The path to modify.
  6426. x, y: The coordinate to line to.
  6427. Throws exceptions on failure to allocate, or attempting to
  6428. modify a packed path.
  6429. */
  6430. FZ_FUNCTION void fz_lineto(float x, float y) const;
  6431. /** Class-aware wrapper for `::fz_moveto()`. */
  6432. /**
  6433. Append a 'moveto' command to a path.
  6434. This 'opens' a path.
  6435. path: The path to modify.
  6436. x, y: The coordinate to move to.
  6437. Throws exceptions on failure to allocate, or attempting to
  6438. modify a packed path.
  6439. */
  6440. FZ_FUNCTION void fz_moveto(float x, float y) const;
  6441. /** Class-aware wrapper for `::fz_packed_path_size()`. */
  6442. /**
  6443. Return the number of bytes required to pack a path.
  6444. */
  6445. FZ_FUNCTION int fz_packed_path_size() const;
  6446. /** Class-aware wrapper for `::fz_path_is_rect()`. */
  6447. /**
  6448. Check whether a given path, under the given transform
  6449. is an axis-aligned rectangle.
  6450. We accept zero width or height rectangles, so
  6451. "move 100, 100; line 200, 100" would count as
  6452. a rectangle too.
  6453. */
  6454. FZ_FUNCTION int fz_path_is_rect(const FzMatrix& ctm) const;
  6455. /** Class-aware wrapper for `::fz_path_is_rect_with_bounds()`. */
  6456. /**
  6457. Check whether a given path, under the given transform
  6458. is an axis-aligned rectangle.
  6459. We accept zero width or height rectangles, so
  6460. "move 100, 100; line 200, 100" would count as
  6461. a rectangle too.
  6462. bounds = NULL, or place to return the rectangle
  6463. bounds if the path is a rectangle.
  6464. */
  6465. FZ_FUNCTION int fz_path_is_rect_with_bounds(const FzMatrix& ctm, FzRect& bounds) const;
  6466. /** Class-aware wrapper for `::fz_quadto()`. */
  6467. /**
  6468. Append a 'quadto' command to an open path. (For a
  6469. quadratic bezier).
  6470. path: The path to modify.
  6471. x0, y0: The control coordinates for the quadratic curve.
  6472. x1, y1: The end coordinates for the quadratic curve.
  6473. Throws exceptions on failure to allocate, or attempting to
  6474. modify a packed path.
  6475. */
  6476. FZ_FUNCTION void fz_quadto(float x0, float y0, float x1, float y1) const;
  6477. /** Class-aware wrapper for `::fz_rectto()`. */
  6478. /**
  6479. Append a 'rectto' command to an open path.
  6480. The rectangle is equivalent to:
  6481. moveto x0 y0
  6482. lineto x1 y0
  6483. lineto x1 y1
  6484. lineto x0 y1
  6485. closepath
  6486. path: The path to modify.
  6487. x0, y0: First corner of the rectangle.
  6488. x1, y1: Second corner of the rectangle.
  6489. Throws exceptions on failure to allocate, or attempting to
  6490. modify a packed path.
  6491. */
  6492. FZ_FUNCTION void fz_rectto(float x0, float y0, float x1, float y1) const;
  6493. /** Class-aware wrapper for `::fz_transform_path()`. */
  6494. /**
  6495. Transform a path by a given
  6496. matrix.
  6497. path: The path to modify (must not be a packed path).
  6498. transform: The transform to apply.
  6499. Throws exceptions if the path is packed, or on failure
  6500. to allocate.
  6501. */
  6502. FZ_FUNCTION void fz_transform_path(const FzMatrix& transform) const;
  6503. /** Class-aware wrapper for `::fz_trim_path()`. */
  6504. /**
  6505. Minimise the internal storage used by a path.
  6506. As paths are constructed, the internal buffers
  6507. grow. To avoid repeated reallocations they
  6508. grow with some spare space. Once a path has
  6509. been fully constructed, this call allows the
  6510. excess space to be trimmed.
  6511. */
  6512. FZ_FUNCTION void fz_trim_path() const;
  6513. /** Class-aware wrapper for `::fz_walk_path()`. */
  6514. /**
  6515. Walk the segments of a path, calling the
  6516. appropriate callback function from a given set for each
  6517. segment of the path.
  6518. path: The path to walk.
  6519. walker: The set of callback functions to use. The first
  6520. 4 callback pointers in the set must be non-NULL. The
  6521. subsequent ones can either be supplied, or can be left
  6522. as NULL, in which case the top 4 functions will be
  6523. called as appropriate to simulate them.
  6524. arg: An opaque argument passed in to each callback.
  6525. Exceptions will only be thrown if the underlying callback
  6526. functions throw them.
  6527. */
  6528. FZ_FUNCTION void fz_walk_path(const FzPathWalker& walker, void *arg) const;
  6529. /** Constructor using raw copy of pre-existing `::fz_path`. */
  6530. /* This constructor is marked as `explicit` because wrapper classes do not
  6531. call `keep`in constructors, but do call `drop` in destructors. So
  6532. automatic construction from a fz_path* will generally cause an
  6533. unbalanced `drop` resulting in errors such as SEGV. */
  6534. FZ_FUNCTION explicit FzPath(::fz_path* internal);
  6535. /** Destructor using fz_drop_path(). */
  6536. FZ_FUNCTION ~FzPath();
  6537. /** Return numerical value of .m_internal; helps with Python debugging. */
  6538. FZ_FUNCTION long long m_internal_value();
  6539. /** Return true iff `m_internal` is not null. */
  6540. FZ_FUNCTION operator bool();
  6541. /* == Member data. */
  6542. /** Pointer to wrapped data. */
  6543. ::fz_path* m_internal;
  6544. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6545. generate code regardless so we always need to have this available. */
  6546. FZ_DATA static int s_num_instances;
  6547. };
  6548. /** Wrapper class for struct `fz_path_walker`. Not copyable or assignable. */
  6549. struct FzPathWalker
  6550. {
  6551. /** Constructor using raw copy of pre-existing `::fz_path_walker`. */
  6552. FZ_FUNCTION FzPathWalker(::fz_path_walker* internal=NULL);
  6553. #ifndef NDEBUG
  6554. /** Destructor only decrements s_num_instances. */
  6555. FZ_FUNCTION ~FzPathWalker();
  6556. #else
  6557. /** We use default destructor. */
  6558. #endif
  6559. /** Return numerical value of .m_internal; helps with Python debugging. */
  6560. FZ_FUNCTION long long m_internal_value();
  6561. /** Return true iff `m_internal` is not null. */
  6562. FZ_FUNCTION operator bool();
  6563. /* == Member data. */
  6564. /** Pointer to wrapped data. */
  6565. ::fz_path_walker* m_internal;
  6566. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6567. generate code regardless so we always need to have this available. */
  6568. FZ_DATA static int s_num_instances;
  6569. private:
  6570. /** This class is not copyable or assignable. */
  6571. FzPathWalker(const FzPathWalker& rhs);
  6572. FzPathWalker& operator=(const FzPathWalker& rhs);
  6573. };
  6574. /** Wrapper class for struct fz_path_walker with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  6575. /*
  6576. We require that the `void* arg` passed to callbacks
  6577. is the original `fz_path_walker*`. So, for example,
  6578. class-aware wrapper mupdf::fz_walk_path() should be
  6579. called like:
  6580. mupdf.FzPath path = ...;
  6581. struct Walker : mupdf.FzPathWalker2 Ellipsis;
  6582. Walker walker(...);
  6583. mupdf::fz_walk_path(path, walker, walker.m_internal);
  6584. */
  6585. struct FzPathWalker2 : FzPathWalker
  6586. {
  6587. /** == Constructor. */
  6588. FZ_FUNCTION FzPathWalker2();
  6589. /** == Destructor. */
  6590. FZ_FUNCTION virtual ~FzPathWalker2();
  6591. /** These methods set the function pointers in *m_internal
  6592. to point to internal callbacks that call our virtual methods. */
  6593. FZ_FUNCTION void use_virtual_moveto( bool use=true);
  6594. FZ_FUNCTION void use_virtual_lineto( bool use=true);
  6595. FZ_FUNCTION void use_virtual_curveto( bool use=true);
  6596. FZ_FUNCTION void use_virtual_closepath( bool use=true);
  6597. FZ_FUNCTION void use_virtual_quadto( bool use=true);
  6598. FZ_FUNCTION void use_virtual_curvetov( bool use=true);
  6599. FZ_FUNCTION void use_virtual_curvetoy( bool use=true);
  6600. FZ_FUNCTION void use_virtual_rectto( bool use=true);
  6601. /** Default virtual method implementations; these all throw an exception. */
  6602. FZ_FUNCTION virtual void moveto(::fz_context *arg_0, float arg_2, float arg_3);
  6603. FZ_FUNCTION virtual void lineto(::fz_context *arg_0, float arg_2, float arg_3);
  6604. FZ_FUNCTION virtual void curveto(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5, float arg_6, float arg_7);
  6605. FZ_FUNCTION virtual void closepath(::fz_context *arg_0);
  6606. FZ_FUNCTION virtual void quadto(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  6607. FZ_FUNCTION virtual void curvetov(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  6608. FZ_FUNCTION virtual void curvetoy(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  6609. FZ_FUNCTION virtual void rectto(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  6610. };
  6611. /** Wrapper class for struct `fz_pcl_options`. Not copyable or assignable. */
  6612. /**
  6613. PCL output
  6614. */
  6615. struct FzPclOptions
  6616. {
  6617. /** == Constructors. */
  6618. /** Constructor using `fz_parse_pcl_options()`. */
  6619. /**
  6620. Parse PCL options.
  6621. Currently defined options and values are as follows:
  6622. preset=X Either "generic" or one of the presets as for fz_pcl_preset.
  6623. spacing=0 No vertical spacing capability
  6624. spacing=1 PCL 3 spacing (<ESC>*p+<n>Y)
  6625. spacing=2 PCL 4 spacing (<ESC>*b<n>Y)
  6626. spacing=3 PCL 5 spacing (<ESC>*b<n>Y and clear seed row)
  6627. mode2 Disable/Enable mode 2 graphics compression
  6628. mode3 Disable/Enable mode 3 graphics compression
  6629. eog_reset End of graphics (<ESC>*rB) resets all parameters
  6630. has_duplex Duplex supported (<ESC>&l<duplex>S)
  6631. has_papersize Papersize setting supported (<ESC>&l<sizecode>A)
  6632. has_copies Number of copies supported (<ESC>&l<copies>X)
  6633. is_ljet4pjl Disable/Enable HP 4PJL model-specific output
  6634. is_oce9050 Disable/Enable Oce 9050 model-specific output
  6635. */
  6636. FZ_FUNCTION FzPclOptions(const FzPclOptions& opts, const char *args);
  6637. /** Default constructor, sets `m_internal` to null. */
  6638. FZ_FUNCTION FzPclOptions();
  6639. /* == Methods. */
  6640. /** Class-aware wrapper for `::fz_pcl_preset()`. */
  6641. /**
  6642. Initialize PCL option struct for a given preset.
  6643. Currently defined presets include:
  6644. generic Generic PCL printer
  6645. ljet4 HP DeskJet
  6646. dj500 HP DeskJet 500
  6647. fs600 Kyocera FS-600
  6648. lj HP LaserJet, HP LaserJet Plus
  6649. lj2 HP LaserJet IIp, HP LaserJet IId
  6650. lj3 HP LaserJet III
  6651. lj3d HP LaserJet IIId
  6652. lj4 HP LaserJet 4
  6653. lj4pl HP LaserJet 4 PL
  6654. lj4d HP LaserJet 4d
  6655. lp2563b HP 2563B line printer
  6656. oce9050 Oce 9050 Line printer
  6657. */
  6658. FZ_FUNCTION void fz_pcl_preset(const char *preset) const;
  6659. /** Constructor using raw copy of pre-existing `::fz_pcl_options`. */
  6660. FZ_FUNCTION FzPclOptions(::fz_pcl_options* internal);
  6661. #ifndef NDEBUG
  6662. /** Destructor only decrements s_num_instances. */
  6663. FZ_FUNCTION ~FzPclOptions();
  6664. #else
  6665. /** We use default destructor. */
  6666. #endif
  6667. /** Return numerical value of .m_internal; helps with Python debugging. */
  6668. FZ_FUNCTION long long m_internal_value();
  6669. /** Return true iff `m_internal` is not null. */
  6670. FZ_FUNCTION operator bool();
  6671. /* == Member data. */
  6672. /** Pointer to wrapped data. */
  6673. ::fz_pcl_options* m_internal;
  6674. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6675. generate code regardless so we always need to have this available. */
  6676. FZ_DATA static int s_num_instances;
  6677. private:
  6678. /** This class is not copyable or assignable. */
  6679. FzPclOptions(const FzPclOptions& rhs);
  6680. FzPclOptions& operator=(const FzPclOptions& rhs);
  6681. };
  6682. /** Wrapper class for struct `fz_pclm_options`. Not copyable or assignable. */
  6683. /**
  6684. PCLm output
  6685. */
  6686. struct FzPclmOptions
  6687. {
  6688. /** == Constructors. */
  6689. /** Constructor using `fz_parse_pclm_options()`. */
  6690. /**
  6691. Parse PCLm options.
  6692. Currently defined options and values are as follows:
  6693. compression=none: No compression
  6694. compression=flate: Flate compression
  6695. strip-height=n: Strip height (default 16)
  6696. */
  6697. FZ_FUNCTION FzPclmOptions(const FzPclmOptions& opts, const char *args);
  6698. /** Construct using fz_parse_pclm_options(). */
  6699. FZ_FUNCTION FzPclmOptions(const char *args);
  6700. /** Default constructor, sets `m_internal` to null. */
  6701. FZ_FUNCTION FzPclmOptions();
  6702. /** Constructor using raw copy of pre-existing `::fz_pclm_options`. */
  6703. FZ_FUNCTION FzPclmOptions(::fz_pclm_options* internal);
  6704. #ifndef NDEBUG
  6705. /** Destructor only decrements s_num_instances. */
  6706. FZ_FUNCTION ~FzPclmOptions();
  6707. #else
  6708. /** We use default destructor. */
  6709. #endif
  6710. /** Return numerical value of .m_internal; helps with Python debugging. */
  6711. FZ_FUNCTION long long m_internal_value();
  6712. /** Return true iff `m_internal` is not null. */
  6713. FZ_FUNCTION operator bool();
  6714. /* == Member data. */
  6715. /** Pointer to wrapped data. */
  6716. ::fz_pclm_options* m_internal;
  6717. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6718. generate code regardless so we always need to have this available. */
  6719. FZ_DATA static int s_num_instances;
  6720. private:
  6721. /** This class is not copyable or assignable. */
  6722. FzPclmOptions(const FzPclmOptions& rhs);
  6723. FzPclmOptions& operator=(const FzPclmOptions& rhs);
  6724. };
  6725. /** Wrapper class for struct `fz_pdfocr_options`. */
  6726. /**
  6727. PDFOCR output
  6728. */
  6729. struct FzPdfocrOptions
  6730. {
  6731. /** We use default copy constructor and operator=. */
  6732. /** Default constructor, sets each member to default value. */
  6733. FZ_FUNCTION FzPdfocrOptions();
  6734. /* == Methods. */
  6735. /** Class-aware wrapper for `::fz_parse_pdfocr_options()`. */
  6736. /**
  6737. Parse PDFOCR options.
  6738. Currently defined options and values are as follows:
  6739. compression=none: No compression
  6740. compression=flate: Flate compression
  6741. strip-height=n: Strip height (default 16)
  6742. ocr-language=<lang>: OCR Language (default eng)
  6743. ocr-datadir=<datadir>: OCR data path (default rely on TESSDATA_PREFIX)
  6744. */
  6745. FZ_FUNCTION FzPdfocrOptions fz_parse_pdfocr_options(const char *args);
  6746. /** Copies <language> into this->language, truncating if necessary. */
  6747. FZ_FUNCTION void language_set2(const char* language);
  6748. /** Copies <datadir> into this->datadir, truncating if necessary. */
  6749. FZ_FUNCTION void datadir_set2(const char* datadir);
  6750. /** Constructor using raw copy of pre-existing `::fz_pdfocr_options`. */
  6751. FZ_FUNCTION FzPdfocrOptions(const ::fz_pdfocr_options* internal);
  6752. /** Constructor using raw copy of pre-existing `::fz_pdfocr_options`. */
  6753. FZ_FUNCTION FzPdfocrOptions(const ::fz_pdfocr_options internal);
  6754. /** Access as underlying struct. */
  6755. FZ_FUNCTION ::fz_pdfocr_options* internal();
  6756. /** Access as underlying struct. */
  6757. FZ_FUNCTION const ::fz_pdfocr_options* internal() const;
  6758. #ifndef NDEBUG
  6759. /** Destructor only decrements s_num_instances. */
  6760. FZ_FUNCTION ~FzPdfocrOptions();
  6761. #else
  6762. /** We use default destructor. */
  6763. #endif
  6764. /* == Member data. */
  6765. /* These members are the same as the members of ::fz_pdfocr_options. */
  6766. int compress;
  6767. int strip_height;
  6768. char language[256];
  6769. char datadir[1024];
  6770. int skew_correct;
  6771. float skew_angle;
  6772. int skew_border;
  6773. int page_count;
  6774. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  6775. generate code regardless so we always need to have this available. */
  6776. FZ_DATA static int s_num_instances;
  6777. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  6778. FZ_FUNCTION std::string to_string();
  6779. /** Comparison method. */
  6780. FZ_FUNCTION bool operator==(const FzPdfocrOptions& rhs);
  6781. /** Comparison method. */
  6782. FZ_FUNCTION bool operator!=(const FzPdfocrOptions& rhs);
  6783. };
  6784. /** Wrapper class for struct `fz_pixmap`. */
  6785. /**
  6786. Pixmaps represent a set of pixels for a 2 dimensional region of
  6787. a plane. Each pixel has n components per pixel. The components
  6788. are in the order process-components, spot-colors, alpha, where
  6789. there can be 0 of any of those types. The data is in
  6790. premultiplied alpha when rendering, but non-premultiplied for
  6791. colorspace conversions and rescaling.
  6792. */
  6793. struct FzPixmap
  6794. {
  6795. /** == Constructors. */
  6796. /** Constructor using `fz_new_barcode_pixmap()`. */
  6797. /**
  6798. Create an fz_pixmap from a barcode definition.
  6799. type: The type of barcode to create.
  6800. value: The value of the barcode.
  6801. size: The size of the barcode.
  6802. ec_level: error correction level 0-8.
  6803. quiet: whether to include quiet zones (0 or 1).
  6804. hrt: whether to include human readable text below the barcode (0 or 1).
  6805. returns a created fz_pixmap.
  6806. */
  6807. FZ_FUNCTION FzPixmap(::fz_barcode_type type, const char *value, int size, int ec_level, int quiet, int hrt);
  6808. /** Constructor using `fz_new_pixmap()`. */
  6809. /**
  6810. Create a new pixmap, with its origin at (0,0)
  6811. cs: The colorspace to use for the pixmap, or NULL for an alpha
  6812. plane/mask.
  6813. w: The width of the pixmap (in pixels)
  6814. h: The height of the pixmap (in pixels)
  6815. seps: Details of separations.
  6816. alpha: 0 for no alpha, 1 for alpha.
  6817. Returns a pointer to the new pixmap. Throws exception on failure
  6818. to allocate.
  6819. */
  6820. FZ_FUNCTION FzPixmap(const FzColorspace& cs, int w, int h, const FzSeparations& seps, int alpha);
  6821. /** Constructor using `fz_new_pixmap_from_color_and_mask()`. */
  6822. FZ_FUNCTION FzPixmap(const FzPixmap& color, const FzPixmap& mask);
  6823. /** Constructor using `fz_new_pixmap_from_display_list()`. */
  6824. /**
  6825. Render the page to a pixmap using the transform and colorspace.
  6826. Ownership of the pixmap is returned to the caller.
  6827. */
  6828. FZ_FUNCTION FzPixmap(const FzDisplayList& list, const FzMatrix& ctm, const FzColorspace& cs, int alpha);
  6829. /** Constructor using `fz_new_pixmap_from_display_list_with_separations()`. */
  6830. /**
  6831. Render the page contents with control over spot colors.
  6832. Ownership of the pixmap is returned to the caller.
  6833. */
  6834. FZ_FUNCTION FzPixmap(const FzDisplayList& list, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha);
  6835. /** Constructor using `fz_new_pixmap_from_page()`. */
  6836. FZ_FUNCTION FzPixmap(const FzPage& page, const FzMatrix& ctm, const FzColorspace& cs, int alpha);
  6837. /** Constructor using `fz_new_pixmap_from_page_number()`. */
  6838. FZ_FUNCTION FzPixmap(const FzDocument& doc, int number, const FzMatrix& ctm, const FzColorspace& cs, int alpha);
  6839. /** Constructor using `fz_new_pixmap_from_page_number_with_separations()`. */
  6840. FZ_FUNCTION FzPixmap(const FzDocument& doc, int number, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha);
  6841. /** Constructor using `fz_new_pixmap_from_page_with_separations()`. */
  6842. FZ_FUNCTION FzPixmap(const FzPage& page, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha);
  6843. /** Constructor using `fz_new_pixmap_from_pixmap()`. */
  6844. /**
  6845. Create a new pixmap that represents a subarea of the specified
  6846. pixmap. A reference is taken to this pixmap that will be dropped
  6847. on destruction.
  6848. The supplied rectangle must be wholly contained within the
  6849. original pixmap.
  6850. Returns a pointer to the new pixmap. Throws exception on failure
  6851. to allocate.
  6852. */
  6853. FZ_FUNCTION FzPixmap(const FzPixmap& pixmap, FzIrect& rect);
  6854. /** Constructor using `fz_new_pixmap_with_bbox()`. */
  6855. /**
  6856. Create a pixmap of a given size, location and pixel format.
  6857. The bounding box specifies the size of the created pixmap and
  6858. where it will be located. The colorspace determines the number
  6859. of components per pixel. Alpha is always present. Pixmaps are
  6860. reference counted, so drop references using fz_drop_pixmap.
  6861. colorspace: Colorspace format used for the created pixmap. The
  6862. pixmap will keep a reference to the colorspace.
  6863. bbox: Bounding box specifying location/size of created pixmap.
  6864. seps: Details of separations.
  6865. alpha: 0 for no alpha, 1 for alpha.
  6866. Returns a pointer to the new pixmap. Throws exception on failure
  6867. to allocate.
  6868. */
  6869. FZ_FUNCTION FzPixmap(const FzColorspace& colorspace, const FzIrect& bbox, const FzSeparations& seps, int alpha);
  6870. /** Constructor using `fz_new_pixmap_with_bbox_and_data()`. */
  6871. /**
  6872. Create a pixmap of a given size, location and pixel format,
  6873. using the supplied data block.
  6874. The bounding box specifies the size of the created pixmap and
  6875. where it will be located. The colorspace determines the number
  6876. of components per pixel. Alpha is always present. Pixmaps are
  6877. reference counted, so drop references using fz_drop_pixmap.
  6878. colorspace: Colorspace format used for the created pixmap. The
  6879. pixmap will keep a reference to the colorspace.
  6880. rect: Bounding box specifying location/size of created pixmap.
  6881. seps: Details of separations.
  6882. alpha: Number of alpha planes (0 or 1).
  6883. samples: The data block to keep the samples in.
  6884. Returns a pointer to the new pixmap. Throws exception on failure
  6885. to allocate.
  6886. */
  6887. FZ_FUNCTION FzPixmap(const FzColorspace& colorspace, const FzIrect& rect, const FzSeparations& seps, int alpha, unsigned char *samples);
  6888. /** Constructor using `fz_new_pixmap_with_data()`. */
  6889. /**
  6890. Create a new pixmap, with its origin at
  6891. (0,0) using the supplied data block.
  6892. cs: The colorspace to use for the pixmap, or NULL for an alpha
  6893. plane/mask.
  6894. w: The width of the pixmap (in pixels)
  6895. h: The height of the pixmap (in pixels)
  6896. seps: Details of separations.
  6897. alpha: 0 for no alpha, 1 for alpha.
  6898. stride: The byte offset from the pixel data in a row to the
  6899. pixel data in the next row.
  6900. samples: The data block to keep the samples in.
  6901. Returns a pointer to the new pixmap. Throws exception on failure to
  6902. allocate.
  6903. */
  6904. FZ_FUNCTION FzPixmap(const FzColorspace& colorspace, int w, int h, const FzSeparations& seps, int alpha, int stride, unsigned char *samples);
  6905. /** Constructor using `pdf_new_pixmap_from_annot()`. */
  6906. FZ_FUNCTION FzPixmap(const PdfAnnot& annot, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha);
  6907. /** Constructor using `pdf_new_pixmap_from_page_contents_with_separations_and_usage()`. */
  6908. FZ_FUNCTION FzPixmap(const PdfPage& page, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha, const char *usage, ::fz_box_type box);
  6909. /** Constructor using `pdf_new_pixmap_from_page_contents_with_usage()`. */
  6910. FZ_FUNCTION FzPixmap(const PdfPage& page, const FzMatrix& ctm, const FzColorspace& cs, int alpha, const char *usage, ::fz_box_type box);
  6911. /** Copy constructor using `fz_keep_pixmap()`. */
  6912. FZ_FUNCTION FzPixmap(const FzPixmap& rhs);
  6913. /** operator= using `fz_keep_pixmap()` and `fz_drop_pixmap()`. */
  6914. FZ_FUNCTION FzPixmap& operator=(const FzPixmap& rhs);
  6915. /** Default constructor, sets `m_internal` to null. */
  6916. FZ_FUNCTION FzPixmap();
  6917. /* == Static methods. */
  6918. /** Class-aware wrapper for `::pdf_new_pixmap_from_page_with_usage()`. */
  6919. FZ_FUNCTION static FzPixmap pdf_new_pixmap_from_page_with_usage(const PdfPage& page, const FzMatrix& ctm, const FzColorspace& cs, int alpha, const char *usage, ::fz_box_type box);
  6920. /** Class-aware wrapper for `::pdf_new_pixmap_from_page_with_separations_and_usage()`. */
  6921. FZ_FUNCTION static FzPixmap pdf_new_pixmap_from_page_with_separations_and_usage(const PdfPage& page, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha, const char *usage, ::fz_box_type box);
  6922. /** Class-aware wrapper for `::fz_new_pixmap_from_page_contents()`. */
  6923. /**
  6924. Render the page contents without annotations.
  6925. Ownership of the pixmap is returned to the caller.
  6926. */
  6927. FZ_FUNCTION static FzPixmap fz_new_pixmap_from_page_contents(const FzPage& page, const FzMatrix& ctm, const FzColorspace& cs, int alpha);
  6928. /** Class-aware wrapper for `::fz_new_pixmap_from_page_contents_with_separations()`. */
  6929. FZ_FUNCTION static FzPixmap fz_new_pixmap_from_page_contents_with_separations(const FzPage& page, const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha);
  6930. /* == Methods. */
  6931. /** Class-aware wrapper for `::fz_alpha_from_gray()`. */
  6932. FZ_FUNCTION FzPixmap fz_alpha_from_gray() const;
  6933. /** Class-aware wrapper for `::fz_autowarp_pixmap()`. */
  6934. FZ_FUNCTION FzPixmap fz_autowarp_pixmap(const FzQuad& points) const;
  6935. /** Class-aware wrapper for `::fz_clear_pixmap()`. */
  6936. /**
  6937. Sets all components (including alpha) of
  6938. all pixels in a pixmap to 0.
  6939. pix: The pixmap to clear.
  6940. */
  6941. FZ_FUNCTION void fz_clear_pixmap() const;
  6942. /** Class-aware wrapper for `::fz_clear_pixmap_rect_with_value()`. */
  6943. /**
  6944. Clears a subrect of a pixmap with the given value.
  6945. pix: The pixmap to clear.
  6946. value: Values in the range 0 to 255 are valid. Each component
  6947. sample for each pixel in the pixmap will be set to this value,
  6948. while alpha will always be set to 255 (non-transparent).
  6949. r: the rectangle.
  6950. */
  6951. FZ_FUNCTION void fz_clear_pixmap_rect_with_value(int value, const FzIrect& r) const;
  6952. /** Class-aware wrapper for `::fz_clear_pixmap_with_value()`. */
  6953. /**
  6954. Clears a pixmap with the given value.
  6955. pix: The pixmap to clear.
  6956. value: Values in the range 0 to 255 are valid. Each component
  6957. sample for each pixel in the pixmap will be set to this value,
  6958. while alpha will always be set to 255 (non-transparent).
  6959. This function is horrible, and should be removed from the
  6960. API and replaced with a less magic one.
  6961. */
  6962. FZ_FUNCTION void fz_clear_pixmap_with_value(int value) const;
  6963. /** Class-aware wrapper for `::fz_clone_pixmap()`. */
  6964. /**
  6965. Clone a pixmap, copying the pixels and associated data to new
  6966. storage.
  6967. The reference count of 'old' is unchanged.
  6968. */
  6969. FZ_FUNCTION FzPixmap fz_clone_pixmap() const;
  6970. /** Class-aware wrapper for `::fz_clone_pixmap_area_with_different_seps()`. */
  6971. FZ_FUNCTION FzPixmap fz_clone_pixmap_area_with_different_seps(FzIrect& bbox, const FzColorspace& dcs, const FzSeparations& seps, const FzColorParams& color_params, const FzDefaultColorspaces& default_cs) const;
  6972. /** Class-aware wrapper for `::fz_convert_indexed_pixmap_to_base()`. */
  6973. /**
  6974. Convert pixmap from indexed to base colorspace.
  6975. This creates a new bitmap containing the converted pixmap data.
  6976. */
  6977. FZ_FUNCTION FzPixmap fz_convert_indexed_pixmap_to_base() const;
  6978. /** Class-aware wrapper for `::fz_convert_pixmap()`. */
  6979. /**
  6980. Convert an existing pixmap to a desired
  6981. colorspace. Other properties of the pixmap, such as resolution
  6982. and position are copied to the converted pixmap.
  6983. pix: The pixmap to convert.
  6984. default_cs: If NULL pix->colorspace is used. It is possible that
  6985. the data may need to be interpreted as one of the color spaces
  6986. in default_cs.
  6987. cs_des: Desired colorspace, may be NULL to denote alpha-only.
  6988. prf: Proofing color space through which we need to convert.
  6989. color_params: Parameters that may be used in conversion (e.g.
  6990. ri).
  6991. keep_alpha: If 0 any alpha component is removed, otherwise
  6992. alpha is kept if present in the pixmap.
  6993. */
  6994. FZ_FUNCTION FzPixmap fz_convert_pixmap(const FzColorspace& cs_des, const FzColorspace& prf, const FzDefaultColorspaces& default_cs, const FzColorParams& color_params, int keep_alpha) const;
  6995. /** Class-aware wrapper for `::fz_convert_separation_pixmap_to_base()`. */
  6996. /**
  6997. Convert pixmap from DeviceN/Separation to base colorspace.
  6998. This creates a new bitmap containing the converted pixmap data.
  6999. */
  7000. FZ_FUNCTION FzPixmap fz_convert_separation_pixmap_to_base() const;
  7001. /** Class-aware wrapper for `::fz_copy_pixmap_rect()`. */
  7002. FZ_FUNCTION void fz_copy_pixmap_rect(const FzPixmap& src, const FzIrect& r, const FzDefaultColorspaces& default_cs) const;
  7003. /** Class-aware wrapper for `::fz_decode_tile()`. */
  7004. FZ_FUNCTION void fz_decode_tile(const float *decode) const;
  7005. /** Class-aware wrapper for `::fz_deskew_pixmap()`. */
  7006. FZ_FUNCTION FzPixmap fz_deskew_pixmap(double degrees, int border) const;
  7007. /** Class-aware wrapper for `::fz_detect_skew()`. */
  7008. FZ_FUNCTION double fz_detect_skew() const;
  7009. /** Class-aware wrapper for `::fz_fill_pixmap_with_color()`.
  7010. This method has out-params. Python/C# wrappers look like:
  7011. `fz_fill_pixmap_with_color(::fz_colorspace *colorspace, ::fz_color_params color_params)` => float color
  7012. */
  7013. /**
  7014. Fill pixmap with solid color.
  7015. */
  7016. FZ_FUNCTION void fz_fill_pixmap_with_color(const FzColorspace& colorspace, float *color, const FzColorParams& color_params) const;
  7017. /** Class-aware wrapper for `::fz_gamma_pixmap()`. */
  7018. /**
  7019. Apply gamma correction to a pixmap. All components
  7020. of all pixels are modified (except alpha, which is unchanged).
  7021. gamma: The gamma value to apply; 1.0 for no change.
  7022. */
  7023. FZ_FUNCTION void fz_gamma_pixmap(float gamma) const;
  7024. /** Class-aware wrapper for `::fz_generate_transition()`. */
  7025. /**
  7026. Generate a frame of a transition.
  7027. tpix: Target pixmap
  7028. opix: Old pixmap
  7029. npix: New pixmap
  7030. time: Position within the transition (0 to 256)
  7031. trans: Transition details
  7032. Returns 1 if successfully generated a frame.
  7033. Note: Pixmaps must include alpha.
  7034. */
  7035. FZ_FUNCTION int fz_generate_transition(const FzPixmap& opix, const FzPixmap& npix, int time, FzTransition& trans) const;
  7036. /** Class-aware wrapper for `::fz_invert_pixmap()`. */
  7037. /**
  7038. Invert all the pixels in a pixmap. All components (process and
  7039. spots) of all pixels are inverted (except alpha, which is
  7040. unchanged).
  7041. */
  7042. FZ_FUNCTION void fz_invert_pixmap() const;
  7043. /** Class-aware wrapper for `::fz_invert_pixmap_alpha()`. */
  7044. /**
  7045. Invert the alpha of all the pixels in a pixmap.
  7046. */
  7047. FZ_FUNCTION void fz_invert_pixmap_alpha() const;
  7048. /** Class-aware wrapper for `::fz_invert_pixmap_luminance()`. */
  7049. /**
  7050. Transform the pixels in a pixmap so that luminance of each
  7051. pixel is inverted, and the chrominance remains unchanged (as
  7052. much as accuracy allows).
  7053. All components of all pixels are inverted (except alpha, which
  7054. is unchanged). Only supports Grey and RGB bitmaps.
  7055. */
  7056. FZ_FUNCTION void fz_invert_pixmap_luminance() const;
  7057. /** Class-aware wrapper for `::fz_invert_pixmap_raw()`. */
  7058. /**
  7059. Invert all the pixels in a non-premultiplied pixmap in a
  7060. very naive manner.
  7061. */
  7062. FZ_FUNCTION void fz_invert_pixmap_raw() const;
  7063. /** Class-aware wrapper for `::fz_invert_pixmap_rect()`. */
  7064. /**
  7065. Invert all the pixels in a given rectangle of a (premultiplied)
  7066. pixmap. All components of all pixels in the rectangle are
  7067. inverted (except alpha, which is unchanged).
  7068. */
  7069. FZ_FUNCTION void fz_invert_pixmap_rect(const FzIrect& rect) const;
  7070. /** Class-aware wrapper for `::fz_is_pixmap_monochrome()`. */
  7071. /**
  7072. Check if the pixmap is a 1-channel image containing samples with
  7073. only values 0 and 255
  7074. */
  7075. FZ_FUNCTION int fz_is_pixmap_monochrome() const;
  7076. /** Class-aware wrapper for `::fz_md5_pixmap()`. */
  7077. FZ_FUNCTION void fz_md5_pixmap(unsigned char digest[16]) const;
  7078. /** Class-aware wrapper for `::fz_md5_pixmap2()`. */
  7079. /**
  7080. C++ alternative to `fz_md5_pixmap()` that returns the digest by value.
  7081. */
  7082. FZ_FUNCTION std::vector<unsigned char> fz_md5_pixmap2() const;
  7083. /** Class-aware wrapper for `::fz_new_bitmap_from_pixmap()`. */
  7084. /**
  7085. Make a bitmap from a pixmap and a halftone.
  7086. pix: The pixmap to generate from. Currently must be a single
  7087. color component with no alpha.
  7088. ht: The halftone to use. NULL implies the default halftone.
  7089. Returns the resultant bitmap. Throws exceptions in the case of
  7090. failure to allocate.
  7091. */
  7092. FZ_FUNCTION FzBitmap fz_new_bitmap_from_pixmap(const FzHalftone& ht) const;
  7093. /** Class-aware wrapper for `::fz_new_bitmap_from_pixmap_band()`. */
  7094. /**
  7095. Make a bitmap from a pixmap and a
  7096. halftone, allowing for the position of the pixmap within an
  7097. overall banded rendering.
  7098. pix: The pixmap to generate from. Currently must be a single
  7099. color component with no alpha.
  7100. ht: The halftone to use. NULL implies the default halftone.
  7101. band_start: Vertical offset within the overall banded rendering
  7102. (in pixels)
  7103. Returns the resultant bitmap. Throws exceptions in the case of
  7104. failure to allocate.
  7105. */
  7106. FZ_FUNCTION FzBitmap fz_new_bitmap_from_pixmap_band(const FzHalftone& ht, int band_start) const;
  7107. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_jpeg()`. */
  7108. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_jpeg(const FzColorParams& color_params, int quality, int invert_cmyk) const;
  7109. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_jpx()`. */
  7110. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_jpx(const FzColorParams& color_params, int quality) const;
  7111. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pam()`. */
  7112. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_pam(const FzColorParams& color_params) const;
  7113. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pbm()`. */
  7114. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_pbm(const FzColorParams& color_params) const;
  7115. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pkm()`. */
  7116. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_pkm(const FzColorParams& color_params) const;
  7117. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_png()`. */
  7118. /**
  7119. Re-encode a given pixmap as a PNG into a buffer.
  7120. Ownership of the buffer is returned.
  7121. */
  7122. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_png(const FzColorParams& color_params) const;
  7123. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_pnm()`. */
  7124. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_pnm(const FzColorParams& color_params) const;
  7125. /** Class-aware wrapper for `::fz_new_buffer_from_pixmap_as_psd()`. */
  7126. FZ_FUNCTION FzBuffer fz_new_buffer_from_pixmap_as_psd(const FzColorParams& color_params) const;
  7127. /** Class-aware wrapper for `::fz_new_image_from_pixmap()`. */
  7128. /**
  7129. Create an image from the given
  7130. pixmap.
  7131. pixmap: The pixmap to base the image upon. A new reference
  7132. to this is taken.
  7133. mask: NULL, or another image to use as a mask for this one.
  7134. A new reference is taken to this image. Supplying a masked
  7135. image as a mask to another image is illegal!
  7136. */
  7137. FZ_FUNCTION FzImage fz_new_image_from_pixmap(const FzImage& mask) const;
  7138. /** Class-aware wrapper for `::fz_new_pixmap_from_alpha_channel()`. */
  7139. FZ_FUNCTION FzPixmap fz_new_pixmap_from_alpha_channel() const;
  7140. /** Class-aware wrapper for `::fz_new_pixmap_from_color_and_mask()`. */
  7141. FZ_FUNCTION FzPixmap fz_new_pixmap_from_color_and_mask(const FzPixmap& mask) const;
  7142. /** Class-aware wrapper for `::fz_new_pixmap_from_pixmap()`. */
  7143. /**
  7144. Create a new pixmap that represents a subarea of the specified
  7145. pixmap. A reference is taken to this pixmap that will be dropped
  7146. on destruction.
  7147. The supplied rectangle must be wholly contained within the
  7148. original pixmap.
  7149. Returns a pointer to the new pixmap. Throws exception on failure
  7150. to allocate.
  7151. */
  7152. FZ_FUNCTION FzPixmap fz_new_pixmap_from_pixmap(FzIrect& rect) const;
  7153. /** Class-aware wrapper for `::fz_pixmap_alpha()`. */
  7154. /**
  7155. Return the number of alpha planes in a pixmap.
  7156. Returns the number of alphas. Does not throw exceptions.
  7157. */
  7158. FZ_FUNCTION int fz_pixmap_alpha() const;
  7159. /** Class-aware wrapper for `::fz_pixmap_bbox()`. */
  7160. /**
  7161. Return the bounding box for a pixmap.
  7162. */
  7163. FZ_FUNCTION FzIrect fz_pixmap_bbox() const;
  7164. /** Class-aware wrapper for `::fz_pixmap_colorants()`. */
  7165. /**
  7166. Return the number of colorants in a pixmap.
  7167. Returns the number of colorants (components, less any spots and
  7168. alpha).
  7169. */
  7170. FZ_FUNCTION int fz_pixmap_colorants() const;
  7171. /** Class-aware wrapper for `::fz_pixmap_colorspace()`. */
  7172. /**
  7173. Return the colorspace of a pixmap
  7174. Returns colorspace.
  7175. */
  7176. FZ_FUNCTION FzColorspace fz_pixmap_colorspace() const;
  7177. /** Class-aware wrapper for `::fz_pixmap_components()`. */
  7178. /**
  7179. Return the number of components in a pixmap.
  7180. Returns the number of components (including spots and alpha).
  7181. */
  7182. FZ_FUNCTION int fz_pixmap_components() const;
  7183. /** Class-aware wrapper for `::fz_pixmap_height()`. */
  7184. /**
  7185. Return the height of the pixmap in pixels.
  7186. */
  7187. FZ_FUNCTION int fz_pixmap_height() const;
  7188. /** Class-aware wrapper for `::fz_pixmap_samples()`. */
  7189. /**
  7190. Returns a pointer to the pixel data of a pixmap.
  7191. Returns the pointer.
  7192. */
  7193. FZ_FUNCTION unsigned char *fz_pixmap_samples() const;
  7194. /** Class-aware wrapper for `::fz_pixmap_samples_int()`. */
  7195. /** */
  7196. FZ_FUNCTION long long fz_pixmap_samples_int() const;
  7197. /** Class-aware wrapper for `::fz_pixmap_size()`. */
  7198. /**
  7199. Return sizeof fz_pixmap plus size of data, in bytes.
  7200. */
  7201. FZ_FUNCTION size_t fz_pixmap_size() const;
  7202. /** Class-aware wrapper for `::fz_pixmap_spots()`. */
  7203. /**
  7204. Return the number of spots in a pixmap.
  7205. Returns the number of spots (components, less colorants and
  7206. alpha). Does not throw exceptions.
  7207. */
  7208. FZ_FUNCTION int fz_pixmap_spots() const;
  7209. /** Class-aware wrapper for `::fz_pixmap_stride()`. */
  7210. /**
  7211. Return the number of bytes in a row in the pixmap.
  7212. */
  7213. FZ_FUNCTION int fz_pixmap_stride() const;
  7214. /** Class-aware wrapper for `::fz_pixmap_width()`. */
  7215. /**
  7216. Return the width of the pixmap in pixels.
  7217. */
  7218. FZ_FUNCTION int fz_pixmap_width() const;
  7219. /** Class-aware wrapper for `::fz_pixmap_x()`. */
  7220. /**
  7221. Return the x value of the pixmap in pixels.
  7222. */
  7223. FZ_FUNCTION int fz_pixmap_x() const;
  7224. /** Class-aware wrapper for `::fz_pixmap_y()`. */
  7225. /**
  7226. Return the y value of the pixmap in pixels.
  7227. */
  7228. FZ_FUNCTION int fz_pixmap_y() const;
  7229. /** Class-aware wrapper for `::fz_samples_get()`. */
  7230. /**
  7231. Provides simple (but slow) access to pixmap data from Python and C#.
  7232. */
  7233. FZ_FUNCTION int fz_samples_get(int offset) const;
  7234. /** Class-aware wrapper for `::fz_samples_set()`. */
  7235. /**
  7236. Provides simple (but slow) write access to pixmap data from Python and
  7237. C#.
  7238. */
  7239. FZ_FUNCTION void fz_samples_set(int offset, int value) const;
  7240. /** Class-aware wrapper for `::fz_save_pixmap_as_jpeg()`. */
  7241. /**
  7242. Save a pixmap as a JPEG.
  7243. */
  7244. FZ_FUNCTION void fz_save_pixmap_as_jpeg(const char *filename, int quality) const;
  7245. /** Class-aware wrapper for `::fz_save_pixmap_as_jpx()`. */
  7246. /**
  7247. Save pixmap data as JP2K with no subsampling.
  7248. quality = 100 = lossless
  7249. otherwise for a factor of x compression use 100-x. (so 80 is 1:20 compression)
  7250. */
  7251. FZ_FUNCTION void fz_save_pixmap_as_jpx(const char *filename, int q) const;
  7252. /** Class-aware wrapper for `::fz_save_pixmap_as_pam()`. */
  7253. /**
  7254. Save a pixmap as a pnm (greyscale, rgb or cmyk, with or without
  7255. alpha).
  7256. */
  7257. FZ_FUNCTION void fz_save_pixmap_as_pam(const char *filename) const;
  7258. /** Class-aware wrapper for `::fz_save_pixmap_as_pbm()`. */
  7259. /**
  7260. Save a pixmap as a pbm. (Performing halftoning).
  7261. */
  7262. FZ_FUNCTION void fz_save_pixmap_as_pbm(const char *filename) const;
  7263. /** Class-aware wrapper for `::fz_save_pixmap_as_pcl()`. */
  7264. /**
  7265. Save an (RGB) pixmap as color PCL.
  7266. */
  7267. FZ_FUNCTION void fz_save_pixmap_as_pcl(char *filename, int append, const FzPclOptions& pcl) const;
  7268. /** Class-aware wrapper for `::fz_save_pixmap_as_pclm()`. */
  7269. /**
  7270. Save a (Greyscale or RGB) pixmap as pclm.
  7271. */
  7272. FZ_FUNCTION void fz_save_pixmap_as_pclm(const char *filename, int append, const FzPclmOptions& options) const;
  7273. /** Class-aware wrapper for `::fz_save_pixmap_as_pdfocr()`. */
  7274. /**
  7275. Save a (Greyscale or RGB) pixmap as pdfocr.
  7276. */
  7277. FZ_FUNCTION void fz_save_pixmap_as_pdfocr(char *filename, int append, FzPdfocrOptions& options) const;
  7278. /** Class-aware wrapper for `::fz_save_pixmap_as_pkm()`. */
  7279. /**
  7280. Save a CMYK pixmap as a pkm. (Performing halftoning).
  7281. */
  7282. FZ_FUNCTION void fz_save_pixmap_as_pkm(const char *filename) const;
  7283. /** Class-aware wrapper for `::fz_save_pixmap_as_png()`. */
  7284. /**
  7285. Save a (Greyscale or RGB) pixmap as a png.
  7286. */
  7287. FZ_FUNCTION void fz_save_pixmap_as_png(const char *filename) const;
  7288. /** Class-aware wrapper for `::fz_save_pixmap_as_pnm()`. */
  7289. /**
  7290. Save a pixmap as a pnm (greyscale or rgb, no alpha).
  7291. */
  7292. FZ_FUNCTION void fz_save_pixmap_as_pnm(const char *filename) const;
  7293. /** Class-aware wrapper for `::fz_save_pixmap_as_ps()`. */
  7294. /**
  7295. Save a (gray, rgb, or cmyk, no alpha) pixmap out as postscript.
  7296. */
  7297. FZ_FUNCTION void fz_save_pixmap_as_ps(char *filename, int append) const;
  7298. /** Class-aware wrapper for `::fz_save_pixmap_as_psd()`. */
  7299. /**
  7300. Save a pixmap as a PSD file.
  7301. */
  7302. FZ_FUNCTION void fz_save_pixmap_as_psd(const char *filename) const;
  7303. /** Class-aware wrapper for `::fz_save_pixmap_as_pwg()`. */
  7304. /**
  7305. Save a pixmap as a PWG.
  7306. */
  7307. FZ_FUNCTION void fz_save_pixmap_as_pwg(char *filename, int append, FzPwgOptions& pwg) const;
  7308. /** Class-aware wrapper for `::fz_scale_pixmap()`. */
  7309. FZ_FUNCTION FzPixmap fz_scale_pixmap(float x, float y, float w, float h, FzIrect& clip) const;
  7310. /** Class-aware wrapper for `::fz_set_pixmap_resolution()`. */
  7311. /**
  7312. Set the pixels per inch resolution of the pixmap.
  7313. */
  7314. FZ_FUNCTION void fz_set_pixmap_resolution(int xres, int yres) const;
  7315. /** Class-aware wrapper for `::fz_subsample_pixmap()`. */
  7316. FZ_FUNCTION void fz_subsample_pixmap(int factor) const;
  7317. /** Class-aware wrapper for `::fz_tint_pixmap()`. */
  7318. /**
  7319. Tint all the pixels in an RGB, BGR, or Gray pixmap.
  7320. black: Map black to this hexadecimal RGB color.
  7321. white: Map white to this hexadecimal RGB color.
  7322. */
  7323. FZ_FUNCTION void fz_tint_pixmap(int black, int white) const;
  7324. /** Class-aware wrapper for `::fz_warp_pixmap()`. */
  7325. FZ_FUNCTION FzPixmap fz_warp_pixmap(const FzQuad& points, int width, int height) const;
  7326. /** Constructor using raw copy of pre-existing `::fz_pixmap`. */
  7327. /* This constructor is marked as `explicit` because wrapper classes do not
  7328. call `keep`in constructors, but do call `drop` in destructors. So
  7329. automatic construction from a fz_pixmap* will generally cause an
  7330. unbalanced `drop` resulting in errors such as SEGV. */
  7331. FZ_FUNCTION explicit FzPixmap(::fz_pixmap* internal);
  7332. /* == Accessors to members of ::fz_pixmap m_internal. */
  7333. FZ_FUNCTION ::fz_storable storable();
  7334. FZ_FUNCTION int x();
  7335. FZ_FUNCTION int y();
  7336. FZ_FUNCTION int w();
  7337. FZ_FUNCTION int h();
  7338. FZ_FUNCTION unsigned char n();
  7339. FZ_FUNCTION unsigned char s();
  7340. FZ_FUNCTION unsigned char alpha();
  7341. FZ_FUNCTION unsigned char flags();
  7342. FZ_FUNCTION ptrdiff_t stride();
  7343. FZ_FUNCTION FzSeparations seps();
  7344. FZ_FUNCTION int xres();
  7345. FZ_FUNCTION int yres();
  7346. FZ_FUNCTION FzColorspace colorspace();
  7347. FZ_FUNCTION const unsigned char *samples();
  7348. FZ_FUNCTION FzPixmap underlying();
  7349. /** Destructor using fz_drop_pixmap(). */
  7350. FZ_FUNCTION ~FzPixmap();
  7351. /** Return numerical value of .m_internal; helps with Python debugging. */
  7352. FZ_FUNCTION long long m_internal_value();
  7353. /** Return true iff `m_internal` is not null. */
  7354. FZ_FUNCTION operator bool();
  7355. /* == Member data. */
  7356. /** Pointer to wrapped data. */
  7357. ::fz_pixmap* m_internal;
  7358. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7359. generate code regardless so we always need to have this available. */
  7360. FZ_DATA static int s_num_instances;
  7361. };
  7362. /** Wrapper class for struct `fz_pixmap_image`. Not copyable or assignable. */
  7363. struct FzPixmapImage
  7364. {
  7365. /** Default constructor, sets `m_internal` to null. */
  7366. FZ_FUNCTION FzPixmapImage();
  7367. /* == Methods. */
  7368. /** Class-aware wrapper for `::fz_pixmap_image_tile()`. */
  7369. /**
  7370. Retrieve the underlying fz_pixmap for an image.
  7371. Returns a pointer to the underlying fz_pixmap for an image,
  7372. or NULL if this image is not based upon an fz_pixmap.
  7373. No reference is returned. Lifespan is limited to that of
  7374. the image itself. If required, use fz_keep_pixmap to take
  7375. a reference to keep it longer.
  7376. */
  7377. FZ_FUNCTION FzPixmap fz_pixmap_image_tile() const;
  7378. /** Class-aware wrapper for `::fz_set_pixmap_image_tile()`. */
  7379. FZ_FUNCTION void fz_set_pixmap_image_tile(const FzPixmap& pix) const;
  7380. /** Constructor using raw copy of pre-existing `::fz_pixmap_image`. */
  7381. FZ_FUNCTION FzPixmapImage(::fz_pixmap_image* internal);
  7382. #ifndef NDEBUG
  7383. /** Destructor only decrements s_num_instances. */
  7384. FZ_FUNCTION ~FzPixmapImage();
  7385. #else
  7386. /** We use default destructor. */
  7387. #endif
  7388. /** Return numerical value of .m_internal; helps with Python debugging. */
  7389. FZ_FUNCTION long long m_internal_value();
  7390. /** Return true iff `m_internal` is not null. */
  7391. FZ_FUNCTION operator bool();
  7392. /* == Member data. */
  7393. /** Pointer to wrapped data. */
  7394. ::fz_pixmap_image* m_internal;
  7395. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7396. generate code regardless so we always need to have this available. */
  7397. FZ_DATA static int s_num_instances;
  7398. private:
  7399. /** This class is not copyable or assignable. */
  7400. FzPixmapImage(const FzPixmapImage& rhs);
  7401. FzPixmapImage& operator=(const FzPixmapImage& rhs);
  7402. };
  7403. /** Wrapper class for struct `fz_point`. */
  7404. /**
  7405. fz_point is a point in a two-dimensional space.
  7406. */
  7407. struct FzPoint
  7408. {
  7409. /** Construct using specified values. */
  7410. FZ_FUNCTION FzPoint(float x, float y);
  7411. /** We use default copy constructor and operator=. */
  7412. /** Default constructor, sets each member to default value. */
  7413. FZ_FUNCTION FzPoint();
  7414. /* == Static methods. */
  7415. /** Class-aware wrapper for `::fz_transform_point()`. */
  7416. /**
  7417. Apply a transformation to a point.
  7418. transform: Transformation matrix to apply. See fz_concat,
  7419. fz_scale, fz_rotate and fz_translate for how to create a
  7420. matrix.
  7421. point: Pointer to point to update.
  7422. Returns transform (unchanged).
  7423. */
  7424. FZ_FUNCTION static FzPoint fz_transform_point(const FzPoint& point, const FzMatrix& m);
  7425. /** Class-aware wrapper for `::fz_transform_point_xy()`. */
  7426. FZ_FUNCTION static FzPoint fz_transform_point_xy(float x, float y, const FzMatrix& m);
  7427. /** Class-aware wrapper for `::fz_transform_vector()`. */
  7428. /**
  7429. Apply a transformation to a vector.
  7430. transform: Transformation matrix to apply. See fz_concat,
  7431. fz_scale and fz_rotate for how to create a matrix. Any
  7432. translation will be ignored.
  7433. vector: Pointer to vector to update.
  7434. */
  7435. FZ_FUNCTION static FzPoint fz_transform_vector(const FzPoint& vector, const FzMatrix& m);
  7436. /* == Methods. */
  7437. /** Class-aware wrapper for `::fz_is_point_inside_quad()`. */
  7438. /**
  7439. Inclusion test for quads.
  7440. */
  7441. FZ_FUNCTION int fz_is_point_inside_quad(const FzQuad& q);
  7442. /** Class-aware wrapper for `::fz_is_point_inside_rect()`. */
  7443. /**
  7444. Inclusion test for rects. (Rect is assumed to be open, i.e.
  7445. top right corner is not included).
  7446. */
  7447. FZ_FUNCTION int fz_is_point_inside_rect(const FzRect& r);
  7448. /** Class-aware wrapper for `::fz_normalize_vector()`. */
  7449. /**
  7450. Normalize a vector to length one.
  7451. */
  7452. FZ_FUNCTION FzPoint fz_normalize_vector();
  7453. /** Class-aware wrapper for `::fz_transform_point()`. */
  7454. /**
  7455. Apply a transformation to a point.
  7456. transform: Transformation matrix to apply. See fz_concat,
  7457. fz_scale, fz_rotate and fz_translate for how to create a
  7458. matrix.
  7459. point: Pointer to point to update.
  7460. Returns transform (unchanged).
  7461. */
  7462. FZ_FUNCTION FzPoint fz_transform_point(const FzMatrix& m);
  7463. /** Class-aware wrapper for `::fz_transform_vector()`. */
  7464. /**
  7465. Apply a transformation to a vector.
  7466. transform: Transformation matrix to apply. See fz_concat,
  7467. fz_scale and fz_rotate for how to create a matrix. Any
  7468. translation will be ignored.
  7469. vector: Pointer to vector to update.
  7470. */
  7471. FZ_FUNCTION FzPoint fz_transform_vector(const FzMatrix& m);
  7472. /** Post-multiply *this by <m> and return *this. */
  7473. FZ_FUNCTION FzPoint& transform(const FzMatrix& m);
  7474. /** Constructor using raw copy of pre-existing `::fz_point`. */
  7475. FZ_FUNCTION FzPoint(const ::fz_point* internal);
  7476. /** Constructor using raw copy of pre-existing `::fz_point`. */
  7477. FZ_FUNCTION FzPoint(const ::fz_point internal);
  7478. /** Access as underlying struct. */
  7479. FZ_FUNCTION ::fz_point* internal();
  7480. /** Access as underlying struct. */
  7481. FZ_FUNCTION const ::fz_point* internal() const;
  7482. #ifndef NDEBUG
  7483. /** Destructor only decrements s_num_instances. */
  7484. FZ_FUNCTION ~FzPoint();
  7485. #else
  7486. /** We use default destructor. */
  7487. #endif
  7488. /* == Member data. */
  7489. /* These members are the same as the members of ::fz_point. */
  7490. float x;
  7491. float y;
  7492. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7493. generate code regardless so we always need to have this available. */
  7494. FZ_DATA static int s_num_instances;
  7495. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  7496. FZ_FUNCTION std::string to_string();
  7497. /** Comparison method. */
  7498. FZ_FUNCTION bool operator==(const FzPoint& rhs);
  7499. /** Comparison method. */
  7500. FZ_FUNCTION bool operator!=(const FzPoint& rhs);
  7501. };
  7502. /** Wrapper class for struct `fz_pool`. Not copyable or assignable. */
  7503. /**
  7504. Simple pool allocators.
  7505. Allocate from the pool, which can then be freed at once.
  7506. */
  7507. struct FzPool
  7508. {
  7509. /** == Constructors. */
  7510. /** Constructor using `fz_new_pool()`. */
  7511. /**
  7512. Create a new pool to allocate from.
  7513. */
  7514. FZ_FUNCTION FzPool();
  7515. /* == Methods. */
  7516. /** Class-aware wrapper for `::fz_json_array_push()`. */
  7517. FZ_FUNCTION void fz_json_array_push(const FzJson& array, const FzJson& item) const;
  7518. /** Class-aware wrapper for `::fz_json_object_set()`. */
  7519. FZ_FUNCTION void fz_json_object_set(const FzJson& object, const char *key, const FzJson& item) const;
  7520. /** Class-aware wrapper for `::fz_pool_alloc()`. */
  7521. /**
  7522. Allocate a block of size bytes from the pool.
  7523. */
  7524. FZ_FUNCTION void *fz_pool_alloc(size_t size) const;
  7525. /** Class-aware wrapper for `::fz_pool_size()`. */
  7526. /**
  7527. The current size of the pool.
  7528. The number of bytes of storage currently allocated to the pool.
  7529. This is the total of the storage used for the blocks making
  7530. up the pool, rather then total of the allocated blocks so far,
  7531. so it will increase in 'lumps'.
  7532. from the pool, then the pool size may still be X
  7533. */
  7534. FZ_FUNCTION size_t fz_pool_size() const;
  7535. /** Class-aware wrapper for `::fz_pool_strdup()`. */
  7536. /**
  7537. strdup equivalent allocating from the pool.
  7538. */
  7539. FZ_FUNCTION char *fz_pool_strdup(const char *s) const;
  7540. /** Class-aware wrapper for `::fz_xml_add_att()`. */
  7541. /**
  7542. Add an attribute to an XML node.
  7543. */
  7544. FZ_FUNCTION void fz_xml_add_att(const FzXml& node, const char *key, const char *val) const;
  7545. /** Constructor using raw copy of pre-existing `::fz_pool`. */
  7546. FZ_FUNCTION FzPool(::fz_pool* internal);
  7547. /** Destructor using fz_drop_pool(). */
  7548. FZ_FUNCTION ~FzPool();
  7549. /** Return numerical value of .m_internal; helps with Python debugging. */
  7550. FZ_FUNCTION long long m_internal_value();
  7551. /** Return true iff `m_internal` is not null. */
  7552. FZ_FUNCTION operator bool();
  7553. /* == Member data. */
  7554. /** Pointer to wrapped data. */
  7555. ::fz_pool* m_internal;
  7556. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7557. generate code regardless so we always need to have this available. */
  7558. FZ_DATA static int s_num_instances;
  7559. private:
  7560. /** This class is not copyable or assignable. */
  7561. FzPool(const FzPool& rhs);
  7562. FzPool& operator=(const FzPool& rhs);
  7563. };
  7564. /** Wrapper class for struct `fz_pool_array`. Not copyable or assignable. */
  7565. /**
  7566. Routines to handle a 'variable length array' within the pool.
  7567. Appending to the array, and looking up items within the array
  7568. are O(log n) operations.
  7569. */
  7570. struct FzPoolArray
  7571. {
  7572. /** == Constructors. */
  7573. /** Constructor using `fz_new_pool_array_imp()`. */
  7574. FZ_FUNCTION FzPoolArray(const FzPool& pool, size_t size, size_t initial);
  7575. /** Default constructor, sets `m_internal` to null. */
  7576. FZ_FUNCTION FzPoolArray();
  7577. /* == Methods. */
  7578. /** Class-aware wrapper for `::fz_pool_array_append()`.
  7579. This method has out-params. Python/C# wrappers look like:
  7580. `fz_pool_array_append()` => `(void *, size_t idx)`
  7581. */
  7582. /**
  7583. Append an element to the end of the array.
  7584. Returns a pointer to the new element (initially all 0's), and
  7585. (optionally) the index of that element.
  7586. */
  7587. FZ_FUNCTION void *fz_pool_array_append(size_t *idx) const;
  7588. /** Class-aware wrapper for `::fz_pool_array_len()`. */
  7589. /**
  7590. Get the length of the array.
  7591. */
  7592. FZ_FUNCTION size_t fz_pool_array_len() const;
  7593. /** Class-aware wrapper for `::fz_pool_array_lookup()`. */
  7594. /**
  7595. Lookup an element in the array.
  7596. */
  7597. FZ_FUNCTION void *fz_pool_array_lookup(size_t idx) const;
  7598. /** Constructor using raw copy of pre-existing `::fz_pool_array`. */
  7599. FZ_FUNCTION FzPoolArray(::fz_pool_array* internal);
  7600. #ifndef NDEBUG
  7601. /** Destructor only decrements s_num_instances. */
  7602. FZ_FUNCTION ~FzPoolArray();
  7603. #else
  7604. /** We use default destructor. */
  7605. #endif
  7606. /** Return numerical value of .m_internal; helps with Python debugging. */
  7607. FZ_FUNCTION long long m_internal_value();
  7608. /** Return true iff `m_internal` is not null. */
  7609. FZ_FUNCTION operator bool();
  7610. /* == Member data. */
  7611. /** Pointer to wrapped data. */
  7612. ::fz_pool_array* m_internal;
  7613. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7614. generate code regardless so we always need to have this available. */
  7615. FZ_DATA static int s_num_instances;
  7616. private:
  7617. /** This class is not copyable or assignable. */
  7618. FzPoolArray(const FzPoolArray& rhs);
  7619. FzPoolArray& operator=(const FzPoolArray& rhs);
  7620. };
  7621. /** Wrapper class for struct `fz_ptr_heap`. Not copyable or assignable. */
  7622. struct FzPtrHeap
  7623. {
  7624. /** Default constructor, sets `m_internal` to null. */
  7625. FZ_FUNCTION FzPtrHeap();
  7626. /* == Methods. */
  7627. /** Class-aware wrapper for `::fz_ptr_heap_insert()`. */
  7628. FZ_FUNCTION void fz_ptr_heap_insert(void *v, int (*HEAP_CMP)(void **, void **)) const;
  7629. /** Class-aware wrapper for `::fz_ptr_heap_sort()`. */
  7630. FZ_FUNCTION void fz_ptr_heap_sort(int (*HEAP_CMP)(void **, void **)) const;
  7631. /** Class-aware wrapper for `::fz_ptr_heap_uniq()`. */
  7632. FZ_FUNCTION void fz_ptr_heap_uniq(int (*HEAP_CMP)(void **, void **)) const;
  7633. /** Constructor using raw copy of pre-existing `::fz_ptr_heap`. */
  7634. FZ_FUNCTION FzPtrHeap(::fz_ptr_heap* internal);
  7635. #ifndef NDEBUG
  7636. /** Destructor only decrements s_num_instances. */
  7637. FZ_FUNCTION ~FzPtrHeap();
  7638. #else
  7639. /** We use default destructor. */
  7640. #endif
  7641. /** Return numerical value of .m_internal; helps with Python debugging. */
  7642. FZ_FUNCTION long long m_internal_value();
  7643. /** Return true iff `m_internal` is not null. */
  7644. FZ_FUNCTION operator bool();
  7645. /* == Member data. */
  7646. /** Pointer to wrapped data. */
  7647. ::fz_ptr_heap* m_internal;
  7648. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7649. generate code regardless so we always need to have this available. */
  7650. FZ_DATA static int s_num_instances;
  7651. private:
  7652. /** This class is not copyable or assignable. */
  7653. FzPtrHeap(const FzPtrHeap& rhs);
  7654. FzPtrHeap& operator=(const FzPtrHeap& rhs);
  7655. };
  7656. /** Wrapper class for struct `fz_pwg_options`. */
  7657. struct FzPwgOptions
  7658. {
  7659. /** We use default copy constructor and operator=. */
  7660. /** Default constructor, sets each member to default value. */
  7661. FZ_FUNCTION FzPwgOptions();
  7662. /** Constructor using raw copy of pre-existing `::fz_pwg_options`. */
  7663. FZ_FUNCTION FzPwgOptions(const ::fz_pwg_options* internal);
  7664. /* == Accessors to members of ::fz_pwg_options m_internal. */
  7665. FZ_FUNCTION char * media_class();
  7666. FZ_FUNCTION char * media_color();
  7667. FZ_FUNCTION char * media_type();
  7668. FZ_FUNCTION char * output_type();
  7669. FZ_FUNCTION unsigned int advance_distance();
  7670. FZ_FUNCTION int advance_media();
  7671. FZ_FUNCTION int collate();
  7672. FZ_FUNCTION int cut_media();
  7673. FZ_FUNCTION int duplex();
  7674. FZ_FUNCTION int insert_sheet();
  7675. FZ_FUNCTION int jog();
  7676. FZ_FUNCTION int leading_edge();
  7677. FZ_FUNCTION int manual_feed();
  7678. FZ_FUNCTION unsigned int media_position();
  7679. FZ_FUNCTION unsigned int media_weight();
  7680. FZ_FUNCTION int mirror_print();
  7681. FZ_FUNCTION int negative_print();
  7682. FZ_FUNCTION unsigned int num_copies();
  7683. FZ_FUNCTION int orientation();
  7684. FZ_FUNCTION int output_face_up();
  7685. FZ_FUNCTION unsigned int * PageSize();
  7686. FZ_FUNCTION int separations();
  7687. FZ_FUNCTION int tray_switch();
  7688. FZ_FUNCTION int tumble();
  7689. FZ_FUNCTION int media_type_num();
  7690. FZ_FUNCTION int compression();
  7691. FZ_FUNCTION unsigned int row_count();
  7692. FZ_FUNCTION unsigned int row_feed();
  7693. FZ_FUNCTION unsigned int row_step();
  7694. FZ_FUNCTION char * rendering_intent();
  7695. FZ_FUNCTION char * page_size_name();
  7696. #ifndef NDEBUG
  7697. /** Destructor only decrements s_num_instances. */
  7698. FZ_FUNCTION ~FzPwgOptions();
  7699. #else
  7700. /** We use default destructor. */
  7701. #endif
  7702. /* == Member data. */
  7703. ::fz_pwg_options m_internal; /** Wrapped data is held by value. */
  7704. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7705. generate code regardless so we always need to have this available. */
  7706. FZ_DATA static int s_num_instances;
  7707. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  7708. FZ_FUNCTION std::string to_string();
  7709. /** Comparison method. */
  7710. FZ_FUNCTION bool operator==(const FzPwgOptions& rhs);
  7711. /** Comparison method. */
  7712. FZ_FUNCTION bool operator!=(const FzPwgOptions& rhs);
  7713. };
  7714. /** Wrapper class for struct `fz_quad`. */
  7715. /**
  7716. A representation for a region defined by 4 points.
  7717. The significant difference between quads and rects is that
  7718. the edges of quads are not axis aligned.
  7719. */
  7720. struct FzQuad
  7721. {
  7722. /** == Constructors. */
  7723. /** Constructor using `fz_quad_from_rect()`. */
  7724. /**
  7725. Convert a rect to a quad (losslessly).
  7726. */
  7727. FZ_FUNCTION FzQuad(const FzRect& r);
  7728. /** Constructor using `fz_transform_quad()`. */
  7729. /**
  7730. Transform a quad by a matrix.
  7731. */
  7732. FZ_FUNCTION FzQuad(const FzQuad& q, const FzMatrix& m);
  7733. /** We use default copy constructor and operator=. */
  7734. /** Default constructor, sets each member to default value. */
  7735. FZ_FUNCTION FzQuad();
  7736. /* == Methods. */
  7737. /** Class-aware wrapper for `::fz_detect_document()`. */
  7738. FZ_FUNCTION int fz_detect_document(const FzPixmap& src);
  7739. /** Class-aware wrapper for `::fz_is_empty_quad()`. */
  7740. /**
  7741. Is a quad empty?
  7742. */
  7743. FZ_FUNCTION int fz_is_empty_quad();
  7744. /** Class-aware wrapper for `::fz_is_infinite_quad()`. */
  7745. /**
  7746. Is a quad infinite?
  7747. */
  7748. FZ_FUNCTION int fz_is_infinite_quad();
  7749. /** Class-aware wrapper for `::fz_is_quad_inside_quad()`. */
  7750. /**
  7751. Inclusion test for quad in quad.
  7752. This may break down if quads are not 'well formed'.
  7753. */
  7754. FZ_FUNCTION int fz_is_quad_inside_quad(const FzQuad& haystack);
  7755. /** Class-aware wrapper for `::fz_is_quad_intersecting_quad()`. */
  7756. /**
  7757. Intersection test for quads.
  7758. This may break down if quads are not 'well formed'.
  7759. */
  7760. FZ_FUNCTION int fz_is_quad_intersecting_quad(const FzQuad& b);
  7761. /** Class-aware wrapper for `::fz_is_valid_quad()`. */
  7762. /**
  7763. Is a quad valid?
  7764. */
  7765. FZ_FUNCTION int fz_is_valid_quad();
  7766. /** Class-aware wrapper for `::fz_rect_from_quad()`. */
  7767. /**
  7768. Convert a quad to the smallest rect that covers it.
  7769. */
  7770. FZ_FUNCTION FzRect fz_rect_from_quad();
  7771. /** Class-aware wrapper for `::fz_transform_quad()`. */
  7772. /**
  7773. Transform a quad by a matrix.
  7774. */
  7775. FZ_FUNCTION FzQuad fz_transform_quad(const FzMatrix& m);
  7776. /** Constructor using raw copy of pre-existing `::fz_quad`. */
  7777. FZ_FUNCTION FzQuad(const ::fz_quad* internal);
  7778. /** Constructor using raw copy of pre-existing `::fz_quad`. */
  7779. FZ_FUNCTION FzQuad(const ::fz_quad internal);
  7780. /** Access as underlying struct. */
  7781. FZ_FUNCTION ::fz_quad* internal();
  7782. /** Access as underlying struct. */
  7783. FZ_FUNCTION const ::fz_quad* internal() const;
  7784. #ifndef NDEBUG
  7785. /** Destructor only decrements s_num_instances. */
  7786. FZ_FUNCTION ~FzQuad();
  7787. #else
  7788. /** We use default destructor. */
  7789. #endif
  7790. /* == Member data. */
  7791. /* These members are the same as the members of ::fz_quad. */
  7792. ::fz_point ul;
  7793. ::fz_point ur;
  7794. ::fz_point ll;
  7795. ::fz_point lr;
  7796. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7797. generate code regardless so we always need to have this available. */
  7798. FZ_DATA static int s_num_instances;
  7799. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  7800. FZ_FUNCTION std::string to_string();
  7801. /** Comparison method. */
  7802. FZ_FUNCTION bool operator==(const FzQuad& rhs);
  7803. /** Comparison method. */
  7804. FZ_FUNCTION bool operator!=(const FzQuad& rhs);
  7805. };
  7806. /** Wrapper class for struct `fz_range`. Not copyable or assignable. */
  7807. struct FzRange
  7808. {
  7809. /** Default constructor, sets `m_internal` to null. */
  7810. FZ_FUNCTION FzRange();
  7811. /** Constructor using raw copy of pre-existing `::fz_range`. */
  7812. FZ_FUNCTION FzRange(::fz_range* internal);
  7813. #ifndef NDEBUG
  7814. /** Destructor only decrements s_num_instances. */
  7815. FZ_FUNCTION ~FzRange();
  7816. #else
  7817. /** We use default destructor. */
  7818. #endif
  7819. /** Return numerical value of .m_internal; helps with Python debugging. */
  7820. FZ_FUNCTION long long m_internal_value();
  7821. /** Return true iff `m_internal` is not null. */
  7822. FZ_FUNCTION operator bool();
  7823. /* == Member data. */
  7824. /** Pointer to wrapped data. */
  7825. ::fz_range* m_internal;
  7826. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  7827. generate code regardless so we always need to have this available. */
  7828. FZ_DATA static int s_num_instances;
  7829. private:
  7830. /** This class is not copyable or assignable. */
  7831. FzRange(const FzRange& rhs);
  7832. FzRange& operator=(const FzRange& rhs);
  7833. };
  7834. /** Wrapper class for struct `fz_rect`. */
  7835. struct FzRect
  7836. {
  7837. enum Fixed
  7838. {
  7839. Fixed_UNIT,
  7840. Fixed_EMPTY,
  7841. Fixed_INFINITE,
  7842. };
  7843. /** == Constructors. */
  7844. /** Constructor using `fz_bound_display_list()`. */
  7845. /**
  7846. Return the bounding box of the page recorded in a display list.
  7847. */
  7848. FZ_FUNCTION FzRect(const FzDisplayList& list);
  7849. /** Constructor using `fz_rect_from_irect()`. */
  7850. /**
  7851. Convert a bbox into a rect.
  7852. For our purposes, a rect can represent all the values we meet in
  7853. a bbox, so nothing can go wrong.
  7854. rect: A place to store the generated rectangle.
  7855. bbox: The bbox to convert.
  7856. Returns rect (updated).
  7857. */
  7858. FZ_FUNCTION FzRect(const FzIrect& bbox);
  7859. /** Constructor using `fz_rect_from_quad()`. */
  7860. /**
  7861. Convert a quad to the smallest rect that covers it.
  7862. */
  7863. FZ_FUNCTION FzRect(const FzQuad& q);
  7864. /** Constructor using `fz_transform_rect()`. */
  7865. /**
  7866. Apply a transform to a rectangle.
  7867. After the four corner points of the axis-aligned rectangle
  7868. have been transformed it may not longer be axis-aligned. So a
  7869. new axis-aligned rectangle is created covering at least the
  7870. area of the transformed rectangle.
  7871. transform: Transformation matrix to apply. See fz_concat,
  7872. fz_scale and fz_rotate for how to create a matrix.
  7873. rect: Rectangle to be transformed. The two special cases
  7874. fz_empty_rect and fz_infinite_rect, may be used but are
  7875. returned unchanged as expected.
  7876. */
  7877. FZ_FUNCTION FzRect(const FzRect& rect, const FzMatrix& m);
  7878. /** Construct from specified values. */
  7879. FZ_FUNCTION FzRect(double x0, double y0, double x1, double y1);
  7880. /** Copy constructor using plain copy. */
  7881. FZ_FUNCTION FzRect(const FzRect& rhs);
  7882. /** Construct from fz_unit_rect, fz_empty_rect or fz_infinite_rect. */
  7883. FZ_FUNCTION FzRect(Fixed fixed);
  7884. /** We use default copy constructor and operator=. */
  7885. /** Default constructor, sets each member to default value. */
  7886. FZ_FUNCTION FzRect();
  7887. /* == Static methods. */
  7888. /** Class-aware wrapper for `::fz_intersect_rect()`. */
  7889. /**
  7890. Compute intersection of two rectangles.
  7891. Given two rectangles, update the first to be the smallest
  7892. axis-aligned rectangle that covers the area covered by both
  7893. given rectangles. If either rectangle is empty then the
  7894. intersection is also empty. If either rectangle is infinite
  7895. then the intersection is simply the non-infinite rectangle.
  7896. Should both rectangles be infinite, then the intersection is
  7897. also infinite.
  7898. */
  7899. FZ_FUNCTION static FzRect fz_intersect_rect(const FzRect& a, const FzRect& b);
  7900. /** Class-aware wrapper for `::fz_union_rect()`. */
  7901. /**
  7902. Compute union of two rectangles.
  7903. Given two rectangles, update the first to be the smallest
  7904. axis-aligned rectangle that encompasses both given rectangles.
  7905. If either rectangle is infinite then the union is also infinite.
  7906. If either rectangle is empty then the union is simply the
  7907. non-empty rectangle. Should both rectangles be empty, then the
  7908. union is also empty.
  7909. */
  7910. FZ_FUNCTION static FzRect fz_union_rect(const FzRect& a, const FzRect& b);
  7911. /* == Methods. */
  7912. /** Class-aware wrapper for `::fz_adjust_rect_for_stroke()`. */
  7913. /**
  7914. Given a rectangle (assumed to be the bounding box for a path),
  7915. expand it to allow for the expansion of the bbox that would be
  7916. seen by stroking the path with the given stroke state and
  7917. transform.
  7918. */
  7919. FZ_FUNCTION FzRect fz_adjust_rect_for_stroke(const FzStrokeState& stroke, const FzMatrix& ctm);
  7920. /** Class-aware wrapper for `::fz_contains_rect()`. */
  7921. /**
  7922. Test rectangle inclusion.
  7923. Return true if a entirely contains b.
  7924. */
  7925. FZ_FUNCTION int fz_contains_rect(const FzRect& b);
  7926. /** Class-aware wrapper for `::fz_expand_rect()`. */
  7927. /**
  7928. Expand a bbox by a given amount in all directions.
  7929. */
  7930. FZ_FUNCTION FzRect fz_expand_rect(float expand);
  7931. /** Class-aware wrapper for `::fz_include_point_in_rect()`. */
  7932. /**
  7933. Expand a bbox to include a given point.
  7934. To create a rectangle that encompasses a sequence of points, the
  7935. rectangle must first be set to be the empty rectangle at one of
  7936. the points before including the others.
  7937. */
  7938. FZ_FUNCTION FzRect fz_include_point_in_rect(const FzPoint& p);
  7939. /** Class-aware wrapper for `::fz_intersect_rect()`. */
  7940. /**
  7941. Compute intersection of two rectangles.
  7942. Given two rectangles, update the first to be the smallest
  7943. axis-aligned rectangle that covers the area covered by both
  7944. given rectangles. If either rectangle is empty then the
  7945. intersection is also empty. If either rectangle is infinite
  7946. then the intersection is simply the non-infinite rectangle.
  7947. Should both rectangles be infinite, then the intersection is
  7948. also infinite.
  7949. */
  7950. FZ_FUNCTION FzRect fz_intersect_rect(const FzRect& b);
  7951. /** Class-aware wrapper for `::fz_irect_from_rect()`. */
  7952. /**
  7953. Convert a rect into the minimal bounding box
  7954. that covers the rectangle.
  7955. Coordinates in a bounding box are integers, so rounding of the
  7956. rects coordinates takes place. The top left corner is rounded
  7957. upwards and left while the bottom right corner is rounded
  7958. downwards and to the right.
  7959. */
  7960. FZ_FUNCTION FzIrect fz_irect_from_rect();
  7961. /** Class-aware wrapper for `::fz_is_empty_rect()`. */
  7962. /**
  7963. Check if rectangle is empty.
  7964. An empty rectangle is defined as one whose area is zero.
  7965. All invalid rectangles are empty.
  7966. */
  7967. FZ_FUNCTION int fz_is_empty_rect();
  7968. /** Class-aware wrapper for `::fz_is_infinite_rect()`. */
  7969. /**
  7970. Check if rectangle is infinite.
  7971. */
  7972. FZ_FUNCTION int fz_is_infinite_rect();
  7973. /** Class-aware wrapper for `::fz_is_rect_inside_rect()`. */
  7974. /**
  7975. Inclusion test for rects.
  7976. rects are assumed to be both open or both closed.
  7977. No invalid rect can include any other rect.
  7978. No invalid rect can be included by any rect.
  7979. Empty (point) rects can include themselves.
  7980. Empty (line) rects can include many (subline) rects.
  7981. */
  7982. FZ_FUNCTION int fz_is_rect_inside_rect(const FzRect& outer);
  7983. /** Class-aware wrapper for `::fz_is_valid_rect()`. */
  7984. /**
  7985. Check if rectangle is valid.
  7986. */
  7987. FZ_FUNCTION int fz_is_valid_rect();
  7988. /** Class-aware wrapper for `::fz_new_bbox_device()`. */
  7989. /**
  7990. Create a device to compute the bounding
  7991. box of all marks on a page.
  7992. The returned bounding box will be the union of all bounding
  7993. boxes of all objects on a page.
  7994. */
  7995. FZ_FUNCTION FzDevice fz_new_bbox_device();
  7996. /** Class-aware wrapper for `::fz_new_display_list()`. */
  7997. /**
  7998. Create an empty display list.
  7999. A display list contains drawing commands (text, images, etc.).
  8000. Use fz_new_list_device for populating the list.
  8001. mediabox: Bounds of the page (in points) represented by the
  8002. display list.
  8003. */
  8004. FZ_FUNCTION FzDisplayList fz_new_display_list();
  8005. /** Class-aware wrapper for `::fz_overlaps_rect()`. */
  8006. /**
  8007. Test rectangle overlap.
  8008. Returns true if the area of the overlap is
  8009. non zero.
  8010. */
  8011. FZ_FUNCTION int fz_overlaps_rect(const FzRect& b);
  8012. /** Class-aware wrapper for `::fz_quad_from_rect()`. */
  8013. /**
  8014. Convert a rect to a quad (losslessly).
  8015. */
  8016. FZ_FUNCTION FzQuad fz_quad_from_rect();
  8017. /** Class-aware wrapper for `::fz_round_rect()`. */
  8018. /**
  8019. Round rectangle coordinates.
  8020. Coordinates in a bounding box are integers, so rounding of the
  8021. rects coordinates takes place. The top left corner is rounded
  8022. upwards and left while the bottom right corner is rounded
  8023. downwards and to the right.
  8024. This differs from fz_irect_from_rect, in that fz_irect_from_rect
  8025. slavishly follows the numbers (i.e any slight over/under
  8026. calculations can cause whole extra pixels to be added).
  8027. fz_round_rect allows for a small amount of rounding error when
  8028. calculating the bbox.
  8029. */
  8030. FZ_FUNCTION FzIrect fz_round_rect();
  8031. /** Class-aware wrapper for `::fz_transform_page()`. */
  8032. /**
  8033. Create transform matrix to draw page
  8034. at a given resolution and rotation. Adjusts the scaling
  8035. factors so that the page covers whole number of
  8036. pixels and adjust the page origin to be at 0,0.
  8037. */
  8038. FZ_FUNCTION FzMatrix fz_transform_page(float resolution, float rotate);
  8039. /** Class-aware wrapper for `::fz_transform_rect()`. */
  8040. /**
  8041. Apply a transform to a rectangle.
  8042. After the four corner points of the axis-aligned rectangle
  8043. have been transformed it may not longer be axis-aligned. So a
  8044. new axis-aligned rectangle is created covering at least the
  8045. area of the transformed rectangle.
  8046. transform: Transformation matrix to apply. See fz_concat,
  8047. fz_scale and fz_rotate for how to create a matrix.
  8048. rect: Rectangle to be transformed. The two special cases
  8049. fz_empty_rect and fz_infinite_rect, may be used but are
  8050. returned unchanged as expected.
  8051. */
  8052. FZ_FUNCTION FzRect fz_transform_rect(const FzMatrix& m);
  8053. /** Class-aware wrapper for `::fz_translate_rect()`. */
  8054. /**
  8055. Translate bounding box.
  8056. Translate a bbox by a given x and y offset. Allows for overflow.
  8057. */
  8058. FZ_FUNCTION FzRect fz_translate_rect(float xoff, float yoff);
  8059. /** Class-aware wrapper for `::fz_union_rect()`. */
  8060. /**
  8061. Compute union of two rectangles.
  8062. Given two rectangles, update the first to be the smallest
  8063. axis-aligned rectangle that encompasses both given rectangles.
  8064. If either rectangle is infinite then the union is also infinite.
  8065. If either rectangle is empty then the union is simply the
  8066. non-empty rectangle. Should both rectangles be empty, then the
  8067. union is also empty.
  8068. */
  8069. FZ_FUNCTION FzRect fz_union_rect(const FzRect& b);
  8070. /** Class-aware wrapper for `::pdf_signature_appearance_signed()`. */
  8071. FZ_FUNCTION FzDisplayList pdf_signature_appearance_signed(::fz_text_language lang, const FzImage& img, const char *left_text, const char *right_text, int include_logo);
  8072. /** Class-aware wrapper for `::pdf_signature_appearance_unsigned()`. */
  8073. FZ_FUNCTION FzDisplayList pdf_signature_appearance_unsigned(::fz_text_language lang);
  8074. /** Transforms *this using fz_transform_rect() with <m>. */
  8075. FZ_FUNCTION void transform(const FzMatrix& m);
  8076. /** Convenience method using fz_contains_rect(). */
  8077. FZ_FUNCTION bool contains(double x, double y);
  8078. /** Uses fz_contains_rect(*this, rhs). */
  8079. FZ_FUNCTION bool contains(FzRect& rhs);
  8080. /** Uses fz_is_empty_rect(). */
  8081. FZ_FUNCTION bool is_empty();
  8082. /** Updates *this using fz_union_rect(). */
  8083. FZ_FUNCTION void union_(FzRect& rhs);
  8084. /** Constructor using raw copy of pre-existing `::fz_rect`. */
  8085. FZ_FUNCTION FzRect(const ::fz_rect* internal);
  8086. /** Constructor using raw copy of pre-existing `::fz_rect`. */
  8087. FZ_FUNCTION FzRect(const ::fz_rect internal);
  8088. /** Access as underlying struct. */
  8089. FZ_FUNCTION ::fz_rect* internal();
  8090. /** Access as underlying struct. */
  8091. FZ_FUNCTION const ::fz_rect* internal() const;
  8092. #ifndef NDEBUG
  8093. /** Destructor only decrements s_num_instances. */
  8094. FZ_FUNCTION ~FzRect();
  8095. #else
  8096. /** We use default destructor. */
  8097. #endif
  8098. /* == Member data. */
  8099. /* These members are the same as the members of ::fz_rect. */
  8100. float x0;
  8101. float y0;
  8102. float x1;
  8103. float y1;
  8104. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8105. generate code regardless so we always need to have this available. */
  8106. FZ_DATA static int s_num_instances;
  8107. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  8108. FZ_FUNCTION std::string to_string();
  8109. /** Comparison method. */
  8110. FZ_FUNCTION bool operator==(const FzRect& rhs);
  8111. /** Comparison method. */
  8112. FZ_FUNCTION bool operator!=(const FzRect& rhs);
  8113. };
  8114. /** Wrapper class for struct `fz_separations`. */
  8115. struct FzSeparations
  8116. {
  8117. /** == Constructors. */
  8118. /** Constructor using `fz_new_separations()`. */
  8119. /**
  8120. Create a new separations structure (initially empty)
  8121. */
  8122. FZ_FUNCTION FzSeparations(int controllable);
  8123. /** Copy constructor using `fz_keep_separations()`. */
  8124. FZ_FUNCTION FzSeparations(const FzSeparations& rhs);
  8125. /** operator= using `fz_keep_separations()` and `fz_drop_separations()`. */
  8126. FZ_FUNCTION FzSeparations& operator=(const FzSeparations& rhs);
  8127. /* == Methods. */
  8128. /** Class-aware wrapper for `::fz_add_separation()`. */
  8129. /**
  8130. Add a separation (null terminated name, colorspace)
  8131. */
  8132. FZ_FUNCTION void fz_add_separation(const char *name, const FzColorspace& cs, int cs_channel) const;
  8133. /** Class-aware wrapper for `::fz_add_separation_equivalents()`. */
  8134. /**
  8135. Add a separation with equivalents (null terminated name,
  8136. colorspace)
  8137. (old, deprecated)
  8138. */
  8139. FZ_FUNCTION void fz_add_separation_equivalents(uint32_t rgba, uint32_t cmyk, const char *name) const;
  8140. /** Class-aware wrapper for `::fz_clone_separations_for_overprint()`. */
  8141. /**
  8142. Return a separations object with all the spots in the input
  8143. separations object that are set to composite, reset to be
  8144. enabled. If there ARE no spots in the object, this returns
  8145. NULL. If the object already has all its spots enabled, then
  8146. just returns another handle on the same object.
  8147. */
  8148. FZ_FUNCTION FzSeparations fz_clone_separations_for_overprint() const;
  8149. /** Class-aware wrapper for `::fz_compare_separations()`. */
  8150. /**
  8151. Compare 2 separations structures (or NULLs).
  8152. Return 0 if identical, non-zero if not identical.
  8153. */
  8154. FZ_FUNCTION int fz_compare_separations(const FzSeparations& sep2) const;
  8155. /** Class-aware wrapper for `::fz_count_active_separations()`. */
  8156. /**
  8157. Return the number of active separations.
  8158. */
  8159. FZ_FUNCTION int fz_count_active_separations() const;
  8160. /** Class-aware wrapper for `::fz_count_separations()`. */
  8161. FZ_FUNCTION int fz_count_separations() const;
  8162. /** Class-aware wrapper for `::fz_separation_equivalent()`.
  8163. This method has out-params. Python/C# wrappers look like:
  8164. `fz_separation_equivalent(int idx, ::fz_colorspace *dst_cs, ::fz_colorspace *prf, ::fz_color_params color_params)` => float dst_color
  8165. */
  8166. /**
  8167. Get the equivalent separation color in a given colorspace.
  8168. */
  8169. FZ_FUNCTION void fz_separation_equivalent(int idx, const FzColorspace& dst_cs, float *dst_color, const FzColorspace& prf, const FzColorParams& color_params) const;
  8170. /** Class-aware wrapper for `::fz_separation_name()`. */
  8171. FZ_FUNCTION const char *fz_separation_name(int separation) const;
  8172. /** Class-aware wrapper for `::fz_set_separation_behavior()`. */
  8173. /**
  8174. Control the rendering of a given separation.
  8175. */
  8176. FZ_FUNCTION void fz_set_separation_behavior(int separation, ::fz_separation_behavior behavior) const;
  8177. /** Constructor using raw copy of pre-existing `::fz_separations`. */
  8178. /* This constructor is marked as `explicit` because wrapper classes do not
  8179. call `keep`in constructors, but do call `drop` in destructors. So
  8180. automatic construction from a fz_separations* will generally cause an
  8181. unbalanced `drop` resulting in errors such as SEGV. */
  8182. FZ_FUNCTION explicit FzSeparations(::fz_separations* internal=NULL);
  8183. /** Destructor using fz_drop_separations(). */
  8184. FZ_FUNCTION ~FzSeparations();
  8185. /** Return numerical value of .m_internal; helps with Python debugging. */
  8186. FZ_FUNCTION long long m_internal_value();
  8187. /** Return true iff `m_internal` is not null. */
  8188. FZ_FUNCTION operator bool();
  8189. /* == Member data. */
  8190. /** Pointer to wrapped data. */
  8191. ::fz_separations* m_internal;
  8192. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8193. generate code regardless so we always need to have this available. */
  8194. FZ_DATA static int s_num_instances;
  8195. };
  8196. /** Wrapper class for struct `fz_sha256`. Not copyable or assignable. */
  8197. /**
  8198. Structure definition is public to enable stack
  8199. based allocation. Do not access the members directly.
  8200. */
  8201. struct FzSha256
  8202. {
  8203. /** Default constructor, sets `m_internal` to null. */
  8204. FZ_FUNCTION FzSha256();
  8205. /* == Methods. */
  8206. /** Class-aware wrapper for `::fz_sha256_final()`. */
  8207. /**
  8208. MD5 finalization. Ends an MD5 message-digest operation, writing
  8209. the message digest and zeroizing the context.
  8210. Never throws an exception.
  8211. */
  8212. FZ_FUNCTION void fz_sha256_final(unsigned char digest[32]) const;
  8213. /** Class-aware wrapper for `::fz_sha256_init()`. */
  8214. /**
  8215. SHA256 initialization. Begins an SHA256 operation, initialising
  8216. the supplied context.
  8217. Never throws an exception.
  8218. */
  8219. FZ_FUNCTION void fz_sha256_init() const;
  8220. /** Class-aware wrapper for `::fz_sha256_update()`. */
  8221. /**
  8222. SHA256 block update operation. Continues an SHA256 message-
  8223. digest operation, processing another message block, and updating
  8224. the context.
  8225. Never throws an exception.
  8226. */
  8227. FZ_FUNCTION void fz_sha256_update(const unsigned char *input, size_t inlen) const;
  8228. /** Constructor using raw copy of pre-existing `::fz_sha256`. */
  8229. FZ_FUNCTION FzSha256(::fz_sha256* internal);
  8230. #ifndef NDEBUG
  8231. /** Destructor only decrements s_num_instances. */
  8232. FZ_FUNCTION ~FzSha256();
  8233. #else
  8234. /** We use default destructor. */
  8235. #endif
  8236. /** Return numerical value of .m_internal; helps with Python debugging. */
  8237. FZ_FUNCTION long long m_internal_value();
  8238. /** Return true iff `m_internal` is not null. */
  8239. FZ_FUNCTION operator bool();
  8240. /* == Member data. */
  8241. /** Pointer to wrapped data. */
  8242. ::fz_sha256* m_internal;
  8243. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8244. generate code regardless so we always need to have this available. */
  8245. FZ_DATA static int s_num_instances;
  8246. private:
  8247. /** This class is not copyable or assignable. */
  8248. FzSha256(const FzSha256& rhs);
  8249. FzSha256& operator=(const FzSha256& rhs);
  8250. };
  8251. /** Wrapper class for struct `fz_sha384`. Not copyable or assignable. */
  8252. struct FzSha384
  8253. {
  8254. /** Default constructor, sets `m_internal` to null. */
  8255. FZ_FUNCTION FzSha384();
  8256. /** Constructor using raw copy of pre-existing `::fz_sha384`. */
  8257. FZ_FUNCTION FzSha384(::fz_sha384* internal);
  8258. #ifndef NDEBUG
  8259. /** Destructor only decrements s_num_instances. */
  8260. FZ_FUNCTION ~FzSha384();
  8261. #else
  8262. /** We use default destructor. */
  8263. #endif
  8264. /** Return numerical value of .m_internal; helps with Python debugging. */
  8265. FZ_FUNCTION long long m_internal_value();
  8266. /** Return true iff `m_internal` is not null. */
  8267. FZ_FUNCTION operator bool();
  8268. /* == Member data. */
  8269. /** Pointer to wrapped data. */
  8270. ::fz_sha384* m_internal;
  8271. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8272. generate code regardless so we always need to have this available. */
  8273. FZ_DATA static int s_num_instances;
  8274. private:
  8275. /** This class is not copyable or assignable. */
  8276. FzSha384(const FzSha384& rhs);
  8277. FzSha384& operator=(const FzSha384& rhs);
  8278. };
  8279. /** Wrapper class for struct `fz_sha512`. Not copyable or assignable. */
  8280. /**
  8281. Structure definition is public to enable stack
  8282. based allocation. Do not access the members directly.
  8283. */
  8284. struct FzSha512
  8285. {
  8286. /** Default constructor, sets `m_internal` to null. */
  8287. FZ_FUNCTION FzSha512();
  8288. /* == Methods. */
  8289. /** Class-aware wrapper for `::fz_sha384_final()`. */
  8290. /**
  8291. SHA384 finalization. Ends an SHA384 message-digest operation,
  8292. writing the message digest and zeroizing the context.
  8293. Never throws an exception.
  8294. */
  8295. FZ_FUNCTION void fz_sha384_final(unsigned char digest[64]) const;
  8296. /** Class-aware wrapper for `::fz_sha384_init()`. */
  8297. /**
  8298. SHA384 initialization. Begins an SHA384 operation, initialising
  8299. the supplied context.
  8300. Never throws an exception.
  8301. */
  8302. FZ_FUNCTION void fz_sha384_init() const;
  8303. /** Class-aware wrapper for `::fz_sha384_update()`. */
  8304. /**
  8305. SHA384 block update operation. Continues an SHA384 message-
  8306. digest operation, processing another message block, and updating
  8307. the context.
  8308. Never throws an exception.
  8309. */
  8310. FZ_FUNCTION void fz_sha384_update(const unsigned char *input, size_t inlen) const;
  8311. /** Class-aware wrapper for `::fz_sha512_final()`. */
  8312. /**
  8313. SHA512 finalization. Ends an SHA512 message-digest operation,
  8314. writing the message digest and zeroizing the context.
  8315. Never throws an exception.
  8316. */
  8317. FZ_FUNCTION void fz_sha512_final(unsigned char digest[64]) const;
  8318. /** Class-aware wrapper for `::fz_sha512_init()`. */
  8319. /**
  8320. SHA512 initialization. Begins an SHA512 operation, initialising
  8321. the supplied context.
  8322. Never throws an exception.
  8323. */
  8324. FZ_FUNCTION void fz_sha512_init() const;
  8325. /** Class-aware wrapper for `::fz_sha512_update()`. */
  8326. /**
  8327. SHA512 block update operation. Continues an SHA512 message-
  8328. digest operation, processing another message block, and updating
  8329. the context.
  8330. Never throws an exception.
  8331. */
  8332. FZ_FUNCTION void fz_sha512_update(const unsigned char *input, size_t inlen) const;
  8333. /** Constructor using raw copy of pre-existing `::fz_sha512`. */
  8334. FZ_FUNCTION FzSha512(::fz_sha512* internal);
  8335. #ifndef NDEBUG
  8336. /** Destructor only decrements s_num_instances. */
  8337. FZ_FUNCTION ~FzSha512();
  8338. #else
  8339. /** We use default destructor. */
  8340. #endif
  8341. /** Return numerical value of .m_internal; helps with Python debugging. */
  8342. FZ_FUNCTION long long m_internal_value();
  8343. /** Return true iff `m_internal` is not null. */
  8344. FZ_FUNCTION operator bool();
  8345. /* == Member data. */
  8346. /** Pointer to wrapped data. */
  8347. ::fz_sha512* m_internal;
  8348. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8349. generate code regardless so we always need to have this available. */
  8350. FZ_DATA static int s_num_instances;
  8351. private:
  8352. /** This class is not copyable or assignable. */
  8353. FzSha512(const FzSha512& rhs);
  8354. FzSha512& operator=(const FzSha512& rhs);
  8355. };
  8356. /** Wrapper class for struct `fz_shade`. */
  8357. /**
  8358. Structure is public to allow derived classes. Do not
  8359. access the members directly.
  8360. */
  8361. struct FzShade
  8362. {
  8363. /** Copy constructor using `fz_keep_shade()`. */
  8364. FZ_FUNCTION FzShade(const FzShade& rhs);
  8365. /** operator= using `fz_keep_shade()` and `fz_drop_shade()`. */
  8366. FZ_FUNCTION FzShade& operator=(const FzShade& rhs);
  8367. /** Default constructor, sets `m_internal` to null. */
  8368. FZ_FUNCTION FzShade();
  8369. /* == Methods. */
  8370. /** Class-aware wrapper for `::fz_bound_shade()`. */
  8371. /**
  8372. Bound a given shading.
  8373. shade: The shade to bound.
  8374. ctm: The transform to apply to the shade before bounding.
  8375. r: Pointer to storage to put the bounds in.
  8376. Returns r, updated to contain the bounds for the shading.
  8377. */
  8378. FZ_FUNCTION FzRect fz_bound_shade(const FzMatrix& ctm) const;
  8379. /** Class-aware wrapper for `::fz_paint_shade()`.
  8380. This method has out-params. Python/C# wrappers look like:
  8381. `fz_paint_shade(::fz_colorspace *override_cs, ::fz_matrix ctm, ::fz_pixmap *dest, ::fz_color_params color_params, ::fz_irect bbox, const ::fz_overprint *eop, ::fz_shade_color_cache **cache)` =>
  8382. */
  8383. /**
  8384. Render a shade to a given pixmap.
  8385. shade: The shade to paint.
  8386. override_cs: NULL, or colorspace to override the shades
  8387. inbuilt colorspace.
  8388. ctm: The transform to apply.
  8389. dest: The pixmap to render into.
  8390. color_params: The color rendering settings
  8391. bbox: Pointer to a bounding box to limit the rendering
  8392. of the shade.
  8393. eop: NULL, or pointer to overprint bitmap.
  8394. cache: *cache is used to cache color information. If *cache is NULL it
  8395. is set to point to a new fz_shade_color_cache. If cache is NULL it is
  8396. ignored.
  8397. */
  8398. FZ_FUNCTION void fz_paint_shade(const FzColorspace& override_cs, const FzMatrix& ctm, const FzPixmap& dest, const FzColorParams& color_params, const FzIrect& bbox, const FzOverprint& eop, FzShadeColorCache& cache) const;
  8399. /** Class-aware wrapper for `::fz_process_shade()`. */
  8400. /**
  8401. Process a shade, using supplied callback functions. This
  8402. decomposes the shading to a mesh (even ones that are not
  8403. natively meshes, such as linear or radial shadings), and
  8404. processes triangles from those meshes.
  8405. shade: The shade to process.
  8406. ctm: The transform to use
  8407. prepare: Callback function to 'prepare' each vertex.
  8408. This function is passed an array of floats, and populates
  8409. a fz_vertex structure.
  8410. process: This function is passed 3 pointers to vertex
  8411. structures, and actually performs the processing (typically
  8412. filling the area between the vertices).
  8413. process_arg: An opaque argument passed through from caller
  8414. to callback functions.
  8415. */
  8416. FZ_FUNCTION void fz_process_shade(const FzMatrix& ctm, const FzRect& scissor, ::fz_shade_prepare_fn *prepare, ::fz_shade_process_fn *process, void *process_arg) const;
  8417. /** Extra wrapper for fz_paint_shade(), passing cache=NULL. */
  8418. FZ_FUNCTION void fz_paint_shade_no_cache( const FzColorspace& override_cs, FzMatrix& ctm, const FzPixmap& dest, FzColorParams& color_params, FzIrect& bbox, const FzOverprint& eop);
  8419. /** Constructor using raw copy of pre-existing `::fz_shade`. */
  8420. /* This constructor is marked as `explicit` because wrapper classes do not
  8421. call `keep`in constructors, but do call `drop` in destructors. So
  8422. automatic construction from a fz_shade* will generally cause an
  8423. unbalanced `drop` resulting in errors such as SEGV. */
  8424. FZ_FUNCTION explicit FzShade(::fz_shade* internal);
  8425. /** Destructor using fz_drop_shade(). */
  8426. FZ_FUNCTION ~FzShade();
  8427. /** Return numerical value of .m_internal; helps with Python debugging. */
  8428. FZ_FUNCTION long long m_internal_value();
  8429. /** Return true iff `m_internal` is not null. */
  8430. FZ_FUNCTION operator bool();
  8431. /* == Member data. */
  8432. /** Pointer to wrapped data. */
  8433. ::fz_shade* m_internal;
  8434. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8435. generate code regardless so we always need to have this available. */
  8436. FZ_DATA static int s_num_instances;
  8437. };
  8438. /** Wrapper class for struct `fz_shade_color_cache`. Not copyable or assignable. */
  8439. struct FzShadeColorCache
  8440. {
  8441. /** Default constructor, sets `m_internal` to null. */
  8442. FZ_FUNCTION FzShadeColorCache();
  8443. /** Constructor using raw copy of pre-existing `::fz_shade_color_cache`. */
  8444. FZ_FUNCTION FzShadeColorCache(::fz_shade_color_cache* internal);
  8445. /** Destructor using fz_drop_shade_color_cache(). */
  8446. FZ_FUNCTION ~FzShadeColorCache();
  8447. /** Return numerical value of .m_internal; helps with Python debugging. */
  8448. FZ_FUNCTION long long m_internal_value();
  8449. /** Return true iff `m_internal` is not null. */
  8450. FZ_FUNCTION operator bool();
  8451. /* == Member data. */
  8452. /** Pointer to wrapped data. */
  8453. ::fz_shade_color_cache* m_internal;
  8454. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8455. generate code regardless so we always need to have this available. */
  8456. FZ_DATA static int s_num_instances;
  8457. private:
  8458. /** This class is not copyable or assignable. */
  8459. FzShadeColorCache(const FzShadeColorCache& rhs);
  8460. FzShadeColorCache& operator=(const FzShadeColorCache& rhs);
  8461. };
  8462. /** Wrapper class for struct `fz_shaper_data_t`. Not copyable or assignable. */
  8463. /**
  8464. In order to shape a given font, we need to
  8465. declare it to a shaper library (harfbuzz, by default, but others
  8466. are possible). To avoid redeclaring it every time we need to
  8467. shape, we hold a shaper handle and the destructor for it within
  8468. the font itself. The handle is initialised by the caller when
  8469. first required and the destructor is called when the fz_font is
  8470. destroyed.
  8471. */
  8472. struct FzShaperDataT
  8473. {
  8474. /** Default constructor, sets `m_internal` to null. */
  8475. FZ_FUNCTION FzShaperDataT();
  8476. /** Constructor using raw copy of pre-existing `::fz_shaper_data_t`. */
  8477. FZ_FUNCTION FzShaperDataT(::fz_shaper_data_t* internal);
  8478. #ifndef NDEBUG
  8479. /** Destructor only decrements s_num_instances. */
  8480. FZ_FUNCTION ~FzShaperDataT();
  8481. #else
  8482. /** We use default destructor. */
  8483. #endif
  8484. /** Return numerical value of .m_internal; helps with Python debugging. */
  8485. FZ_FUNCTION long long m_internal_value();
  8486. /** Return true iff `m_internal` is not null. */
  8487. FZ_FUNCTION operator bool();
  8488. /* == Member data. */
  8489. /** Pointer to wrapped data. */
  8490. ::fz_shaper_data_t* m_internal;
  8491. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8492. generate code regardless so we always need to have this available. */
  8493. FZ_DATA static int s_num_instances;
  8494. private:
  8495. /** This class is not copyable or assignable. */
  8496. FzShaperDataT(const FzShaperDataT& rhs);
  8497. FzShaperDataT& operator=(const FzShaperDataT& rhs);
  8498. };
  8499. struct FzStextBlockIterator;
  8500. /** Wrapper class for struct `fz_stext_block`. */
  8501. struct FzStextBlock
  8502. {
  8503. /** == Constructors. */
  8504. /** Constructor using `fz_new_stext_struct()`. */
  8505. FZ_FUNCTION FzStextBlock(const FzStextPage& page, ::fz_structure standard, const char *raw, int index);
  8506. /** We use default copy constructor and operator=. */
  8507. /** Default constructor, sets `m_internal` to null. */
  8508. FZ_FUNCTION FzStextBlock();
  8509. /* == Methods. */
  8510. /** Returns m_internal.u.i.transform if m_internal->type is FZ_STEXT_BLOCK_IMAGE, else throws. */
  8511. FZ_FUNCTION FzMatrix i_transform();
  8512. /** Returns m_internal.u.i.image if m_internal->type is FZ_STEXT_BLOCK_IMAGE, else throws. */
  8513. FZ_FUNCTION FzImage i_image();
  8514. /** Used for iteration over linked list of FzStextLine items starting at fz_stext_line::u.t.first_line. */
  8515. FZ_FUNCTION FzStextBlockIterator begin();
  8516. /** Used for iteration over linked list of FzStextLine items starting at fz_stext_line::u.t.first_line. */
  8517. FZ_FUNCTION FzStextBlockIterator end();
  8518. /** Constructor using raw copy of pre-existing `::fz_stext_block`. */
  8519. FZ_FUNCTION FzStextBlock(::fz_stext_block* internal);
  8520. #ifndef NDEBUG
  8521. /** Destructor only decrements s_num_instances. */
  8522. FZ_FUNCTION ~FzStextBlock();
  8523. #else
  8524. /** We use default destructor. */
  8525. #endif
  8526. /** Return numerical value of .m_internal; helps with Python debugging. */
  8527. FZ_FUNCTION long long m_internal_value();
  8528. /** Return true iff `m_internal` is not null. */
  8529. FZ_FUNCTION operator bool();
  8530. /* == Member data. */
  8531. /** Pointer to wrapped data. */
  8532. ::fz_stext_block* m_internal;
  8533. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8534. generate code regardless so we always need to have this available. */
  8535. FZ_DATA static int s_num_instances;
  8536. typedef FzStextBlockIterator iterator;
  8537. };
  8538. /** Wrapper class for struct `fz_stext_char`. */
  8539. /**
  8540. Text extraction device: Used for searching, format conversion etc.
  8541. (In development - Subject to change in future versions)
  8542. */
  8543. struct FzStextChar
  8544. {
  8545. /** We use default copy constructor and operator=. */
  8546. /** Default constructor, sets `m_internal` to null. */
  8547. FZ_FUNCTION FzStextChar();
  8548. /** Constructor using raw copy of pre-existing `::fz_stext_char`. */
  8549. FZ_FUNCTION FzStextChar(::fz_stext_char* internal);
  8550. #ifndef NDEBUG
  8551. /** Destructor only decrements s_num_instances. */
  8552. FZ_FUNCTION ~FzStextChar();
  8553. #else
  8554. /** We use default destructor. */
  8555. #endif
  8556. /** Return numerical value of .m_internal; helps with Python debugging. */
  8557. FZ_FUNCTION long long m_internal_value();
  8558. /** Return true iff `m_internal` is not null. */
  8559. FZ_FUNCTION operator bool();
  8560. /* == Member data. */
  8561. /** Pointer to wrapped data. */
  8562. ::fz_stext_char* m_internal;
  8563. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8564. generate code regardless so we always need to have this available. */
  8565. FZ_DATA static int s_num_instances;
  8566. };
  8567. /** Wrapper class for struct `fz_stext_grid_positions`. Not copyable or assignable. */
  8568. struct FzStextGridPositions
  8569. {
  8570. /** Default constructor, sets `m_internal` to null. */
  8571. FZ_FUNCTION FzStextGridPositions();
  8572. /** Constructor using raw copy of pre-existing `::fz_stext_grid_positions`. */
  8573. FZ_FUNCTION FzStextGridPositions(::fz_stext_grid_positions* internal);
  8574. #ifndef NDEBUG
  8575. /** Destructor only decrements s_num_instances. */
  8576. FZ_FUNCTION ~FzStextGridPositions();
  8577. #else
  8578. /** We use default destructor. */
  8579. #endif
  8580. /** Return numerical value of .m_internal; helps with Python debugging. */
  8581. FZ_FUNCTION long long m_internal_value();
  8582. /** Return true iff `m_internal` is not null. */
  8583. FZ_FUNCTION operator bool();
  8584. /* == Member data. */
  8585. /** Pointer to wrapped data. */
  8586. ::fz_stext_grid_positions* m_internal;
  8587. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8588. generate code regardless so we always need to have this available. */
  8589. FZ_DATA static int s_num_instances;
  8590. private:
  8591. /** This class is not copyable or assignable. */
  8592. FzStextGridPositions(const FzStextGridPositions& rhs);
  8593. FzStextGridPositions& operator=(const FzStextGridPositions& rhs);
  8594. };
  8595. struct FzStextLineIterator;
  8596. /** Wrapper class for struct `fz_stext_line`. */
  8597. struct FzStextLine
  8598. {
  8599. /** We use default copy constructor and operator=. */
  8600. /** Default constructor, sets `m_internal` to null. */
  8601. FZ_FUNCTION FzStextLine();
  8602. /* == Methods. */
  8603. /** Used for iteration over linked list of FzStextChar items starting at fz_stext_char::first_char. */
  8604. FZ_FUNCTION FzStextLineIterator begin();
  8605. /** Used for iteration over linked list of FzStextChar items starting at fz_stext_char::first_char. */
  8606. FZ_FUNCTION FzStextLineIterator end();
  8607. /** Constructor using raw copy of pre-existing `::fz_stext_line`. */
  8608. FZ_FUNCTION FzStextLine(::fz_stext_line* internal);
  8609. #ifndef NDEBUG
  8610. /** Destructor only decrements s_num_instances. */
  8611. FZ_FUNCTION ~FzStextLine();
  8612. #else
  8613. /** We use default destructor. */
  8614. #endif
  8615. /** Return numerical value of .m_internal; helps with Python debugging. */
  8616. FZ_FUNCTION long long m_internal_value();
  8617. /** Return true iff `m_internal` is not null. */
  8618. FZ_FUNCTION operator bool();
  8619. /* == Member data. */
  8620. /** Pointer to wrapped data. */
  8621. ::fz_stext_line* m_internal;
  8622. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8623. generate code regardless so we always need to have this available. */
  8624. FZ_DATA static int s_num_instances;
  8625. typedef FzStextLineIterator iterator;
  8626. };
  8627. /** Wrapper class for struct `fz_stext_options`. */
  8628. /**
  8629. Options for creating structured text.
  8630. */
  8631. struct FzStextOptions
  8632. {
  8633. /** Construct with .flags, .scale but no clip. */
  8634. FZ_FUNCTION FzStextOptions(int flags, float scale=1.0);
  8635. /** Construct with .flags, .scale and .clip; FZ_STEXT_CLIP_RECT
  8636. is automatically set in .flags. */
  8637. FZ_FUNCTION FzStextOptions(int flags, fz_rect clip, float scale=1.0);
  8638. /** We use default copy constructor and operator=. */
  8639. /** Default constructor, sets each member to default value. */
  8640. FZ_FUNCTION FzStextOptions();
  8641. /* == Methods. */
  8642. /** Class-aware wrapper for `::fz_parse_stext_options()`. */
  8643. /**
  8644. Parse stext device options from a comma separated key-value
  8645. string.
  8646. */
  8647. FZ_FUNCTION FzStextOptions fz_parse_stext_options(const char *string);
  8648. /** Constructor using raw copy of pre-existing `::fz_stext_options`. */
  8649. FZ_FUNCTION FzStextOptions(const ::fz_stext_options* internal);
  8650. /** Constructor using raw copy of pre-existing `::fz_stext_options`. */
  8651. FZ_FUNCTION FzStextOptions(const ::fz_stext_options internal);
  8652. /** Access as underlying struct. */
  8653. FZ_FUNCTION ::fz_stext_options* internal();
  8654. /** Access as underlying struct. */
  8655. FZ_FUNCTION const ::fz_stext_options* internal() const;
  8656. #ifndef NDEBUG
  8657. /** Destructor only decrements s_num_instances. */
  8658. FZ_FUNCTION ~FzStextOptions();
  8659. #else
  8660. /** We use default destructor. */
  8661. #endif
  8662. /* == Member data. */
  8663. /* These members are the same as the members of ::fz_stext_options. */
  8664. int flags;
  8665. float scale;
  8666. ::fz_rect clip;
  8667. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8668. generate code regardless so we always need to have this available. */
  8669. FZ_DATA static int s_num_instances;
  8670. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  8671. FZ_FUNCTION std::string to_string();
  8672. /** Comparison method. */
  8673. FZ_FUNCTION bool operator==(const FzStextOptions& rhs);
  8674. /** Comparison method. */
  8675. FZ_FUNCTION bool operator!=(const FzStextOptions& rhs);
  8676. };
  8677. struct FzStextPageIterator;
  8678. /** Wrapper class for struct `fz_stext_page`. Not copyable or assignable. */
  8679. /**
  8680. A text page is a list of blocks, together with an overall
  8681. bounding box.
  8682. The name of this structure is now slightly out of date. It
  8683. should really be fz_stext_document, cos it can contain
  8684. content from multiple pages.
  8685. */
  8686. struct FzStextPage
  8687. {
  8688. /** == Constructors. */
  8689. /** Constructor using `fz_new_stext_page()`. */
  8690. /**
  8691. Create an empty text page.
  8692. The text page is filled out by the text device to contain the
  8693. blocks and lines of text on the page.
  8694. mediabox: optional mediabox information.
  8695. */
  8696. FZ_FUNCTION FzStextPage(const FzRect& mediabox);
  8697. /** Constructor using `fz_new_stext_page_from_chapter_page_number()`. */
  8698. FZ_FUNCTION FzStextPage(const FzDocument& doc, int chapter, int number, FzStextOptions& options);
  8699. /** Constructor using `fz_new_stext_page_from_display_list()`. */
  8700. FZ_FUNCTION FzStextPage(const FzDisplayList& list, FzStextOptions& options);
  8701. /** Constructor using `fz_new_stext_page_from_page()`. */
  8702. /**
  8703. Extract text from page.
  8704. Ownership of the fz_stext_page is returned to the caller.
  8705. */
  8706. FZ_FUNCTION FzStextPage(const FzPage& page, FzStextOptions& options);
  8707. /** Constructor using `fz_new_stext_page_from_page_number()`. */
  8708. FZ_FUNCTION FzStextPage(const FzDocument& doc, int number, FzStextOptions& options);
  8709. /** Constructor using `pdf_new_stext_page_from_annot()`. */
  8710. FZ_FUNCTION FzStextPage(const PdfAnnot& annot, FzStextOptions& options);
  8711. /** Default constructor, sets `m_internal` to null. */
  8712. FZ_FUNCTION FzStextPage();
  8713. /* == Methods. */
  8714. /** Class-aware wrapper for `::fz_classify_stext_rect()`. */
  8715. FZ_FUNCTION void fz_classify_stext_rect(::fz_structure classification, const FzRect& rect) const;
  8716. /** Class-aware wrapper for `::fz_find_table_within_bounds()`. */
  8717. /**
  8718. Interpret the bounded contents of a given stext page as
  8719. a table.
  8720. The page contents will be rewritten to contain a Table
  8721. structure with the identified content in it.
  8722. This uses the same logic as for fz_table_hunt, without the
  8723. actual hunting. fz_table_hunt hunts to find possible bounds
  8724. for multiple tables on the page; this routine just finds a
  8725. single table contained within the given rectangle.
  8726. Returns the stext_block list that contains the content of
  8727. the table.
  8728. */
  8729. FZ_FUNCTION FzStextBlock fz_find_table_within_bounds(const FzRect& bounds) const;
  8730. /** Class-aware wrapper for `::fz_highlight_selection()`. */
  8731. /**
  8732. Return a list of quads to highlight lines inside the selection
  8733. points.
  8734. */
  8735. FZ_FUNCTION int fz_highlight_selection(const FzPoint& a, const FzPoint& b, FzQuad& quads, int max_quads) const;
  8736. /** Class-aware wrapper for `::fz_highlight_selection2()`. */
  8737. /**
  8738. C++ alternative to fz_highlight_selection() that returns quads in a
  8739. std::vector.
  8740. */
  8741. FZ_FUNCTION std::vector<fz_quad> fz_highlight_selection2(const FzPoint& a, const FzPoint& b, int max_quads) const;
  8742. /** Class-aware wrapper for `::fz_new_buffer_from_stext_page()`. */
  8743. /**
  8744. Convert structured text into plain text.
  8745. */
  8746. FZ_FUNCTION FzBuffer fz_new_buffer_from_stext_page() const;
  8747. /** Class-aware wrapper for `::fz_new_stext_device()`. */
  8748. /**
  8749. Create a device to extract the text on a page.
  8750. Gather the text on a page into blocks and lines.
  8751. The reading order is taken from the order the text is drawn in
  8752. the source file, so may not be accurate.
  8753. page: The text page to which content should be added. This will
  8754. usually be a newly created (empty) text page, but it can be one
  8755. containing data already (for example when merging multiple
  8756. pages, or watermarking).
  8757. options: Options to configure the stext device.
  8758. */
  8759. FZ_FUNCTION FzDevice fz_new_stext_device(FzStextOptions& options) const;
  8760. /** Class-aware wrapper for `::fz_new_stext_device_for_page()`. */
  8761. /**
  8762. Create a device to extract the text on a page into an existing
  8763. fz_stext_page structure.
  8764. Gather the text on a page into blocks and lines.
  8765. The reading order is taken from the order the text is drawn in
  8766. the source file, so may not be accurate.
  8767. stext_page: The text page to which content should be added. This will
  8768. usually be a newly created (empty) text page, but it can be one
  8769. containing data already (for example when merging multiple
  8770. pages, or watermarking).
  8771. options: Options to configure the stext device.
  8772. The next 2 parameters are copied into the fz_stext_page structure's
  8773. ids section, so only have to be valid if you expect to interrogate
  8774. that section later.
  8775. chapter_num: The chapter number that this page came from.
  8776. page_num: The page number that this page came from.
  8777. The final parameter is copied into the fz_stext_page structure's
  8778. ids section. The mediabox for the enture fz_stext_page is unioned
  8779. with this, so pass fz_empty_bbox if you don't care about getting
  8780. a valid value back from the ids section, but you don't want to
  8781. upset the value in the page->mediabox field.
  8782. mediabox: The mediabox for this page.
  8783. */
  8784. FZ_FUNCTION FzDevice fz_new_stext_device_for_page(FzStextOptions& opts, int chapter_num, int page_num, const FzRect& mediabox) const;
  8785. /** Class-aware wrapper for `::fz_new_stext_struct()`. */
  8786. FZ_FUNCTION FzStextBlock fz_new_stext_struct(::fz_structure standard, const char *raw, int index) const;
  8787. /** Class-aware wrapper for `::fz_paragraph_break()`. */
  8788. /**
  8789. Attempt to break paragraphs at plausible places.
  8790. */
  8791. FZ_FUNCTION void fz_paragraph_break() const;
  8792. /** Class-aware wrapper for `::fz_search_stext_page()`.
  8793. This method has out-params. Python/C# wrappers look like:
  8794. `fz_search_stext_page(const char *needle, ::fz_quad *hit_bbox, int hit_max)` => `(int, int hit_mark)`
  8795. */
  8796. /**
  8797. Search for occurrence of 'needle' in text page.
  8798. Return the number of quads and store hit quads in the passed in
  8799. array.
  8800. NOTE: This is an experimental interface and subject to change
  8801. without notice.
  8802. */
  8803. FZ_FUNCTION int fz_search_stext_page(const char *needle, int *hit_mark, FzQuad& hit_bbox, int hit_max) const;
  8804. /** Class-aware wrapper for `::fz_search_stext_page_cb()`. */
  8805. /**
  8806. Search for occurrence of 'needle' in text page.
  8807. Call callback once for each hit. This callback will receive
  8808. (potentially) multiple quads for each hit.
  8809. Returns the number of hits - note that this is potentially
  8810. different from (i.e. is not greater than) the number of quads
  8811. as returned by the non callback API.
  8812. NOTE: This is an experimental interface and subject to change
  8813. without notice.
  8814. */
  8815. FZ_FUNCTION int fz_search_stext_page_cb(const char *needle, ::fz_search_callback_fn *cb, void *opaque) const;
  8816. /** Class-aware wrapper for `::fz_segment_stext_page()`. */
  8817. /**
  8818. Perform segmentation analysis on an (unstructured) page to look for
  8819. recursive subdivisions.
  8820. Essentially this code attempts to split the page horizontally and/or
  8821. vertically repeatedly into smaller and smaller "segments" (divisions).
  8822. This minimises the reordering of the content, but some reordering
  8823. may be unavoidable.
  8824. Returns 0 if no changes were made to the document.
  8825. This is experimental code, and may change (or be removed) in future
  8826. versions!
  8827. */
  8828. FZ_FUNCTION int fz_segment_stext_page() const;
  8829. /** Class-aware wrapper for `::fz_segment_stext_rect()`. */
  8830. /**
  8831. Perform segmentation analysis on a rectangle of a given
  8832. stext page.
  8833. Like fz_segment_stext_page, this attempts to split the given page
  8834. region horizontally and/or vertically repeatedly into smaller and
  8835. smaller "segments".
  8836. This works for pages with structure too, but splitting with
  8837. rectangles that cut across structure blocks may not behave as
  8838. expected.
  8839. This minimises the reordering of the content (as viewed from the
  8840. perspective of a depth first traversal), but some reordering may
  8841. be unavoidable.
  8842. This function accepts smaller gaps for segmentation than the full
  8843. page segmentation does.
  8844. Returns 0 if no changes were made to the document.
  8845. This is experimental code, and may change (or be removed) in future
  8846. versions!
  8847. */
  8848. FZ_FUNCTION int fz_segment_stext_rect(const FzRect& rect) const;
  8849. /** Class-aware wrapper for `::fz_snap_selection()`. */
  8850. FZ_FUNCTION FzQuad fz_snap_selection(FzPoint& ap, FzPoint& bp, int mode) const;
  8851. /** Class-aware wrapper for `::fz_stext_remove_page_fill()`. */
  8852. FZ_FUNCTION int fz_stext_remove_page_fill() const;
  8853. /** Class-aware wrapper for `::fz_table_hunt()`. */
  8854. /**
  8855. Hunt for possible tables on a page, and update the stext with
  8856. information.
  8857. */
  8858. FZ_FUNCTION void fz_table_hunt() const;
  8859. /** Class-aware wrapper for `::fz_table_hunt_within_bounds()`. */
  8860. /**
  8861. Hunt for possible tables within a specific rect on a page, and
  8862. update the stext with information.
  8863. */
  8864. FZ_FUNCTION void fz_table_hunt_within_bounds(const FzRect& bounds) const;
  8865. /** Wrapper for fz_copy_selection() that returns std::string. */
  8866. FZ_FUNCTION std::string fz_copy_selection(FzPoint& a, FzPoint& b, int crlf);
  8867. /** Wrapper for fz_copy_rectangle() that returns a std::string. */
  8868. FZ_FUNCTION std::string fz_copy_rectangle(FzRect& area, int crlf);
  8869. /** Wrapper for fz_search_stext_page() that returns std::vector of Quads. */
  8870. FZ_FUNCTION std::vector<FzQuad> search_stext_page(const char* needle, int *hit_mark, int max_quads);
  8871. /** Used for iteration over linked list of FzStextBlock items starting at fz_stext_block::first_block. */
  8872. FZ_FUNCTION FzStextPageIterator begin();
  8873. /** Used for iteration over linked list of FzStextBlock items starting at fz_stext_block::first_block. */
  8874. FZ_FUNCTION FzStextPageIterator end();
  8875. /** Constructor using raw copy of pre-existing `::fz_stext_page`. */
  8876. /* This constructor is marked as `explicit` because wrapper classes do not
  8877. call `keep`in constructors, but do call `drop` in destructors. So
  8878. automatic construction from a fz_stext_page* will generally cause an
  8879. unbalanced `drop` resulting in errors such as SEGV. */
  8880. FZ_FUNCTION explicit FzStextPage(::fz_stext_page* internal);
  8881. /** Destructor using fz_drop_stext_page(). */
  8882. FZ_FUNCTION ~FzStextPage();
  8883. /** Return numerical value of .m_internal; helps with Python debugging. */
  8884. FZ_FUNCTION long long m_internal_value();
  8885. /** Return true iff `m_internal` is not null. */
  8886. FZ_FUNCTION operator bool();
  8887. /* == Member data. */
  8888. /** Pointer to wrapped data. */
  8889. ::fz_stext_page* m_internal;
  8890. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8891. generate code regardless so we always need to have this available. */
  8892. FZ_DATA static int s_num_instances;
  8893. typedef FzStextPageIterator iterator;
  8894. private:
  8895. /** This class is not copyable or assignable. */
  8896. FzStextPage(const FzStextPage& rhs);
  8897. FzStextPage& operator=(const FzStextPage& rhs);
  8898. };
  8899. /** Wrapper class for struct `fz_stext_page_block_iterator`. Not copyable or assignable. */
  8900. struct FzStextPageBlockIterator
  8901. {
  8902. /** Default constructor, sets `m_internal` to null. */
  8903. FZ_FUNCTION FzStextPageBlockIterator();
  8904. /* == Methods. */
  8905. /** Class-aware wrapper for `::fz_stext_page_block_iterator_eod()`. */
  8906. FZ_FUNCTION int fz_stext_page_block_iterator_eod() const;
  8907. /** Class-aware wrapper for `::fz_stext_page_block_iterator_eod_dfs()`. */
  8908. FZ_FUNCTION int fz_stext_page_block_iterator_eod_dfs() const;
  8909. /** Constructor using raw copy of pre-existing `::fz_stext_page_block_iterator`. */
  8910. FZ_FUNCTION FzStextPageBlockIterator(::fz_stext_page_block_iterator* internal);
  8911. #ifndef NDEBUG
  8912. /** Destructor only decrements s_num_instances. */
  8913. FZ_FUNCTION ~FzStextPageBlockIterator();
  8914. #else
  8915. /** We use default destructor. */
  8916. #endif
  8917. /** Return numerical value of .m_internal; helps with Python debugging. */
  8918. FZ_FUNCTION long long m_internal_value();
  8919. /** Return true iff `m_internal` is not null. */
  8920. FZ_FUNCTION operator bool();
  8921. /* == Member data. */
  8922. /** Pointer to wrapped data. */
  8923. ::fz_stext_page_block_iterator* m_internal;
  8924. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  8925. generate code regardless so we always need to have this available. */
  8926. FZ_DATA static int s_num_instances;
  8927. private:
  8928. /** This class is not copyable or assignable. */
  8929. FzStextPageBlockIterator(const FzStextPageBlockIterator& rhs);
  8930. FzStextPageBlockIterator& operator=(const FzStextPageBlockIterator& rhs);
  8931. };
  8932. /** Wrapper class for struct `fz_stext_page_details`. Not copyable or assignable. */
  8933. /**
  8934. * A note on stext's handling of structure.
  8935. *
  8936. * A PDF document can contain a structure tree. This gives the
  8937. * structure of a document in its entirety as a tree. e.g.
  8938. *
  8939. * Tree MCID INDEX
  8940. * -------------------------------------
  8941. * DOC 0 0
  8942. * TOC 1 0
  8943. * TOC_ITEM 2 0
  8944. * TOC_ITEM 3 1
  8945. * TOC_ITEM 4 2
  8946. * ...
  8947. * STORY 100 1
  8948. * SECTION 101 0
  8949. * HEADING 102 0
  8950. * SUBSECTION 103 1
  8951. * PARAGRAPH 104 0
  8952. * PARAGRAPH 105 1
  8953. * PARAGRAPH 106 2
  8954. * SUBSECTION 107 2
  8955. * PARAGRAPH 108 0
  8956. * PARAGRAPH 109 1
  8957. * PARAGRAPH 110 2
  8958. * ...
  8959. * SECTION 200 1
  8960. * ...
  8961. *
  8962. * Each different section of the tree is identified as part of an
  8963. * MCID by a number (this is a slight simplification, but makes the
  8964. * explanation easier).
  8965. *
  8966. * The PDF document contains markings that say "Entering MCID 0"
  8967. * and "Leaving MCID 0". Any content within that region is therefore
  8968. * identified as appearing in that particular structural region.
  8969. *
  8970. * This means that content can be sent in the document in a different
  8971. * order to which it appears 'logically' in the tree.
  8972. *
  8973. * MuPDF converts this tree form into a nested series of calls to
  8974. * begin_structure and end_structure.
  8975. *
  8976. * For instance, if the document started out with MCID 100, then
  8977. * we'd send:
  8978. * begin_structure("DOC")
  8979. * begin_structure("STORY")
  8980. *
  8981. * The problem with this is that if we send:
  8982. * begin_structure("DOC")
  8983. * begin_structure("STORY")
  8984. * begin_structure("SECTION")
  8985. * begin_structure("SUBSECTION")
  8986. *
  8987. * or
  8988. * begin_structure("DOC")
  8989. * begin_structure("STORY")
  8990. * begin_structure("SECTION")
  8991. * begin_structure("HEADING")
  8992. *
  8993. * How do I know what order the SECTION and HEADING should appear in?
  8994. * Are they even in the same STORY? Or the same DOC?
  8995. *
  8996. * Accordingly, every begin_structure is accompanied not only with the
  8997. * node type, but with an index. The index is the number of this node
  8998. * within this level of the tree. Hence:
  8999. *
  9000. * begin_structure("DOC", 0)
  9001. * begin_structure("STORY", 0)
  9002. * begin_structure("SECTION", 0)
  9003. * begin_structure("HEADING", 0)
  9004. * and
  9005. * begin_structure("DOC", 0)
  9006. * begin_structure("STORY", 0)
  9007. * begin_structure("SECTION", 0)
  9008. * begin_structure("SUBSECTION", 1)
  9009. *
  9010. * are now unambiguous in their describing of the tree.
  9011. *
  9012. * MuPDF automatically sends the minimal end_structure/begin_structure
  9013. * pairs to move us between nodes in the tree.
  9014. *
  9015. * In order to accommodate this information within the structured text
  9016. * data structures an additional block type is used. Previously a
  9017. * "page" was just a list of blocks, either text or images. e.g.
  9018. *
  9019. * [BLOCK:TEXT] <-> [BLOCK:IMG] <-> [BLOCK:TEXT] <-> [BLOCK:TEXT] ...
  9020. *
  9021. * We now introduce a new type of block, STRUCT, that turns this into
  9022. * a tree:
  9023. *
  9024. * [BLOCK:TEXT] <-> [BLOCK:STRUCT(IDX=0)] <-> [BLOCK:TEXT] <-> ...
  9025. * /|\
  9026. * [STRUCT:TYPE=DOC] <----
  9027. * |
  9028. * [BLOCK:TEXT] <-> [BLOCK:STRUCT(IDX=0)] <-> [BLOCK:TEXT] <-> ...
  9029. * /|\
  9030. * [STRUCT:TYPE=STORY] <--
  9031. * |
  9032. * ...
  9033. *
  9034. * Rather than doing a simple linear traversal of the list to extract
  9035. * the logical data, a caller now has to do a depth-first traversal.
  9036. */
  9037. struct FzStextPageDetails
  9038. {
  9039. /** Default constructor, sets `m_internal` to null. */
  9040. FZ_FUNCTION FzStextPageDetails();
  9041. /** Constructor using raw copy of pre-existing `::fz_stext_page_details`. */
  9042. FZ_FUNCTION FzStextPageDetails(::fz_stext_page_details* internal);
  9043. #ifndef NDEBUG
  9044. /** Destructor only decrements s_num_instances. */
  9045. FZ_FUNCTION ~FzStextPageDetails();
  9046. #else
  9047. /** We use default destructor. */
  9048. #endif
  9049. /** Return numerical value of .m_internal; helps with Python debugging. */
  9050. FZ_FUNCTION long long m_internal_value();
  9051. /** Return true iff `m_internal` is not null. */
  9052. FZ_FUNCTION operator bool();
  9053. /* == Member data. */
  9054. /** Pointer to wrapped data. */
  9055. ::fz_stext_page_details* m_internal;
  9056. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9057. generate code regardless so we always need to have this available. */
  9058. FZ_DATA static int s_num_instances;
  9059. private:
  9060. /** This class is not copyable or assignable. */
  9061. FzStextPageDetails(const FzStextPageDetails& rhs);
  9062. FzStextPageDetails& operator=(const FzStextPageDetails& rhs);
  9063. };
  9064. /** Wrapper class for struct `fz_stext_struct`. Not copyable or assignable. */
  9065. struct FzStextStruct
  9066. {
  9067. /** Default constructor, sets `m_internal` to null. */
  9068. FZ_FUNCTION FzStextStruct();
  9069. /** Constructor using raw copy of pre-existing `::fz_stext_struct`. */
  9070. FZ_FUNCTION FzStextStruct(::fz_stext_struct* internal);
  9071. #ifndef NDEBUG
  9072. /** Destructor only decrements s_num_instances. */
  9073. FZ_FUNCTION ~FzStextStruct();
  9074. #else
  9075. /** We use default destructor. */
  9076. #endif
  9077. /** Return numerical value of .m_internal; helps with Python debugging. */
  9078. FZ_FUNCTION long long m_internal_value();
  9079. /** Return true iff `m_internal` is not null. */
  9080. FZ_FUNCTION operator bool();
  9081. /* == Member data. */
  9082. /** Pointer to wrapped data. */
  9083. ::fz_stext_struct* m_internal;
  9084. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9085. generate code regardless so we always need to have this available. */
  9086. FZ_DATA static int s_num_instances;
  9087. private:
  9088. /** This class is not copyable or assignable. */
  9089. FzStextStruct(const FzStextStruct& rhs);
  9090. FzStextStruct& operator=(const FzStextStruct& rhs);
  9091. };
  9092. /** Wrapper class for struct `fz_storable`. */
  9093. /**
  9094. Resource store
  9095. MuPDF stores decoded "objects" into a store for potential reuse.
  9096. If the size of the store gets too big, objects stored within it
  9097. can be evicted and freed to recover space. When MuPDF comes to
  9098. decode such an object, it will check to see if a version of this
  9099. object is already in the store - if it is, it will simply reuse
  9100. it. If not, it will decode it and place it into the store.
  9101. All objects that can be placed into the store are derived from
  9102. the fz_storable type (i.e. this should be the first component of
  9103. the objects structure). This allows for consistent (thread safe)
  9104. reference counting, and includes a function that will be called
  9105. to free the object as soon as the reference count reaches zero.
  9106. Most objects offer fz_keep_XXXX/fz_drop_XXXX functions derived
  9107. from fz_keep_storable/fz_drop_storable. Creation of such objects
  9108. includes a call to FZ_INIT_STORABLE to set up the fz_storable
  9109. header.
  9110. */
  9111. struct FzStorable
  9112. {
  9113. /** Copy constructor using `fz_keep_storable()`. */
  9114. FZ_FUNCTION FzStorable(const FzStorable& rhs);
  9115. /** operator= using `fz_keep_storable()` and `fz_drop_storable()`. */
  9116. FZ_FUNCTION FzStorable& operator=(const FzStorable& rhs);
  9117. /** Default constructor, sets `m_internal` to null. */
  9118. FZ_FUNCTION FzStorable();
  9119. /** Constructor using raw copy of pre-existing `::fz_storable`. */
  9120. /* This constructor is marked as `explicit` because wrapper classes do not
  9121. call `keep`in constructors, but do call `drop` in destructors. So
  9122. automatic construction from a fz_storable* will generally cause an
  9123. unbalanced `drop` resulting in errors such as SEGV. */
  9124. FZ_FUNCTION explicit FzStorable(::fz_storable* internal);
  9125. /** Destructor using fz_drop_storable(). */
  9126. FZ_FUNCTION ~FzStorable();
  9127. /** Return numerical value of .m_internal; helps with Python debugging. */
  9128. FZ_FUNCTION long long m_internal_value();
  9129. /** Return true iff `m_internal` is not null. */
  9130. FZ_FUNCTION operator bool();
  9131. /* == Member data. */
  9132. /** Pointer to wrapped data. */
  9133. ::fz_storable* m_internal;
  9134. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9135. generate code regardless so we always need to have this available. */
  9136. FZ_DATA static int s_num_instances;
  9137. };
  9138. /** Wrapper class for struct `fz_store`. Not copyable or assignable. */
  9139. struct FzStore
  9140. {
  9141. /** Default constructor, sets `m_internal` to null. */
  9142. FZ_FUNCTION FzStore();
  9143. /** Constructor using raw copy of pre-existing `::fz_store`. */
  9144. FZ_FUNCTION FzStore(::fz_store* internal);
  9145. #ifndef NDEBUG
  9146. /** Destructor only decrements s_num_instances. */
  9147. FZ_FUNCTION ~FzStore();
  9148. #else
  9149. /** We use default destructor. */
  9150. #endif
  9151. /** Return numerical value of .m_internal; helps with Python debugging. */
  9152. FZ_FUNCTION long long m_internal_value();
  9153. /** Return true iff `m_internal` is not null. */
  9154. FZ_FUNCTION operator bool();
  9155. /* == Member data. */
  9156. /** Pointer to wrapped data. */
  9157. ::fz_store* m_internal;
  9158. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9159. generate code regardless so we always need to have this available. */
  9160. FZ_DATA static int s_num_instances;
  9161. private:
  9162. /** This class is not copyable or assignable. */
  9163. FzStore(const FzStore& rhs);
  9164. FzStore& operator=(const FzStore& rhs);
  9165. };
  9166. /** Wrapper class for struct `fz_store_hash`. Not copyable or assignable. */
  9167. /**
  9168. The store can be seen as a dictionary that maps keys to
  9169. fz_storable values. In order to allow keys of different types to
  9170. be stored, we have a structure full of functions for each key
  9171. 'type'; this fz_store_type pointer is stored with each key, and
  9172. tells the store how to perform certain operations (like taking/
  9173. dropping a reference, comparing two keys, outputting details for
  9174. debugging etc).
  9175. The store uses a hash table internally for speed where possible.
  9176. In order for this to work, we need a mechanism for turning a
  9177. generic 'key' into 'a hashable string'. For this purpose the
  9178. type structure contains a make_hash_key function pointer that
  9179. maps from a void * to a fz_store_hash structure. If
  9180. make_hash_key function returns 0, then the key is determined not
  9181. to be hashable, and the value is not stored in the hash table.
  9182. Some objects can be used both as values within the store, and as
  9183. a component of keys within the store. We refer to these objects
  9184. as "key storable" objects. In this case, we need to take
  9185. additional care to ensure that we do not end up keeping an item
  9186. within the store, purely because its value is referred to by
  9187. another key in the store.
  9188. An example of this are fz_images in PDF files. Each fz_image is
  9189. placed into the store to enable it to be easily reused. When the
  9190. image is rendered, a pixmap is generated from the image, and the
  9191. pixmap is placed into the store so it can be reused on
  9192. subsequent renders. The image forms part of the key for the
  9193. pixmap.
  9194. When we close the pdf document (and any associated pages/display
  9195. lists etc), we drop the images from the store. This may leave us
  9196. in the position of the images having non-zero reference counts
  9197. purely because they are used as part of the keys for the
  9198. pixmaps.
  9199. We therefore use special reference counting functions to keep
  9200. track of these "key storable" items, and hence store the number
  9201. of references to these items that are used in keys.
  9202. When the number of references to an object == the number of
  9203. references to an object from keys in the store, we know that we
  9204. can remove all the items which have that object as part of the
  9205. key. This is done by running a pass over the store, 'reaping'
  9206. those items.
  9207. Reap passes are slower than we would like as they touch every
  9208. item in the store. We therefore provide a way to 'batch' such
  9209. reap passes together, using fz_defer_reap_start/
  9210. fz_defer_reap_end to bracket a region in which many may be
  9211. triggered.
  9212. */
  9213. struct FzStoreHash
  9214. {
  9215. /** Default constructor, sets `m_internal` to null. */
  9216. FZ_FUNCTION FzStoreHash();
  9217. /** Constructor using raw copy of pre-existing `::fz_store_hash`. */
  9218. FZ_FUNCTION FzStoreHash(::fz_store_hash* internal);
  9219. #ifndef NDEBUG
  9220. /** Destructor only decrements s_num_instances. */
  9221. FZ_FUNCTION ~FzStoreHash();
  9222. #else
  9223. /** We use default destructor. */
  9224. #endif
  9225. /** Return numerical value of .m_internal; helps with Python debugging. */
  9226. FZ_FUNCTION long long m_internal_value();
  9227. /** Return true iff `m_internal` is not null. */
  9228. FZ_FUNCTION operator bool();
  9229. /* == Member data. */
  9230. /** Pointer to wrapped data. */
  9231. ::fz_store_hash* m_internal;
  9232. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9233. generate code regardless so we always need to have this available. */
  9234. FZ_DATA static int s_num_instances;
  9235. private:
  9236. /** This class is not copyable or assignable. */
  9237. FzStoreHash(const FzStoreHash& rhs);
  9238. FzStoreHash& operator=(const FzStoreHash& rhs);
  9239. };
  9240. /** Wrapper class for struct `fz_store_type`. Not copyable or assignable. */
  9241. /**
  9242. Every type of object to be placed into the store defines an
  9243. fz_store_type. This contains the pointers to functions to
  9244. make hashes, manipulate keys, and check for needing reaping.
  9245. */
  9246. struct FzStoreType
  9247. {
  9248. /** Default constructor, sets `m_internal` to null. */
  9249. FZ_FUNCTION FzStoreType();
  9250. /** Constructor using raw copy of pre-existing `::fz_store_type`. */
  9251. FZ_FUNCTION FzStoreType(::fz_store_type* internal);
  9252. #ifndef NDEBUG
  9253. /** Destructor only decrements s_num_instances. */
  9254. FZ_FUNCTION ~FzStoreType();
  9255. #else
  9256. /** We use default destructor. */
  9257. #endif
  9258. /** Return numerical value of .m_internal; helps with Python debugging. */
  9259. FZ_FUNCTION long long m_internal_value();
  9260. /** Return true iff `m_internal` is not null. */
  9261. FZ_FUNCTION operator bool();
  9262. /* == Member data. */
  9263. /** Pointer to wrapped data. */
  9264. ::fz_store_type* m_internal;
  9265. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9266. generate code regardless so we always need to have this available. */
  9267. FZ_DATA static int s_num_instances;
  9268. private:
  9269. /** This class is not copyable or assignable. */
  9270. FzStoreType(const FzStoreType& rhs);
  9271. FzStoreType& operator=(const FzStoreType& rhs);
  9272. };
  9273. /** Wrapper class for struct `fz_story`. Not copyable or assignable. */
  9274. struct FzStory
  9275. {
  9276. /** == Constructors. */
  9277. /** Constructor using `fz_new_story()`. */
  9278. FZ_FUNCTION FzStory(const FzBuffer& buf, const char *user_css, float em, const FzArchive& dir);
  9279. /** Default constructor, sets `m_internal` to null. */
  9280. FZ_FUNCTION FzStory();
  9281. /* == Methods. */
  9282. /** Class-aware wrapper for `::fz_draw_story()`. */
  9283. FZ_FUNCTION void fz_draw_story(const FzDevice& dev, const FzMatrix& ctm) const;
  9284. /** Class-aware wrapper for `::fz_place_story()`. */
  9285. FZ_FUNCTION int fz_place_story(const FzRect& where, FzRect& filled) const;
  9286. /** Class-aware wrapper for `::fz_place_story_flags()`. */
  9287. FZ_FUNCTION int fz_place_story_flags(const FzRect& where, FzRect& filled, int flags) const;
  9288. /** Class-aware wrapper for `::fz_reset_story()`. */
  9289. FZ_FUNCTION void fz_reset_story() const;
  9290. /** Class-aware wrapper for `::fz_story_document()`. */
  9291. FZ_FUNCTION FzXml fz_story_document() const;
  9292. /** Class-aware wrapper for `::fz_story_positions()`. */
  9293. FZ_FUNCTION void fz_story_positions(::fz_story_position_callback *cb, void *arg) const;
  9294. /** Class-aware wrapper for `::fz_story_warnings()`. */
  9295. FZ_FUNCTION const char *fz_story_warnings() const;
  9296. /** Constructor using raw copy of pre-existing `::fz_story`. */
  9297. FZ_FUNCTION FzStory(::fz_story* internal);
  9298. /** Destructor using fz_drop_story(). */
  9299. FZ_FUNCTION ~FzStory();
  9300. /** Return numerical value of .m_internal; helps with Python debugging. */
  9301. FZ_FUNCTION long long m_internal_value();
  9302. /** Return true iff `m_internal` is not null. */
  9303. FZ_FUNCTION operator bool();
  9304. /* == Member data. */
  9305. /** Pointer to wrapped data. */
  9306. ::fz_story* m_internal;
  9307. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9308. generate code regardless so we always need to have this available. */
  9309. FZ_DATA static int s_num_instances;
  9310. private:
  9311. /** This class is not copyable or assignable. */
  9312. FzStory(const FzStory& rhs);
  9313. FzStory& operator=(const FzStory& rhs);
  9314. };
  9315. /** Wrapper class for struct `fz_story_element_position`. */
  9316. struct FzStoryElementPosition
  9317. {
  9318. /** We use default copy constructor and operator=. */
  9319. /** Default constructor, sets each member to default value. */
  9320. FZ_FUNCTION FzStoryElementPosition();
  9321. /** Constructor using raw copy of pre-existing `::fz_story_element_position`. */
  9322. FZ_FUNCTION FzStoryElementPosition(const ::fz_story_element_position* internal);
  9323. /** Constructor using raw copy of pre-existing `::fz_story_element_position`. */
  9324. FZ_FUNCTION FzStoryElementPosition(const ::fz_story_element_position internal);
  9325. /** Access as underlying struct. */
  9326. FZ_FUNCTION ::fz_story_element_position* internal();
  9327. /** Access as underlying struct. */
  9328. FZ_FUNCTION const ::fz_story_element_position* internal() const;
  9329. #ifndef NDEBUG
  9330. /** Destructor only decrements s_num_instances. */
  9331. FZ_FUNCTION ~FzStoryElementPosition();
  9332. #else
  9333. /** We use default destructor. */
  9334. #endif
  9335. /* == Member data. */
  9336. /* These members are the same as the members of ::fz_story_element_position. */
  9337. int depth;
  9338. int heading;
  9339. const char *id;
  9340. const char *href;
  9341. ::fz_rect rect;
  9342. const char *text;
  9343. int open_close;
  9344. int rectangle_num;
  9345. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9346. generate code regardless so we always need to have this available. */
  9347. FZ_DATA static int s_num_instances;
  9348. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  9349. FZ_FUNCTION std::string to_string();
  9350. /** Comparison method. */
  9351. FZ_FUNCTION bool operator==(const FzStoryElementPosition& rhs);
  9352. /** Comparison method. */
  9353. FZ_FUNCTION bool operator!=(const FzStoryElementPosition& rhs);
  9354. };
  9355. /** Wrapper class for struct `fz_stream`. */
  9356. /**
  9357. fz_stream is a buffered reader capable of seeking in both
  9358. directions.
  9359. Streams are reference counted, so references must be dropped
  9360. by a call to fz_drop_stream.
  9361. Only the data between rp and wp is valid.
  9362. */
  9363. struct FzStream
  9364. {
  9365. /** == Constructors. */
  9366. /** Constructor using `fz_new_stream()`. */
  9367. /**
  9368. Create a new stream object with the given
  9369. internal state and function pointers.
  9370. state: Internal state (opaque to everything but implementation).
  9371. next: Should provide the next set of bytes (up to max) of stream
  9372. data. Return the number of bytes read, or EOF when there is no
  9373. more data.
  9374. drop: Should clean up and free the internal state. May not
  9375. throw exceptions.
  9376. */
  9377. FZ_FUNCTION FzStream(void *state, ::fz_stream_next_fn *next, ::fz_stream_drop_fn *drop);
  9378. /** Constructor using `fz_open_file()`. */
  9379. /**
  9380. Open the named file and wrap it in a stream.
  9381. filename: Path to a file. On non-Windows machines the filename
  9382. should be exactly as it would be passed to fopen(2). On Windows
  9383. machines, the path should be UTF-8 encoded so that non-ASCII
  9384. characters can be represented. Other platforms do the encoding
  9385. as standard anyway (and in most cases, particularly for MacOS
  9386. and Linux, the encoding they use is UTF-8 anyway).
  9387. */
  9388. FZ_FUNCTION FzStream(const char *filename);
  9389. /** Constructor using `fz_open_file_ptr_no_close()`. */
  9390. /**
  9391. Create a stream from a FILE * that will not be closed
  9392. when the stream is dropped.
  9393. */
  9394. FZ_FUNCTION FzStream(FILE *file);
  9395. /** Constructor using `fz_open_memory()`. */
  9396. /**
  9397. Open a block of memory as a stream.
  9398. data: Pointer to start of data block. Ownership of the data
  9399. block is NOT passed in.
  9400. len: Number of bytes in data block.
  9401. Returns pointer to newly created stream. May throw exceptions on
  9402. failure to allocate.
  9403. */
  9404. FZ_FUNCTION FzStream(const unsigned char *data, size_t len);
  9405. /** Construct using fz_open_file(). */
  9406. FZ_FUNCTION FzStream(const std::string& filename);
  9407. /** Copy constructor using `fz_keep_stream()`. */
  9408. FZ_FUNCTION FzStream(const FzStream& rhs);
  9409. /** operator= using `fz_keep_stream()` and `fz_drop_stream()`. */
  9410. FZ_FUNCTION FzStream& operator=(const FzStream& rhs);
  9411. /** Default constructor, sets `m_internal` to null. */
  9412. FZ_FUNCTION FzStream();
  9413. /* == Static methods. */
  9414. /** Class-aware wrapper for `::fz_open_file_autodelete()`. */
  9415. /**
  9416. Do the same as fz_open_file, but delete the file upon close.
  9417. */
  9418. FZ_FUNCTION static FzStream fz_open_file_autodelete(const char *filename);
  9419. /* == Methods. */
  9420. /** Class-aware wrapper for `::fz_available()`. */
  9421. /**
  9422. Ask how many bytes are available immediately from
  9423. a given stream.
  9424. stm: The stream to read from.
  9425. max: A hint for the underlying stream; the maximum number of
  9426. bytes that we are sure we will want to read. If you do not know
  9427. this number, give 1.
  9428. Returns the number of bytes immediately available between the
  9429. read and write pointers. This number is guaranteed only to be 0
  9430. if we have hit EOF. The number of bytes returned here need have
  9431. no relation to max (could be larger, could be smaller).
  9432. */
  9433. FZ_FUNCTION size_t fz_available(size_t max) const;
  9434. /** Class-aware wrapper for `::fz_decomp_image_from_stream()`.
  9435. This method has out-params. Python/C# wrappers look like:
  9436. `fz_decomp_image_from_stream(::fz_compressed_image *image, ::fz_irect *subarea, int indexed, int l2factor)` => `(fz_pixmap *, int l2extra)`
  9437. */
  9438. /**
  9439. Decode a subarea of a compressed image. l2factor is the amount
  9440. of subsampling inbuilt to the stream (i.e. performed by the
  9441. decoder). If non NULL, l2extra is the extra amount of
  9442. subsampling that should be performed by this routine. This will
  9443. be updated on exit to the amount of subsampling that is still
  9444. required to be done.
  9445. Returns a kept reference.
  9446. */
  9447. FZ_FUNCTION FzPixmap fz_decomp_image_from_stream(const FzCompressedImage& image, FzIrect& subarea, int indexed, int l2factor, int *l2extra) const;
  9448. /** Class-aware wrapper for `::fz_is_cfb_archive()`. */
  9449. /**
  9450. Detect if stream object is a cfb archive.
  9451. Assumes that the stream object is seekable.
  9452. */
  9453. FZ_FUNCTION int fz_is_cfb_archive() const;
  9454. /** Class-aware wrapper for `::fz_is_eof()`. */
  9455. /**
  9456. Query if the stream has reached EOF (during normal bytewise
  9457. reading).
  9458. See fz_is_eof_bits for the equivalent function for bitwise
  9459. reading.
  9460. */
  9461. FZ_FUNCTION int fz_is_eof() const;
  9462. /** Class-aware wrapper for `::fz_is_eof_bits()`. */
  9463. /**
  9464. Query if the stream has reached EOF (during bitwise
  9465. reading).
  9466. See fz_is_eof for the equivalent function for bytewise
  9467. reading.
  9468. */
  9469. FZ_FUNCTION int fz_is_eof_bits() const;
  9470. /** Class-aware wrapper for `::fz_is_libarchive_archive()`. */
  9471. /**
  9472. Detect if stream object is an archive supported by libarchive.
  9473. Assumes that the stream object is seekable.
  9474. */
  9475. FZ_FUNCTION int fz_is_libarchive_archive() const;
  9476. /** Class-aware wrapper for `::fz_is_tar_archive()`. */
  9477. /**
  9478. Detect if stream object is a tar archive.
  9479. Assumes that the stream object is seekable.
  9480. */
  9481. FZ_FUNCTION int fz_is_tar_archive() const;
  9482. /** Class-aware wrapper for `::fz_is_zip_archive()`. */
  9483. /**
  9484. Detect if stream object is a zip archive.
  9485. Assumes that the stream object is seekable.
  9486. */
  9487. FZ_FUNCTION int fz_is_zip_archive() const;
  9488. /** Class-aware wrapper for `::fz_new_archive_of_size()`. */
  9489. FZ_FUNCTION FzArchive fz_new_archive_of_size(int size) const;
  9490. /** Class-aware wrapper for `::fz_open_a85d()`. */
  9491. /**
  9492. a85d filter performs ASCII 85 Decoding of data read
  9493. from the chained filter.
  9494. */
  9495. FZ_FUNCTION FzStream fz_open_a85d() const;
  9496. /** Class-aware wrapper for `::fz_open_aesd()`. */
  9497. /**
  9498. aesd filter performs AES decoding of data read from the chained
  9499. filter using the supplied key.
  9500. */
  9501. FZ_FUNCTION FzStream fz_open_aesd(unsigned char *key, unsigned int keylen) const;
  9502. /** Class-aware wrapper for `::fz_open_ahxd()`. */
  9503. /**
  9504. ahxd filter performs ASCII Hex decoding of data read
  9505. from the chained filter.
  9506. */
  9507. FZ_FUNCTION FzStream fz_open_ahxd() const;
  9508. /** Class-aware wrapper for `::fz_open_arc4()`. */
  9509. /**
  9510. arc4 filter performs RC4 decoding of data read from the chained
  9511. filter using the supplied key.
  9512. */
  9513. FZ_FUNCTION FzStream fz_open_arc4(unsigned char *key, unsigned int keylen) const;
  9514. /** Class-aware wrapper for `::fz_open_archive_with_stream()`. */
  9515. /**
  9516. Open zip or tar archive stream.
  9517. Open an archive using a seekable stream object rather than
  9518. opening a file or directory on disk.
  9519. */
  9520. FZ_FUNCTION FzArchive fz_open_archive_with_stream() const;
  9521. /** Class-aware wrapper for `::fz_open_brotlid()`. */
  9522. /**
  9523. brotlid filter performs Brotli decoding of data read
  9524. from the chained filter.
  9525. */
  9526. FZ_FUNCTION FzStream fz_open_brotlid() const;
  9527. /** Class-aware wrapper for `::fz_open_cfb_archive_with_stream()`. */
  9528. /**
  9529. Open a cfb file as an archive.
  9530. Open an archive using a seekable stream object rather than
  9531. opening a file or directory on disk.
  9532. An exception is thrown if the file is not recognised as a chm.
  9533. */
  9534. FZ_FUNCTION FzArchive fz_open_cfb_archive_with_stream() const;
  9535. /** Class-aware wrapper for `::fz_open_dctd()`. */
  9536. /**
  9537. dctd filter performs DCT (JPEG) decoding of data read
  9538. from the chained filter.
  9539. color_transform implements the PDF color_transform option
  9540. use -1 for default behavior
  9541. use 0 to disable YUV-RGB / YCCK-CMYK transforms
  9542. use 1 to enable YUV-RGB / YCCK-CMYK transforms
  9543. invert_cmyk implements the necessary inversion for Photoshop CMYK images
  9544. use 0 if embedded in PDF
  9545. use 1 if not embedded in PDF
  9546. For subsampling on decode, set l2factor to the log2 of the
  9547. reduction required (therefore 0 = full size decode).
  9548. jpegtables is an optional stream from which the JPEG tables
  9549. can be read. Use NULL if not required.
  9550. */
  9551. FZ_FUNCTION FzStream fz_open_dctd(int color_transform, int invert_cmyk, int l2factor, const FzStream& jpegtables) const;
  9552. /** Class-aware wrapper for `::fz_open_endstream_filter()`. */
  9553. /**
  9554. The endstream filter reads a PDF substream, and starts to look
  9555. for an 'endstream' token after the specified length.
  9556. */
  9557. FZ_FUNCTION FzStream fz_open_endstream_filter(uint64_t len, int64_t offset) const;
  9558. /** Class-aware wrapper for `::fz_open_faxd()`. */
  9559. /**
  9560. faxd filter performs FAX decoding of data read from
  9561. the chained filter.
  9562. k: see fax specification (fax default is 0).
  9563. end_of_line: whether we expect end of line markers (fax default
  9564. is 0).
  9565. encoded_byte_align: whether we align to bytes after each line
  9566. (fax default is 0).
  9567. columns: how many columns in the image (fax default is 1728).
  9568. rows: 0 for unspecified or the number of rows of data to expect.
  9569. end_of_block: whether we expect end of block markers (fax
  9570. default is 1).
  9571. black_is_1: determines the polarity of the image (fax default is
  9572. 0).
  9573. */
  9574. FZ_FUNCTION FzStream fz_open_faxd(int k, int end_of_line, int encoded_byte_align, int columns, int rows, int end_of_block, int black_is_1) const;
  9575. /** Class-aware wrapper for `::fz_open_flated()`. */
  9576. /**
  9577. flated filter performs LZ77 decoding (inflating) of data read
  9578. from the chained filter.
  9579. window_bits: How large a decompression window to use. Typically
  9580. 15. A negative number, -n, means to use n bits, but to expect
  9581. raw data with no header.
  9582. */
  9583. FZ_FUNCTION FzStream fz_open_flated(int window_bits) const;
  9584. /** Class-aware wrapper for `::fz_open_image_decomp_stream()`.
  9585. This method has out-params. Python/C# wrappers look like:
  9586. `fz_open_image_decomp_stream(::fz_compression_params *arg_1)` => `(fz_stream *, int l2factor)`
  9587. */
  9588. /**
  9589. Open a stream to read the decompressed version of another stream
  9590. with optional log2 subsampling.
  9591. */
  9592. FZ_FUNCTION FzStream fz_open_image_decomp_stream(const FzCompressionParams& arg_1, int *l2factor) const;
  9593. /** Class-aware wrapper for `::fz_open_jbig2d()`. */
  9594. /**
  9595. Open a filter that performs jbig2 decompression on the chained
  9596. stream, using the optional globals record.
  9597. */
  9598. FZ_FUNCTION FzStream fz_open_jbig2d(const FzJbig2Globals& globals, int embedded) const;
  9599. /** Class-aware wrapper for `::fz_open_leecher()`. */
  9600. /**
  9601. Attach a filter to a stream that will store any
  9602. characters read from the stream into the supplied buffer.
  9603. chain: The underlying stream to leech from.
  9604. buf: The buffer into which the read data should be appended.
  9605. The buffer will be resized as required.
  9606. Returns pointer to newly created stream. May throw exceptions on
  9607. failure to allocate.
  9608. */
  9609. FZ_FUNCTION FzStream fz_open_leecher(const FzBuffer& buf) const;
  9610. /** Class-aware wrapper for `::fz_open_libarchive_archive_with_stream()`. */
  9611. /**
  9612. Open an archive using libarchive.
  9613. Open an archive using a seekable stream object rather than
  9614. opening a file or directory on disk.
  9615. An exception is thrown if the stream is not supported by libarchive.
  9616. */
  9617. FZ_FUNCTION FzArchive fz_open_libarchive_archive_with_stream() const;
  9618. /** Class-aware wrapper for `::fz_open_libarchived()`. */
  9619. /**
  9620. libarchived filter performs generic compressed decoding of data
  9621. in any format understood by libarchive from the chained filter.
  9622. This will throw an exception if libarchive is not built in, or
  9623. if the compression format is not recognised.
  9624. */
  9625. FZ_FUNCTION FzStream fz_open_libarchived() const;
  9626. /** Class-aware wrapper for `::fz_open_lzwd()`. */
  9627. /**
  9628. lzwd filter performs LZW decoding of data read from the chained
  9629. filter.
  9630. early_change: (Default 1) specifies whether to change codes 1
  9631. bit early.
  9632. min_bits: (Default 9) specifies the minimum number of bits to
  9633. use.
  9634. reverse_bits: (Default 0) allows for compatibility with gif and
  9635. old style tiffs (1).
  9636. old_tiff: (Default 0) allows for different handling of the clear
  9637. code, as found in old style tiffs.
  9638. */
  9639. FZ_FUNCTION FzStream fz_open_lzwd(int early_change, int min_bits, int reverse_bits, int old_tiff) const;
  9640. /** Class-aware wrapper for `::fz_open_null_filter()`. */
  9641. /**
  9642. The null filter reads a specified amount of data from the
  9643. substream.
  9644. */
  9645. FZ_FUNCTION FzStream fz_open_null_filter(uint64_t len, int64_t offset) const;
  9646. /** Class-aware wrapper for `::fz_open_predict()`. */
  9647. /**
  9648. predict filter performs pixel prediction on data read from
  9649. the chained filter.
  9650. predictor: 1 = copy, 2 = tiff, other = inline PNG predictor
  9651. columns: width of image in pixels
  9652. colors: number of components.
  9653. bpc: bits per component (typically 8)
  9654. */
  9655. FZ_FUNCTION FzStream fz_open_predict(int predictor, int columns, int colors, int bpc) const;
  9656. /** Class-aware wrapper for `::fz_open_range_filter()`. */
  9657. /**
  9658. The range filter copies data from specified ranges of the
  9659. chained stream.
  9660. */
  9661. FZ_FUNCTION FzStream fz_open_range_filter(const FzRange& ranges, int nranges) const;
  9662. /** Class-aware wrapper for `::fz_open_rld()`. */
  9663. /**
  9664. rld filter performs Run Length Decoding of data read
  9665. from the chained filter.
  9666. */
  9667. FZ_FUNCTION FzStream fz_open_rld() const;
  9668. /** Class-aware wrapper for `::fz_open_sgilog16()`. */
  9669. /**
  9670. SGI Log 16bit (greyscale) decode from the chained filter.
  9671. Decodes lines of w pixels to 8bpp greyscale.
  9672. */
  9673. FZ_FUNCTION FzStream fz_open_sgilog16(int w) const;
  9674. /** Class-aware wrapper for `::fz_open_sgilog24()`. */
  9675. /**
  9676. SGI Log 24bit (LUV) decode from the chained filter.
  9677. Decodes lines of w pixels to 8bpc rgb.
  9678. */
  9679. FZ_FUNCTION FzStream fz_open_sgilog24(int w) const;
  9680. /** Class-aware wrapper for `::fz_open_sgilog32()`. */
  9681. /**
  9682. SGI Log 32bit (LUV) decode from the chained filter.
  9683. Decodes lines of w pixels to 8bpc rgb.
  9684. */
  9685. FZ_FUNCTION FzStream fz_open_sgilog32(int w) const;
  9686. /** Class-aware wrapper for `::fz_open_tar_archive_with_stream()`. */
  9687. /**
  9688. Open a tar archive stream.
  9689. Open an archive using a seekable stream object rather than
  9690. opening a file or directory on disk.
  9691. An exception is thrown if the stream is not a tar archive as
  9692. indicated by the presence of a tar signature.
  9693. */
  9694. FZ_FUNCTION FzArchive fz_open_tar_archive_with_stream() const;
  9695. /** Class-aware wrapper for `::fz_open_thunder()`. */
  9696. /**
  9697. 4bit greyscale Thunderscan decoding from the chained filter.
  9698. Decodes lines of w pixels to 8bpp greyscale.
  9699. */
  9700. FZ_FUNCTION FzStream fz_open_thunder(int w) const;
  9701. /** Class-aware wrapper for `::fz_open_zip_archive_with_stream()`. */
  9702. /**
  9703. Open a zip archive stream.
  9704. Open an archive using a seekable stream object rather than
  9705. opening a file or directory on disk.
  9706. An exception is thrown if the stream is not a zip archive as
  9707. indicated by the presence of a zip signature.
  9708. */
  9709. FZ_FUNCTION FzArchive fz_open_zip_archive_with_stream() const;
  9710. /** Class-aware wrapper for `::fz_parse_xml_stream()`. */
  9711. /**
  9712. Parse the contents of buffer into a tree of xml nodes.
  9713. preserve_white: whether to keep or delete all-whitespace nodes.
  9714. */
  9715. FZ_FUNCTION FzXml fz_parse_xml_stream(int preserve_white) const;
  9716. /** Class-aware wrapper for `::fz_peek_byte()`. */
  9717. /**
  9718. Peek at the next byte in a stream.
  9719. stm: The stream to peek at.
  9720. Returns -1 for EOF, or the next byte that will be read.
  9721. */
  9722. FZ_FUNCTION int fz_peek_byte() const;
  9723. /** Class-aware wrapper for `::fz_read()`. */
  9724. /**
  9725. Read from a stream into a given data block.
  9726. stm: The stream to read from.
  9727. data: The data block to read into.
  9728. len: The length of the data block (in bytes).
  9729. Returns the number of bytes read. May throw exceptions.
  9730. */
  9731. FZ_FUNCTION size_t fz_read(unsigned char *data, size_t len) const;
  9732. /** Class-aware wrapper for `::fz_read_all()`. */
  9733. /**
  9734. Read all of a stream into a buffer.
  9735. stm: The stream to read from
  9736. initial: Suggested initial size for the buffer.
  9737. Returns a buffer created from reading from the stream. May throw
  9738. exceptions on failure to allocate.
  9739. */
  9740. FZ_FUNCTION FzBuffer fz_read_all(size_t initial) const;
  9741. /** Class-aware wrapper for `::fz_read_best()`.
  9742. This method has out-params. Python/C# wrappers look like:
  9743. `fz_read_best(size_t initial, size_t worst_case)` => `(fz_buffer *, int truncated)`
  9744. */
  9745. /**
  9746. Attempt to read a stream into a buffer. If truncated
  9747. is NULL behaves as fz_read_all, sets a truncated flag in case of
  9748. error.
  9749. stm: The stream to read from.
  9750. initial: Suggested initial size for the buffer.
  9751. truncated: Flag to store success/failure indication in.
  9752. worst_case: 0 for unknown, otherwise an upper bound for the
  9753. size of the stream.
  9754. Returns a buffer created from reading from the stream.
  9755. */
  9756. FZ_FUNCTION FzBuffer fz_read_best(size_t initial, int *truncated, size_t worst_case) const;
  9757. /** Class-aware wrapper for `::fz_read_bits()`. */
  9758. /**
  9759. Read the next n bits from a stream (assumed to
  9760. be packed most significant bit first).
  9761. stm: The stream to read from.
  9762. n: The number of bits to read, between 1 and 8*sizeof(int)
  9763. inclusive.
  9764. Returns -1 for EOF, or the required number of bits.
  9765. */
  9766. FZ_FUNCTION unsigned int fz_read_bits(int n) const;
  9767. /** Class-aware wrapper for `::fz_read_byte()`. */
  9768. /**
  9769. Read the next byte from a stream.
  9770. stm: The stream t read from.
  9771. Returns -1 for end of stream, or the next byte. May
  9772. throw exceptions.
  9773. */
  9774. FZ_FUNCTION int fz_read_byte() const;
  9775. /** Class-aware wrapper for `::fz_read_float()`. */
  9776. FZ_FUNCTION float fz_read_float() const;
  9777. /** Class-aware wrapper for `::fz_read_float_le()`. */
  9778. FZ_FUNCTION float fz_read_float_le() const;
  9779. /** Class-aware wrapper for `::fz_read_int16()`. */
  9780. FZ_FUNCTION int16_t fz_read_int16() const;
  9781. /** Class-aware wrapper for `::fz_read_int16_le()`. */
  9782. FZ_FUNCTION int16_t fz_read_int16_le() const;
  9783. /** Class-aware wrapper for `::fz_read_int32()`. */
  9784. FZ_FUNCTION int32_t fz_read_int32() const;
  9785. /** Class-aware wrapper for `::fz_read_int32_le()`. */
  9786. FZ_FUNCTION int32_t fz_read_int32_le() const;
  9787. /** Class-aware wrapper for `::fz_read_int64()`. */
  9788. FZ_FUNCTION int64_t fz_read_int64() const;
  9789. /** Class-aware wrapper for `::fz_read_int64_le()`. */
  9790. FZ_FUNCTION int64_t fz_read_int64_le() const;
  9791. /** Class-aware wrapper for `::fz_read_line()`. */
  9792. /**
  9793. Read a line from stream into the buffer until either a
  9794. terminating newline or EOF, which it replaces with a null byte
  9795. ('\0').
  9796. Returns buf on success, and NULL when end of file occurs while
  9797. no characters have been read.
  9798. */
  9799. FZ_FUNCTION char *fz_read_line(char *buf, size_t max) const;
  9800. /** Class-aware wrapper for `::fz_read_rbits()`. */
  9801. /**
  9802. Read the next n bits from a stream (assumed to
  9803. be packed least significant bit first).
  9804. stm: The stream to read from.
  9805. n: The number of bits to read, between 1 and 8*sizeof(int)
  9806. inclusive.
  9807. Returns (unsigned int)-1 for EOF, or the required number of bits.
  9808. */
  9809. FZ_FUNCTION unsigned int fz_read_rbits(int n) const;
  9810. /** Class-aware wrapper for `::fz_read_rune()`. */
  9811. /**
  9812. Read a utf-8 rune from a stream.
  9813. In the event of encountering badly formatted utf-8 codes
  9814. (such as a leading code with an unexpected number of following
  9815. codes) no error/exception is given, but undefined values may be
  9816. returned.
  9817. */
  9818. FZ_FUNCTION int fz_read_rune() const;
  9819. /** Class-aware wrapper for `::fz_read_string()`. */
  9820. /**
  9821. Read a null terminated string from the stream into
  9822. a buffer of a given length. The buffer will be null terminated.
  9823. Throws on failure (including the failure to fit the entire
  9824. string including the terminator into the buffer).
  9825. */
  9826. FZ_FUNCTION void fz_read_string(char *buffer, int len) const;
  9827. /** Class-aware wrapper for `::fz_read_uint16()`. */
  9828. /**
  9829. fz_read_[u]int(16|24|32|64)(_le)?
  9830. Read a 16/32/64 bit signed/unsigned integer from stream,
  9831. in big or little-endian byte orders.
  9832. Throws an exception if EOF is encountered.
  9833. */
  9834. FZ_FUNCTION uint16_t fz_read_uint16() const;
  9835. /** Class-aware wrapper for `::fz_read_uint16_le()`. */
  9836. FZ_FUNCTION uint16_t fz_read_uint16_le() const;
  9837. /** Class-aware wrapper for `::fz_read_uint24()`. */
  9838. FZ_FUNCTION uint32_t fz_read_uint24() const;
  9839. /** Class-aware wrapper for `::fz_read_uint24_le()`. */
  9840. FZ_FUNCTION uint32_t fz_read_uint24_le() const;
  9841. /** Class-aware wrapper for `::fz_read_uint32()`. */
  9842. FZ_FUNCTION uint32_t fz_read_uint32() const;
  9843. /** Class-aware wrapper for `::fz_read_uint32_le()`. */
  9844. FZ_FUNCTION uint32_t fz_read_uint32_le() const;
  9845. /** Class-aware wrapper for `::fz_read_uint64()`. */
  9846. FZ_FUNCTION uint64_t fz_read_uint64() const;
  9847. /** Class-aware wrapper for `::fz_read_uint64_le()`. */
  9848. FZ_FUNCTION uint64_t fz_read_uint64_le() const;
  9849. /** Class-aware wrapper for `::fz_read_utf16_be()`. */
  9850. FZ_FUNCTION int fz_read_utf16_be() const;
  9851. /** Class-aware wrapper for `::fz_read_utf16_le()`. */
  9852. /**
  9853. Read a utf-16 rune from a stream. (little endian and
  9854. big endian respectively).
  9855. In the event of encountering badly formatted utf-16 codes
  9856. (mismatched surrogates) no error/exception is given, but
  9857. undefined values may be returned.
  9858. */
  9859. FZ_FUNCTION int fz_read_utf16_le() const;
  9860. /* Class-aware wrapper for `fz_recognize_document_stream_and_dir_content()`
  9861. is not available because returned wrapper class for `fz_document_handler`
  9862. is non-copyable. */
  9863. /* Class-aware wrapper for `fz_recognize_document_stream_content()`
  9864. is not available because returned wrapper class for `fz_document_handler`
  9865. is non-copyable. */
  9866. /** Class-aware wrapper for `::fz_seek()`. */
  9867. /**
  9868. Seek within a stream.
  9869. stm: The stream to seek within.
  9870. offset: The offset to seek to.
  9871. whence: From where the offset is measured (see fseek).
  9872. SEEK_SET - start of stream.
  9873. SEEK_CUR - current position.
  9874. SEEK_END - end of stream.
  9875. */
  9876. FZ_FUNCTION void fz_seek(int64_t offset, int whence) const;
  9877. /** Class-aware wrapper for `::fz_skip()`. */
  9878. /**
  9879. Read from a stream discarding data.
  9880. stm: The stream to read from.
  9881. len: The number of bytes to read.
  9882. Returns the number of bytes read. May throw exceptions.
  9883. */
  9884. FZ_FUNCTION size_t fz_skip(size_t len) const;
  9885. /** Class-aware wrapper for `::fz_skip_space()`. */
  9886. /**
  9887. Skip over whitespace (bytes <= 32) in a stream.
  9888. */
  9889. FZ_FUNCTION void fz_skip_space() const;
  9890. /** Class-aware wrapper for `::fz_skip_string()`. */
  9891. /**
  9892. Skip over a given string in a stream. Return 0 if successfully
  9893. skipped, non-zero otherwise. As many characters will be skipped
  9894. over as matched in the string.
  9895. */
  9896. FZ_FUNCTION int fz_skip_string(const char *str) const;
  9897. /** Class-aware wrapper for `::fz_stream_filename()`. */
  9898. /**
  9899. Return the filename (UTF-8 encoded) from which a stream was opened.
  9900. Returns NULL if the filename is not available (or the stream was
  9901. opened from a source other than a file).
  9902. */
  9903. FZ_FUNCTION const char *fz_stream_filename() const;
  9904. /** Class-aware wrapper for `::fz_sync_bits()`. */
  9905. /**
  9906. Called after reading bits to tell the stream
  9907. that we are about to return to reading bytewise. Resyncs
  9908. the stream to whole byte boundaries.
  9909. */
  9910. FZ_FUNCTION void fz_sync_bits() const;
  9911. /** Class-aware wrapper for `::fz_tell()`. */
  9912. /**
  9913. return the current reading position within a stream
  9914. */
  9915. FZ_FUNCTION int64_t fz_tell() const;
  9916. /** Class-aware wrapper for `::fz_try_open_archive_with_stream()`. */
  9917. /**
  9918. Open zip or tar archive stream.
  9919. Does the same as fz_open_archive_with_stream, but will not throw
  9920. an error in the event of failing to recognise the format. Will
  9921. still throw errors in other cases though!
  9922. */
  9923. FZ_FUNCTION FzArchive fz_try_open_archive_with_stream() const;
  9924. /** Class-aware wrapper for `::fz_unpack_stream()`. */
  9925. FZ_FUNCTION FzStream fz_unpack_stream(int depth, int w, int h, int n, int indexed, int pad, int skip) const;
  9926. /** Class-aware wrapper for `::fz_unread_byte()`. */
  9927. /**
  9928. Unread the single last byte successfully
  9929. read from a stream. Do not call this without having
  9930. successfully read a byte.
  9931. stm: The stream to operate upon.
  9932. */
  9933. FZ_FUNCTION void fz_unread_byte() const;
  9934. /** Class-aware wrapper for `::pdf_load_cmap()`. */
  9935. FZ_FUNCTION PdfCmap pdf_load_cmap() const;
  9936. /** Class-aware wrapper for `::pdf_open_crypt()`. */
  9937. FZ_FUNCTION FzStream pdf_open_crypt(const PdfCrypt& crypt, int num, int gen) const;
  9938. /** Class-aware wrapper for `::pdf_open_crypt_with_filter()`. */
  9939. FZ_FUNCTION FzStream pdf_open_crypt_with_filter(const PdfCrypt& crypt, const PdfObj& name, int num, int gen) const;
  9940. /** Class-aware wrapper for `::pdf_open_document_with_stream()`. */
  9941. FZ_FUNCTION PdfDocument pdf_open_document_with_stream() const;
  9942. /** Constructor using raw copy of pre-existing `::fz_stream`. */
  9943. /* This constructor is marked as `explicit` because wrapper classes do not
  9944. call `keep`in constructors, but do call `drop` in destructors. So
  9945. automatic construction from a fz_stream* will generally cause an
  9946. unbalanced `drop` resulting in errors such as SEGV. */
  9947. FZ_FUNCTION explicit FzStream(::fz_stream* internal);
  9948. /** Destructor using fz_drop_stream(). */
  9949. FZ_FUNCTION ~FzStream();
  9950. /** Return numerical value of .m_internal; helps with Python debugging. */
  9951. FZ_FUNCTION long long m_internal_value();
  9952. /** Return true iff `m_internal` is not null. */
  9953. FZ_FUNCTION operator bool();
  9954. /* == Member data. */
  9955. /** Pointer to wrapped data. */
  9956. ::fz_stream* m_internal;
  9957. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9958. generate code regardless so we always need to have this available. */
  9959. FZ_DATA static int s_num_instances;
  9960. };
  9961. /** Wrapper class for struct `fz_string`. */
  9962. struct FzString
  9963. {
  9964. /** == Constructors. */
  9965. /** Constructor using `fz_new_string()`. */
  9966. FZ_FUNCTION FzString(const char *str);
  9967. /** Copy constructor using `fz_keep_string()`. */
  9968. FZ_FUNCTION FzString(const FzString& rhs);
  9969. /** operator= using `fz_keep_string()` and `fz_drop_string()`. */
  9970. FZ_FUNCTION FzString& operator=(const FzString& rhs);
  9971. /** Default constructor, sets `m_internal` to null. */
  9972. FZ_FUNCTION FzString();
  9973. /** Constructor using raw copy of pre-existing `::fz_string`. */
  9974. /* This constructor is marked as `explicit` because wrapper classes do not
  9975. call `keep`in constructors, but do call `drop` in destructors. So
  9976. automatic construction from a fz_string* will generally cause an
  9977. unbalanced `drop` resulting in errors such as SEGV. */
  9978. FZ_FUNCTION explicit FzString(::fz_string* internal);
  9979. /** Destructor using fz_drop_string(). */
  9980. FZ_FUNCTION ~FzString();
  9981. /** Return numerical value of .m_internal; helps with Python debugging. */
  9982. FZ_FUNCTION long long m_internal_value();
  9983. /** Return true iff `m_internal` is not null. */
  9984. FZ_FUNCTION operator bool();
  9985. /* == Member data. */
  9986. /** Pointer to wrapped data. */
  9987. ::fz_string* m_internal;
  9988. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  9989. generate code regardless so we always need to have this available. */
  9990. FZ_DATA static int s_num_instances;
  9991. };
  9992. /** Wrapper class for struct `fz_stroke_state`. */
  9993. struct FzStrokeState
  9994. {
  9995. /** == Constructors. */
  9996. /** Constructor using `fz_new_stroke_state()`. */
  9997. /**
  9998. Create a new (empty) stroke state structure (with no dash
  9999. data) and return a reference to it.
  10000. Throws exception on failure to allocate.
  10001. */
  10002. FZ_FUNCTION FzStrokeState();
  10003. /** Constructor using `fz_new_stroke_state_with_dash_len()`. */
  10004. /**
  10005. Create a new (empty) stroke state structure, with room for
  10006. dash data of the given length, and return a reference to it.
  10007. len: The number of dash elements to allow room for.
  10008. Throws exception on failure to allocate.
  10009. */
  10010. FZ_FUNCTION FzStrokeState(int len);
  10011. /** Copy constructor using `fz_keep_stroke_state()`. */
  10012. FZ_FUNCTION FzStrokeState(const FzStrokeState& rhs);
  10013. /** operator= using `fz_keep_stroke_state()` and `fz_drop_stroke_state()`. */
  10014. FZ_FUNCTION FzStrokeState& operator=(const FzStrokeState& rhs);
  10015. /* == Methods. */
  10016. /** Class-aware wrapper for `::fz_clone_stroke_state()`. */
  10017. /**
  10018. Create an identical stroke_state structure and return a
  10019. reference to it.
  10020. stroke: The stroke state reference to clone.
  10021. Exceptions may be thrown in the event of a failure to
  10022. allocate.
  10023. */
  10024. FZ_FUNCTION FzStrokeState fz_clone_stroke_state() const;
  10025. /** Class-aware wrapper for `::fz_stroke_state_eq()`. */
  10026. FZ_FUNCTION int fz_stroke_state_eq(const FzStrokeState& b) const;
  10027. /** Class-aware wrapper for `::fz_unshare_stroke_state()`. */
  10028. /**
  10029. Given a reference to a (possibly) shared stroke_state structure,
  10030. return a reference to an equivalent stroke_state structure
  10031. that is guaranteed to be unshared (i.e. one that can
  10032. safely be modified).
  10033. shared: The reference to a (possibly) shared structure
  10034. to unshare. Ownership of this reference is passed in
  10035. to this function, even in the case of exceptions being
  10036. thrown.
  10037. Exceptions may be thrown in the event of failure to
  10038. allocate if required.
  10039. */
  10040. FZ_FUNCTION FzStrokeState fz_unshare_stroke_state() const;
  10041. /** Class-aware wrapper for `::fz_unshare_stroke_state_with_dash_len()`. */
  10042. /**
  10043. Given a reference to a (possibly) shared stroke_state structure,
  10044. return a reference to a stroke_state structure (with room for a
  10045. given amount of dash data) that is guaranteed to be unshared
  10046. (i.e. one that can safely be modified).
  10047. shared: The reference to a (possibly) shared structure
  10048. to unshare. Ownership of this reference is passed in
  10049. to this function, even in the case of exceptions being
  10050. thrown.
  10051. Exceptions may be thrown in the event of failure to
  10052. allocate if required.
  10053. */
  10054. FZ_FUNCTION FzStrokeState fz_unshare_stroke_state_with_dash_len(int len) const;
  10055. /** Constructor using raw copy of pre-existing `::fz_stroke_state`. */
  10056. /* This constructor is marked as `explicit` because wrapper classes do not
  10057. call `keep`in constructors, but do call `drop` in destructors. So
  10058. automatic construction from a fz_stroke_state* will generally cause an
  10059. unbalanced `drop` resulting in errors such as SEGV. */
  10060. FZ_FUNCTION explicit FzStrokeState(::fz_stroke_state* internal);
  10061. /** Destructor using fz_drop_stroke_state(). */
  10062. FZ_FUNCTION ~FzStrokeState();
  10063. /** Return numerical value of .m_internal; helps with Python debugging. */
  10064. FZ_FUNCTION long long m_internal_value();
  10065. /** Return true iff `m_internal` is not null. */
  10066. FZ_FUNCTION operator bool();
  10067. /* == Member data. */
  10068. /** Pointer to wrapped data. */
  10069. ::fz_stroke_state* m_internal;
  10070. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10071. generate code regardless so we always need to have this available. */
  10072. FZ_DATA static int s_num_instances;
  10073. };
  10074. /** Wrapper class for struct `fz_style_context`. Not copyable or assignable. */
  10075. struct FzStyleContext
  10076. {
  10077. /** Default constructor, sets `m_internal` to null. */
  10078. FZ_FUNCTION FzStyleContext();
  10079. /** Constructor using raw copy of pre-existing `::fz_style_context`. */
  10080. FZ_FUNCTION FzStyleContext(::fz_style_context* internal);
  10081. #ifndef NDEBUG
  10082. /** Destructor only decrements s_num_instances. */
  10083. FZ_FUNCTION ~FzStyleContext();
  10084. #else
  10085. /** We use default destructor. */
  10086. #endif
  10087. /** Return numerical value of .m_internal; helps with Python debugging. */
  10088. FZ_FUNCTION long long m_internal_value();
  10089. /** Return true iff `m_internal` is not null. */
  10090. FZ_FUNCTION operator bool();
  10091. /* == Member data. */
  10092. /** Pointer to wrapped data. */
  10093. ::fz_style_context* m_internal;
  10094. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10095. generate code regardless so we always need to have this available. */
  10096. FZ_DATA static int s_num_instances;
  10097. private:
  10098. /** This class is not copyable or assignable. */
  10099. FzStyleContext(const FzStyleContext& rhs);
  10100. FzStyleContext& operator=(const FzStyleContext& rhs);
  10101. };
  10102. /** Wrapper class for struct `fz_text`. */
  10103. struct FzText
  10104. {
  10105. /** == Constructors. */
  10106. /** Constructor using `fz_new_text()`. */
  10107. /**
  10108. Create a new empty fz_text object.
  10109. Throws exception on failure to allocate.
  10110. */
  10111. FZ_FUNCTION FzText();
  10112. /** Copy constructor using `fz_keep_text()`. */
  10113. FZ_FUNCTION FzText(const FzText& rhs);
  10114. /** operator= using `fz_keep_text()` and `fz_drop_text()`. */
  10115. FZ_FUNCTION FzText& operator=(const FzText& rhs);
  10116. /* == Methods. */
  10117. /** Class-aware wrapper for `::fz_bound_text()`. */
  10118. /**
  10119. Find the bounds of a given text object.
  10120. text: The text object to find the bounds of.
  10121. stroke: Pointer to the stroke attributes (for stroked
  10122. text), or NULL (for filled text).
  10123. ctm: The matrix in use.
  10124. r: pointer to storage for the bounds.
  10125. Returns a pointer to r, which is updated to contain the
  10126. bounding box for the text object.
  10127. */
  10128. FZ_FUNCTION FzRect fz_bound_text(const FzStrokeState& stroke, const FzMatrix& ctm) const;
  10129. /** Class-aware wrapper for `::fz_show_glyph()`. */
  10130. /**
  10131. Add a glyph/unicode value to a text object.
  10132. text: Text object to add to.
  10133. font: The font the glyph should be added in.
  10134. trm: The transform to use for the glyph.
  10135. glyph: The glyph id to add.
  10136. unicode: The unicode character for the glyph.
  10137. cid: The CJK CID value or raw character code.
  10138. wmode: 1 for vertical mode, 0 for horizontal.
  10139. bidi_level: The bidirectional level for this glyph.
  10140. markup_dir: The direction of the text as specified in the
  10141. markup.
  10142. language: The language in use (if known, 0 otherwise)
  10143. (e.g. FZ_LANG_zh_Hans).
  10144. Throws exception on failure to allocate.
  10145. */
  10146. FZ_FUNCTION void fz_show_glyph(const FzFont& font, const FzMatrix& trm, int glyph, int unicode, int wmode, int bidi_level, ::fz_bidi_direction markup_dir, ::fz_text_language language) const;
  10147. /** Class-aware wrapper for `::fz_show_glyph_aux()`. */
  10148. FZ_FUNCTION void fz_show_glyph_aux(const FzFont& font, const FzMatrix& trm, float adv, int glyph, int unicode, int cid, int wmode, int bidi_level, ::fz_bidi_direction markup_dir, ::fz_text_language lang) const;
  10149. /** Class-aware wrapper for `::fz_show_string()`. */
  10150. /**
  10151. Add a UTF8 string to a text object.
  10152. text: Text object to add to.
  10153. font: The font the string should be added in.
  10154. trm: The transform to use.
  10155. s: The utf-8 string to add.
  10156. wmode: 1 for vertical mode, 0 for horizontal.
  10157. bidi_level: The bidirectional level for this glyph.
  10158. markup_dir: The direction of the text as specified in the markup.
  10159. language: The language in use (if known, 0 otherwise)
  10160. (e.g. FZ_LANG_zh_Hans).
  10161. Returns the transform updated with the advance width of the
  10162. string.
  10163. */
  10164. FZ_FUNCTION FzMatrix fz_show_string(const FzFont& font, const FzMatrix& trm, const char *s, int wmode, int bidi_level, ::fz_bidi_direction markup_dir, ::fz_text_language language) const;
  10165. /** Constructor using raw copy of pre-existing `::fz_text`. */
  10166. /* This constructor is marked as `explicit` because wrapper classes do not
  10167. call `keep`in constructors, but do call `drop` in destructors. So
  10168. automatic construction from a fz_text* will generally cause an
  10169. unbalanced `drop` resulting in errors such as SEGV. */
  10170. FZ_FUNCTION explicit FzText(::fz_text* internal);
  10171. /** Destructor using fz_drop_text(). */
  10172. FZ_FUNCTION ~FzText();
  10173. /** Return numerical value of .m_internal; helps with Python debugging. */
  10174. FZ_FUNCTION long long m_internal_value();
  10175. /** Return true iff `m_internal` is not null. */
  10176. FZ_FUNCTION operator bool();
  10177. /* == Member data. */
  10178. /** Pointer to wrapped data. */
  10179. ::fz_text* m_internal;
  10180. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10181. generate code regardless so we always need to have this available. */
  10182. FZ_DATA static int s_num_instances;
  10183. };
  10184. /** Wrapper class for struct `fz_text_decoder`. Not copyable or assignable. */
  10185. /**
  10186. * A text decoder (to read arbitrary encodings and convert to unicode).
  10187. */
  10188. struct FzTextDecoder
  10189. {
  10190. /** Default constructor, sets `m_internal` to null. */
  10191. FZ_FUNCTION FzTextDecoder();
  10192. /* == Methods. */
  10193. /** Class-aware wrapper for `::fz_init_text_decoder()`. */
  10194. FZ_FUNCTION void fz_init_text_decoder(const char *encoding) const;
  10195. /** Constructor using raw copy of pre-existing `::fz_text_decoder`. */
  10196. FZ_FUNCTION FzTextDecoder(::fz_text_decoder* internal);
  10197. #ifndef NDEBUG
  10198. /** Destructor only decrements s_num_instances. */
  10199. FZ_FUNCTION ~FzTextDecoder();
  10200. #else
  10201. /** We use default destructor. */
  10202. #endif
  10203. /** Return numerical value of .m_internal; helps with Python debugging. */
  10204. FZ_FUNCTION long long m_internal_value();
  10205. /** Return true iff `m_internal` is not null. */
  10206. FZ_FUNCTION operator bool();
  10207. /* == Member data. */
  10208. /** Pointer to wrapped data. */
  10209. ::fz_text_decoder* m_internal;
  10210. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10211. generate code regardless so we always need to have this available. */
  10212. FZ_DATA static int s_num_instances;
  10213. private:
  10214. /** This class is not copyable or assignable. */
  10215. FzTextDecoder(const FzTextDecoder& rhs);
  10216. FzTextDecoder& operator=(const FzTextDecoder& rhs);
  10217. };
  10218. /** Wrapper class for struct `fz_text_item`. Not copyable or assignable. */
  10219. /**
  10220. Text buffer.
  10221. The trm field contains the a, b, c and d coefficients.
  10222. The e and f coefficients come from the individual elements,
  10223. together they form the transform matrix for the glyph.
  10224. Glyphs are referenced by glyph ID.
  10225. The Unicode text equivalent is kept in a separate array
  10226. with indexes into the glyph array.
  10227. */
  10228. struct FzTextItem
  10229. {
  10230. /** Default constructor, sets `m_internal` to null. */
  10231. FZ_FUNCTION FzTextItem();
  10232. /** Constructor using raw copy of pre-existing `::fz_text_item`. */
  10233. FZ_FUNCTION FzTextItem(::fz_text_item* internal);
  10234. #ifndef NDEBUG
  10235. /** Destructor only decrements s_num_instances. */
  10236. FZ_FUNCTION ~FzTextItem();
  10237. #else
  10238. /** We use default destructor. */
  10239. #endif
  10240. /** Return numerical value of .m_internal; helps with Python debugging. */
  10241. FZ_FUNCTION long long m_internal_value();
  10242. /** Return true iff `m_internal` is not null. */
  10243. FZ_FUNCTION operator bool();
  10244. /* == Member data. */
  10245. /** Pointer to wrapped data. */
  10246. ::fz_text_item* m_internal;
  10247. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10248. generate code regardless so we always need to have this available. */
  10249. FZ_DATA static int s_num_instances;
  10250. private:
  10251. /** This class is not copyable or assignable. */
  10252. FzTextItem(const FzTextItem& rhs);
  10253. FzTextItem& operator=(const FzTextItem& rhs);
  10254. };
  10255. /** Wrapper class for struct `fz_text_span`. Not copyable or assignable. */
  10256. struct FzTextSpan
  10257. {
  10258. /** Default constructor, sets `m_internal` to null. */
  10259. FZ_FUNCTION FzTextSpan();
  10260. /* == Methods. */
  10261. /** Gives class-aware access to m_internal->font. */
  10262. FZ_FUNCTION FzFont font();
  10263. /** Gives class-aware access to m_internal->trm. */
  10264. FZ_FUNCTION FzMatrix trm();
  10265. /** Gives access to m_internal->items[i].
  10266. Returned reference is only valid as long as `this`.
  10267. Provided mainly for use by SWIG bindings.
  10268. */
  10269. FZ_FUNCTION fz_text_item& items( int i);
  10270. /** Constructor using raw copy of pre-existing `::fz_text_span`. */
  10271. FZ_FUNCTION FzTextSpan(::fz_text_span* internal);
  10272. #ifndef NDEBUG
  10273. /** Destructor only decrements s_num_instances. */
  10274. FZ_FUNCTION ~FzTextSpan();
  10275. #else
  10276. /** We use default destructor. */
  10277. #endif
  10278. /** Return numerical value of .m_internal; helps with Python debugging. */
  10279. FZ_FUNCTION long long m_internal_value();
  10280. /** Return true iff `m_internal` is not null. */
  10281. FZ_FUNCTION operator bool();
  10282. /* == Member data. */
  10283. /** Pointer to wrapped data. */
  10284. ::fz_text_span* m_internal;
  10285. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10286. generate code regardless so we always need to have this available. */
  10287. FZ_DATA static int s_num_instances;
  10288. private:
  10289. /** This class is not copyable or assignable. */
  10290. FzTextSpan(const FzTextSpan& rhs);
  10291. FzTextSpan& operator=(const FzTextSpan& rhs);
  10292. };
  10293. /** Wrapper class for struct `fz_transition`. */
  10294. struct FzTransition
  10295. {
  10296. /** We use default copy constructor and operator=. */
  10297. /** Default constructor, sets each member to default value. */
  10298. FZ_FUNCTION FzTransition();
  10299. /** Constructor using raw copy of pre-existing `::fz_transition`. */
  10300. FZ_FUNCTION FzTransition(const ::fz_transition* internal);
  10301. /** Constructor using raw copy of pre-existing `::fz_transition`. */
  10302. FZ_FUNCTION FzTransition(const ::fz_transition internal);
  10303. /** Access as underlying struct. */
  10304. FZ_FUNCTION ::fz_transition* internal();
  10305. /** Access as underlying struct. */
  10306. FZ_FUNCTION const ::fz_transition* internal() const;
  10307. #ifndef NDEBUG
  10308. /** Destructor only decrements s_num_instances. */
  10309. FZ_FUNCTION ~FzTransition();
  10310. #else
  10311. /** We use default destructor. */
  10312. #endif
  10313. /* == Member data. */
  10314. /* These members are the same as the members of ::fz_transition. */
  10315. int type;
  10316. float duration;
  10317. int vertical;
  10318. int outwards;
  10319. int direction;
  10320. int state0;
  10321. int state1;
  10322. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10323. generate code regardless so we always need to have this available. */
  10324. FZ_DATA static int s_num_instances;
  10325. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  10326. FZ_FUNCTION std::string to_string();
  10327. /** Comparison method. */
  10328. FZ_FUNCTION bool operator==(const FzTransition& rhs);
  10329. /** Comparison method. */
  10330. FZ_FUNCTION bool operator!=(const FzTransition& rhs);
  10331. };
  10332. /** Wrapper class for struct `fz_tree`. Not copyable or assignable. */
  10333. /**
  10334. AA-tree to look up things by strings.
  10335. */
  10336. struct FzTree
  10337. {
  10338. /** Default constructor, sets `m_internal` to null. */
  10339. FZ_FUNCTION FzTree();
  10340. /* == Methods. */
  10341. /** Class-aware wrapper for `::fz_new_tree_archive()`. */
  10342. /**
  10343. Create an archive that holds named buffers.
  10344. tree can either be a preformed tree with fz_buffers as values,
  10345. or it can be NULL for an empty tree.
  10346. */
  10347. FZ_FUNCTION FzArchive fz_new_tree_archive() const;
  10348. /** Class-aware wrapper for `::fz_tree_lookup()`. */
  10349. /**
  10350. Look for the value of a node in the tree with the given key.
  10351. Simple pointer equivalence is used for key.
  10352. Returns NULL for no match.
  10353. */
  10354. FZ_FUNCTION void *fz_tree_lookup(const char *key) const;
  10355. /** Constructor using raw copy of pre-existing `::fz_tree`. */
  10356. FZ_FUNCTION FzTree(::fz_tree* internal);
  10357. #ifndef NDEBUG
  10358. /** Destructor only decrements s_num_instances. */
  10359. FZ_FUNCTION ~FzTree();
  10360. #else
  10361. /** We use default destructor. */
  10362. #endif
  10363. /** Return numerical value of .m_internal; helps with Python debugging. */
  10364. FZ_FUNCTION long long m_internal_value();
  10365. /** Return true iff `m_internal` is not null. */
  10366. FZ_FUNCTION operator bool();
  10367. /* == Member data. */
  10368. /** Pointer to wrapped data. */
  10369. ::fz_tree* m_internal;
  10370. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10371. generate code regardless so we always need to have this available. */
  10372. FZ_DATA static int s_num_instances;
  10373. private:
  10374. /** This class is not copyable or assignable. */
  10375. FzTree(const FzTree& rhs);
  10376. FzTree& operator=(const FzTree& rhs);
  10377. };
  10378. /** Wrapper class for struct `fz_tuning_context`. Not copyable or assignable. */
  10379. struct FzTuningContext
  10380. {
  10381. /** Default constructor, sets `m_internal` to null. */
  10382. FZ_FUNCTION FzTuningContext();
  10383. /** Constructor using raw copy of pre-existing `::fz_tuning_context`. */
  10384. FZ_FUNCTION FzTuningContext(::fz_tuning_context* internal);
  10385. #ifndef NDEBUG
  10386. /** Destructor only decrements s_num_instances. */
  10387. FZ_FUNCTION ~FzTuningContext();
  10388. #else
  10389. /** We use default destructor. */
  10390. #endif
  10391. /** Return numerical value of .m_internal; helps with Python debugging. */
  10392. FZ_FUNCTION long long m_internal_value();
  10393. /** Return true iff `m_internal` is not null. */
  10394. FZ_FUNCTION operator bool();
  10395. /* == Member data. */
  10396. /** Pointer to wrapped data. */
  10397. ::fz_tuning_context* m_internal;
  10398. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10399. generate code regardless so we always need to have this available. */
  10400. FZ_DATA static int s_num_instances;
  10401. private:
  10402. /** This class is not copyable or assignable. */
  10403. FzTuningContext(const FzTuningContext& rhs);
  10404. FzTuningContext& operator=(const FzTuningContext& rhs);
  10405. };
  10406. /** Wrapper class for struct `fz_vertex`. Not copyable or assignable. */
  10407. /**
  10408. * Handy routine for processing mesh based shades
  10409. */
  10410. struct FzVertex
  10411. {
  10412. /** Default constructor, sets `m_internal` to null. */
  10413. FZ_FUNCTION FzVertex();
  10414. /** Constructor using raw copy of pre-existing `::fz_vertex`. */
  10415. FZ_FUNCTION FzVertex(::fz_vertex* internal);
  10416. #ifndef NDEBUG
  10417. /** Destructor only decrements s_num_instances. */
  10418. FZ_FUNCTION ~FzVertex();
  10419. #else
  10420. /** We use default destructor. */
  10421. #endif
  10422. /** Return numerical value of .m_internal; helps with Python debugging. */
  10423. FZ_FUNCTION long long m_internal_value();
  10424. /** Return true iff `m_internal` is not null. */
  10425. FZ_FUNCTION operator bool();
  10426. /* == Member data. */
  10427. /** Pointer to wrapped data. */
  10428. ::fz_vertex* m_internal;
  10429. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10430. generate code regardless so we always need to have this available. */
  10431. FZ_DATA static int s_num_instances;
  10432. private:
  10433. /** This class is not copyable or assignable. */
  10434. FzVertex(const FzVertex& rhs);
  10435. FzVertex& operator=(const FzVertex& rhs);
  10436. };
  10437. /** Wrapper class for struct `fz_warn_context`. Not copyable or assignable. */
  10438. struct FzWarnContext
  10439. {
  10440. /** Default constructor, sets `m_internal` to null. */
  10441. FZ_FUNCTION FzWarnContext();
  10442. /** Constructor using raw copy of pre-existing `::fz_warn_context`. */
  10443. FZ_FUNCTION FzWarnContext(::fz_warn_context* internal);
  10444. #ifndef NDEBUG
  10445. /** Destructor only decrements s_num_instances. */
  10446. FZ_FUNCTION ~FzWarnContext();
  10447. #else
  10448. /** We use default destructor. */
  10449. #endif
  10450. /** Return numerical value of .m_internal; helps with Python debugging. */
  10451. FZ_FUNCTION long long m_internal_value();
  10452. /** Return true iff `m_internal` is not null. */
  10453. FZ_FUNCTION operator bool();
  10454. /* == Member data. */
  10455. /** Pointer to wrapped data. */
  10456. ::fz_warn_context* m_internal;
  10457. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10458. generate code regardless so we always need to have this available. */
  10459. FZ_DATA static int s_num_instances;
  10460. private:
  10461. /** This class is not copyable or assignable. */
  10462. FzWarnContext(const FzWarnContext& rhs);
  10463. FzWarnContext& operator=(const FzWarnContext& rhs);
  10464. };
  10465. /** Wrapper class for struct `fz_write_story_position`. Not copyable or assignable. */
  10466. struct FzWriteStoryPosition
  10467. {
  10468. /** Default constructor, sets `m_internal` to null. */
  10469. FZ_FUNCTION FzWriteStoryPosition();
  10470. /** Constructor using raw copy of pre-existing `::fz_write_story_position`. */
  10471. FZ_FUNCTION FzWriteStoryPosition(::fz_write_story_position* internal);
  10472. #ifndef NDEBUG
  10473. /** Destructor only decrements s_num_instances. */
  10474. FZ_FUNCTION ~FzWriteStoryPosition();
  10475. #else
  10476. /** We use default destructor. */
  10477. #endif
  10478. /** Return numerical value of .m_internal; helps with Python debugging. */
  10479. FZ_FUNCTION long long m_internal_value();
  10480. /** Return true iff `m_internal` is not null. */
  10481. FZ_FUNCTION operator bool();
  10482. /* == Member data. */
  10483. /** Pointer to wrapped data. */
  10484. ::fz_write_story_position* m_internal;
  10485. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10486. generate code regardless so we always need to have this available. */
  10487. FZ_DATA static int s_num_instances;
  10488. private:
  10489. /** This class is not copyable or assignable. */
  10490. FzWriteStoryPosition(const FzWriteStoryPosition& rhs);
  10491. FzWriteStoryPosition& operator=(const FzWriteStoryPosition& rhs);
  10492. };
  10493. /** Wrapper class for struct `fz_write_story_positions`. Not copyable or assignable. */
  10494. struct FzWriteStoryPositions
  10495. {
  10496. /** Default constructor, sets `m_internal` to null. */
  10497. FZ_FUNCTION FzWriteStoryPositions();
  10498. /** Constructor using raw copy of pre-existing `::fz_write_story_positions`. */
  10499. FZ_FUNCTION FzWriteStoryPositions(::fz_write_story_positions* internal);
  10500. #ifndef NDEBUG
  10501. /** Destructor only decrements s_num_instances. */
  10502. FZ_FUNCTION ~FzWriteStoryPositions();
  10503. #else
  10504. /** We use default destructor. */
  10505. #endif
  10506. /** Return numerical value of .m_internal; helps with Python debugging. */
  10507. FZ_FUNCTION long long m_internal_value();
  10508. /** Return true iff `m_internal` is not null. */
  10509. FZ_FUNCTION operator bool();
  10510. /* == Member data. */
  10511. /** Pointer to wrapped data. */
  10512. ::fz_write_story_positions* m_internal;
  10513. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10514. generate code regardless so we always need to have this available. */
  10515. FZ_DATA static int s_num_instances;
  10516. private:
  10517. /** This class is not copyable or assignable. */
  10518. FzWriteStoryPositions(const FzWriteStoryPositions& rhs);
  10519. FzWriteStoryPositions& operator=(const FzWriteStoryPositions& rhs);
  10520. };
  10521. /** Wrapper class for struct `fz_xml`. */
  10522. /**
  10523. XML document model
  10524. */
  10525. struct FzXml
  10526. {
  10527. /** == Constructors. */
  10528. /** Constructor using `fz_new_dom()`. */
  10529. /**
  10530. Make new xml dom root element.
  10531. */
  10532. FZ_FUNCTION FzXml(const char *tag);
  10533. /** Constructor using `fz_new_dom_node()`. */
  10534. /**
  10535. Create a new dom node.
  10536. This will NOT be linked in yet.
  10537. */
  10538. FZ_FUNCTION FzXml(const FzXml& dom, const char *tag);
  10539. /** Copy constructor using `fz_keep_xml()`. */
  10540. FZ_FUNCTION FzXml(const FzXml& rhs);
  10541. /** operator= using `fz_keep_xml()` and `fz_drop_xml()`. */
  10542. FZ_FUNCTION FzXml& operator=(const FzXml& rhs);
  10543. /** Default constructor, sets `m_internal` to null. */
  10544. FZ_FUNCTION FzXml();
  10545. /* == Static methods. */
  10546. /** Class-aware wrapper for `::fz_new_dom_text_node()`. */
  10547. /**
  10548. Create a new dom text node.
  10549. This will NOT be linked in yet.
  10550. */
  10551. FZ_FUNCTION static FzXml fz_new_dom_text_node(const FzXml& dom, const char *text);
  10552. /* == Methods. */
  10553. /** Class-aware wrapper for `::fz_debug_xml()`. */
  10554. /**
  10555. Pretty-print an XML tree to stdout. (Deprecated, use
  10556. fz_output_xml in preference).
  10557. */
  10558. FZ_FUNCTION void fz_debug_xml(int level) const;
  10559. /** Class-aware wrapper for `::fz_detach_xml()`. */
  10560. /**
  10561. Detach a node from the tree, unlinking it from its parent,
  10562. and setting the document root to the node.
  10563. */
  10564. FZ_FUNCTION void fz_detach_xml() const;
  10565. /** Class-aware wrapper for `::fz_dom_add_attribute()`. */
  10566. /**
  10567. Add an attribute to an element.
  10568. Ownership of att and value remain with the caller.
  10569. */
  10570. FZ_FUNCTION void fz_dom_add_attribute(const char *att, const char *value) const;
  10571. /** Class-aware wrapper for `::fz_dom_append_child()`. */
  10572. /**
  10573. Insert an element as the last child of a parent, unlinking the
  10574. child from its current position if required.
  10575. */
  10576. FZ_FUNCTION void fz_dom_append_child(const FzXml& child) const;
  10577. /** Class-aware wrapper for `::fz_dom_attribute()`. */
  10578. /**
  10579. Retrieve the value of a given attribute from a given element.
  10580. Returns a borrowed pointer to the value or NULL if not found.
  10581. */
  10582. FZ_FUNCTION const char *fz_dom_attribute(const char *att) const;
  10583. /** Class-aware wrapper for `::fz_dom_body()`. */
  10584. /**
  10585. Return a borrowed reference for the 'body' element of
  10586. the given DOM.
  10587. */
  10588. FZ_FUNCTION FzXml fz_dom_body() const;
  10589. /** Class-aware wrapper for `::fz_dom_clone()`. */
  10590. /**
  10591. Clone an element (and its children).
  10592. A borrowed reference to the clone is returned. The clone is not
  10593. yet linked into the DOM.
  10594. */
  10595. FZ_FUNCTION FzXml fz_dom_clone() const;
  10596. /** Class-aware wrapper for `::fz_dom_create_element()`. */
  10597. /**
  10598. Create an element of a given tag type for the given DOM.
  10599. The element is not linked into the DOM yet.
  10600. */
  10601. FZ_FUNCTION FzXml fz_dom_create_element(const char *tag) const;
  10602. /** Class-aware wrapper for `::fz_dom_create_text_node()`. */
  10603. /**
  10604. Create a text node for the given DOM.
  10605. The element is not linked into the DOM yet.
  10606. */
  10607. FZ_FUNCTION FzXml fz_dom_create_text_node(const char *text) const;
  10608. /** Class-aware wrapper for `::fz_dom_document_element()`. */
  10609. /**
  10610. Return a borrowed reference for the document (the top
  10611. level element) of the DOM.
  10612. */
  10613. FZ_FUNCTION FzXml fz_dom_document_element() const;
  10614. /** Class-aware wrapper for `::fz_dom_find()`. */
  10615. /**
  10616. Find the first element matching the requirements in a depth first traversal from elt.
  10617. The tagname must match tag, unless tag is NULL, when all tag names are considered to match.
  10618. If att is NULL, then all tags match.
  10619. Otherwise:
  10620. If match is NULL, then only nodes that have an att attribute match.
  10621. If match is non-NULL, then only nodes that have an att attribute that matches match match.
  10622. Returns NULL (if no match found), or a borrowed reference to the first matching element.
  10623. */
  10624. FZ_FUNCTION FzXml fz_dom_find(const char *tag, const char *att, const char *match) const;
  10625. /** Class-aware wrapper for `::fz_dom_find_next()`. */
  10626. /**
  10627. Find the next element matching the requirements.
  10628. */
  10629. FZ_FUNCTION FzXml fz_dom_find_next(const char *tag, const char *att, const char *match) const;
  10630. /** Class-aware wrapper for `::fz_dom_first_child()`. */
  10631. /**
  10632. Return a borrowed reference to the first child of a node,
  10633. or NULL if there isn't one.
  10634. */
  10635. FZ_FUNCTION FzXml fz_dom_first_child() const;
  10636. /** Class-aware wrapper for `::fz_dom_get_attribute()`.
  10637. This method has out-params. Python/C# wrappers look like:
  10638. `fz_dom_get_attribute(int i)` => `(const char *, const char *att)`
  10639. */
  10640. /**
  10641. Enumerate through the attributes of an element.
  10642. Call with i=0,1,2,3... to enumerate attributes.
  10643. On return *att and the return value will be NULL if there are not
  10644. that many attributes to read. Otherwise, *att will be filled in
  10645. with a borrowed pointer to the attribute name, and the return
  10646. value will be a borrowed pointer to the value.
  10647. */
  10648. FZ_FUNCTION const char *fz_dom_get_attribute(int i, const char **att) const;
  10649. /** Class-aware wrapper for `::fz_dom_insert_after()`. */
  10650. /**
  10651. Insert an element (new_elt), after another element (node),
  10652. unlinking the new_elt from its current position if required.
  10653. */
  10654. FZ_FUNCTION void fz_dom_insert_after(const FzXml& new_elt) const;
  10655. /** Class-aware wrapper for `::fz_dom_insert_before()`. */
  10656. /**
  10657. Insert an element (new_elt), before another element (node),
  10658. unlinking the new_elt from its current position if required.
  10659. */
  10660. FZ_FUNCTION void fz_dom_insert_before(const FzXml& new_elt) const;
  10661. /** Class-aware wrapper for `::fz_dom_next()`. */
  10662. /**
  10663. Return a borrowed reference to the next sibling of a node,
  10664. or NULL if there isn't one.
  10665. */
  10666. FZ_FUNCTION FzXml fz_dom_next() const;
  10667. /** Class-aware wrapper for `::fz_dom_parent()`. */
  10668. /**
  10669. Return a borrowed reference to the parent of a node,
  10670. or NULL if there isn't one.
  10671. */
  10672. FZ_FUNCTION FzXml fz_dom_parent() const;
  10673. /** Class-aware wrapper for `::fz_dom_previous()`. */
  10674. /**
  10675. Return a borrowed reference to the previous sibling of a node,
  10676. or NULL if there isn't one.
  10677. */
  10678. FZ_FUNCTION FzXml fz_dom_previous() const;
  10679. /** Class-aware wrapper for `::fz_dom_remove()`. */
  10680. /**
  10681. Remove an element from the DOM. The element can be added back elsewhere
  10682. if required.
  10683. No reference counting changes for the element.
  10684. */
  10685. FZ_FUNCTION void fz_dom_remove() const;
  10686. /** Class-aware wrapper for `::fz_dom_remove_attribute()`. */
  10687. /**
  10688. Remove an attribute from an element.
  10689. */
  10690. FZ_FUNCTION void fz_dom_remove_attribute(const char *att) const;
  10691. /** Class-aware wrapper for `::fz_new_display_list_from_svg_xml()`.
  10692. This method has out-params. Python/C# wrappers look like:
  10693. `fz_new_display_list_from_svg_xml(::fz_xml *xml, const char *base_uri, ::fz_archive *dir)` => `(fz_display_list *, float w, float h)`
  10694. */
  10695. /**
  10696. Parse an SVG document into a display-list.
  10697. */
  10698. FZ_FUNCTION FzDisplayList fz_new_display_list_from_svg_xml(const FzXml& xml, const char *base_uri, const FzArchive& dir, float *w, float *h) const;
  10699. /** Class-aware wrapper for `::fz_new_dom_node()`. */
  10700. /**
  10701. Create a new dom node.
  10702. This will NOT be linked in yet.
  10703. */
  10704. FZ_FUNCTION FzXml fz_new_dom_node(const char *tag) const;
  10705. /** Class-aware wrapper for `::fz_new_dom_text_node()`. */
  10706. /**
  10707. Create a new dom text node.
  10708. This will NOT be linked in yet.
  10709. */
  10710. FZ_FUNCTION FzXml fz_new_dom_text_node(const char *text) const;
  10711. /** Class-aware wrapper for `::fz_new_image_from_svg_xml()`. */
  10712. /**
  10713. Create a scalable image from an SVG document.
  10714. */
  10715. FZ_FUNCTION FzImage fz_new_image_from_svg_xml(const FzXml& xml, const char *base_uri, const FzArchive& dir) const;
  10716. /** Class-aware wrapper for `::fz_save_xml()`. */
  10717. /**
  10718. As for fz_write_xml, but direct to a file.
  10719. */
  10720. FZ_FUNCTION void fz_save_xml(const char *path, int indented) const;
  10721. /** Class-aware wrapper for `::fz_write_xml()`. */
  10722. /**
  10723. Write our xml structure out to an xml stream.
  10724. Properly formatted XML is only allowed to have a single top-level node
  10725. under which everything must sit. Our structures allow for multiple
  10726. top level nodes. If required, we will output an extra 'ROOT' node
  10727. at the top so that the xml is well-formed.
  10728. If 'indented' is non-zero then additional whitespace will be added to
  10729. make the XML easier to read in a text editor. It will NOT be properly
  10730. compliant.
  10731. */
  10732. FZ_FUNCTION void fz_write_xml(const FzOutput& out, int indented) const;
  10733. /** Class-aware wrapper for `::fz_xml_att()`. */
  10734. /**
  10735. Return the value of an attribute of an XML node.
  10736. NULL if the attribute doesn't exist.
  10737. */
  10738. FZ_FUNCTION char *fz_xml_att(const char *att) const;
  10739. /** Class-aware wrapper for `::fz_xml_att_alt()`. */
  10740. /**
  10741. Return the value of an attribute of an XML node.
  10742. If the first attribute doesn't exist, try the second.
  10743. NULL if neither attribute exists.
  10744. */
  10745. FZ_FUNCTION char *fz_xml_att_alt(const char *one, const char *two) const;
  10746. /** Class-aware wrapper for `::fz_xml_att_eq()`. */
  10747. /**
  10748. Check for a matching attribute on an XML node.
  10749. If the node has the requested attribute (name), and the value
  10750. matches (match) then return 1. Otherwise, 0.
  10751. */
  10752. FZ_FUNCTION int fz_xml_att_eq(const char *name, const char *match) const;
  10753. /** Class-aware wrapper for `::fz_xml_down()`. */
  10754. /**
  10755. Return first child of XML node.
  10756. */
  10757. FZ_FUNCTION FzXml fz_xml_down() const;
  10758. /** Class-aware wrapper for `::fz_xml_find()`. */
  10759. /**
  10760. Search the siblings of XML nodes starting with item looking for
  10761. the first with the given tag.
  10762. Return NULL if none found.
  10763. */
  10764. FZ_FUNCTION FzXml fz_xml_find(const char *tag) const;
  10765. /** Class-aware wrapper for `::fz_xml_find_dfs()`. */
  10766. /**
  10767. Perform a depth first search from item, returning the first
  10768. child that matches the given tag (or any tag if tag is NULL),
  10769. with the given attribute (if att is non NULL), that matches
  10770. match (if match is non NULL).
  10771. */
  10772. FZ_FUNCTION FzXml fz_xml_find_dfs(const char *tag, const char *att, const char *match) const;
  10773. /** Class-aware wrapper for `::fz_xml_find_dfs_top()`. */
  10774. /**
  10775. Perform a depth first search from item, returning the first
  10776. child that matches the given tag (or any tag if tag is NULL),
  10777. with the given attribute (if att is non NULL), that matches
  10778. match (if match is non NULL). The search stops if it ever
  10779. reaches the top of the tree, or the declared 'top' item.
  10780. */
  10781. FZ_FUNCTION FzXml fz_xml_find_dfs_top(const char *tag, const char *att, const char *match, const FzXml& top) const;
  10782. /** Class-aware wrapper for `::fz_xml_find_down()`. */
  10783. /**
  10784. Search the siblings of XML nodes starting with the first child
  10785. of item looking for the first with the given tag.
  10786. Return NULL if none found.
  10787. */
  10788. FZ_FUNCTION FzXml fz_xml_find_down(const char *tag) const;
  10789. /** Class-aware wrapper for `::fz_xml_find_down_match()`. */
  10790. /**
  10791. Search the siblings of XML nodes starting with the first child
  10792. of item looking for the first with the given tag (or any tag if
  10793. tag is NULL), and with a matching attribute.
  10794. Return NULL if none found.
  10795. */
  10796. FZ_FUNCTION FzXml fz_xml_find_down_match(const char *tag, const char *att, const char *match) const;
  10797. /** Class-aware wrapper for `::fz_xml_find_match()`. */
  10798. /**
  10799. Search the siblings of XML nodes starting with item looking for
  10800. the first with the given tag (or any tag if tag is NULL), and
  10801. with a matching attribute.
  10802. Return NULL if none found.
  10803. */
  10804. FZ_FUNCTION FzXml fz_xml_find_match(const char *tag, const char *att, const char *match) const;
  10805. /** Class-aware wrapper for `::fz_xml_find_next()`. */
  10806. /**
  10807. Search the siblings of XML nodes starting with the first sibling
  10808. of item looking for the first with the given tag.
  10809. Return NULL if none found.
  10810. */
  10811. FZ_FUNCTION FzXml fz_xml_find_next(const char *tag) const;
  10812. /** Class-aware wrapper for `::fz_xml_find_next_dfs()`. */
  10813. /**
  10814. Perform a depth first search onwards from item, returning the first
  10815. child that matches the given tag (or any tag if tag is NULL),
  10816. with the given attribute (if att is non NULL), that matches
  10817. match (if match is non NULL).
  10818. */
  10819. FZ_FUNCTION FzXml fz_xml_find_next_dfs(const char *tag, const char *att, const char *match) const;
  10820. /** Class-aware wrapper for `::fz_xml_find_next_dfs_top()`. */
  10821. /**
  10822. Perform a depth first search onwards from item, returning the first
  10823. child that matches the given tag (or any tag if tag is NULL),
  10824. with the given attribute (if att is non NULL), that matches
  10825. match (if match is non NULL). The search stops if it ever reaches
  10826. the top of the tree, or the declared 'top' item.
  10827. */
  10828. FZ_FUNCTION FzXml fz_xml_find_next_dfs_top(const char *tag, const char *att, const char *match, const FzXml& top) const;
  10829. /** Class-aware wrapper for `::fz_xml_find_next_match()`. */
  10830. /**
  10831. Search the siblings of XML nodes starting with the first sibling
  10832. of item looking for the first with the given tag (or any tag if tag
  10833. is NULL), and with a matching attribute.
  10834. Return NULL if none found.
  10835. */
  10836. FZ_FUNCTION FzXml fz_xml_find_next_match(const char *tag, const char *att, const char *match) const;
  10837. /** Class-aware wrapper for `::fz_xml_is_tag()`. */
  10838. /**
  10839. Return true if the tag name matches.
  10840. */
  10841. FZ_FUNCTION int fz_xml_is_tag(const char *name) const;
  10842. /** Class-aware wrapper for `::fz_xml_next()`. */
  10843. /**
  10844. Return next sibling of XML node.
  10845. */
  10846. FZ_FUNCTION FzXml fz_xml_next() const;
  10847. /** Class-aware wrapper for `::fz_xml_prev()`. */
  10848. /**
  10849. Return previous sibling of XML node.
  10850. */
  10851. FZ_FUNCTION FzXml fz_xml_prev() const;
  10852. /** Class-aware wrapper for `::fz_xml_root()`. */
  10853. /**
  10854. Return the topmost XML node of a document.
  10855. */
  10856. FZ_FUNCTION FzXml fz_xml_root() const;
  10857. /** Class-aware wrapper for `::fz_xml_tag()`. */
  10858. /**
  10859. Return tag of XML node. Return NULL for text nodes.
  10860. */
  10861. FZ_FUNCTION char *fz_xml_tag() const;
  10862. /** Class-aware wrapper for `::fz_xml_text()`. */
  10863. /**
  10864. Return the text content of an XML node.
  10865. Return NULL if the node is a tag.
  10866. */
  10867. FZ_FUNCTION char *fz_xml_text() const;
  10868. /** Class-aware wrapper for `::fz_xml_up()`. */
  10869. /**
  10870. Return parent of XML node.
  10871. */
  10872. FZ_FUNCTION FzXml fz_xml_up() const;
  10873. /** Constructor using raw copy of pre-existing `::fz_xml`. */
  10874. /* This constructor is marked as `explicit` because wrapper classes do not
  10875. call `keep`in constructors, but do call `drop` in destructors. So
  10876. automatic construction from a fz_xml* will generally cause an
  10877. unbalanced `drop` resulting in errors such as SEGV. */
  10878. FZ_FUNCTION explicit FzXml(::fz_xml* internal);
  10879. /** Destructor using fz_drop_xml(). */
  10880. FZ_FUNCTION ~FzXml();
  10881. /** Return numerical value of .m_internal; helps with Python debugging. */
  10882. FZ_FUNCTION long long m_internal_value();
  10883. /** Return true iff `m_internal` is not null. */
  10884. FZ_FUNCTION operator bool();
  10885. /* == Member data. */
  10886. /** Pointer to wrapped data. */
  10887. ::fz_xml* m_internal;
  10888. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10889. generate code regardless so we always need to have this available. */
  10890. FZ_DATA static int s_num_instances;
  10891. };
  10892. /** Wrapper class for struct `fz_xml_doc`. Not copyable or assignable. */
  10893. struct FzXmlDoc
  10894. {
  10895. /** Default constructor, sets `m_internal` to null. */
  10896. FZ_FUNCTION FzXmlDoc();
  10897. /** Constructor using raw copy of pre-existing `::fz_xml_doc`. */
  10898. /* This constructor is marked as `explicit` because wrapper classes do not
  10899. call `keep`in constructors, but do call `drop` in destructors. So
  10900. automatic construction from a fz_xml_doc* will generally cause an
  10901. unbalanced `drop` resulting in errors such as SEGV. */
  10902. FZ_FUNCTION explicit FzXmlDoc(::fz_xml_doc* internal);
  10903. #ifndef NDEBUG
  10904. /** Destructor only decrements s_num_instances. */
  10905. FZ_FUNCTION ~FzXmlDoc();
  10906. #else
  10907. /** We use default destructor. */
  10908. #endif
  10909. /** Return numerical value of .m_internal; helps with Python debugging. */
  10910. FZ_FUNCTION long long m_internal_value();
  10911. /** Return true iff `m_internal` is not null. */
  10912. FZ_FUNCTION operator bool();
  10913. /* == Member data. */
  10914. /** Pointer to wrapped data. */
  10915. ::fz_xml_doc* m_internal;
  10916. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10917. generate code regardless so we always need to have this available. */
  10918. FZ_DATA static int s_num_instances;
  10919. private:
  10920. /** This class is not copyable or assignable. */
  10921. FzXmlDoc(const FzXmlDoc& rhs);
  10922. FzXmlDoc& operator=(const FzXmlDoc& rhs);
  10923. };
  10924. /** Wrapper class for struct `fz_zip_writer`. Not copyable or assignable. */
  10925. /**
  10926. fz_zip_writer offers methods for creating and writing zip files.
  10927. It can be seen as the reverse of the fz_archive zip
  10928. implementation.
  10929. */
  10930. struct FzZipWriter
  10931. {
  10932. /** == Constructors. */
  10933. /** Constructor using `fz_new_zip_writer()`. */
  10934. /**
  10935. Create a new zip writer that writes to a given file.
  10936. Open an archive using a seekable stream object rather than
  10937. opening a file or directory on disk.
  10938. */
  10939. FZ_FUNCTION FzZipWriter(const char *filename);
  10940. /** Constructor using `fz_new_zip_writer_with_output()`. */
  10941. /**
  10942. Create a new zip writer that writes to a given output stream.
  10943. Ownership of out passes in immediately upon calling this function.
  10944. The caller should never drop the fz_output, even if this function throws
  10945. an exception.
  10946. */
  10947. FZ_FUNCTION FzZipWriter(const FzOutput& out);
  10948. /** Default constructor, sets `m_internal` to null. */
  10949. FZ_FUNCTION FzZipWriter();
  10950. /* == Methods. */
  10951. /** Class-aware wrapper for `::fz_close_zip_writer()`. */
  10952. /**
  10953. Close the zip file for writing.
  10954. This flushes any pending data to the file. This can throw
  10955. exceptions.
  10956. */
  10957. FZ_FUNCTION void fz_close_zip_writer() const;
  10958. /** Class-aware wrapper for `::fz_write_zip_entry()`. */
  10959. /**
  10960. Given a buffer of data, (optionally) compress it, and add it to
  10961. the zip file with the given name.
  10962. */
  10963. FZ_FUNCTION void fz_write_zip_entry(const char *name, const FzBuffer& buf, int compress) const;
  10964. /** Constructor using raw copy of pre-existing `::fz_zip_writer`. */
  10965. FZ_FUNCTION FzZipWriter(::fz_zip_writer* internal);
  10966. /** Destructor using fz_drop_zip_writer(). */
  10967. FZ_FUNCTION ~FzZipWriter();
  10968. /** Return numerical value of .m_internal; helps with Python debugging. */
  10969. FZ_FUNCTION long long m_internal_value();
  10970. /** Return true iff `m_internal` is not null. */
  10971. FZ_FUNCTION operator bool();
  10972. /* == Member data. */
  10973. /** Pointer to wrapped data. */
  10974. ::fz_zip_writer* m_internal;
  10975. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  10976. generate code regardless so we always need to have this available. */
  10977. FZ_DATA static int s_num_instances;
  10978. private:
  10979. /** This class is not copyable or assignable. */
  10980. FzZipWriter(const FzZipWriter& rhs);
  10981. FzZipWriter& operator=(const FzZipWriter& rhs);
  10982. };
  10983. /** Wrapper class for struct `pdf_alert_event`. Not copyable or assignable. */
  10984. struct PdfAlertEvent
  10985. {
  10986. /** Default constructor, sets `m_internal` to null. */
  10987. FZ_FUNCTION PdfAlertEvent();
  10988. /** Constructor using raw copy of pre-existing `::pdf_alert_event`. */
  10989. FZ_FUNCTION PdfAlertEvent(::pdf_alert_event* internal);
  10990. #ifndef NDEBUG
  10991. /** Destructor only decrements s_num_instances. */
  10992. FZ_FUNCTION ~PdfAlertEvent();
  10993. #else
  10994. /** We use default destructor. */
  10995. #endif
  10996. /** Return numerical value of .m_internal; helps with Python debugging. */
  10997. FZ_FUNCTION long long m_internal_value();
  10998. /** Return true iff `m_internal` is not null. */
  10999. FZ_FUNCTION operator bool();
  11000. /* == Member data. */
  11001. /** Pointer to wrapped data. */
  11002. ::pdf_alert_event* m_internal;
  11003. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11004. generate code regardless so we always need to have this available. */
  11005. FZ_DATA static int s_num_instances;
  11006. private:
  11007. /** This class is not copyable or assignable. */
  11008. PdfAlertEvent(const PdfAlertEvent& rhs);
  11009. PdfAlertEvent& operator=(const PdfAlertEvent& rhs);
  11010. };
  11011. /** Wrapper class for struct `pdf_annot`. */
  11012. struct PdfAnnot
  11013. {
  11014. /** Copy constructor using `pdf_keep_annot()`. */
  11015. FZ_FUNCTION PdfAnnot(const PdfAnnot& rhs);
  11016. /** operator= using `pdf_keep_annot()` and `pdf_drop_annot()`. */
  11017. FZ_FUNCTION PdfAnnot& operator=(const PdfAnnot& rhs);
  11018. /* == Methods. */
  11019. /** Class-aware wrapper for `::pdf_add_annot_border_dash_item()`. */
  11020. FZ_FUNCTION void pdf_add_annot_border_dash_item(float length) const;
  11021. /** Class-aware wrapper for `::pdf_add_annot_ink_list_stroke()`. */
  11022. FZ_FUNCTION void pdf_add_annot_ink_list_stroke() const;
  11023. /** Class-aware wrapper for `::pdf_add_annot_ink_list_stroke_vertex()`. */
  11024. FZ_FUNCTION void pdf_add_annot_ink_list_stroke_vertex(const FzPoint& p) const;
  11025. /** Class-aware wrapper for `::pdf_add_annot_quad_point()`. */
  11026. FZ_FUNCTION void pdf_add_annot_quad_point(const FzQuad& quad) const;
  11027. /** Class-aware wrapper for `::pdf_add_annot_vertex()`. */
  11028. FZ_FUNCTION void pdf_add_annot_vertex(const FzPoint& p) const;
  11029. /** Class-aware wrapper for `::pdf_annot_MK_BC()`.
  11030. This method has out-params. Python/C# wrappers look like:
  11031. `pdf_annot_MK_BC(float color[4])` => int n
  11032. */
  11033. FZ_FUNCTION void pdf_annot_MK_BC(int *n, float color[4]) const;
  11034. /** Class-aware wrapper for `::pdf_annot_MK_BC_rgb()`. */
  11035. FZ_FUNCTION int pdf_annot_MK_BC_rgb(float rgb[3]) const;
  11036. /** Class-aware wrapper for `::pdf_annot_MK_BG()`.
  11037. This method has out-params. Python/C# wrappers look like:
  11038. `pdf_annot_MK_BG(float color[4])` => int n
  11039. */
  11040. FZ_FUNCTION void pdf_annot_MK_BG(int *n, float color[4]) const;
  11041. /** Class-aware wrapper for `::pdf_annot_MK_BG_rgb()`. */
  11042. FZ_FUNCTION int pdf_annot_MK_BG_rgb(float rgb[3]) const;
  11043. /** Class-aware wrapper for `::pdf_annot_active()`. */
  11044. FZ_FUNCTION int pdf_annot_active() const;
  11045. /** Class-aware wrapper for `::pdf_annot_ap()`. */
  11046. FZ_FUNCTION PdfObj pdf_annot_ap() const;
  11047. /** Class-aware wrapper for `::pdf_annot_author()`. */
  11048. FZ_FUNCTION const char *pdf_annot_author() const;
  11049. /** Class-aware wrapper for `::pdf_annot_border()`. */
  11050. FZ_FUNCTION float pdf_annot_border() const;
  11051. /** Class-aware wrapper for `::pdf_annot_border_dash_count()`. */
  11052. FZ_FUNCTION int pdf_annot_border_dash_count() const;
  11053. /** Class-aware wrapper for `::pdf_annot_border_dash_item()`. */
  11054. FZ_FUNCTION float pdf_annot_border_dash_item(int i) const;
  11055. /** Class-aware wrapper for `::pdf_annot_border_effect()`. */
  11056. FZ_FUNCTION enum pdf_border_effect pdf_annot_border_effect() const;
  11057. /** Class-aware wrapper for `::pdf_annot_border_effect_intensity()`. */
  11058. FZ_FUNCTION float pdf_annot_border_effect_intensity() const;
  11059. /** Class-aware wrapper for `::pdf_annot_border_style()`. */
  11060. FZ_FUNCTION enum pdf_border_style pdf_annot_border_style() const;
  11061. /** Class-aware wrapper for `::pdf_annot_border_width()`. */
  11062. FZ_FUNCTION float pdf_annot_border_width() const;
  11063. /** Class-aware wrapper for `::pdf_annot_callout_point()`. */
  11064. FZ_FUNCTION FzPoint pdf_annot_callout_point() const;
  11065. /** Class-aware wrapper for `::pdf_annot_callout_style()`. */
  11066. FZ_FUNCTION enum pdf_line_ending pdf_annot_callout_style() const;
  11067. /** Class-aware wrapper for `::pdf_annot_color()`.
  11068. This method has out-params. Python/C# wrappers look like:
  11069. `pdf_annot_color(float color[4])` => int n
  11070. */
  11071. FZ_FUNCTION void pdf_annot_color(int *n, float color[4]) const;
  11072. /** Class-aware wrapper for `::pdf_annot_contents()`. */
  11073. FZ_FUNCTION const char *pdf_annot_contents() const;
  11074. /** Class-aware wrapper for `::pdf_annot_creation_date()`. */
  11075. FZ_FUNCTION int64_t pdf_annot_creation_date() const;
  11076. /** Class-aware wrapper for `::pdf_annot_default_appearance()`.
  11077. This method has out-params. Python/C# wrappers look like:
  11078. `pdf_annot_default_appearance(float color[4])` => `(const char *font, float size, int n)`
  11079. */
  11080. FZ_FUNCTION void pdf_annot_default_appearance(const char **font, float *size, int *n, float color[4]) const;
  11081. /** Class-aware wrapper for `::pdf_annot_default_appearance_unmapped()`.
  11082. This method has out-params. Python/C# wrappers look like:
  11083. `pdf_annot_default_appearance_unmapped(char *font_name, int font_name_len, float color[4])` => `(float size, int n)`
  11084. */
  11085. FZ_FUNCTION void pdf_annot_default_appearance_unmapped(char *font_name, int font_name_len, float *size, int *n, float color[4]) const;
  11086. /** Class-aware wrapper for `::pdf_annot_ensure_local_xref()`. */
  11087. FZ_FUNCTION void pdf_annot_ensure_local_xref() const;
  11088. /** Class-aware wrapper for `::pdf_annot_event_blur()`. */
  11089. FZ_FUNCTION void pdf_annot_event_blur() const;
  11090. /** Class-aware wrapper for `::pdf_annot_event_down()`. */
  11091. FZ_FUNCTION void pdf_annot_event_down() const;
  11092. /** Class-aware wrapper for `::pdf_annot_event_enter()`. */
  11093. FZ_FUNCTION void pdf_annot_event_enter() const;
  11094. /** Class-aware wrapper for `::pdf_annot_event_exit()`. */
  11095. FZ_FUNCTION void pdf_annot_event_exit() const;
  11096. /** Class-aware wrapper for `::pdf_annot_event_focus()`. */
  11097. FZ_FUNCTION void pdf_annot_event_focus() const;
  11098. /** Class-aware wrapper for `::pdf_annot_event_page_close()`. */
  11099. FZ_FUNCTION void pdf_annot_event_page_close() const;
  11100. /** Class-aware wrapper for `::pdf_annot_event_page_invisible()`. */
  11101. FZ_FUNCTION void pdf_annot_event_page_invisible() const;
  11102. /** Class-aware wrapper for `::pdf_annot_event_page_open()`. */
  11103. FZ_FUNCTION void pdf_annot_event_page_open() const;
  11104. /** Class-aware wrapper for `::pdf_annot_event_page_visible()`. */
  11105. FZ_FUNCTION void pdf_annot_event_page_visible() const;
  11106. /** Class-aware wrapper for `::pdf_annot_event_up()`. */
  11107. FZ_FUNCTION void pdf_annot_event_up() const;
  11108. /** Class-aware wrapper for `::pdf_annot_field_flags()`. */
  11109. FZ_FUNCTION int pdf_annot_field_flags() const;
  11110. /** Class-aware wrapper for `::pdf_annot_field_label()`. */
  11111. FZ_FUNCTION const char *pdf_annot_field_label() const;
  11112. /** Class-aware wrapper for `::pdf_annot_field_value()`. */
  11113. FZ_FUNCTION const char *pdf_annot_field_value() const;
  11114. /** Class-aware wrapper for `::pdf_annot_filespec()`. */
  11115. FZ_FUNCTION PdfObj pdf_annot_filespec() const;
  11116. /** Class-aware wrapper for `::pdf_annot_flags()`. */
  11117. FZ_FUNCTION int pdf_annot_flags() const;
  11118. /** Class-aware wrapper for `::pdf_annot_has_author()`. */
  11119. FZ_FUNCTION int pdf_annot_has_author() const;
  11120. /** Class-aware wrapper for `::pdf_annot_has_border()`. */
  11121. FZ_FUNCTION int pdf_annot_has_border() const;
  11122. /** Class-aware wrapper for `::pdf_annot_has_border_effect()`. */
  11123. FZ_FUNCTION int pdf_annot_has_border_effect() const;
  11124. /** Class-aware wrapper for `::pdf_annot_has_callout()`. */
  11125. FZ_FUNCTION int pdf_annot_has_callout() const;
  11126. /** Class-aware wrapper for `::pdf_annot_has_default_appearance()`. */
  11127. FZ_FUNCTION int pdf_annot_has_default_appearance() const;
  11128. /** Class-aware wrapper for `::pdf_annot_has_filespec()`. */
  11129. FZ_FUNCTION int pdf_annot_has_filespec() const;
  11130. /** Class-aware wrapper for `::pdf_annot_has_icon_name()`. */
  11131. FZ_FUNCTION int pdf_annot_has_icon_name() const;
  11132. /** Class-aware wrapper for `::pdf_annot_has_ink_list()`. */
  11133. FZ_FUNCTION int pdf_annot_has_ink_list() const;
  11134. /** Class-aware wrapper for `::pdf_annot_has_intent()`. */
  11135. FZ_FUNCTION int pdf_annot_has_intent() const;
  11136. /** Class-aware wrapper for `::pdf_annot_has_interior_color()`. */
  11137. FZ_FUNCTION int pdf_annot_has_interior_color() const;
  11138. /** Class-aware wrapper for `::pdf_annot_has_line()`. */
  11139. FZ_FUNCTION int pdf_annot_has_line() const;
  11140. /** Class-aware wrapper for `::pdf_annot_has_line_ending_styles()`. */
  11141. FZ_FUNCTION int pdf_annot_has_line_ending_styles() const;
  11142. /** Class-aware wrapper for `::pdf_annot_has_open()`. */
  11143. FZ_FUNCTION int pdf_annot_has_open() const;
  11144. /** Class-aware wrapper for `::pdf_annot_has_popup()`. */
  11145. FZ_FUNCTION int pdf_annot_has_popup() const;
  11146. /** Class-aware wrapper for `::pdf_annot_has_quad_points()`. */
  11147. FZ_FUNCTION int pdf_annot_has_quad_points() const;
  11148. /** Class-aware wrapper for `::pdf_annot_has_quadding()`. */
  11149. FZ_FUNCTION int pdf_annot_has_quadding() const;
  11150. /** Class-aware wrapper for `::pdf_annot_has_rect()`. */
  11151. FZ_FUNCTION int pdf_annot_has_rect() const;
  11152. /** Class-aware wrapper for `::pdf_annot_has_rich_contents()`. */
  11153. FZ_FUNCTION int pdf_annot_has_rich_contents() const;
  11154. /** Class-aware wrapper for `::pdf_annot_has_rich_defaults()`. */
  11155. FZ_FUNCTION int pdf_annot_has_rich_defaults() const;
  11156. /** Class-aware wrapper for `::pdf_annot_has_vertices()`. */
  11157. FZ_FUNCTION int pdf_annot_has_vertices() const;
  11158. /** Class-aware wrapper for `::pdf_annot_hidden_for_editing()`. */
  11159. FZ_FUNCTION int pdf_annot_hidden_for_editing() const;
  11160. /** Class-aware wrapper for `::pdf_annot_hot()`. */
  11161. FZ_FUNCTION int pdf_annot_hot() const;
  11162. /** Class-aware wrapper for `::pdf_annot_icon_name()`. */
  11163. FZ_FUNCTION const char *pdf_annot_icon_name() const;
  11164. /** Class-aware wrapper for `::pdf_annot_ink_list_count()`. */
  11165. FZ_FUNCTION int pdf_annot_ink_list_count() const;
  11166. /** Class-aware wrapper for `::pdf_annot_ink_list_stroke_count()`. */
  11167. FZ_FUNCTION int pdf_annot_ink_list_stroke_count(int i) const;
  11168. /** Class-aware wrapper for `::pdf_annot_ink_list_stroke_vertex()`. */
  11169. FZ_FUNCTION FzPoint pdf_annot_ink_list_stroke_vertex(int i, int k) const;
  11170. /** Class-aware wrapper for `::pdf_annot_intent()`. */
  11171. FZ_FUNCTION enum pdf_intent pdf_annot_intent() const;
  11172. /** Class-aware wrapper for `::pdf_annot_interior_color()`.
  11173. This method has out-params. Python/C# wrappers look like:
  11174. `pdf_annot_interior_color(float color[4])` => int n
  11175. */
  11176. FZ_FUNCTION void pdf_annot_interior_color(int *n, float color[4]) const;
  11177. /** Class-aware wrapper for `::pdf_annot_is_open()`. */
  11178. FZ_FUNCTION int pdf_annot_is_open() const;
  11179. /** Class-aware wrapper for `::pdf_annot_is_standard_stamp()`. */
  11180. FZ_FUNCTION int pdf_annot_is_standard_stamp() const;
  11181. /** Class-aware wrapper for `::pdf_annot_line()`. */
  11182. FZ_FUNCTION void pdf_annot_line(FzPoint& a, FzPoint& b) const;
  11183. /** Class-aware wrapper for `::pdf_annot_line_caption()`. */
  11184. FZ_FUNCTION int pdf_annot_line_caption() const;
  11185. /** Class-aware wrapper for `::pdf_annot_line_caption_offset()`. */
  11186. FZ_FUNCTION FzPoint pdf_annot_line_caption_offset() const;
  11187. /** Class-aware wrapper for `::pdf_annot_line_end_style()`. */
  11188. FZ_FUNCTION enum pdf_line_ending pdf_annot_line_end_style() const;
  11189. /** Class-aware wrapper for `::pdf_annot_line_ending_styles()`.
  11190. This method has out-params. Python/C# wrappers look like:
  11191. `pdf_annot_line_ending_styles()` => `(enum pdf_line_ending start_style, enum pdf_line_ending end_style)`
  11192. */
  11193. FZ_FUNCTION void pdf_annot_line_ending_styles(enum pdf_line_ending *start_style, enum pdf_line_ending *end_style) const;
  11194. /** Class-aware wrapper for `::pdf_annot_line_leader()`. */
  11195. FZ_FUNCTION float pdf_annot_line_leader() const;
  11196. /** Class-aware wrapper for `::pdf_annot_line_leader_extension()`. */
  11197. FZ_FUNCTION float pdf_annot_line_leader_extension() const;
  11198. /** Class-aware wrapper for `::pdf_annot_line_leader_offset()`. */
  11199. FZ_FUNCTION float pdf_annot_line_leader_offset() const;
  11200. /** Class-aware wrapper for `::pdf_annot_line_start_style()`. */
  11201. FZ_FUNCTION enum pdf_line_ending pdf_annot_line_start_style() const;
  11202. /** Class-aware wrapper for `::pdf_annot_modification_date()`. */
  11203. FZ_FUNCTION int64_t pdf_annot_modification_date() const;
  11204. /** Class-aware wrapper for `::pdf_annot_needs_resynthesis()`. */
  11205. FZ_FUNCTION int pdf_annot_needs_resynthesis() const;
  11206. /** Class-aware wrapper for `::pdf_annot_obj()`. */
  11207. FZ_FUNCTION PdfObj pdf_annot_obj() const;
  11208. /** Class-aware wrapper for `::pdf_annot_opacity()`. */
  11209. FZ_FUNCTION float pdf_annot_opacity() const;
  11210. /** Class-aware wrapper for `::pdf_annot_page()`. */
  11211. FZ_FUNCTION PdfPage pdf_annot_page() const;
  11212. /** Class-aware wrapper for `::pdf_annot_pop_and_discard_local_xref()`. */
  11213. FZ_FUNCTION void pdf_annot_pop_and_discard_local_xref() const;
  11214. /** Class-aware wrapper for `::pdf_annot_pop_local_xref()`. */
  11215. FZ_FUNCTION void pdf_annot_pop_local_xref() const;
  11216. /** Class-aware wrapper for `::pdf_annot_popup()`. */
  11217. FZ_FUNCTION FzRect pdf_annot_popup() const;
  11218. /** Class-aware wrapper for `::pdf_annot_push_local_xref()`. */
  11219. FZ_FUNCTION void pdf_annot_push_local_xref() const;
  11220. /** Class-aware wrapper for `::pdf_annot_quad_point()`. */
  11221. FZ_FUNCTION FzQuad pdf_annot_quad_point(int i) const;
  11222. /** Class-aware wrapper for `::pdf_annot_quad_point_count()`. */
  11223. FZ_FUNCTION int pdf_annot_quad_point_count() const;
  11224. /** Class-aware wrapper for `::pdf_annot_quadding()`. */
  11225. FZ_FUNCTION int pdf_annot_quadding() const;
  11226. /** Class-aware wrapper for `::pdf_annot_rect()`. */
  11227. FZ_FUNCTION FzRect pdf_annot_rect() const;
  11228. /** Class-aware wrapper for `::pdf_annot_request_resynthesis()`. */
  11229. FZ_FUNCTION void pdf_annot_request_resynthesis() const;
  11230. /** Class-aware wrapper for `::pdf_annot_request_synthesis()`. */
  11231. FZ_FUNCTION void pdf_annot_request_synthesis() const;
  11232. /** Class-aware wrapper for `::pdf_annot_rich_contents()`. */
  11233. FZ_FUNCTION const char *pdf_annot_rich_contents() const;
  11234. /** Class-aware wrapper for `::pdf_annot_rich_defaults()`. */
  11235. FZ_FUNCTION const char *pdf_annot_rich_defaults() const;
  11236. /** Class-aware wrapper for `::pdf_annot_stamp_image_obj()`. */
  11237. FZ_FUNCTION PdfObj pdf_annot_stamp_image_obj() const;
  11238. /** Class-aware wrapper for `::pdf_annot_transform()`. */
  11239. FZ_FUNCTION FzMatrix pdf_annot_transform() const;
  11240. /** Class-aware wrapper for `::pdf_annot_type()`. */
  11241. FZ_FUNCTION enum pdf_annot_type pdf_annot_type() const;
  11242. /** Class-aware wrapper for `::pdf_annot_vertex()`. */
  11243. FZ_FUNCTION FzPoint pdf_annot_vertex(int i) const;
  11244. /** Class-aware wrapper for `::pdf_annot_vertex_count()`. */
  11245. FZ_FUNCTION int pdf_annot_vertex_count() const;
  11246. /** Class-aware wrapper for `::pdf_apply_redaction()`. */
  11247. FZ_FUNCTION int pdf_apply_redaction(PdfRedactOptions& opts) const;
  11248. /** Class-aware wrapper for `::pdf_bound_annot()`. */
  11249. FZ_FUNCTION FzRect pdf_bound_annot() const;
  11250. /** Class-aware wrapper for `::pdf_bound_widget()`. */
  11251. FZ_FUNCTION FzRect pdf_bound_widget() const;
  11252. /** Class-aware wrapper for `::pdf_choice_widget_is_multiselect()`. */
  11253. FZ_FUNCTION int pdf_choice_widget_is_multiselect() const;
  11254. /** Class-aware wrapper for `::pdf_choice_widget_options()`. */
  11255. FZ_FUNCTION int pdf_choice_widget_options(int exportval, const char *opts[]) const;
  11256. /** Class-aware wrapper for `::pdf_choice_widget_options2()`. */
  11257. /** Swig-friendly wrapper for pdf_choice_widget_options(), returns the
  11258. options directly in a vector. */
  11259. FZ_FUNCTION std::vector<std::string> pdf_choice_widget_options2(int exportval) const;
  11260. /** Class-aware wrapper for `::pdf_choice_widget_set_value()`. */
  11261. FZ_FUNCTION void pdf_choice_widget_set_value(int n, const char *opts[]) const;
  11262. /** Class-aware wrapper for `::pdf_choice_widget_value()`. */
  11263. FZ_FUNCTION int pdf_choice_widget_value(const char *opts[]) const;
  11264. /** Class-aware wrapper for `::pdf_clear_annot_border_dash()`. */
  11265. FZ_FUNCTION void pdf_clear_annot_border_dash() const;
  11266. /** Class-aware wrapper for `::pdf_clear_annot_ink_list()`. */
  11267. FZ_FUNCTION void pdf_clear_annot_ink_list() const;
  11268. /** Class-aware wrapper for `::pdf_clear_annot_quad_points()`. */
  11269. FZ_FUNCTION void pdf_clear_annot_quad_points() const;
  11270. /** Class-aware wrapper for `::pdf_clear_annot_vertices()`. */
  11271. FZ_FUNCTION void pdf_clear_annot_vertices() const;
  11272. /** Class-aware wrapper for `::pdf_clear_signature()`. */
  11273. FZ_FUNCTION void pdf_clear_signature() const;
  11274. /** Class-aware wrapper for `::pdf_dirty_annot()`. */
  11275. FZ_FUNCTION void pdf_dirty_annot() const;
  11276. /** Class-aware wrapper for `::pdf_edit_text_field_value()`.
  11277. This method has out-params. Python/C# wrappers look like:
  11278. `pdf_edit_text_field_value(const char *value, const char *change)` => `(int, int selStart, int selEnd, char *newvalue)`
  11279. */
  11280. FZ_FUNCTION int pdf_edit_text_field_value(const char *value, const char *change, int *selStart, int *selEnd, char **newvalue) const;
  11281. /** Class-aware wrapper for `::pdf_get_widget_editing_state()`. */
  11282. FZ_FUNCTION int pdf_get_widget_editing_state() const;
  11283. /** Class-aware wrapper for `::pdf_incremental_change_since_signing_widget()`. */
  11284. FZ_FUNCTION int pdf_incremental_change_since_signing_widget() const;
  11285. /** Class-aware wrapper for `::pdf_new_display_list_from_annot()`. */
  11286. FZ_FUNCTION FzDisplayList pdf_new_display_list_from_annot() const;
  11287. /** Class-aware wrapper for `::pdf_new_pixmap_from_annot()`. */
  11288. FZ_FUNCTION FzPixmap pdf_new_pixmap_from_annot(const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha) const;
  11289. /** Class-aware wrapper for `::pdf_next_annot()`. */
  11290. FZ_FUNCTION PdfAnnot pdf_next_annot() const;
  11291. /** Class-aware wrapper for `::pdf_next_widget()`. */
  11292. FZ_FUNCTION PdfAnnot pdf_next_widget() const;
  11293. /** Class-aware wrapper for `::pdf_run_annot()`. */
  11294. FZ_FUNCTION void pdf_run_annot(const FzDevice& dev, const FzMatrix& ctm, FzCookie& cookie) const;
  11295. /** Class-aware wrapper for `::pdf_set_annot_active()`. */
  11296. FZ_FUNCTION void pdf_set_annot_active(int active) const;
  11297. /** Class-aware wrapper for `::pdf_set_annot_appearance()`. */
  11298. FZ_FUNCTION void pdf_set_annot_appearance(const char *appearance, const char *state, const FzMatrix& ctm, const FzRect& bbox, const PdfObj& res, const FzBuffer& contents) const;
  11299. /** Class-aware wrapper for `::pdf_set_annot_appearance_from_display_list()`. */
  11300. FZ_FUNCTION void pdf_set_annot_appearance_from_display_list(const char *appearance, const char *state, const FzMatrix& ctm, const FzDisplayList& list) const;
  11301. /** Class-aware wrapper for `::pdf_set_annot_author()`. */
  11302. FZ_FUNCTION void pdf_set_annot_author(const char *author) const;
  11303. /** Class-aware wrapper for `::pdf_set_annot_border()`. */
  11304. FZ_FUNCTION void pdf_set_annot_border(float width) const;
  11305. /** Class-aware wrapper for `::pdf_set_annot_border_effect()`. */
  11306. FZ_FUNCTION void pdf_set_annot_border_effect(enum pdf_border_effect effect) const;
  11307. /** Class-aware wrapper for `::pdf_set_annot_border_effect_intensity()`. */
  11308. FZ_FUNCTION void pdf_set_annot_border_effect_intensity(float intensity) const;
  11309. /** Class-aware wrapper for `::pdf_set_annot_border_style()`. */
  11310. FZ_FUNCTION void pdf_set_annot_border_style(enum pdf_border_style style) const;
  11311. /** Class-aware wrapper for `::pdf_set_annot_border_width()`. */
  11312. FZ_FUNCTION void pdf_set_annot_border_width(float width) const;
  11313. /** Class-aware wrapper for `::pdf_set_annot_callout_line2()`. */
  11314. /** SWIG-friendly wrapper for pdf_set_annot_callout_line(). */
  11315. FZ_FUNCTION void pdf_set_annot_callout_line2(std::vector<fz_point> &callout) const;
  11316. /** Class-aware wrapper for `::pdf_set_annot_callout_point()`. */
  11317. FZ_FUNCTION void pdf_set_annot_callout_point(const FzPoint& p) const;
  11318. /** Class-aware wrapper for `::pdf_set_annot_callout_style()`. */
  11319. FZ_FUNCTION void pdf_set_annot_callout_style(enum pdf_line_ending style) const;
  11320. /** Class-aware wrapper for `::pdf_set_annot_color()`. */
  11321. FZ_FUNCTION void pdf_set_annot_color(int n, const float *color) const;
  11322. /** Class-aware wrapper for `::pdf_set_annot_contents()`. */
  11323. FZ_FUNCTION void pdf_set_annot_contents(const char *text) const;
  11324. /** Class-aware wrapper for `::pdf_set_annot_creation_date()`. */
  11325. FZ_FUNCTION void pdf_set_annot_creation_date(int64_t time) const;
  11326. /** Class-aware wrapper for `::pdf_set_annot_default_appearance()`. */
  11327. FZ_FUNCTION void pdf_set_annot_default_appearance(const char *font, float size, int n, const float *color) const;
  11328. /** Class-aware wrapper for `::pdf_set_annot_filespec()`. */
  11329. FZ_FUNCTION void pdf_set_annot_filespec(const PdfObj& obj) const;
  11330. /** Class-aware wrapper for `::pdf_set_annot_flags()`. */
  11331. FZ_FUNCTION void pdf_set_annot_flags(int flags) const;
  11332. /** Class-aware wrapper for `::pdf_set_annot_hidden_for_editing()`. */
  11333. FZ_FUNCTION void pdf_set_annot_hidden_for_editing(int hidden) const;
  11334. /** Class-aware wrapper for `::pdf_set_annot_hot()`. */
  11335. FZ_FUNCTION void pdf_set_annot_hot(int hot) const;
  11336. /** Class-aware wrapper for `::pdf_set_annot_icon_name()`. */
  11337. FZ_FUNCTION void pdf_set_annot_icon_name(const char *name) const;
  11338. /** Class-aware wrapper for `::pdf_set_annot_ink_list()`. */
  11339. FZ_FUNCTION void pdf_set_annot_ink_list(int n, const int *count, FzPoint& v) const;
  11340. /** Class-aware wrapper for `::pdf_set_annot_intent()`. */
  11341. FZ_FUNCTION void pdf_set_annot_intent(enum pdf_intent it) const;
  11342. /** Class-aware wrapper for `::pdf_set_annot_interior_color()`. */
  11343. FZ_FUNCTION void pdf_set_annot_interior_color(int n, const float *color) const;
  11344. /** Class-aware wrapper for `::pdf_set_annot_is_open()`. */
  11345. FZ_FUNCTION void pdf_set_annot_is_open(int is_open) const;
  11346. /** Class-aware wrapper for `::pdf_set_annot_language()`. */
  11347. FZ_FUNCTION void pdf_set_annot_language(::fz_text_language lang) const;
  11348. /** Class-aware wrapper for `::pdf_set_annot_line()`. */
  11349. FZ_FUNCTION void pdf_set_annot_line(const FzPoint& a, const FzPoint& b) const;
  11350. /** Class-aware wrapper for `::pdf_set_annot_line_caption()`. */
  11351. FZ_FUNCTION void pdf_set_annot_line_caption(int cap) const;
  11352. /** Class-aware wrapper for `::pdf_set_annot_line_caption_offset()`. */
  11353. FZ_FUNCTION void pdf_set_annot_line_caption_offset(const FzPoint& offset) const;
  11354. /** Class-aware wrapper for `::pdf_set_annot_line_end_style()`. */
  11355. FZ_FUNCTION void pdf_set_annot_line_end_style(enum pdf_line_ending e) const;
  11356. /** Class-aware wrapper for `::pdf_set_annot_line_ending_styles()`. */
  11357. FZ_FUNCTION void pdf_set_annot_line_ending_styles(enum pdf_line_ending start_style, enum pdf_line_ending end_style) const;
  11358. /** Class-aware wrapper for `::pdf_set_annot_line_leader()`. */
  11359. FZ_FUNCTION void pdf_set_annot_line_leader(float ll) const;
  11360. /** Class-aware wrapper for `::pdf_set_annot_line_leader_extension()`. */
  11361. FZ_FUNCTION void pdf_set_annot_line_leader_extension(float lle) const;
  11362. /** Class-aware wrapper for `::pdf_set_annot_line_leader_offset()`. */
  11363. FZ_FUNCTION void pdf_set_annot_line_leader_offset(float llo) const;
  11364. /** Class-aware wrapper for `::pdf_set_annot_line_start_style()`. */
  11365. FZ_FUNCTION void pdf_set_annot_line_start_style(enum pdf_line_ending s) const;
  11366. /** Class-aware wrapper for `::pdf_set_annot_modification_date()`. */
  11367. FZ_FUNCTION void pdf_set_annot_modification_date(int64_t time) const;
  11368. /** Class-aware wrapper for `::pdf_set_annot_opacity()`. */
  11369. FZ_FUNCTION void pdf_set_annot_opacity(float opacity) const;
  11370. /** Class-aware wrapper for `::pdf_set_annot_popup()`. */
  11371. FZ_FUNCTION void pdf_set_annot_popup(const FzRect& rect) const;
  11372. /** Class-aware wrapper for `::pdf_set_annot_quad_points()`. */
  11373. FZ_FUNCTION void pdf_set_annot_quad_points(int n, FzQuad& qv) const;
  11374. /** Class-aware wrapper for `::pdf_set_annot_quadding()`. */
  11375. FZ_FUNCTION void pdf_set_annot_quadding(int q) const;
  11376. /** Class-aware wrapper for `::pdf_set_annot_rect()`. */
  11377. FZ_FUNCTION void pdf_set_annot_rect(const FzRect& rect) const;
  11378. /** Class-aware wrapper for `::pdf_set_annot_resynthesised()`. */
  11379. FZ_FUNCTION void pdf_set_annot_resynthesised() const;
  11380. /** Class-aware wrapper for `::pdf_set_annot_rich_contents()`. */
  11381. FZ_FUNCTION void pdf_set_annot_rich_contents(const char *plain, const char *rich) const;
  11382. /** Class-aware wrapper for `::pdf_set_annot_rich_defaults()`. */
  11383. FZ_FUNCTION void pdf_set_annot_rich_defaults(const char *style) const;
  11384. /** Class-aware wrapper for `::pdf_set_annot_stamp_image()`. */
  11385. FZ_FUNCTION void pdf_set_annot_stamp_image(const FzImage& image) const;
  11386. /** Class-aware wrapper for `::pdf_set_annot_stamp_image_obj()`. */
  11387. FZ_FUNCTION void pdf_set_annot_stamp_image_obj(const PdfObj& ref) const;
  11388. /** Class-aware wrapper for `::pdf_set_annot_vertex()`. */
  11389. FZ_FUNCTION void pdf_set_annot_vertex(int i, const FzPoint& p) const;
  11390. /** Class-aware wrapper for `::pdf_set_annot_vertices()`. */
  11391. FZ_FUNCTION void pdf_set_annot_vertices(int n, FzPoint& v) const;
  11392. /** Class-aware wrapper for `::pdf_set_choice_field_value()`. */
  11393. FZ_FUNCTION int pdf_set_choice_field_value(const char *value) const;
  11394. /** Class-aware wrapper for `::pdf_set_text_field_value()`. */
  11395. FZ_FUNCTION int pdf_set_text_field_value(const char *value) const;
  11396. /** Class-aware wrapper for `::pdf_set_widget_editing_state()`. */
  11397. FZ_FUNCTION void pdf_set_widget_editing_state(int editing) const;
  11398. /** Class-aware wrapper for `::pdf_sign_signature()`. */
  11399. FZ_FUNCTION void pdf_sign_signature(const PdfPkcs7Signer& signer, int appearance_flags, const FzImage& graphic, const char *reason, const char *location) const;
  11400. /** Class-aware wrapper for `::pdf_sign_signature_with_appearance()`. */
  11401. FZ_FUNCTION void pdf_sign_signature_with_appearance(const PdfPkcs7Signer& signer, int64_t date, const FzDisplayList& disp_list) const;
  11402. /** Class-aware wrapper for `::pdf_text_widget_format()`. */
  11403. FZ_FUNCTION int pdf_text_widget_format() const;
  11404. /** Class-aware wrapper for `::pdf_text_widget_max_len()`. */
  11405. FZ_FUNCTION int pdf_text_widget_max_len() const;
  11406. /** Class-aware wrapper for `::pdf_toggle_widget()`. */
  11407. FZ_FUNCTION int pdf_toggle_widget() const;
  11408. /** Class-aware wrapper for `::pdf_update_annot()`. */
  11409. FZ_FUNCTION int pdf_update_annot() const;
  11410. /** Class-aware wrapper for `::pdf_update_widget()`. */
  11411. FZ_FUNCTION int pdf_update_widget() const;
  11412. /** Class-aware wrapper for `::pdf_validate_signature()`. */
  11413. FZ_FUNCTION int pdf_validate_signature() const;
  11414. /** Class-aware wrapper for `::pdf_widget_is_readonly()`. */
  11415. FZ_FUNCTION int pdf_widget_is_readonly() const;
  11416. /** Class-aware wrapper for `::pdf_widget_is_signed()`. */
  11417. FZ_FUNCTION int pdf_widget_is_signed() const;
  11418. /** Class-aware wrapper for `::pdf_widget_type()`. */
  11419. FZ_FUNCTION enum pdf_widget_type pdf_widget_type() const;
  11420. /** Constructor using raw copy of pre-existing `::pdf_annot`. */
  11421. /* This constructor is marked as `explicit` because wrapper classes do not
  11422. call `keep`in constructors, but do call `drop` in destructors. So
  11423. automatic construction from a pdf_annot* will generally cause an
  11424. unbalanced `drop` resulting in errors such as SEGV. */
  11425. FZ_FUNCTION explicit PdfAnnot(::pdf_annot* internal=NULL);
  11426. /** Destructor using pdf_drop_annot(). */
  11427. FZ_FUNCTION ~PdfAnnot();
  11428. /** Return numerical value of .m_internal; helps with Python debugging. */
  11429. FZ_FUNCTION long long m_internal_value();
  11430. /** Return true iff `m_internal` is not null. */
  11431. FZ_FUNCTION operator bool();
  11432. /* == Member data. */
  11433. /** Pointer to wrapped data. */
  11434. ::pdf_annot* m_internal;
  11435. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11436. generate code regardless so we always need to have this available. */
  11437. FZ_DATA static int s_num_instances;
  11438. };
  11439. /** Wrapper class for struct `pdf_clean_options`. */
  11440. struct PdfCleanOptions
  11441. {
  11442. /** Default constructor, makes copy of pdf_default_write_options. */
  11443. FZ_FUNCTION PdfCleanOptions();
  11444. /** Copy constructor using raw memcopy(). */
  11445. FZ_FUNCTION PdfCleanOptions(const PdfCleanOptions& rhs);
  11446. /** We use default copy constructor and operator=. */
  11447. /* == Methods. */
  11448. /** Assignment using plain memcpy(). */
  11449. FZ_FUNCTION PdfCleanOptions& operator=(const PdfCleanOptions& rhs);
  11450. /** Copies <text> into write.opwd_utf8[]. */
  11451. FZ_FUNCTION void write_opwd_utf8_set(const std::string& text);
  11452. /** Copies <text> into upwd_utf8[]. */
  11453. FZ_FUNCTION void write_upwd_utf8_set(const std::string& text);
  11454. /** Constructor using raw copy of pre-existing `::pdf_clean_options`. */
  11455. FZ_FUNCTION PdfCleanOptions(const ::pdf_clean_options* internal);
  11456. /** Constructor using raw copy of pre-existing `::pdf_clean_options`. */
  11457. FZ_FUNCTION PdfCleanOptions(const ::pdf_clean_options internal);
  11458. /** Access as underlying struct. */
  11459. FZ_FUNCTION ::pdf_clean_options* internal();
  11460. /** Access as underlying struct. */
  11461. FZ_FUNCTION const ::pdf_clean_options* internal() const;
  11462. #ifndef NDEBUG
  11463. /** Destructor only decrements s_num_instances. */
  11464. FZ_FUNCTION ~PdfCleanOptions();
  11465. #else
  11466. /** We use default destructor. */
  11467. #endif
  11468. /* == Member data. */
  11469. /* These members are the same as the members of ::pdf_clean_options. */
  11470. ::pdf_write_options write;
  11471. ::pdf_image_rewriter_options image;
  11472. int subset_fonts;
  11473. ::pdf_clean_options_structure structure;
  11474. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11475. generate code regardless so we always need to have this available. */
  11476. FZ_DATA static int s_num_instances;
  11477. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  11478. FZ_FUNCTION std::string to_string();
  11479. /** Comparison method. */
  11480. FZ_FUNCTION bool operator==(const PdfCleanOptions& rhs);
  11481. /** Comparison method. */
  11482. FZ_FUNCTION bool operator!=(const PdfCleanOptions& rhs);
  11483. };
  11484. /** Wrapper class for struct `pdf_cmap`. */
  11485. struct PdfCmap
  11486. {
  11487. /** == Constructors. */
  11488. /** Constructor using `pdf_new_cmap()`. */
  11489. FZ_FUNCTION PdfCmap();
  11490. /** Constructor using `pdf_new_identity_cmap()`. */
  11491. FZ_FUNCTION PdfCmap(int wmode, int bytes);
  11492. /** Copy constructor using `pdf_keep_cmap()`. */
  11493. FZ_FUNCTION PdfCmap(const PdfCmap& rhs);
  11494. /** operator= using `pdf_keep_cmap()` and `pdf_drop_cmap()`. */
  11495. FZ_FUNCTION PdfCmap& operator=(const PdfCmap& rhs);
  11496. /* == Methods. */
  11497. /** Class-aware wrapper for `::pdf_add_codespace()`. */
  11498. FZ_FUNCTION void pdf_add_codespace(unsigned int low, unsigned int high, size_t n) const;
  11499. /** Class-aware wrapper for `::pdf_cmap_size()`. */
  11500. FZ_FUNCTION size_t pdf_cmap_size() const;
  11501. /** Class-aware wrapper for `::pdf_cmap_wmode()`. */
  11502. FZ_FUNCTION int pdf_cmap_wmode() const;
  11503. /** Class-aware wrapper for `::pdf_decode_cmap()`.
  11504. This method has out-params. Python/C# wrappers look like:
  11505. `pdf_decode_cmap(unsigned char *s, unsigned char *e)` => `(int, unsigned int cpt)`
  11506. */
  11507. FZ_FUNCTION int pdf_decode_cmap(unsigned char *s, unsigned char *e, unsigned int *cpt) const;
  11508. /** Class-aware wrapper for `::pdf_lookup_cmap()`. */
  11509. FZ_FUNCTION int pdf_lookup_cmap(unsigned int cpt) const;
  11510. /** Class-aware wrapper for `::pdf_lookup_cmap_full()`.
  11511. This method has out-params. Python/C# wrappers look like:
  11512. `pdf_lookup_cmap_full(unsigned int cpt)` => `(int, int out)`
  11513. */
  11514. FZ_FUNCTION int pdf_lookup_cmap_full(unsigned int cpt, int *out) const;
  11515. /** Class-aware wrapper for `::pdf_map_one_to_many()`.
  11516. This method has out-params. Python/C# wrappers look like:
  11517. `pdf_map_one_to_many(unsigned int one, size_t len)` => int many
  11518. */
  11519. FZ_FUNCTION void pdf_map_one_to_many(unsigned int one, int *many, size_t len) const;
  11520. /** Class-aware wrapper for `::pdf_map_range_to_range()`. */
  11521. FZ_FUNCTION void pdf_map_range_to_range(unsigned int srclo, unsigned int srchi, int dstlo) const;
  11522. /** Class-aware wrapper for `::pdf_set_cmap_wmode()`. */
  11523. FZ_FUNCTION void pdf_set_cmap_wmode(int wmode) const;
  11524. /** Class-aware wrapper for `::pdf_set_usecmap()`. */
  11525. FZ_FUNCTION void pdf_set_usecmap(const PdfCmap& usecmap) const;
  11526. /** Class-aware wrapper for `::pdf_sort_cmap()`. */
  11527. FZ_FUNCTION void pdf_sort_cmap() const;
  11528. /** Constructor using raw copy of pre-existing `::pdf_cmap`. */
  11529. /* This constructor is marked as `explicit` because wrapper classes do not
  11530. call `keep`in constructors, but do call `drop` in destructors. So
  11531. automatic construction from a pdf_cmap* will generally cause an
  11532. unbalanced `drop` resulting in errors such as SEGV. */
  11533. FZ_FUNCTION explicit PdfCmap(::pdf_cmap* internal);
  11534. /** Destructor using pdf_drop_cmap(). */
  11535. FZ_FUNCTION ~PdfCmap();
  11536. /** Return numerical value of .m_internal; helps with Python debugging. */
  11537. FZ_FUNCTION long long m_internal_value();
  11538. /** Return true iff `m_internal` is not null. */
  11539. FZ_FUNCTION operator bool();
  11540. /* == Member data. */
  11541. /** Pointer to wrapped data. */
  11542. ::pdf_cmap* m_internal;
  11543. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11544. generate code regardless so we always need to have this available. */
  11545. FZ_DATA static int s_num_instances;
  11546. };
  11547. /** Wrapper class for struct `pdf_color_filter_options`. Not copyable or assignable. */
  11548. struct PdfColorFilterOptions
  11549. {
  11550. /** Default constructor, sets `m_internal` to null. */
  11551. FZ_FUNCTION PdfColorFilterOptions();
  11552. /** Constructor using raw copy of pre-existing `::pdf_color_filter_options`. */
  11553. FZ_FUNCTION PdfColorFilterOptions(::pdf_color_filter_options* internal);
  11554. #ifndef NDEBUG
  11555. /** Destructor only decrements s_num_instances. */
  11556. FZ_FUNCTION ~PdfColorFilterOptions();
  11557. #else
  11558. /** We use default destructor. */
  11559. #endif
  11560. /** Return numerical value of .m_internal; helps with Python debugging. */
  11561. FZ_FUNCTION long long m_internal_value();
  11562. /** Return true iff `m_internal` is not null. */
  11563. FZ_FUNCTION operator bool();
  11564. /* == Member data. */
  11565. /** Pointer to wrapped data. */
  11566. ::pdf_color_filter_options* m_internal;
  11567. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11568. generate code regardless so we always need to have this available. */
  11569. FZ_DATA static int s_num_instances;
  11570. private:
  11571. /** This class is not copyable or assignable. */
  11572. PdfColorFilterOptions(const PdfColorFilterOptions& rhs);
  11573. PdfColorFilterOptions& operator=(const PdfColorFilterOptions& rhs);
  11574. };
  11575. /** Wrapper class for struct `pdf_colorspace_resource_key`. Not copyable or assignable. */
  11576. struct PdfColorspaceResourceKey
  11577. {
  11578. /** Default constructor, sets `m_internal` to null. */
  11579. FZ_FUNCTION PdfColorspaceResourceKey();
  11580. /** Constructor using raw copy of pre-existing `::pdf_colorspace_resource_key`. */
  11581. FZ_FUNCTION PdfColorspaceResourceKey(::pdf_colorspace_resource_key* internal);
  11582. #ifndef NDEBUG
  11583. /** Destructor only decrements s_num_instances. */
  11584. FZ_FUNCTION ~PdfColorspaceResourceKey();
  11585. #else
  11586. /** We use default destructor. */
  11587. #endif
  11588. /** Return numerical value of .m_internal; helps with Python debugging. */
  11589. FZ_FUNCTION long long m_internal_value();
  11590. /** Return true iff `m_internal` is not null. */
  11591. FZ_FUNCTION operator bool();
  11592. /* == Member data. */
  11593. /** Pointer to wrapped data. */
  11594. ::pdf_colorspace_resource_key* m_internal;
  11595. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11596. generate code regardless so we always need to have this available. */
  11597. FZ_DATA static int s_num_instances;
  11598. private:
  11599. /** This class is not copyable or assignable. */
  11600. PdfColorspaceResourceKey(const PdfColorspaceResourceKey& rhs);
  11601. PdfColorspaceResourceKey& operator=(const PdfColorspaceResourceKey& rhs);
  11602. };
  11603. /** Wrapper class for struct `pdf_crypt`. Not copyable or assignable. */
  11604. struct PdfCrypt
  11605. {
  11606. /** == Constructors. */
  11607. /** Constructor using `pdf_new_crypt()`. */
  11608. FZ_FUNCTION PdfCrypt(const PdfObj& enc, const PdfObj& id);
  11609. /** Constructor using `pdf_new_encrypt()`. */
  11610. FZ_FUNCTION PdfCrypt(const char *opwd_utf8, const char *upwd_utf8, const PdfObj& id, int permissions, int algorithm);
  11611. /** Default constructor, sets `m_internal` to null. */
  11612. FZ_FUNCTION PdfCrypt();
  11613. /* == Methods. */
  11614. /** Class-aware wrapper for `::pdf_crypt_encrypt_metadata()`. */
  11615. FZ_FUNCTION int pdf_crypt_encrypt_metadata() const;
  11616. /** Class-aware wrapper for `::pdf_crypt_key()`. */
  11617. FZ_FUNCTION unsigned char *pdf_crypt_key() const;
  11618. /** Class-aware wrapper for `::pdf_crypt_length()`. */
  11619. FZ_FUNCTION int pdf_crypt_length() const;
  11620. /** Class-aware wrapper for `::pdf_crypt_method()`. */
  11621. FZ_FUNCTION const char *pdf_crypt_method() const;
  11622. /** Class-aware wrapper for `::pdf_crypt_obj()`. */
  11623. FZ_FUNCTION void pdf_crypt_obj(const PdfObj& obj, int num, int gen) const;
  11624. /** Class-aware wrapper for `::pdf_crypt_owner_encryption()`. */
  11625. FZ_FUNCTION unsigned char *pdf_crypt_owner_encryption() const;
  11626. /** Class-aware wrapper for `::pdf_crypt_owner_password()`. */
  11627. FZ_FUNCTION unsigned char *pdf_crypt_owner_password() const;
  11628. /** Class-aware wrapper for `::pdf_crypt_permissions()`. */
  11629. FZ_FUNCTION int pdf_crypt_permissions() const;
  11630. /** Class-aware wrapper for `::pdf_crypt_permissions_encryption()`. */
  11631. FZ_FUNCTION unsigned char *pdf_crypt_permissions_encryption() const;
  11632. /** Class-aware wrapper for `::pdf_crypt_revision()`. */
  11633. FZ_FUNCTION int pdf_crypt_revision() const;
  11634. /** Class-aware wrapper for `::pdf_crypt_stream_method()`. */
  11635. FZ_FUNCTION const char *pdf_crypt_stream_method() const;
  11636. /** Class-aware wrapper for `::pdf_crypt_string_method()`. */
  11637. FZ_FUNCTION const char *pdf_crypt_string_method() const;
  11638. /** Class-aware wrapper for `::pdf_crypt_user_encryption()`. */
  11639. FZ_FUNCTION unsigned char *pdf_crypt_user_encryption() const;
  11640. /** Class-aware wrapper for `::pdf_crypt_user_password()`. */
  11641. FZ_FUNCTION unsigned char *pdf_crypt_user_password() const;
  11642. /** Class-aware wrapper for `::pdf_crypt_version()`. */
  11643. FZ_FUNCTION int pdf_crypt_version() const;
  11644. /** Class-aware wrapper for `::pdf_encrypt_data()`. */
  11645. FZ_FUNCTION void pdf_encrypt_data(int num, int gen, void (*fmt_str_out)(::fz_context *, void *, const unsigned char *, size_t ), void *arg, const unsigned char *s, size_t n) const;
  11646. /** Class-aware wrapper for `::pdf_encrypted_len()`. */
  11647. FZ_FUNCTION size_t pdf_encrypted_len(int num, int gen, size_t len) const;
  11648. /** Constructor using raw copy of pre-existing `::pdf_crypt`. */
  11649. FZ_FUNCTION PdfCrypt(::pdf_crypt* internal);
  11650. /** Destructor using pdf_drop_crypt(). */
  11651. FZ_FUNCTION ~PdfCrypt();
  11652. /** Return numerical value of .m_internal; helps with Python debugging. */
  11653. FZ_FUNCTION long long m_internal_value();
  11654. /** Return true iff `m_internal` is not null. */
  11655. FZ_FUNCTION operator bool();
  11656. /* == Member data. */
  11657. /** Pointer to wrapped data. */
  11658. ::pdf_crypt* m_internal;
  11659. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11660. generate code regardless so we always need to have this available. */
  11661. FZ_DATA static int s_num_instances;
  11662. private:
  11663. /** This class is not copyable or assignable. */
  11664. PdfCrypt(const PdfCrypt& rhs);
  11665. PdfCrypt& operator=(const PdfCrypt& rhs);
  11666. };
  11667. /** Wrapper class for struct `pdf_csi`. Not copyable or assignable. */
  11668. struct PdfCsi
  11669. {
  11670. /** Default constructor, sets `m_internal` to null. */
  11671. FZ_FUNCTION PdfCsi();
  11672. /** Constructor using raw copy of pre-existing `::pdf_csi`. */
  11673. FZ_FUNCTION PdfCsi(::pdf_csi* internal);
  11674. #ifndef NDEBUG
  11675. /** Destructor only decrements s_num_instances. */
  11676. FZ_FUNCTION ~PdfCsi();
  11677. #else
  11678. /** We use default destructor. */
  11679. #endif
  11680. /** Return numerical value of .m_internal; helps with Python debugging. */
  11681. FZ_FUNCTION long long m_internal_value();
  11682. /** Return true iff `m_internal` is not null. */
  11683. FZ_FUNCTION operator bool();
  11684. /* == Member data. */
  11685. /** Pointer to wrapped data. */
  11686. ::pdf_csi* m_internal;
  11687. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11688. generate code regardless so we always need to have this available. */
  11689. FZ_DATA static int s_num_instances;
  11690. private:
  11691. /** This class is not copyable or assignable. */
  11692. PdfCsi(const PdfCsi& rhs);
  11693. PdfCsi& operator=(const PdfCsi& rhs);
  11694. };
  11695. /** Wrapper class for struct `pdf_cycle_list`. Not copyable or assignable. */
  11696. struct PdfCycleList
  11697. {
  11698. /** Default constructor, sets `m_internal` to null. */
  11699. FZ_FUNCTION PdfCycleList();
  11700. /* == Methods. */
  11701. /** Class-aware wrapper for `::pdf_cycle()`. */
  11702. FZ_FUNCTION int pdf_cycle(const PdfCycleList& prev, const PdfObj& obj) const;
  11703. /** Constructor using raw copy of pre-existing `::pdf_cycle_list`. */
  11704. FZ_FUNCTION PdfCycleList(::pdf_cycle_list* internal);
  11705. #ifndef NDEBUG
  11706. /** Destructor only decrements s_num_instances. */
  11707. FZ_FUNCTION ~PdfCycleList();
  11708. #else
  11709. /** We use default destructor. */
  11710. #endif
  11711. /** Return numerical value of .m_internal; helps with Python debugging. */
  11712. FZ_FUNCTION long long m_internal_value();
  11713. /** Return true iff `m_internal` is not null. */
  11714. FZ_FUNCTION operator bool();
  11715. /* == Member data. */
  11716. /** Pointer to wrapped data. */
  11717. ::pdf_cycle_list* m_internal;
  11718. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11719. generate code regardless so we always need to have this available. */
  11720. FZ_DATA static int s_num_instances;
  11721. private:
  11722. /** This class is not copyable or assignable. */
  11723. PdfCycleList(const PdfCycleList& rhs);
  11724. PdfCycleList& operator=(const PdfCycleList& rhs);
  11725. };
  11726. /** Wrapper class for struct `pdf_doc_event`. Not copyable or assignable. */
  11727. struct PdfDocEvent
  11728. {
  11729. /** Default constructor, sets `m_internal` to null. */
  11730. FZ_FUNCTION PdfDocEvent();
  11731. /* == Methods. */
  11732. /** Class-aware wrapper for `::pdf_access_exec_menu_item_event()`. */
  11733. FZ_FUNCTION const char *pdf_access_exec_menu_item_event() const;
  11734. /** Constructor using raw copy of pre-existing `::pdf_doc_event`. */
  11735. FZ_FUNCTION PdfDocEvent(::pdf_doc_event* internal);
  11736. #ifndef NDEBUG
  11737. /** Destructor only decrements s_num_instances. */
  11738. FZ_FUNCTION ~PdfDocEvent();
  11739. #else
  11740. /** We use default destructor. */
  11741. #endif
  11742. /** Return numerical value of .m_internal; helps with Python debugging. */
  11743. FZ_FUNCTION long long m_internal_value();
  11744. /** Return true iff `m_internal` is not null. */
  11745. FZ_FUNCTION operator bool();
  11746. /* == Member data. */
  11747. /** Pointer to wrapped data. */
  11748. ::pdf_doc_event* m_internal;
  11749. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  11750. generate code regardless so we always need to have this available. */
  11751. FZ_DATA static int s_num_instances;
  11752. private:
  11753. /** This class is not copyable or assignable. */
  11754. PdfDocEvent(const PdfDocEvent& rhs);
  11755. PdfDocEvent& operator=(const PdfDocEvent& rhs);
  11756. };
  11757. /** Wrapper class for struct `pdf_document`. */
  11758. struct PdfDocument
  11759. {
  11760. /** == Constructors. */
  11761. /** Constructor using `pdf_create_document()`. */
  11762. FZ_FUNCTION PdfDocument();
  11763. /** Constructor using `pdf_document_from_fz_document()`. */
  11764. FZ_FUNCTION PdfDocument(const FzDocument& ptr);
  11765. /** Constructor using `pdf_open_document()`. */
  11766. FZ_FUNCTION PdfDocument(const char *filename);
  11767. /** Constructor using `pdf_open_document_with_stream()`. */
  11768. FZ_FUNCTION PdfDocument(const FzStream& file);
  11769. /** Copy constructor using `pdf_keep_document()`. */
  11770. FZ_FUNCTION PdfDocument(const PdfDocument& rhs);
  11771. /** operator= using `pdf_keep_document()` and `pdf_drop_document()`. */
  11772. FZ_FUNCTION PdfDocument& operator=(const PdfDocument& rhs);
  11773. /* == Methods. */
  11774. /** Class-aware wrapper for `::pdf_abandon_operation()`. */
  11775. FZ_FUNCTION void pdf_abandon_operation() const;
  11776. /** Class-aware wrapper for `::pdf_add_cid_font()`. */
  11777. FZ_FUNCTION PdfObj pdf_add_cid_font(const FzFont& font) const;
  11778. /** Class-aware wrapper for `::pdf_add_cjk_font()`. */
  11779. FZ_FUNCTION PdfObj pdf_add_cjk_font(const FzFont& font, int script, int wmode, int serif) const;
  11780. /** Class-aware wrapper for `::pdf_add_colorspace()`. */
  11781. FZ_FUNCTION PdfObj pdf_add_colorspace(const FzColorspace& cs) const;
  11782. /** Class-aware wrapper for `::pdf_add_embedded_file()`. */
  11783. FZ_FUNCTION PdfObj pdf_add_embedded_file(const char *filename, const char *mimetype, const FzBuffer& contents, int64_t created, int64_t modified, int add_checksum) const;
  11784. /** Class-aware wrapper for `::pdf_add_image()`. */
  11785. FZ_FUNCTION PdfObj pdf_add_image(const FzImage& image) const;
  11786. /** Class-aware wrapper for `::pdf_add_journal_fragment()`. */
  11787. FZ_FUNCTION void pdf_add_journal_fragment(int parent, const PdfObj& copy, const FzBuffer& copy_stream, int newobj) const;
  11788. /** Class-aware wrapper for `::pdf_add_new_array()`. */
  11789. FZ_FUNCTION PdfObj pdf_add_new_array(int initial) const;
  11790. /** Class-aware wrapper for `::pdf_add_new_dict()`. */
  11791. FZ_FUNCTION PdfObj pdf_add_new_dict(int initial) const;
  11792. /** Class-aware wrapper for `::pdf_add_object()`. */
  11793. FZ_FUNCTION PdfObj pdf_add_object(const PdfObj& obj) const;
  11794. /** Class-aware wrapper for `::pdf_add_page()`. */
  11795. FZ_FUNCTION PdfObj pdf_add_page(const FzRect& mediabox, int rotate, const PdfObj& resources, const FzBuffer& contents) const;
  11796. /** Class-aware wrapper for `::pdf_add_simple_font()`. */
  11797. FZ_FUNCTION PdfObj pdf_add_simple_font(const FzFont& font, int encoding) const;
  11798. /** Class-aware wrapper for `::pdf_add_stream()`. */
  11799. FZ_FUNCTION PdfObj pdf_add_stream(const FzBuffer& buf, const PdfObj& obj, int compressed) const;
  11800. /** Class-aware wrapper for `::pdf_add_substitute_font()`. */
  11801. FZ_FUNCTION PdfObj pdf_add_substitute_font(const FzFont& font) const;
  11802. /** Class-aware wrapper for `::pdf_annot_field_event_keystroke()`. */
  11803. FZ_FUNCTION int pdf_annot_field_event_keystroke(const PdfAnnot& annot, const PdfKeystrokeEvent& evt) const;
  11804. /** Class-aware wrapper for `::pdf_authenticate_password()`. */
  11805. FZ_FUNCTION int pdf_authenticate_password(const char *pw) const;
  11806. /** Class-aware wrapper for `::pdf_bake_document()`. */
  11807. FZ_FUNCTION void pdf_bake_document(int bake_annots, int bake_widgets) const;
  11808. /** Class-aware wrapper for `::pdf_begin_implicit_operation()`. */
  11809. FZ_FUNCTION void pdf_begin_implicit_operation() const;
  11810. /** Class-aware wrapper for `::pdf_begin_operation()`. */
  11811. FZ_FUNCTION void pdf_begin_operation(const char *operation) const;
  11812. /** Class-aware wrapper for `::pdf_calculate_form()`. */
  11813. FZ_FUNCTION void pdf_calculate_form() const;
  11814. /** Class-aware wrapper for `::pdf_can_be_saved_incrementally()`. */
  11815. FZ_FUNCTION int pdf_can_be_saved_incrementally() const;
  11816. /** Class-aware wrapper for `::pdf_can_redo()`. */
  11817. FZ_FUNCTION int pdf_can_redo() const;
  11818. /** Class-aware wrapper for `::pdf_can_undo()`. */
  11819. FZ_FUNCTION int pdf_can_undo() const;
  11820. /** Class-aware wrapper for `::pdf_clear_xref()`. */
  11821. FZ_FUNCTION void pdf_clear_xref() const;
  11822. /** Class-aware wrapper for `::pdf_clear_xref_to_mark()`. */
  11823. FZ_FUNCTION void pdf_clear_xref_to_mark() const;
  11824. /** Class-aware wrapper for `::pdf_count_document_associated_files()`. */
  11825. FZ_FUNCTION int pdf_count_document_associated_files() const;
  11826. /** Class-aware wrapper for `::pdf_count_layer_config_ui()`. */
  11827. FZ_FUNCTION int pdf_count_layer_config_ui() const;
  11828. /** Class-aware wrapper for `::pdf_count_layer_configs()`. */
  11829. FZ_FUNCTION int pdf_count_layer_configs() const;
  11830. /** Class-aware wrapper for `::pdf_count_layers()`. */
  11831. FZ_FUNCTION int pdf_count_layers() const;
  11832. /** Class-aware wrapper for `::pdf_count_objects()`. */
  11833. FZ_FUNCTION int pdf_count_objects() const;
  11834. /** Class-aware wrapper for `::pdf_count_pages()`. */
  11835. FZ_FUNCTION int pdf_count_pages() const;
  11836. /** Class-aware wrapper for `::pdf_count_q_balance()`.
  11837. This method has out-params. Python/C# wrappers look like:
  11838. `pdf_count_q_balance(::pdf_obj *res, ::pdf_obj *stm)` => `(int prepend, int append)`
  11839. */
  11840. FZ_FUNCTION void pdf_count_q_balance(const PdfObj& res, const PdfObj& stm, int *prepend, int *append) const;
  11841. /** Class-aware wrapper for `::pdf_count_signatures()`. */
  11842. FZ_FUNCTION int pdf_count_signatures() const;
  11843. /** Class-aware wrapper for `::pdf_count_unsaved_versions()`. */
  11844. FZ_FUNCTION int pdf_count_unsaved_versions() const;
  11845. /** Class-aware wrapper for `::pdf_count_versions()`. */
  11846. FZ_FUNCTION int pdf_count_versions() const;
  11847. /** Class-aware wrapper for `::pdf_create_field_name()`. */
  11848. FZ_FUNCTION void pdf_create_field_name(const char *prefix, char *buf, size_t len) const;
  11849. /** Class-aware wrapper for `::pdf_create_object()`. */
  11850. FZ_FUNCTION int pdf_create_object() const;
  11851. /** Class-aware wrapper for `::pdf_debug_doc_changes()`. */
  11852. FZ_FUNCTION void pdf_debug_doc_changes() const;
  11853. /** Class-aware wrapper for `::pdf_delete_object()`. */
  11854. FZ_FUNCTION void pdf_delete_object(int num) const;
  11855. /** Class-aware wrapper for `::pdf_delete_page()`. */
  11856. FZ_FUNCTION void pdf_delete_page(int number) const;
  11857. /** Class-aware wrapper for `::pdf_delete_page_labels()`. */
  11858. FZ_FUNCTION void pdf_delete_page_labels(int index) const;
  11859. /** Class-aware wrapper for `::pdf_delete_page_range()`. */
  11860. FZ_FUNCTION void pdf_delete_page_range(int start, int end) const;
  11861. /** Class-aware wrapper for `::pdf_deselect_layer_config_ui()`. */
  11862. FZ_FUNCTION void pdf_deselect_layer_config_ui(int ui) const;
  11863. /** Class-aware wrapper for `::pdf_deserialise_journal()`. */
  11864. FZ_FUNCTION void pdf_deserialise_journal(const FzStream& stm) const;
  11865. /** Class-aware wrapper for `::pdf_disable_js()`. */
  11866. FZ_FUNCTION void pdf_disable_js() const;
  11867. /** Class-aware wrapper for `::pdf_doc_was_linearized()`. */
  11868. FZ_FUNCTION int pdf_doc_was_linearized() const;
  11869. /** Class-aware wrapper for `::pdf_document_associated_file()`. */
  11870. FZ_FUNCTION PdfObj pdf_document_associated_file(int idx) const;
  11871. /** Class-aware wrapper for `::pdf_document_event_did_print()`. */
  11872. FZ_FUNCTION void pdf_document_event_did_print() const;
  11873. /** Class-aware wrapper for `::pdf_document_event_did_save()`. */
  11874. FZ_FUNCTION void pdf_document_event_did_save() const;
  11875. /** Class-aware wrapper for `::pdf_document_event_will_close()`. */
  11876. FZ_FUNCTION void pdf_document_event_will_close() const;
  11877. /** Class-aware wrapper for `::pdf_document_event_will_print()`. */
  11878. FZ_FUNCTION void pdf_document_event_will_print() const;
  11879. /** Class-aware wrapper for `::pdf_document_event_will_save()`. */
  11880. FZ_FUNCTION void pdf_document_event_will_save() const;
  11881. /** Class-aware wrapper for `::pdf_document_output_intent()`. */
  11882. FZ_FUNCTION FzColorspace pdf_document_output_intent() const;
  11883. /** Class-aware wrapper for `::pdf_document_permissions()`. */
  11884. FZ_FUNCTION int pdf_document_permissions() const;
  11885. /** Class-aware wrapper for `::pdf_empty_store()`. */
  11886. FZ_FUNCTION void pdf_empty_store() const;
  11887. /** Class-aware wrapper for `::pdf_enable_journal()`. */
  11888. FZ_FUNCTION void pdf_enable_journal() const;
  11889. /** Class-aware wrapper for `::pdf_enable_js()`. */
  11890. FZ_FUNCTION void pdf_enable_js() const;
  11891. /** Class-aware wrapper for `::pdf_enable_layer()`. */
  11892. FZ_FUNCTION void pdf_enable_layer(int layer, int enabled) const;
  11893. /** Class-aware wrapper for `::pdf_end_operation()`. */
  11894. FZ_FUNCTION void pdf_end_operation() const;
  11895. /** Class-aware wrapper for `::pdf_ensure_solid_xref()`. */
  11896. FZ_FUNCTION void pdf_ensure_solid_xref(int num) const;
  11897. /** Class-aware wrapper for `::pdf_event_issue_alert()`. */
  11898. FZ_FUNCTION void pdf_event_issue_alert(const PdfAlertEvent& evt) const;
  11899. /** Class-aware wrapper for `::pdf_event_issue_exec_menu_item()`. */
  11900. FZ_FUNCTION void pdf_event_issue_exec_menu_item(const char *item) const;
  11901. /** Class-aware wrapper for `::pdf_event_issue_launch_url()`. */
  11902. FZ_FUNCTION void pdf_event_issue_launch_url(const char *url, int new_frame) const;
  11903. /** Class-aware wrapper for `::pdf_event_issue_mail_doc()`. */
  11904. FZ_FUNCTION void pdf_event_issue_mail_doc(const PdfMailDocEvent& evt) const;
  11905. /** Class-aware wrapper for `::pdf_event_issue_print()`. */
  11906. FZ_FUNCTION void pdf_event_issue_print() const;
  11907. /** Class-aware wrapper for `::pdf_field_event_calculate()`. */
  11908. FZ_FUNCTION void pdf_field_event_calculate(const PdfObj& field) const;
  11909. /** Class-aware wrapper for `::pdf_field_event_format()`. */
  11910. FZ_FUNCTION char *pdf_field_event_format(const PdfObj& field) const;
  11911. /** Class-aware wrapper for `::pdf_field_event_keystroke()`. */
  11912. FZ_FUNCTION int pdf_field_event_keystroke(const PdfObj& field, const PdfKeystrokeEvent& evt) const;
  11913. /** Class-aware wrapper for `::pdf_field_event_validate()`.
  11914. This method has out-params. Python/C# wrappers look like:
  11915. `pdf_field_event_validate(::pdf_obj *field, const char *value)` => `(int, char *newvalue)`
  11916. */
  11917. FZ_FUNCTION int pdf_field_event_validate(const PdfObj& field, const char *value, char **newvalue) const;
  11918. /** Class-aware wrapper for `::pdf_field_reset()`. */
  11919. FZ_FUNCTION void pdf_field_reset(const PdfObj& field) const;
  11920. /** Class-aware wrapper for `::pdf_filter_annot_contents()`. */
  11921. FZ_FUNCTION void pdf_filter_annot_contents(const PdfAnnot& annot, PdfFilterOptions& options) const;
  11922. /** Class-aware wrapper for `::pdf_filter_page_contents()`. */
  11923. FZ_FUNCTION void pdf_filter_page_contents(const PdfPage& page, PdfFilterOptions& options) const;
  11924. /** Class-aware wrapper for `::pdf_find_colorspace_resource()`. */
  11925. FZ_FUNCTION PdfObj pdf_find_colorspace_resource(const FzColorspace& item, const PdfColorspaceResourceKey& key) const;
  11926. /** Class-aware wrapper for `::pdf_find_font_resource()`. */
  11927. FZ_FUNCTION PdfObj pdf_find_font_resource(int type, int encoding, const FzFont& item, const PdfFontResourceKey& key) const;
  11928. /** Class-aware wrapper for `::pdf_find_version_for_obj()`. */
  11929. FZ_FUNCTION int pdf_find_version_for_obj(const PdfObj& obj) const;
  11930. /** Class-aware wrapper for `::pdf_forget_xref()`. */
  11931. FZ_FUNCTION void pdf_forget_xref() const;
  11932. /** Class-aware wrapper for `::pdf_get_doc_event_callback_data()`. */
  11933. FZ_FUNCTION void *pdf_get_doc_event_callback_data() const;
  11934. /** Class-aware wrapper for `::pdf_graft_object()`. */
  11935. FZ_FUNCTION PdfObj pdf_graft_object(const PdfObj& obj) const;
  11936. /** Class-aware wrapper for `::pdf_graft_page()`. */
  11937. FZ_FUNCTION void pdf_graft_page(int page_to, const PdfDocument& src, int page_from) const;
  11938. /** Class-aware wrapper for `::pdf_has_permission()`. */
  11939. FZ_FUNCTION int pdf_has_permission(::fz_permission p) const;
  11940. /** Class-aware wrapper for `::pdf_has_unsaved_changes()`. */
  11941. FZ_FUNCTION int pdf_has_unsaved_changes() const;
  11942. /** Class-aware wrapper for `::pdf_has_unsaved_sigs()`. */
  11943. FZ_FUNCTION int pdf_has_unsaved_sigs() const;
  11944. /** Class-aware wrapper for `::pdf_insert_colorspace_resource()`. */
  11945. FZ_FUNCTION PdfObj pdf_insert_colorspace_resource(const PdfColorspaceResourceKey& key, const PdfObj& obj) const;
  11946. /** Class-aware wrapper for `::pdf_insert_font_resource()`. */
  11947. FZ_FUNCTION PdfObj pdf_insert_font_resource(const PdfFontResourceKey& key, const PdfObj& obj) const;
  11948. /** Class-aware wrapper for `::pdf_insert_page()`. */
  11949. FZ_FUNCTION void pdf_insert_page(int at, const PdfObj& page) const;
  11950. /** Class-aware wrapper for `::pdf_invalidate_xfa()`. */
  11951. FZ_FUNCTION void pdf_invalidate_xfa() const;
  11952. /** Class-aware wrapper for `::pdf_is_local_object()`. */
  11953. FZ_FUNCTION int pdf_is_local_object(const PdfObj& obj) const;
  11954. /** Class-aware wrapper for `::pdf_is_ocg_hidden()`. */
  11955. FZ_FUNCTION int pdf_is_ocg_hidden(const PdfResourceStack& rdb, const char *usage, const PdfObj& ocg) const;
  11956. /** Class-aware wrapper for `::pdf_js_set_console()`. */
  11957. FZ_FUNCTION void pdf_js_set_console(const PdfJsConsole& console, void *user) const;
  11958. /** Class-aware wrapper for `::pdf_js_supported()`. */
  11959. FZ_FUNCTION int pdf_js_supported() const;
  11960. /** Class-aware wrapper for `::pdf_layer_config_info()`. */
  11961. FZ_FUNCTION void pdf_layer_config_info(int config_num, PdfLayerConfig& info) const;
  11962. /** Class-aware wrapper for `::pdf_layer_config_ui_info()`. */
  11963. FZ_FUNCTION void pdf_layer_config_ui_info(int ui, PdfLayerConfigUi& info) const;
  11964. /** Class-aware wrapper for `::pdf_layer_is_enabled()`. */
  11965. FZ_FUNCTION int pdf_layer_is_enabled(int layer) const;
  11966. /** Class-aware wrapper for `::pdf_layer_name()`. */
  11967. FZ_FUNCTION const char *pdf_layer_name(int layer) const;
  11968. /** Class-aware wrapper for `::pdf_load_compressed_inline_image()`. */
  11969. FZ_FUNCTION void pdf_load_compressed_inline_image(const PdfObj& dict, int length, const FzStream& cstm, int indexed, const FzCompressedImage& image) const;
  11970. /** Class-aware wrapper for `::pdf_load_compressed_stream()`. */
  11971. FZ_FUNCTION FzCompressedBuffer pdf_load_compressed_stream(int num, size_t worst_case) const;
  11972. /** Class-aware wrapper for `::pdf_load_default_colorspaces()`. */
  11973. FZ_FUNCTION FzDefaultColorspaces pdf_load_default_colorspaces(const PdfPage& page) const;
  11974. /** Class-aware wrapper for `::pdf_load_embedded_cmap()`. */
  11975. FZ_FUNCTION PdfCmap pdf_load_embedded_cmap(const PdfObj& ref) const;
  11976. /** Class-aware wrapper for `::pdf_load_image()`. */
  11977. FZ_FUNCTION FzImage pdf_load_image(const PdfObj& obj) const;
  11978. /** Class-aware wrapper for `::pdf_load_inline_image()`. */
  11979. FZ_FUNCTION FzImage pdf_load_inline_image(const PdfResourceStack& rdb, const PdfObj& dict, const FzStream& file) const;
  11980. /** Class-aware wrapper for `::pdf_load_journal()`. */
  11981. FZ_FUNCTION void pdf_load_journal(const char *filename) const;
  11982. /** Class-aware wrapper for `::pdf_load_link_annots()`. */
  11983. FZ_FUNCTION FzLink pdf_load_link_annots(const PdfPage& arg_1, const PdfObj& annots, int pagenum, const FzMatrix& page_ctm) const;
  11984. /** Class-aware wrapper for `::pdf_load_name_tree()`. */
  11985. FZ_FUNCTION PdfObj pdf_load_name_tree(const PdfObj& which) const;
  11986. /** Class-aware wrapper for `::pdf_load_object()`. */
  11987. /**
  11988. Load a given object.
  11989. This can cause xref reorganisations (solidifications etc) due to
  11990. repairs, so all held pdf_xref_entries should be considered
  11991. invalid after this call (other than the returned one).
  11992. */
  11993. FZ_FUNCTION PdfObj pdf_load_object(int num) const;
  11994. /** Class-aware wrapper for `::pdf_load_outline()`. */
  11995. FZ_FUNCTION FzOutline pdf_load_outline() const;
  11996. /** Class-aware wrapper for `::pdf_load_page()`. */
  11997. FZ_FUNCTION PdfPage pdf_load_page(int number) const;
  11998. /** Class-aware wrapper for `::pdf_load_page_tree()`. */
  11999. FZ_FUNCTION void pdf_load_page_tree() const;
  12000. /** Class-aware wrapper for `::pdf_load_pattern()`. */
  12001. FZ_FUNCTION PdfPattern pdf_load_pattern(const PdfObj& obj) const;
  12002. /** Class-aware wrapper for `::pdf_load_raw_stream_number()`. */
  12003. FZ_FUNCTION FzBuffer pdf_load_raw_stream_number(int num) const;
  12004. /** Class-aware wrapper for `::pdf_load_shading()`. */
  12005. FZ_FUNCTION FzShade pdf_load_shading(const PdfObj& obj) const;
  12006. /** Class-aware wrapper for `::pdf_load_stream_number()`. */
  12007. FZ_FUNCTION FzBuffer pdf_load_stream_number(int num) const;
  12008. /** Class-aware wrapper for `::pdf_load_to_unicode()`.
  12009. This method has out-params. Python/C# wrappers look like:
  12010. `pdf_load_to_unicode(::pdf_font_desc *font, char *collection, ::pdf_obj *cmapstm)` => const char *strings
  12011. */
  12012. FZ_FUNCTION void pdf_load_to_unicode(const PdfFontDesc& font, const char **strings, char *collection, const PdfObj& cmapstm) const;
  12013. /** Class-aware wrapper for `::pdf_load_type3_glyphs()`. */
  12014. FZ_FUNCTION void pdf_load_type3_glyphs(const PdfFontDesc& fontdesc) const;
  12015. /** Class-aware wrapper for `::pdf_load_unencrypted_object()`. */
  12016. FZ_FUNCTION PdfObj pdf_load_unencrypted_object(int num) const;
  12017. /** Class-aware wrapper for `::pdf_lookup_dest()`. */
  12018. FZ_FUNCTION PdfObj pdf_lookup_dest(const PdfObj& needle) const;
  12019. /** Class-aware wrapper for `::pdf_lookup_metadata()`. */
  12020. FZ_FUNCTION int pdf_lookup_metadata(const char *key, char *ptr, size_t size) const;
  12021. /** Class-aware wrapper for `::pdf_lookup_metadata2()`. */
  12022. /**
  12023. C++ alternative to `pdf_lookup_metadata()` that returns a `std::string`
  12024. or calls `fz_throw()` if not found.
  12025. */
  12026. FZ_FUNCTION std::string pdf_lookup_metadata2(const char *key) const;
  12027. /** Class-aware wrapper for `::pdf_lookup_name()`. */
  12028. FZ_FUNCTION PdfObj pdf_lookup_name(const PdfObj& which, const PdfObj& needle) const;
  12029. /** Class-aware wrapper for `::pdf_lookup_page_loc()`.
  12030. This method has out-params. Python/C# wrappers look like:
  12031. `pdf_lookup_page_loc(int needle, ::pdf_obj **parentp)` => `(pdf_obj *, int indexp)`
  12032. */
  12033. FZ_FUNCTION PdfObj pdf_lookup_page_loc(int needle, PdfObj& parentp, int *indexp) const;
  12034. /** Class-aware wrapper for `::pdf_lookup_page_number()`. */
  12035. FZ_FUNCTION int pdf_lookup_page_number(const PdfObj& pageobj) const;
  12036. /** Class-aware wrapper for `::pdf_lookup_page_obj()`. */
  12037. FZ_FUNCTION PdfObj pdf_lookup_page_obj(int needle) const;
  12038. /** Class-aware wrapper for `::pdf_mark_xref()`. */
  12039. FZ_FUNCTION void pdf_mark_xref() const;
  12040. /** Class-aware wrapper for `::pdf_metadata()`. */
  12041. FZ_FUNCTION PdfObj pdf_metadata() const;
  12042. /** Class-aware wrapper for `::pdf_minimize_document()`. */
  12043. FZ_FUNCTION void pdf_minimize_document() const;
  12044. /** Class-aware wrapper for `::pdf_needs_password()`. */
  12045. FZ_FUNCTION int pdf_needs_password() const;
  12046. /** Class-aware wrapper for `::pdf_new_action_from_link()`. */
  12047. FZ_FUNCTION PdfObj pdf_new_action_from_link(const char *uri) const;
  12048. /** Class-aware wrapper for `::pdf_new_array()`. */
  12049. FZ_FUNCTION PdfObj pdf_new_array(int initialcap) const;
  12050. /** Class-aware wrapper for `::pdf_new_color_filter()`. */
  12051. FZ_FUNCTION PdfProcessor pdf_new_color_filter(const PdfProcessor& chain, int struct_parents, const FzMatrix& transform, PdfFilterOptions& options, void *copts) const;
  12052. /** Class-aware wrapper for `::pdf_new_date()`. */
  12053. FZ_FUNCTION PdfObj pdf_new_date(int64_t time) const;
  12054. /** Class-aware wrapper for `::pdf_new_dest_from_link()`. */
  12055. FZ_FUNCTION PdfObj pdf_new_dest_from_link(const char *uri, int is_remote) const;
  12056. /** Class-aware wrapper for `::pdf_new_dict()`. */
  12057. FZ_FUNCTION PdfObj pdf_new_dict(int initialcap) const;
  12058. /** Class-aware wrapper for `::pdf_new_graft_map()`. */
  12059. FZ_FUNCTION PdfGraftMap pdf_new_graft_map() const;
  12060. /** Class-aware wrapper for `::pdf_new_indirect()`. */
  12061. FZ_FUNCTION PdfObj pdf_new_indirect(int num, int gen) const;
  12062. /** Class-aware wrapper for `::pdf_new_matrix()`. */
  12063. FZ_FUNCTION PdfObj pdf_new_matrix(const FzMatrix& mtx) const;
  12064. /** Class-aware wrapper for `::pdf_new_pdf_device()`. */
  12065. FZ_FUNCTION FzDevice pdf_new_pdf_device(const FzMatrix& topctm, const PdfObj& resources, const FzBuffer& contents) const;
  12066. /** Class-aware wrapper for `::pdf_new_point()`. */
  12067. FZ_FUNCTION PdfObj pdf_new_point(const FzPoint& point) const;
  12068. /** Class-aware wrapper for `::pdf_new_rect()`. */
  12069. FZ_FUNCTION PdfObj pdf_new_rect(const FzRect& rect) const;
  12070. /** Class-aware wrapper for `::pdf_new_run_processor()`. */
  12071. FZ_FUNCTION PdfProcessor pdf_new_run_processor(const FzDevice& dev, const FzMatrix& ctm, int struct_parent, const char *usage, const PdfGstate& gstate, const FzDefaultColorspaces& default_cs, FzCookie& cookie, const PdfGstate& fill_gstate, const PdfGstate& stroke_gstate) const;
  12072. /** Class-aware wrapper for `::pdf_new_sanitize_filter()`. */
  12073. FZ_FUNCTION PdfProcessor pdf_new_sanitize_filter(const PdfProcessor& chain, int struct_parents, const FzMatrix& transform, PdfFilterOptions& options, void *sopts) const;
  12074. /** Class-aware wrapper for `::pdf_new_xobject()`. */
  12075. FZ_FUNCTION PdfObj pdf_new_xobject(const FzRect& bbox, const FzMatrix& matrix, const PdfObj& res, const FzBuffer& buffer) const;
  12076. /** Class-aware wrapper for `::pdf_obj_num_is_stream()`. */
  12077. FZ_FUNCTION int pdf_obj_num_is_stream(int num) const;
  12078. /** Class-aware wrapper for `::pdf_object_exists()`. */
  12079. FZ_FUNCTION int pdf_object_exists(int num) const;
  12080. /** Class-aware wrapper for `::pdf_open_contents_stream()`. */
  12081. FZ_FUNCTION FzStream pdf_open_contents_stream(const PdfObj& obj) const;
  12082. /** Class-aware wrapper for `::pdf_open_inline_stream()`. */
  12083. FZ_FUNCTION FzStream pdf_open_inline_stream(const PdfObj& stmobj, int length, const FzStream& chain, const FzCompressionParams& params) const;
  12084. /** Class-aware wrapper for `::pdf_open_raw_stream_number()`. */
  12085. FZ_FUNCTION FzStream pdf_open_raw_stream_number(int num) const;
  12086. /** Class-aware wrapper for `::pdf_open_stream_number()`. */
  12087. FZ_FUNCTION FzStream pdf_open_stream_number(int num) const;
  12088. /** Class-aware wrapper for `::pdf_open_stream_with_offset()`. */
  12089. FZ_FUNCTION FzStream pdf_open_stream_with_offset(int num, const PdfObj& dict, int64_t stm_ofs) const;
  12090. /** Class-aware wrapper for `::pdf_page_label()`. */
  12091. FZ_FUNCTION void pdf_page_label(int page, char *buf, size_t size) const;
  12092. /** Class-aware wrapper for `::pdf_page_write()`.
  12093. This method has out-params. Python/C# wrappers look like:
  12094. `pdf_page_write(::fz_rect mediabox, ::pdf_obj **presources, ::fz_buffer **pcontents)` => `(fz_device *)`
  12095. */
  12096. FZ_FUNCTION FzDevice pdf_page_write(const FzRect& mediabox, PdfObj& presources, FzBuffer& pcontents) const;
  12097. /** Class-aware wrapper for `::pdf_parse_array()`. */
  12098. FZ_FUNCTION PdfObj pdf_parse_array(const FzStream& f, const PdfLexbuf& buf) const;
  12099. /** Class-aware wrapper for `::pdf_parse_dict()`. */
  12100. FZ_FUNCTION PdfObj pdf_parse_dict(const FzStream& f, const PdfLexbuf& buf) const;
  12101. /** Class-aware wrapper for `::pdf_parse_ind_obj()`.
  12102. This method has out-params. Python/C# wrappers look like:
  12103. `pdf_parse_ind_obj(::fz_stream *f)` => `(pdf_obj *, int num, int gen, int64_t stm_ofs, int try_repair)`
  12104. */
  12105. FZ_FUNCTION PdfObj pdf_parse_ind_obj(const FzStream& f, int *num, int *gen, int64_t *stm_ofs, int *try_repair) const;
  12106. /** Class-aware wrapper for `::pdf_parse_journal_obj()`.
  12107. This method has out-params. Python/C# wrappers look like:
  12108. `pdf_parse_journal_obj(::fz_stream *stm, ::fz_buffer **ostm)` => `(pdf_obj *, int onum, int newobj)`
  12109. */
  12110. FZ_FUNCTION PdfObj pdf_parse_journal_obj(const FzStream& stm, int *onum, FzBuffer& ostm, int *newobj) const;
  12111. /** Class-aware wrapper for `::pdf_parse_stm_obj()`. */
  12112. FZ_FUNCTION PdfObj pdf_parse_stm_obj(const FzStream& f, const PdfLexbuf& buf) const;
  12113. /** Class-aware wrapper for `::pdf_progressive_advance()`. */
  12114. FZ_FUNCTION PdfObj pdf_progressive_advance(int pagenum) const;
  12115. /** Class-aware wrapper for `::pdf_purge_local_resources()`. */
  12116. FZ_FUNCTION void pdf_purge_local_resources() const;
  12117. /** Class-aware wrapper for `::pdf_purge_locals_from_store()`. */
  12118. FZ_FUNCTION void pdf_purge_locals_from_store() const;
  12119. /** Class-aware wrapper for `::pdf_purge_object_from_store()`. */
  12120. FZ_FUNCTION void pdf_purge_object_from_store(int num) const;
  12121. /** Class-aware wrapper for `::pdf_read_journal()`. */
  12122. FZ_FUNCTION void pdf_read_journal(const FzStream& stm) const;
  12123. /** Class-aware wrapper for `::pdf_rearrange_pages()`. */
  12124. FZ_FUNCTION void pdf_rearrange_pages(int count, const int *pages, ::pdf_clean_options_structure structure) const;
  12125. /** Class-aware wrapper for `::pdf_rearrange_pages2()`. */
  12126. /** Swig-friendly wrapper for pdf_rearrange_pages(). */
  12127. FZ_FUNCTION void pdf_rearrange_pages2(const std::vector<int> &pages, ::pdf_clean_options_structure structure) const;
  12128. /** Class-aware wrapper for `::pdf_recolor_page()`. */
  12129. FZ_FUNCTION void pdf_recolor_page(int pagenum, PdfRecolorOptions& opts) const;
  12130. /** Class-aware wrapper for `::pdf_redact_page()`. */
  12131. FZ_FUNCTION int pdf_redact_page(const PdfPage& page, PdfRedactOptions& opts) const;
  12132. /** Class-aware wrapper for `::pdf_redo()`. */
  12133. FZ_FUNCTION void pdf_redo() const;
  12134. /** Class-aware wrapper for `::pdf_remove_output_intents()`. */
  12135. FZ_FUNCTION void pdf_remove_output_intents() const;
  12136. /** Class-aware wrapper for `::pdf_repair_obj()`.
  12137. This method has out-params. Python/C# wrappers look like:
  12138. `pdf_repair_obj(::pdf_lexbuf *buf, ::pdf_obj **encrypt, ::pdf_obj **id, ::pdf_obj **page, ::pdf_obj **root)` => `(int, int64_t stmofsp, int64_t stmlenp, int64_t tmpofs)`
  12139. */
  12140. FZ_FUNCTION int pdf_repair_obj(const PdfLexbuf& buf, int64_t *stmofsp, int64_t *stmlenp, PdfObj& encrypt, PdfObj& id, PdfObj& page, int64_t *tmpofs, PdfObj& root) const;
  12141. /** Class-aware wrapper for `::pdf_repair_xref()`. */
  12142. FZ_FUNCTION void pdf_repair_xref() const;
  12143. /** Class-aware wrapper for `::pdf_replace_xref()`. */
  12144. FZ_FUNCTION void pdf_replace_xref(const PdfXrefEntry& entries, int n) const;
  12145. /** Class-aware wrapper for `::pdf_reset_form()`. */
  12146. FZ_FUNCTION void pdf_reset_form(const PdfObj& fields, int exclude) const;
  12147. /** Class-aware wrapper for `::pdf_resolve_link()`.
  12148. This method has out-params. Python/C# wrappers look like:
  12149. `pdf_resolve_link(const char *uri)` => `(int, float xp, float yp)`
  12150. */
  12151. FZ_FUNCTION int pdf_resolve_link(const char *uri, float *xp, float *yp) const;
  12152. /** Class-aware wrapper for `::pdf_rewrite_images()`. */
  12153. FZ_FUNCTION void pdf_rewrite_images(PdfImageRewriterOptions& opts) const;
  12154. /** Class-aware wrapper for `::pdf_run_document_structure()`. */
  12155. FZ_FUNCTION void pdf_run_document_structure(const FzDevice& dev, FzCookie& cookie) const;
  12156. /** Class-aware wrapper for `::pdf_run_glyph()`. */
  12157. FZ_FUNCTION void pdf_run_glyph(const PdfObj& resources, const FzBuffer& contents, const FzDevice& dev, const FzMatrix& ctm, void *gstate, const FzDefaultColorspaces& default_cs, void *fill_gstate, void *stroke_gstate) const;
  12158. /** Class-aware wrapper for `::pdf_save_document()`. */
  12159. FZ_FUNCTION void pdf_save_document(const char *filename, PdfWriteOptions& opts) const;
  12160. /** Class-aware wrapper for `::pdf_save_journal()`. */
  12161. FZ_FUNCTION void pdf_save_journal(const char *filename) const;
  12162. /** Class-aware wrapper for `::pdf_save_snapshot()`. */
  12163. FZ_FUNCTION void pdf_save_snapshot(const char *filename) const;
  12164. /** Class-aware wrapper for `::pdf_select_layer_config()`. */
  12165. FZ_FUNCTION void pdf_select_layer_config(int config_num) const;
  12166. /** Class-aware wrapper for `::pdf_select_layer_config_ui()`. */
  12167. FZ_FUNCTION void pdf_select_layer_config_ui(int ui) const;
  12168. /** Class-aware wrapper for `::pdf_serialise_journal()`. */
  12169. FZ_FUNCTION void pdf_serialise_journal(const FzOutput& out) const;
  12170. /** Class-aware wrapper for `::pdf_set_annot_field_value()`. */
  12171. FZ_FUNCTION int pdf_set_annot_field_value(const PdfAnnot& widget, const char *text, int ignore_trigger_events) const;
  12172. /** Class-aware wrapper for `::pdf_set_doc_event_callback()`. */
  12173. FZ_FUNCTION void pdf_set_doc_event_callback(::pdf_doc_event_cb *event_cb, ::pdf_free_doc_event_data_cb *free_event_data_cb, void *data) const;
  12174. /** Class-aware wrapper for `::pdf_set_document_language()`. */
  12175. FZ_FUNCTION void pdf_set_document_language(::fz_text_language lang) const;
  12176. /** Class-aware wrapper for `::pdf_set_field_value()`. */
  12177. FZ_FUNCTION int pdf_set_field_value(const PdfObj& field, const char *text, int ignore_trigger_events) const;
  12178. /** Class-aware wrapper for `::pdf_set_layer_config_as_default()`. */
  12179. FZ_FUNCTION void pdf_set_layer_config_as_default() const;
  12180. /** Class-aware wrapper for `::pdf_set_page_labels()`. */
  12181. FZ_FUNCTION void pdf_set_page_labels(int index, ::pdf_page_label_style style, const char *prefix, int start) const;
  12182. /** Class-aware wrapper for `::pdf_set_populating_xref_trailer()`. */
  12183. FZ_FUNCTION void pdf_set_populating_xref_trailer(const PdfObj& trailer) const;
  12184. /** Class-aware wrapper for `::pdf_signature_byte_range()`. */
  12185. FZ_FUNCTION int pdf_signature_byte_range(const PdfObj& signature, const FzRange& byte_range) const;
  12186. /** Class-aware wrapper for `::pdf_signature_contents()`.
  12187. This method has out-params. Python/C# wrappers look like:
  12188. `pdf_signature_contents(::pdf_obj *signature)` => `(size_t, char *contents)`
  12189. */
  12190. FZ_FUNCTION size_t pdf_signature_contents(const PdfObj& signature, char **contents) const;
  12191. /** Class-aware wrapper for `::pdf_signature_hash_bytes()`. */
  12192. FZ_FUNCTION FzStream pdf_signature_hash_bytes(const PdfObj& signature) const;
  12193. /** Class-aware wrapper for `::pdf_signature_incremental_change_since_signing()`. */
  12194. FZ_FUNCTION int pdf_signature_incremental_change_since_signing(const PdfObj& signature) const;
  12195. /** Class-aware wrapper for `::pdf_signature_is_signed()`. */
  12196. FZ_FUNCTION int pdf_signature_is_signed(const PdfObj& field) const;
  12197. /** Class-aware wrapper for `::pdf_signature_set_value()`. */
  12198. FZ_FUNCTION void pdf_signature_set_value(const PdfObj& field, const PdfPkcs7Signer& signer, int64_t stime) const;
  12199. /** Class-aware wrapper for `::pdf_subset_fonts()`. */
  12200. FZ_FUNCTION void pdf_subset_fonts(int pages_len, const int *pages) const;
  12201. /** Class-aware wrapper for `::pdf_subset_fonts2()`. */
  12202. /** Swig-friendly wrapper for pdf_subset_fonts(). */
  12203. FZ_FUNCTION void pdf_subset_fonts2(const std::vector<int> &pages) const;
  12204. /** Class-aware wrapper for `::pdf_sync_open_pages()`. */
  12205. FZ_FUNCTION void pdf_sync_open_pages() const;
  12206. /** Class-aware wrapper for `::pdf_toggle_layer_config_ui()`. */
  12207. FZ_FUNCTION void pdf_toggle_layer_config_ui(int ui) const;
  12208. /** Class-aware wrapper for `::pdf_trailer()`. */
  12209. FZ_FUNCTION PdfObj pdf_trailer() const;
  12210. /** Class-aware wrapper for `::pdf_undo()`. */
  12211. FZ_FUNCTION void pdf_undo() const;
  12212. /** Class-aware wrapper for `::pdf_undoredo_state()`.
  12213. This method has out-params. Python/C# wrappers look like:
  12214. `pdf_undoredo_state()` => `(int, int steps)`
  12215. */
  12216. FZ_FUNCTION int pdf_undoredo_state(int *steps) const;
  12217. /** Class-aware wrapper for `::pdf_undoredo_step()`. */
  12218. FZ_FUNCTION const char *pdf_undoredo_step(int step) const;
  12219. /** Class-aware wrapper for `::pdf_update_object()`. */
  12220. FZ_FUNCTION void pdf_update_object(int num, const PdfObj& obj) const;
  12221. /** Class-aware wrapper for `::pdf_update_stream()`. */
  12222. FZ_FUNCTION void pdf_update_stream(const PdfObj& ref, const FzBuffer& buf, int compressed) const;
  12223. /** Class-aware wrapper for `::pdf_update_xobject()`. */
  12224. FZ_FUNCTION void pdf_update_xobject(const PdfObj& xobj, const FzRect& bbox, const FzMatrix& mat, const PdfObj& res, const FzBuffer& buffer) const;
  12225. /** Class-aware wrapper for `::pdf_validate_change_history()`. */
  12226. FZ_FUNCTION int pdf_validate_change_history() const;
  12227. /** Class-aware wrapper for `::pdf_validate_changes()`. */
  12228. FZ_FUNCTION int pdf_validate_changes(int version) const;
  12229. /** Class-aware wrapper for `::pdf_version()`. */
  12230. FZ_FUNCTION int pdf_version() const;
  12231. /** Class-aware wrapper for `::pdf_was_pure_xfa()`. */
  12232. FZ_FUNCTION int pdf_was_pure_xfa() const;
  12233. /** Class-aware wrapper for `::pdf_was_repaired()`. */
  12234. FZ_FUNCTION int pdf_was_repaired() const;
  12235. /** Class-aware wrapper for `::pdf_write_document()`. */
  12236. FZ_FUNCTION void pdf_write_document(const FzOutput& out, PdfWriteOptions& opts) const;
  12237. /** Class-aware wrapper for `::pdf_write_journal()`. */
  12238. FZ_FUNCTION void pdf_write_journal(const FzOutput& out) const;
  12239. /** Class-aware wrapper for `::pdf_write_snapshot()`. */
  12240. FZ_FUNCTION void pdf_write_snapshot(const FzOutput& out) const;
  12241. /** Class-aware wrapper for `::pdf_xref_ensure_incremental_object()`. */
  12242. FZ_FUNCTION int pdf_xref_ensure_incremental_object(int num) const;
  12243. /** Class-aware wrapper for `::pdf_xref_ensure_local_object()`. */
  12244. FZ_FUNCTION void pdf_xref_ensure_local_object(int num) const;
  12245. /** Class-aware wrapper for `::pdf_xref_entry_map()`. */
  12246. FZ_FUNCTION void pdf_xref_entry_map(void (*fn)(::fz_context *, ::pdf_xref_entry *, int , ::pdf_document *, void *), void *arg) const;
  12247. /** Class-aware wrapper for `::pdf_xref_is_incremental()`. */
  12248. FZ_FUNCTION int pdf_xref_is_incremental(int num) const;
  12249. /** Class-aware wrapper for `::pdf_xref_len()`. */
  12250. FZ_FUNCTION int pdf_xref_len() const;
  12251. /** Class-aware wrapper for `::pdf_xref_obj_is_unsaved_signature()`. */
  12252. FZ_FUNCTION int pdf_xref_obj_is_unsaved_signature(const PdfObj& obj) const;
  12253. /** Class-aware wrapper for `::pdf_xref_remove_unsaved_signature()`. */
  12254. FZ_FUNCTION void pdf_xref_remove_unsaved_signature(const PdfObj& field) const;
  12255. /** Class-aware wrapper for `::pdf_xref_store_unsaved_signature()`. */
  12256. FZ_FUNCTION void pdf_xref_store_unsaved_signature(const PdfObj& field, const PdfPkcs7Signer& signer) const;
  12257. /** Class-aware wrapper for `::pdf_zugferd_profile()`.
  12258. This method has out-params. Python/C# wrappers look like:
  12259. `pdf_zugferd_profile()` => `(enum pdf_zugferd_profile, float version)`
  12260. */
  12261. FZ_FUNCTION enum pdf_zugferd_profile pdf_zugferd_profile(float *version) const;
  12262. /** Class-aware wrapper for `::pdf_zugferd_xml()`. */
  12263. FZ_FUNCTION FzBuffer pdf_zugferd_xml() const;
  12264. /** Returns wrapper for .super member. */
  12265. FZ_FUNCTION FzDocument super();
  12266. /** Constructor using raw copy of pre-existing `::pdf_document`. */
  12267. /* This constructor is marked as `explicit` because wrapper classes do not
  12268. call `keep`in constructors, but do call `drop` in destructors. So
  12269. automatic construction from a pdf_document* will generally cause an
  12270. unbalanced `drop` resulting in errors such as SEGV. */
  12271. FZ_FUNCTION explicit PdfDocument(::pdf_document* internal);
  12272. /** Destructor using pdf_drop_document(). */
  12273. FZ_FUNCTION ~PdfDocument();
  12274. /** Return numerical value of .m_internal; helps with Python debugging. */
  12275. FZ_FUNCTION long long m_internal_value();
  12276. /** Return true iff `m_internal` is not null. */
  12277. FZ_FUNCTION operator bool();
  12278. /* == Member data. */
  12279. /** Pointer to wrapped data. */
  12280. ::pdf_document* m_internal;
  12281. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12282. generate code regardless so we always need to have this available. */
  12283. FZ_DATA static int s_num_instances;
  12284. };
  12285. /** Wrapper class for struct `pdf_filespec_params`. Not copyable or assignable. */
  12286. struct PdfFilespecParams
  12287. {
  12288. /** Default constructor, sets `m_internal` to null. */
  12289. FZ_FUNCTION PdfFilespecParams();
  12290. /** Constructor using raw copy of pre-existing `::pdf_filespec_params`. */
  12291. FZ_FUNCTION PdfFilespecParams(::pdf_filespec_params* internal);
  12292. #ifndef NDEBUG
  12293. /** Destructor only decrements s_num_instances. */
  12294. FZ_FUNCTION ~PdfFilespecParams();
  12295. #else
  12296. /** We use default destructor. */
  12297. #endif
  12298. /** Return numerical value of .m_internal; helps with Python debugging. */
  12299. FZ_FUNCTION long long m_internal_value();
  12300. /** Return true iff `m_internal` is not null. */
  12301. FZ_FUNCTION operator bool();
  12302. /* == Member data. */
  12303. /** Pointer to wrapped data. */
  12304. ::pdf_filespec_params* m_internal;
  12305. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12306. generate code regardless so we always need to have this available. */
  12307. FZ_DATA static int s_num_instances;
  12308. private:
  12309. /** This class is not copyable or assignable. */
  12310. PdfFilespecParams(const PdfFilespecParams& rhs);
  12311. PdfFilespecParams& operator=(const PdfFilespecParams& rhs);
  12312. };
  12313. /** Wrapper class for struct `pdf_filter_factory`. */
  12314. struct PdfFilterFactory
  12315. {
  12316. /** We use default copy constructor and operator=. */
  12317. /** Default constructor, sets each member to default value. */
  12318. FZ_FUNCTION PdfFilterFactory();
  12319. /** Constructor using raw copy of pre-existing `::pdf_filter_factory`. */
  12320. FZ_FUNCTION PdfFilterFactory(const ::pdf_filter_factory* internal);
  12321. /** Constructor using raw copy of pre-existing `::pdf_filter_factory`. */
  12322. FZ_FUNCTION PdfFilterFactory(const ::pdf_filter_factory internal);
  12323. /** Access as underlying struct. */
  12324. FZ_FUNCTION ::pdf_filter_factory* internal();
  12325. /** Access as underlying struct. */
  12326. FZ_FUNCTION const ::pdf_filter_factory* internal() const;
  12327. #ifndef NDEBUG
  12328. /** Destructor only decrements s_num_instances. */
  12329. FZ_FUNCTION ~PdfFilterFactory();
  12330. #else
  12331. /** We use default destructor. */
  12332. #endif
  12333. /* == Member data. */
  12334. /* These members are the same as the members of ::pdf_filter_factory. */
  12335. ::pdf_filter_factory_fn *filter;
  12336. void *options;
  12337. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12338. generate code regardless so we always need to have this available. */
  12339. FZ_DATA static int s_num_instances;
  12340. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  12341. FZ_FUNCTION std::string to_string();
  12342. /** Comparison method. */
  12343. FZ_FUNCTION bool operator==(const PdfFilterFactory& rhs);
  12344. /** Comparison method. */
  12345. FZ_FUNCTION bool operator!=(const PdfFilterFactory& rhs);
  12346. };
  12347. /** Wrapper class for struct pdf_filter_factory with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  12348. struct PdfFilterFactory2 : PdfFilterFactory
  12349. {
  12350. /** == Constructor. */
  12351. FZ_FUNCTION PdfFilterFactory2();
  12352. /** == Destructor. */
  12353. FZ_FUNCTION virtual ~PdfFilterFactory2();
  12354. /** These methods set the function pointers in *m_internal
  12355. to point to internal callbacks that call our virtual methods. */
  12356. FZ_FUNCTION void use_virtual_filter( bool use=true);
  12357. /** Default virtual method implementations; these all throw an exception. */
  12358. FZ_FUNCTION virtual ::pdf_processor * filter(::fz_context *arg_0, ::pdf_document *arg_1, ::pdf_processor *arg_2, int arg_3, ::fz_matrix arg_4, ::pdf_filter_options *arg_5);
  12359. };
  12360. /** Wrapper class for struct `pdf_filter_options`. */
  12361. struct PdfFilterOptions
  12362. {
  12363. /** Default constructor initialises all fields to null/zero. */
  12364. FZ_FUNCTION PdfFilterOptions();
  12365. /** We use default copy constructor and operator=. */
  12366. /* == Methods. */
  12367. /** Appends `factory` to internal vector and updates this->filters. */
  12368. FZ_FUNCTION void add_factory( const pdf_filter_factory& factory);
  12369. /** Constructor using raw copy of pre-existing `::pdf_filter_options`. */
  12370. FZ_FUNCTION PdfFilterOptions(const ::pdf_filter_options* internal);
  12371. /** Constructor using raw copy of pre-existing `::pdf_filter_options`. */
  12372. FZ_FUNCTION PdfFilterOptions(const ::pdf_filter_options internal);
  12373. /** Access as underlying struct. */
  12374. FZ_FUNCTION ::pdf_filter_options* internal();
  12375. /** Access as underlying struct. */
  12376. FZ_FUNCTION const ::pdf_filter_options* internal() const;
  12377. #ifndef NDEBUG
  12378. /** Destructor only decrements s_num_instances. */
  12379. FZ_FUNCTION ~PdfFilterOptions();
  12380. #else
  12381. /** We use default destructor. */
  12382. #endif
  12383. /* == Member data. */
  12384. /* These members are the same as the members of ::pdf_filter_options. */
  12385. int recurse;
  12386. int instance_forms;
  12387. int ascii;
  12388. int no_update;
  12389. void *opaque;
  12390. void (*complete)(::fz_context *, ::fz_buffer *, void *);
  12391. ::pdf_filter_factory *filters;
  12392. int newlines;
  12393. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12394. generate code regardless so we always need to have this available. */
  12395. FZ_DATA static int s_num_instances;
  12396. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  12397. FZ_FUNCTION std::string to_string();
  12398. /** Comparison method. */
  12399. FZ_FUNCTION bool operator==(const PdfFilterOptions& rhs);
  12400. /** Comparison method. */
  12401. FZ_FUNCTION bool operator!=(const PdfFilterOptions& rhs);
  12402. std::vector< pdf_filter_factory> m_filters;
  12403. };
  12404. /** Wrapper class for struct pdf_filter_options with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  12405. struct PdfFilterOptions2 : PdfFilterOptions
  12406. {
  12407. /** == Constructor. */
  12408. FZ_FUNCTION PdfFilterOptions2();
  12409. /** == Destructor. */
  12410. FZ_FUNCTION virtual ~PdfFilterOptions2();
  12411. /** These methods set the function pointers in *m_internal
  12412. to point to internal callbacks that call our virtual methods. */
  12413. FZ_FUNCTION void use_virtual_complete( bool use=true);
  12414. /** Default virtual method implementations; these all throw an exception. */
  12415. FZ_FUNCTION virtual void complete(::fz_context *arg_0, ::fz_buffer *arg_1);
  12416. };
  12417. /** Wrapper class for struct `pdf_font_desc`. Not copyable or assignable. */
  12418. struct PdfFontDesc
  12419. {
  12420. /** == Constructors. */
  12421. /** Constructor using `pdf_new_font_desc()`. */
  12422. FZ_FUNCTION PdfFontDesc();
  12423. /* == Methods. */
  12424. /** Class-aware wrapper for `::pdf_add_hmtx()`. */
  12425. FZ_FUNCTION void pdf_add_hmtx(int lo, int hi, int w) const;
  12426. /** Class-aware wrapper for `::pdf_add_vmtx()`. */
  12427. FZ_FUNCTION void pdf_add_vmtx(int lo, int hi, int x, int y, int w) const;
  12428. /** Class-aware wrapper for `::pdf_end_hmtx()`. */
  12429. FZ_FUNCTION void pdf_end_hmtx() const;
  12430. /** Class-aware wrapper for `::pdf_end_vmtx()`. */
  12431. FZ_FUNCTION void pdf_end_vmtx() const;
  12432. /** Class-aware wrapper for `::pdf_font_cid_to_gid()`. */
  12433. FZ_FUNCTION int pdf_font_cid_to_gid(int cid) const;
  12434. /** Class-aware wrapper for `::pdf_set_default_hmtx()`. */
  12435. FZ_FUNCTION void pdf_set_default_hmtx(int w) const;
  12436. /** Class-aware wrapper for `::pdf_set_default_vmtx()`. */
  12437. FZ_FUNCTION void pdf_set_default_vmtx(int y, int w) const;
  12438. /** Class-aware wrapper for `::pdf_set_font_wmode()`. */
  12439. FZ_FUNCTION void pdf_set_font_wmode(int wmode) const;
  12440. /** Constructor using raw copy of pre-existing `::pdf_font_desc`. */
  12441. FZ_FUNCTION PdfFontDesc(::pdf_font_desc* internal);
  12442. #ifndef NDEBUG
  12443. /** Destructor only decrements s_num_instances. */
  12444. FZ_FUNCTION ~PdfFontDesc();
  12445. #else
  12446. /** We use default destructor. */
  12447. #endif
  12448. /** Return numerical value of .m_internal; helps with Python debugging. */
  12449. FZ_FUNCTION long long m_internal_value();
  12450. /** Return true iff `m_internal` is not null. */
  12451. FZ_FUNCTION operator bool();
  12452. /* == Member data. */
  12453. /** Pointer to wrapped data. */
  12454. ::pdf_font_desc* m_internal;
  12455. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12456. generate code regardless so we always need to have this available. */
  12457. FZ_DATA static int s_num_instances;
  12458. private:
  12459. /** This class is not copyable or assignable. */
  12460. PdfFontDesc(const PdfFontDesc& rhs);
  12461. PdfFontDesc& operator=(const PdfFontDesc& rhs);
  12462. };
  12463. /** Wrapper class for struct `pdf_font_resource_key`. Not copyable or assignable. */
  12464. struct PdfFontResourceKey
  12465. {
  12466. /** Default constructor, sets `m_internal` to null. */
  12467. FZ_FUNCTION PdfFontResourceKey();
  12468. /** Constructor using raw copy of pre-existing `::pdf_font_resource_key`. */
  12469. FZ_FUNCTION PdfFontResourceKey(::pdf_font_resource_key* internal);
  12470. #ifndef NDEBUG
  12471. /** Destructor only decrements s_num_instances. */
  12472. FZ_FUNCTION ~PdfFontResourceKey();
  12473. #else
  12474. /** We use default destructor. */
  12475. #endif
  12476. /** Return numerical value of .m_internal; helps with Python debugging. */
  12477. FZ_FUNCTION long long m_internal_value();
  12478. /** Return true iff `m_internal` is not null. */
  12479. FZ_FUNCTION operator bool();
  12480. /* == Member data. */
  12481. /** Pointer to wrapped data. */
  12482. ::pdf_font_resource_key* m_internal;
  12483. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12484. generate code regardless so we always need to have this available. */
  12485. FZ_DATA static int s_num_instances;
  12486. private:
  12487. /** This class is not copyable or assignable. */
  12488. PdfFontResourceKey(const PdfFontResourceKey& rhs);
  12489. PdfFontResourceKey& operator=(const PdfFontResourceKey& rhs);
  12490. };
  12491. /** Wrapper class for struct `pdf_function`. */
  12492. struct PdfFunction
  12493. {
  12494. /** Copy constructor using `pdf_keep_function()`. */
  12495. FZ_FUNCTION PdfFunction(const PdfFunction& rhs);
  12496. /** operator= using `pdf_keep_function()` and `pdf_drop_function()`. */
  12497. FZ_FUNCTION PdfFunction& operator=(const PdfFunction& rhs);
  12498. /** Default constructor, sets `m_internal` to null. */
  12499. FZ_FUNCTION PdfFunction();
  12500. /* == Methods. */
  12501. /** Class-aware wrapper for `::pdf_eval_function()`.
  12502. This method has out-params. Python/C# wrappers look like:
  12503. `pdf_eval_function(const float *in, int inlen, int outlen)` => float out
  12504. */
  12505. FZ_FUNCTION void pdf_eval_function(const float *in, int inlen, float *out, int outlen) const;
  12506. /** Class-aware wrapper for `::pdf_function_size()`. */
  12507. FZ_FUNCTION size_t pdf_function_size() const;
  12508. /** Constructor using raw copy of pre-existing `::pdf_function`. */
  12509. /* This constructor is marked as `explicit` because wrapper classes do not
  12510. call `keep`in constructors, but do call `drop` in destructors. So
  12511. automatic construction from a pdf_function* will generally cause an
  12512. unbalanced `drop` resulting in errors such as SEGV. */
  12513. FZ_FUNCTION explicit PdfFunction(::pdf_function* internal);
  12514. /** Destructor using pdf_drop_function(). */
  12515. FZ_FUNCTION ~PdfFunction();
  12516. /** Return numerical value of .m_internal; helps with Python debugging. */
  12517. FZ_FUNCTION long long m_internal_value();
  12518. /** Return true iff `m_internal` is not null. */
  12519. FZ_FUNCTION operator bool();
  12520. /* == Member data. */
  12521. /** Pointer to wrapped data. */
  12522. ::pdf_function* m_internal;
  12523. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12524. generate code regardless so we always need to have this available. */
  12525. FZ_DATA static int s_num_instances;
  12526. };
  12527. /** Wrapper class for struct `pdf_graft_map`. */
  12528. struct PdfGraftMap
  12529. {
  12530. /** == Constructors. */
  12531. /** Constructor using `pdf_new_graft_map()`. */
  12532. FZ_FUNCTION PdfGraftMap(const PdfDocument& dst);
  12533. /** Copy constructor using `pdf_keep_graft_map()`. */
  12534. FZ_FUNCTION PdfGraftMap(const PdfGraftMap& rhs);
  12535. /** operator= using `pdf_keep_graft_map()` and `pdf_drop_graft_map()`. */
  12536. FZ_FUNCTION PdfGraftMap& operator=(const PdfGraftMap& rhs);
  12537. /** Default constructor, sets `m_internal` to null. */
  12538. FZ_FUNCTION PdfGraftMap();
  12539. /* == Methods. */
  12540. /** Class-aware wrapper for `::pdf_graft_mapped_object()`. */
  12541. FZ_FUNCTION PdfObj pdf_graft_mapped_object(const PdfObj& obj) const;
  12542. /** Class-aware wrapper for `::pdf_graft_mapped_page()`. */
  12543. FZ_FUNCTION void pdf_graft_mapped_page(int page_to, const PdfDocument& src, int page_from) const;
  12544. /** Constructor using raw copy of pre-existing `::pdf_graft_map`. */
  12545. /* This constructor is marked as `explicit` because wrapper classes do not
  12546. call `keep`in constructors, but do call `drop` in destructors. So
  12547. automatic construction from a pdf_graft_map* will generally cause an
  12548. unbalanced `drop` resulting in errors such as SEGV. */
  12549. FZ_FUNCTION explicit PdfGraftMap(::pdf_graft_map* internal);
  12550. /** Destructor using pdf_drop_graft_map(). */
  12551. FZ_FUNCTION ~PdfGraftMap();
  12552. /** Return numerical value of .m_internal; helps with Python debugging. */
  12553. FZ_FUNCTION long long m_internal_value();
  12554. /** Return true iff `m_internal` is not null. */
  12555. FZ_FUNCTION operator bool();
  12556. /* == Member data. */
  12557. /** Pointer to wrapped data. */
  12558. ::pdf_graft_map* m_internal;
  12559. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12560. generate code regardless so we always need to have this available. */
  12561. FZ_DATA static int s_num_instances;
  12562. };
  12563. /** Wrapper class for struct `pdf_gstate`. Not copyable or assignable. */
  12564. struct PdfGstate
  12565. {
  12566. /** Default constructor, sets `m_internal` to null. */
  12567. FZ_FUNCTION PdfGstate();
  12568. /** Constructor using raw copy of pre-existing `::pdf_gstate`. */
  12569. FZ_FUNCTION PdfGstate(::pdf_gstate* internal);
  12570. #ifndef NDEBUG
  12571. /** Destructor only decrements s_num_instances. */
  12572. FZ_FUNCTION ~PdfGstate();
  12573. #else
  12574. /** We use default destructor. */
  12575. #endif
  12576. /** Return numerical value of .m_internal; helps with Python debugging. */
  12577. FZ_FUNCTION long long m_internal_value();
  12578. /** Return true iff `m_internal` is not null. */
  12579. FZ_FUNCTION operator bool();
  12580. /* == Member data. */
  12581. /** Pointer to wrapped data. */
  12582. ::pdf_gstate* m_internal;
  12583. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12584. generate code regardless so we always need to have this available. */
  12585. FZ_DATA static int s_num_instances;
  12586. private:
  12587. /** This class is not copyable or assignable. */
  12588. PdfGstate(const PdfGstate& rhs);
  12589. PdfGstate& operator=(const PdfGstate& rhs);
  12590. };
  12591. /** Wrapper class for struct `pdf_hint_page`. Not copyable or assignable. */
  12592. struct PdfHintPage
  12593. {
  12594. /** Default constructor, sets `m_internal` to null. */
  12595. FZ_FUNCTION PdfHintPage();
  12596. /** Constructor using raw copy of pre-existing `::pdf_hint_page`. */
  12597. FZ_FUNCTION PdfHintPage(::pdf_hint_page* internal);
  12598. #ifndef NDEBUG
  12599. /** Destructor only decrements s_num_instances. */
  12600. FZ_FUNCTION ~PdfHintPage();
  12601. #else
  12602. /** We use default destructor. */
  12603. #endif
  12604. /** Return numerical value of .m_internal; helps with Python debugging. */
  12605. FZ_FUNCTION long long m_internal_value();
  12606. /** Return true iff `m_internal` is not null. */
  12607. FZ_FUNCTION operator bool();
  12608. /* == Member data. */
  12609. /** Pointer to wrapped data. */
  12610. ::pdf_hint_page* m_internal;
  12611. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12612. generate code regardless so we always need to have this available. */
  12613. FZ_DATA static int s_num_instances;
  12614. private:
  12615. /** This class is not copyable or assignable. */
  12616. PdfHintPage(const PdfHintPage& rhs);
  12617. PdfHintPage& operator=(const PdfHintPage& rhs);
  12618. };
  12619. /** Wrapper class for struct `pdf_hint_shared`. Not copyable or assignable. */
  12620. struct PdfHintShared
  12621. {
  12622. /** Default constructor, sets `m_internal` to null. */
  12623. FZ_FUNCTION PdfHintShared();
  12624. /** Constructor using raw copy of pre-existing `::pdf_hint_shared`. */
  12625. FZ_FUNCTION PdfHintShared(::pdf_hint_shared* internal);
  12626. #ifndef NDEBUG
  12627. /** Destructor only decrements s_num_instances. */
  12628. FZ_FUNCTION ~PdfHintShared();
  12629. #else
  12630. /** We use default destructor. */
  12631. #endif
  12632. /** Return numerical value of .m_internal; helps with Python debugging. */
  12633. FZ_FUNCTION long long m_internal_value();
  12634. /** Return true iff `m_internal` is not null. */
  12635. FZ_FUNCTION operator bool();
  12636. /* == Member data. */
  12637. /** Pointer to wrapped data. */
  12638. ::pdf_hint_shared* m_internal;
  12639. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12640. generate code regardless so we always need to have this available. */
  12641. FZ_DATA static int s_num_instances;
  12642. private:
  12643. /** This class is not copyable or assignable. */
  12644. PdfHintShared(const PdfHintShared& rhs);
  12645. PdfHintShared& operator=(const PdfHintShared& rhs);
  12646. };
  12647. /** Wrapper class for struct `pdf_hmtx`. Not copyable or assignable. */
  12648. struct PdfHmtx
  12649. {
  12650. /** Default constructor, sets `m_internal` to null. */
  12651. FZ_FUNCTION PdfHmtx();
  12652. /** Constructor using raw copy of pre-existing `::pdf_hmtx`. */
  12653. FZ_FUNCTION PdfHmtx(::pdf_hmtx* internal);
  12654. #ifndef NDEBUG
  12655. /** Destructor only decrements s_num_instances. */
  12656. FZ_FUNCTION ~PdfHmtx();
  12657. #else
  12658. /** We use default destructor. */
  12659. #endif
  12660. /** Return numerical value of .m_internal; helps with Python debugging. */
  12661. FZ_FUNCTION long long m_internal_value();
  12662. /** Return true iff `m_internal` is not null. */
  12663. FZ_FUNCTION operator bool();
  12664. /* == Member data. */
  12665. /** Pointer to wrapped data. */
  12666. ::pdf_hmtx* m_internal;
  12667. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12668. generate code regardless so we always need to have this available. */
  12669. FZ_DATA static int s_num_instances;
  12670. private:
  12671. /** This class is not copyable or assignable. */
  12672. PdfHmtx(const PdfHmtx& rhs);
  12673. PdfHmtx& operator=(const PdfHmtx& rhs);
  12674. };
  12675. /** Wrapper class for struct `pdf_image_rewriter_options`. */
  12676. struct PdfImageRewriterOptions
  12677. {
  12678. /** We use default copy constructor and operator=. */
  12679. /** Default constructor, sets each member to default value. */
  12680. FZ_FUNCTION PdfImageRewriterOptions();
  12681. /** Constructor using raw copy of pre-existing `::pdf_image_rewriter_options`. */
  12682. FZ_FUNCTION PdfImageRewriterOptions(const ::pdf_image_rewriter_options* internal);
  12683. /** Constructor using raw copy of pre-existing `::pdf_image_rewriter_options`. */
  12684. FZ_FUNCTION PdfImageRewriterOptions(const ::pdf_image_rewriter_options internal);
  12685. /** Access as underlying struct. */
  12686. FZ_FUNCTION ::pdf_image_rewriter_options* internal();
  12687. /** Access as underlying struct. */
  12688. FZ_FUNCTION const ::pdf_image_rewriter_options* internal() const;
  12689. #ifndef NDEBUG
  12690. /** Destructor only decrements s_num_instances. */
  12691. FZ_FUNCTION ~PdfImageRewriterOptions();
  12692. #else
  12693. /** We use default destructor. */
  12694. #endif
  12695. /* == Member data. */
  12696. /* These members are the same as the members of ::pdf_image_rewriter_options. */
  12697. int color_lossless_image_subsample_method;
  12698. int color_lossy_image_subsample_method;
  12699. int color_lossless_image_subsample_threshold;
  12700. int color_lossless_image_subsample_to;
  12701. int color_lossy_image_subsample_threshold;
  12702. int color_lossy_image_subsample_to;
  12703. int color_lossless_image_recompress_method;
  12704. int color_lossy_image_recompress_method;
  12705. char *color_lossy_image_recompress_quality;
  12706. char *color_lossless_image_recompress_quality;
  12707. int gray_lossless_image_subsample_method;
  12708. int gray_lossy_image_subsample_method;
  12709. int gray_lossless_image_subsample_threshold;
  12710. int gray_lossless_image_subsample_to;
  12711. int gray_lossy_image_subsample_threshold;
  12712. int gray_lossy_image_subsample_to;
  12713. int gray_lossless_image_recompress_method;
  12714. int gray_lossy_image_recompress_method;
  12715. char *gray_lossy_image_recompress_quality;
  12716. char *gray_lossless_image_recompress_quality;
  12717. int bitonal_image_subsample_method;
  12718. int bitonal_image_subsample_threshold;
  12719. int bitonal_image_subsample_to;
  12720. int bitonal_image_recompress_method;
  12721. char *bitonal_image_recompress_quality;
  12722. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12723. generate code regardless so we always need to have this available. */
  12724. FZ_DATA static int s_num_instances;
  12725. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  12726. FZ_FUNCTION std::string to_string();
  12727. /** Comparison method. */
  12728. FZ_FUNCTION bool operator==(const PdfImageRewriterOptions& rhs);
  12729. /** Comparison method. */
  12730. FZ_FUNCTION bool operator!=(const PdfImageRewriterOptions& rhs);
  12731. };
  12732. /** Wrapper class for struct `pdf_journal`. Not copyable or assignable. */
  12733. struct PdfJournal
  12734. {
  12735. /** Default constructor, sets `m_internal` to null. */
  12736. FZ_FUNCTION PdfJournal();
  12737. /* == Methods. */
  12738. /** Class-aware wrapper for `::pdf_discard_journal()`. */
  12739. FZ_FUNCTION void pdf_discard_journal() const;
  12740. /** Constructor using raw copy of pre-existing `::pdf_journal`. */
  12741. FZ_FUNCTION PdfJournal(::pdf_journal* internal);
  12742. /** Destructor using pdf_drop_journal(). */
  12743. FZ_FUNCTION ~PdfJournal();
  12744. /** Return numerical value of .m_internal; helps with Python debugging. */
  12745. FZ_FUNCTION long long m_internal_value();
  12746. /** Return true iff `m_internal` is not null. */
  12747. FZ_FUNCTION operator bool();
  12748. /* == Member data. */
  12749. /** Pointer to wrapped data. */
  12750. ::pdf_journal* m_internal;
  12751. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12752. generate code regardless so we always need to have this available. */
  12753. FZ_DATA static int s_num_instances;
  12754. private:
  12755. /** This class is not copyable or assignable. */
  12756. PdfJournal(const PdfJournal& rhs);
  12757. PdfJournal& operator=(const PdfJournal& rhs);
  12758. };
  12759. /** Wrapper class for struct `pdf_js`. Not copyable or assignable. */
  12760. struct PdfJs
  12761. {
  12762. /** Default constructor, sets `m_internal` to null. */
  12763. FZ_FUNCTION PdfJs();
  12764. /* == Methods. */
  12765. /** Class-aware wrapper for `::pdf_js_event_init()`. */
  12766. FZ_FUNCTION void pdf_js_event_init(const PdfObj& target, const char *value, int willCommit) const;
  12767. /** Class-aware wrapper for `::pdf_js_event_init_keystroke()`. */
  12768. FZ_FUNCTION void pdf_js_event_init_keystroke(const PdfObj& target, const PdfKeystrokeEvent& evt) const;
  12769. /** Class-aware wrapper for `::pdf_js_event_result()`. */
  12770. FZ_FUNCTION int pdf_js_event_result() const;
  12771. /** Class-aware wrapper for `::pdf_js_event_result_keystroke()`. */
  12772. FZ_FUNCTION int pdf_js_event_result_keystroke(const PdfKeystrokeEvent& evt) const;
  12773. /** Class-aware wrapper for `::pdf_js_event_result_validate()`.
  12774. This method has out-params. Python/C# wrappers look like:
  12775. `pdf_js_event_result_validate()` => `(int, char *newvalue)`
  12776. */
  12777. FZ_FUNCTION int pdf_js_event_result_validate(char **newvalue) const;
  12778. /** Class-aware wrapper for `::pdf_js_event_value()`. */
  12779. FZ_FUNCTION char *pdf_js_event_value() const;
  12780. /** Class-aware wrapper for `::pdf_js_execute()`.
  12781. This method has out-params. Python/C# wrappers look like:
  12782. `pdf_js_execute(const char *name, const char *code)` => char *result
  12783. */
  12784. FZ_FUNCTION void pdf_js_execute(const char *name, const char *code, char **result) const;
  12785. /** Constructor using raw copy of pre-existing `::pdf_js`. */
  12786. FZ_FUNCTION PdfJs(::pdf_js* internal);
  12787. /** Destructor using pdf_drop_js(). */
  12788. FZ_FUNCTION ~PdfJs();
  12789. /** Return numerical value of .m_internal; helps with Python debugging. */
  12790. FZ_FUNCTION long long m_internal_value();
  12791. /** Return true iff `m_internal` is not null. */
  12792. FZ_FUNCTION operator bool();
  12793. /* == Member data. */
  12794. /** Pointer to wrapped data. */
  12795. ::pdf_js* m_internal;
  12796. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12797. generate code regardless so we always need to have this available. */
  12798. FZ_DATA static int s_num_instances;
  12799. private:
  12800. /** This class is not copyable or assignable. */
  12801. PdfJs(const PdfJs& rhs);
  12802. PdfJs& operator=(const PdfJs& rhs);
  12803. };
  12804. /** Wrapper class for struct `pdf_js_console`. Not copyable or assignable. */
  12805. struct PdfJsConsole
  12806. {
  12807. /** Default constructor, sets `m_internal` to null. */
  12808. FZ_FUNCTION PdfJsConsole();
  12809. /** Constructor using raw copy of pre-existing `::pdf_js_console`. */
  12810. FZ_FUNCTION PdfJsConsole(::pdf_js_console* internal);
  12811. #ifndef NDEBUG
  12812. /** Destructor only decrements s_num_instances. */
  12813. FZ_FUNCTION ~PdfJsConsole();
  12814. #else
  12815. /** We use default destructor. */
  12816. #endif
  12817. /** Return numerical value of .m_internal; helps with Python debugging. */
  12818. FZ_FUNCTION long long m_internal_value();
  12819. /** Return true iff `m_internal` is not null. */
  12820. FZ_FUNCTION operator bool();
  12821. /* == Member data. */
  12822. /** Pointer to wrapped data. */
  12823. ::pdf_js_console* m_internal;
  12824. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12825. generate code regardless so we always need to have this available. */
  12826. FZ_DATA static int s_num_instances;
  12827. private:
  12828. /** This class is not copyable or assignable. */
  12829. PdfJsConsole(const PdfJsConsole& rhs);
  12830. PdfJsConsole& operator=(const PdfJsConsole& rhs);
  12831. };
  12832. /** Wrapper class for struct `pdf_keystroke_event`. Not copyable or assignable. */
  12833. struct PdfKeystrokeEvent
  12834. {
  12835. /** Default constructor, sets `m_internal` to null. */
  12836. FZ_FUNCTION PdfKeystrokeEvent();
  12837. /** Constructor using raw copy of pre-existing `::pdf_keystroke_event`. */
  12838. FZ_FUNCTION PdfKeystrokeEvent(::pdf_keystroke_event* internal);
  12839. #ifndef NDEBUG
  12840. /** Destructor only decrements s_num_instances. */
  12841. FZ_FUNCTION ~PdfKeystrokeEvent();
  12842. #else
  12843. /** We use default destructor. */
  12844. #endif
  12845. /** Return numerical value of .m_internal; helps with Python debugging. */
  12846. FZ_FUNCTION long long m_internal_value();
  12847. /** Return true iff `m_internal` is not null. */
  12848. FZ_FUNCTION operator bool();
  12849. /* == Member data. */
  12850. /** Pointer to wrapped data. */
  12851. ::pdf_keystroke_event* m_internal;
  12852. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12853. generate code regardless so we always need to have this available. */
  12854. FZ_DATA static int s_num_instances;
  12855. private:
  12856. /** This class is not copyable or assignable. */
  12857. PdfKeystrokeEvent(const PdfKeystrokeEvent& rhs);
  12858. PdfKeystrokeEvent& operator=(const PdfKeystrokeEvent& rhs);
  12859. };
  12860. /** Wrapper class for struct `pdf_launch_url_event`. Not copyable or assignable. */
  12861. struct PdfLaunchUrlEvent
  12862. {
  12863. /** Default constructor, sets `m_internal` to null. */
  12864. FZ_FUNCTION PdfLaunchUrlEvent();
  12865. /** Constructor using raw copy of pre-existing `::pdf_launch_url_event`. */
  12866. FZ_FUNCTION PdfLaunchUrlEvent(::pdf_launch_url_event* internal);
  12867. #ifndef NDEBUG
  12868. /** Destructor only decrements s_num_instances. */
  12869. FZ_FUNCTION ~PdfLaunchUrlEvent();
  12870. #else
  12871. /** We use default destructor. */
  12872. #endif
  12873. /** Return numerical value of .m_internal; helps with Python debugging. */
  12874. FZ_FUNCTION long long m_internal_value();
  12875. /** Return true iff `m_internal` is not null. */
  12876. FZ_FUNCTION operator bool();
  12877. /* == Member data. */
  12878. /** Pointer to wrapped data. */
  12879. ::pdf_launch_url_event* m_internal;
  12880. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12881. generate code regardless so we always need to have this available. */
  12882. FZ_DATA static int s_num_instances;
  12883. private:
  12884. /** This class is not copyable or assignable. */
  12885. PdfLaunchUrlEvent(const PdfLaunchUrlEvent& rhs);
  12886. PdfLaunchUrlEvent& operator=(const PdfLaunchUrlEvent& rhs);
  12887. };
  12888. /** Wrapper class for struct `pdf_layer_config`. */
  12889. struct PdfLayerConfig
  12890. {
  12891. /** We use default copy constructor and operator=. */
  12892. /** Default constructor, sets each member to default value. */
  12893. FZ_FUNCTION PdfLayerConfig();
  12894. /** Constructor using raw copy of pre-existing `::pdf_layer_config`. */
  12895. FZ_FUNCTION PdfLayerConfig(const ::pdf_layer_config* internal);
  12896. /** Constructor using raw copy of pre-existing `::pdf_layer_config`. */
  12897. FZ_FUNCTION PdfLayerConfig(const ::pdf_layer_config internal);
  12898. /** Access as underlying struct. */
  12899. FZ_FUNCTION ::pdf_layer_config* internal();
  12900. /** Access as underlying struct. */
  12901. FZ_FUNCTION const ::pdf_layer_config* internal() const;
  12902. #ifndef NDEBUG
  12903. /** Destructor only decrements s_num_instances. */
  12904. FZ_FUNCTION ~PdfLayerConfig();
  12905. #else
  12906. /** We use default destructor. */
  12907. #endif
  12908. /* == Member data. */
  12909. /* These members are the same as the members of ::pdf_layer_config. */
  12910. const char *name;
  12911. const char *creator;
  12912. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12913. generate code regardless so we always need to have this available. */
  12914. FZ_DATA static int s_num_instances;
  12915. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  12916. FZ_FUNCTION std::string to_string();
  12917. /** Comparison method. */
  12918. FZ_FUNCTION bool operator==(const PdfLayerConfig& rhs);
  12919. /** Comparison method. */
  12920. FZ_FUNCTION bool operator!=(const PdfLayerConfig& rhs);
  12921. };
  12922. /** Wrapper class for struct `pdf_layer_config_ui`. */
  12923. struct PdfLayerConfigUi
  12924. {
  12925. /** Default constructor sets .text to null, .type to PDF_LAYER_UI_LABEL, and other fields to zero. */
  12926. FZ_FUNCTION PdfLayerConfigUi();
  12927. /** We use default copy constructor and operator=. */
  12928. /** Constructor using raw copy of pre-existing `::pdf_layer_config_ui`. */
  12929. FZ_FUNCTION PdfLayerConfigUi(const ::pdf_layer_config_ui* internal);
  12930. /** Constructor using raw copy of pre-existing `::pdf_layer_config_ui`. */
  12931. FZ_FUNCTION PdfLayerConfigUi(const ::pdf_layer_config_ui internal);
  12932. /** Access as underlying struct. */
  12933. FZ_FUNCTION ::pdf_layer_config_ui* internal();
  12934. /** Access as underlying struct. */
  12935. FZ_FUNCTION const ::pdf_layer_config_ui* internal() const;
  12936. #ifndef NDEBUG
  12937. /** Destructor only decrements s_num_instances. */
  12938. FZ_FUNCTION ~PdfLayerConfigUi();
  12939. #else
  12940. /** We use default destructor. */
  12941. #endif
  12942. /* == Member data. */
  12943. /* These members are the same as the members of ::pdf_layer_config_ui. */
  12944. const char *text;
  12945. int depth;
  12946. ::pdf_layer_config_ui_type type;
  12947. int selected;
  12948. int locked;
  12949. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12950. generate code regardless so we always need to have this available. */
  12951. FZ_DATA static int s_num_instances;
  12952. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  12953. FZ_FUNCTION std::string to_string();
  12954. /** Comparison method. */
  12955. FZ_FUNCTION bool operator==(const PdfLayerConfigUi& rhs);
  12956. /** Comparison method. */
  12957. FZ_FUNCTION bool operator!=(const PdfLayerConfigUi& rhs);
  12958. };
  12959. /** Wrapper class for struct `pdf_lexbuf`. Not copyable or assignable. */
  12960. struct PdfLexbuf
  12961. {
  12962. /** Constructor that calls pdf_lexbuf_init(size). */
  12963. FZ_FUNCTION PdfLexbuf(int size);
  12964. /** Default constructor, sets `m_internal` to null. */
  12965. FZ_FUNCTION PdfLexbuf();
  12966. /* == Methods. */
  12967. /** Class-aware wrapper for `::pdf_lexbuf_fin()`. */
  12968. FZ_FUNCTION void pdf_lexbuf_fin() const;
  12969. /** Class-aware wrapper for `::pdf_lexbuf_grow()`. */
  12970. FZ_FUNCTION ptrdiff_t pdf_lexbuf_grow() const;
  12971. /** Class-aware wrapper for `::pdf_lexbuf_init()`. */
  12972. FZ_FUNCTION void pdf_lexbuf_init(int size) const;
  12973. /** Destructor that calls pdf_lexbuf_fin(). */
  12974. FZ_FUNCTION ~PdfLexbuf();
  12975. /** Constructor using raw copy of pre-existing `::pdf_lexbuf`. */
  12976. FZ_FUNCTION PdfLexbuf(::pdf_lexbuf* internal);
  12977. /** Return numerical value of .m_internal; helps with Python debugging. */
  12978. FZ_FUNCTION long long m_internal_value();
  12979. /** Return true iff `m_internal` is not null. */
  12980. FZ_FUNCTION operator bool();
  12981. /* == Member data. */
  12982. /** Pointer to wrapped data. */
  12983. ::pdf_lexbuf* m_internal;
  12984. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  12985. generate code regardless so we always need to have this available. */
  12986. FZ_DATA static int s_num_instances;
  12987. private:
  12988. /** This class is not copyable or assignable. */
  12989. PdfLexbuf(const PdfLexbuf& rhs);
  12990. PdfLexbuf& operator=(const PdfLexbuf& rhs);
  12991. };
  12992. /** Wrapper class for struct `pdf_lexbuf_large`. Not copyable or assignable. */
  12993. struct PdfLexbufLarge
  12994. {
  12995. /** Default constructor, sets `m_internal` to null. */
  12996. FZ_FUNCTION PdfLexbufLarge();
  12997. /** Constructor using raw copy of pre-existing `::pdf_lexbuf_large`. */
  12998. FZ_FUNCTION PdfLexbufLarge(::pdf_lexbuf_large* internal);
  12999. #ifndef NDEBUG
  13000. /** Destructor only decrements s_num_instances. */
  13001. FZ_FUNCTION ~PdfLexbufLarge();
  13002. #else
  13003. /** We use default destructor. */
  13004. #endif
  13005. /** Return numerical value of .m_internal; helps with Python debugging. */
  13006. FZ_FUNCTION long long m_internal_value();
  13007. /** Return true iff `m_internal` is not null. */
  13008. FZ_FUNCTION operator bool();
  13009. /* == Member data. */
  13010. /** Pointer to wrapped data. */
  13011. ::pdf_lexbuf_large* m_internal;
  13012. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13013. generate code regardless so we always need to have this available. */
  13014. FZ_DATA static int s_num_instances;
  13015. private:
  13016. /** This class is not copyable or assignable. */
  13017. PdfLexbufLarge(const PdfLexbufLarge& rhs);
  13018. PdfLexbufLarge& operator=(const PdfLexbufLarge& rhs);
  13019. };
  13020. /** Wrapper class for struct `pdf_locked_fields`. Not copyable or assignable. */
  13021. struct PdfLockedFields
  13022. {
  13023. /** Default constructor, sets `m_internal` to null. */
  13024. FZ_FUNCTION PdfLockedFields();
  13025. /* == Methods. */
  13026. /** Class-aware wrapper for `::pdf_is_field_locked()`. */
  13027. FZ_FUNCTION int pdf_is_field_locked(const char *name) const;
  13028. /** Constructor using raw copy of pre-existing `::pdf_locked_fields`. */
  13029. FZ_FUNCTION PdfLockedFields(::pdf_locked_fields* internal);
  13030. /** Destructor using pdf_drop_locked_fields(). */
  13031. FZ_FUNCTION ~PdfLockedFields();
  13032. /** Return numerical value of .m_internal; helps with Python debugging. */
  13033. FZ_FUNCTION long long m_internal_value();
  13034. /** Return true iff `m_internal` is not null. */
  13035. FZ_FUNCTION operator bool();
  13036. /* == Member data. */
  13037. /** Pointer to wrapped data. */
  13038. ::pdf_locked_fields* m_internal;
  13039. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13040. generate code regardless so we always need to have this available. */
  13041. FZ_DATA static int s_num_instances;
  13042. private:
  13043. /** This class is not copyable or assignable. */
  13044. PdfLockedFields(const PdfLockedFields& rhs);
  13045. PdfLockedFields& operator=(const PdfLockedFields& rhs);
  13046. };
  13047. /** Wrapper class for struct `pdf_mail_doc_event`. Not copyable or assignable. */
  13048. struct PdfMailDocEvent
  13049. {
  13050. /** Default constructor, sets `m_internal` to null. */
  13051. FZ_FUNCTION PdfMailDocEvent();
  13052. /** Constructor using raw copy of pre-existing `::pdf_mail_doc_event`. */
  13053. FZ_FUNCTION PdfMailDocEvent(::pdf_mail_doc_event* internal);
  13054. #ifndef NDEBUG
  13055. /** Destructor only decrements s_num_instances. */
  13056. FZ_FUNCTION ~PdfMailDocEvent();
  13057. #else
  13058. /** We use default destructor. */
  13059. #endif
  13060. /** Return numerical value of .m_internal; helps with Python debugging. */
  13061. FZ_FUNCTION long long m_internal_value();
  13062. /** Return true iff `m_internal` is not null. */
  13063. FZ_FUNCTION operator bool();
  13064. /* == Member data. */
  13065. /** Pointer to wrapped data. */
  13066. ::pdf_mail_doc_event* m_internal;
  13067. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13068. generate code regardless so we always need to have this available. */
  13069. FZ_DATA static int s_num_instances;
  13070. private:
  13071. /** This class is not copyable or assignable. */
  13072. PdfMailDocEvent(const PdfMailDocEvent& rhs);
  13073. PdfMailDocEvent& operator=(const PdfMailDocEvent& rhs);
  13074. };
  13075. /** Wrapper class for struct `pdf_mark_bits`. Not copyable or assignable. */
  13076. struct PdfMarkBits
  13077. {
  13078. /** == Constructors. */
  13079. /** Constructor using `pdf_new_mark_bits()`. */
  13080. FZ_FUNCTION PdfMarkBits(const PdfDocument& doc);
  13081. /** Default constructor, sets `m_internal` to null. */
  13082. FZ_FUNCTION PdfMarkBits();
  13083. /* == Methods. */
  13084. /** Class-aware wrapper for `::pdf_mark_bits_reset()`. */
  13085. FZ_FUNCTION void pdf_mark_bits_reset() const;
  13086. /** Class-aware wrapper for `::pdf_mark_bits_set()`. */
  13087. FZ_FUNCTION int pdf_mark_bits_set(const PdfObj& obj) const;
  13088. /** Constructor using raw copy of pre-existing `::pdf_mark_bits`. */
  13089. FZ_FUNCTION PdfMarkBits(::pdf_mark_bits* internal);
  13090. /** Destructor using pdf_drop_mark_bits(). */
  13091. FZ_FUNCTION ~PdfMarkBits();
  13092. /** Return numerical value of .m_internal; helps with Python debugging. */
  13093. FZ_FUNCTION long long m_internal_value();
  13094. /** Return true iff `m_internal` is not null. */
  13095. FZ_FUNCTION operator bool();
  13096. /* == Member data. */
  13097. /** Pointer to wrapped data. */
  13098. ::pdf_mark_bits* m_internal;
  13099. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13100. generate code regardless so we always need to have this available. */
  13101. FZ_DATA static int s_num_instances;
  13102. private:
  13103. /** This class is not copyable or assignable. */
  13104. PdfMarkBits(const PdfMarkBits& rhs);
  13105. PdfMarkBits& operator=(const PdfMarkBits& rhs);
  13106. };
  13107. /** Wrapper class for struct `pdf_mark_list`. Not copyable or assignable. */
  13108. struct PdfMarkList
  13109. {
  13110. /** Default constructor, sets `m_internal` to null. */
  13111. FZ_FUNCTION PdfMarkList();
  13112. /* == Methods. */
  13113. /** Class-aware wrapper for `::pdf_mark_list_check()`. */
  13114. FZ_FUNCTION int pdf_mark_list_check(const PdfObj& obj) const;
  13115. /** Class-aware wrapper for `::pdf_mark_list_free()`. */
  13116. FZ_FUNCTION void pdf_mark_list_free() const;
  13117. /** Class-aware wrapper for `::pdf_mark_list_init()`. */
  13118. FZ_FUNCTION void pdf_mark_list_init() const;
  13119. /** Class-aware wrapper for `::pdf_mark_list_pop()`. */
  13120. FZ_FUNCTION void pdf_mark_list_pop() const;
  13121. /** Class-aware wrapper for `::pdf_mark_list_push()`. */
  13122. FZ_FUNCTION int pdf_mark_list_push(const PdfObj& obj) const;
  13123. /** Constructor using raw copy of pre-existing `::pdf_mark_list`. */
  13124. FZ_FUNCTION PdfMarkList(::pdf_mark_list* internal);
  13125. #ifndef NDEBUG
  13126. /** Destructor only decrements s_num_instances. */
  13127. FZ_FUNCTION ~PdfMarkList();
  13128. #else
  13129. /** We use default destructor. */
  13130. #endif
  13131. /** Return numerical value of .m_internal; helps with Python debugging. */
  13132. FZ_FUNCTION long long m_internal_value();
  13133. /** Return true iff `m_internal` is not null. */
  13134. FZ_FUNCTION operator bool();
  13135. /* == Member data. */
  13136. /** Pointer to wrapped data. */
  13137. ::pdf_mark_list* m_internal;
  13138. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13139. generate code regardless so we always need to have this available. */
  13140. FZ_DATA static int s_num_instances;
  13141. private:
  13142. /** This class is not copyable or assignable. */
  13143. PdfMarkList(const PdfMarkList& rhs);
  13144. PdfMarkList& operator=(const PdfMarkList& rhs);
  13145. };
  13146. /** Wrapper class for struct `pdf_mrange`. Not copyable or assignable. */
  13147. struct PdfMrange
  13148. {
  13149. /** Default constructor, sets `m_internal` to null. */
  13150. FZ_FUNCTION PdfMrange();
  13151. /** Constructor using raw copy of pre-existing `::pdf_mrange`. */
  13152. FZ_FUNCTION PdfMrange(::pdf_mrange* internal);
  13153. #ifndef NDEBUG
  13154. /** Destructor only decrements s_num_instances. */
  13155. FZ_FUNCTION ~PdfMrange();
  13156. #else
  13157. /** We use default destructor. */
  13158. #endif
  13159. /** Return numerical value of .m_internal; helps with Python debugging. */
  13160. FZ_FUNCTION long long m_internal_value();
  13161. /** Return true iff `m_internal` is not null. */
  13162. FZ_FUNCTION operator bool();
  13163. /* == Member data. */
  13164. /** Pointer to wrapped data. */
  13165. ::pdf_mrange* m_internal;
  13166. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13167. generate code regardless so we always need to have this available. */
  13168. FZ_DATA static int s_num_instances;
  13169. private:
  13170. /** This class is not copyable or assignable. */
  13171. PdfMrange(const PdfMrange& rhs);
  13172. PdfMrange& operator=(const PdfMrange& rhs);
  13173. };
  13174. /** Wrapper class for struct `pdf_obj`. */
  13175. struct PdfObj
  13176. {
  13177. /** == Constructors. */
  13178. /** Constructor using `pdf_new_action_from_link()`. */
  13179. FZ_FUNCTION PdfObj(const PdfDocument& doc, const char *uri);
  13180. /** Constructor using `pdf_new_array()`. */
  13181. FZ_FUNCTION PdfObj(const PdfDocument& doc, int initialcap);
  13182. /** Constructor using `pdf_new_date()`. */
  13183. FZ_FUNCTION PdfObj(const PdfDocument& doc, int64_t time);
  13184. /** Constructor using `pdf_new_dest_from_link()`. */
  13185. FZ_FUNCTION PdfObj(const PdfDocument& doc, const char *uri, int is_remote);
  13186. /** Constructor using `pdf_new_indirect()`. */
  13187. FZ_FUNCTION PdfObj(const PdfDocument& doc, int num, int gen);
  13188. /** Constructor using `pdf_new_int()`. */
  13189. FZ_FUNCTION PdfObj(int64_t i);
  13190. /** Constructor using `pdf_new_matrix()`. */
  13191. FZ_FUNCTION PdfObj(const PdfDocument& doc, const FzMatrix& mtx);
  13192. /** Constructor using `pdf_new_name()`. */
  13193. FZ_FUNCTION PdfObj(const char *str);
  13194. /** Constructor using `pdf_new_point()`. */
  13195. FZ_FUNCTION PdfObj(const PdfDocument& doc, const FzPoint& point);
  13196. /** Constructor using `pdf_new_real()`. */
  13197. FZ_FUNCTION PdfObj(float f);
  13198. /** Constructor using `pdf_new_rect()`. */
  13199. FZ_FUNCTION PdfObj(const PdfDocument& doc, const FzRect& rect);
  13200. /** Constructor using `pdf_new_string()`. */
  13201. FZ_FUNCTION PdfObj(const char *str, size_t len);
  13202. /** Constructor using `pdf_new_xobject()`. */
  13203. FZ_FUNCTION PdfObj(const PdfDocument& doc, const FzRect& bbox, const FzMatrix& matrix, const PdfObj& res, const FzBuffer& buffer);
  13204. /** Copy constructor using `pdf_keep_obj()`. */
  13205. FZ_FUNCTION PdfObj(const PdfObj& rhs);
  13206. /** operator= using `pdf_keep_obj()` and `pdf_drop_obj()`. */
  13207. FZ_FUNCTION PdfObj& operator=(const PdfObj& rhs);
  13208. /* == Static methods. */
  13209. /** Class-aware wrapper for `::pdf_new_text_string()`. */
  13210. FZ_FUNCTION static PdfObj pdf_new_text_string(const char *s);
  13211. /** Class-aware wrapper for `::pdf_new_dict()`. */
  13212. FZ_FUNCTION static PdfObj pdf_new_dict(const PdfDocument& doc, int initialcap);
  13213. /* == Methods. */
  13214. /** Class-aware wrapper for `::pdf_array_contains()`. */
  13215. FZ_FUNCTION int pdf_array_contains(const PdfObj& obj) const;
  13216. /** Class-aware wrapper for `::pdf_array_delete()`. */
  13217. FZ_FUNCTION void pdf_array_delete(int index) const;
  13218. /** Class-aware wrapper for `::pdf_array_find()`. */
  13219. FZ_FUNCTION int pdf_array_find(const PdfObj& obj) const;
  13220. /** Class-aware wrapper for `::pdf_array_get()`. */
  13221. FZ_FUNCTION PdfObj pdf_array_get(int i) const;
  13222. /** Class-aware wrapper for `::pdf_array_get_bool()`. */
  13223. FZ_FUNCTION int pdf_array_get_bool(int index) const;
  13224. /** Class-aware wrapper for `::pdf_array_get_int()`. */
  13225. FZ_FUNCTION int pdf_array_get_int(int index) const;
  13226. /** Class-aware wrapper for `::pdf_array_get_matrix()`. */
  13227. FZ_FUNCTION FzMatrix pdf_array_get_matrix(int index) const;
  13228. /** Class-aware wrapper for `::pdf_array_get_name()`. */
  13229. FZ_FUNCTION const char *pdf_array_get_name(int index) const;
  13230. /** Class-aware wrapper for `::pdf_array_get_real()`. */
  13231. FZ_FUNCTION float pdf_array_get_real(int index) const;
  13232. /** Class-aware wrapper for `::pdf_array_get_rect()`. */
  13233. FZ_FUNCTION FzRect pdf_array_get_rect(int index) const;
  13234. /** Class-aware wrapper for `::pdf_array_get_string()`.
  13235. This method has out-params. Python/C# wrappers look like:
  13236. `pdf_array_get_string(int index)` => `(const char *, size_t sizep)`
  13237. */
  13238. FZ_FUNCTION const char *pdf_array_get_string(int index, size_t *sizep) const;
  13239. /** Class-aware wrapper for `::pdf_array_get_text_string()`. */
  13240. FZ_FUNCTION const char *pdf_array_get_text_string(int index) const;
  13241. /** Class-aware wrapper for `::pdf_array_insert()`. */
  13242. FZ_FUNCTION void pdf_array_insert(const PdfObj& obj, int index) const;
  13243. /** Class-aware wrapper for `::pdf_array_len()`. */
  13244. FZ_FUNCTION int pdf_array_len() const;
  13245. /** Class-aware wrapper for `::pdf_array_push()`. */
  13246. FZ_FUNCTION void pdf_array_push(const PdfObj& obj) const;
  13247. /** Class-aware wrapper for `::pdf_array_push_array()`. */
  13248. FZ_FUNCTION PdfObj pdf_array_push_array(int initial) const;
  13249. /** Class-aware wrapper for `::pdf_array_push_bool()`. */
  13250. FZ_FUNCTION void pdf_array_push_bool(int x) const;
  13251. /** Class-aware wrapper for `::pdf_array_push_dict()`. */
  13252. FZ_FUNCTION PdfObj pdf_array_push_dict(int initial) const;
  13253. /** Class-aware wrapper for `::pdf_array_push_int()`. */
  13254. FZ_FUNCTION void pdf_array_push_int(int64_t x) const;
  13255. /** Class-aware wrapper for `::pdf_array_push_name()`. */
  13256. FZ_FUNCTION void pdf_array_push_name(const char *x) const;
  13257. /** Class-aware wrapper for `::pdf_array_push_real()`. */
  13258. FZ_FUNCTION void pdf_array_push_real(double x) const;
  13259. /** Class-aware wrapper for `::pdf_array_push_string()`. */
  13260. FZ_FUNCTION void pdf_array_push_string(const char *x, size_t n) const;
  13261. /** Class-aware wrapper for `::pdf_array_push_text_string()`. */
  13262. FZ_FUNCTION void pdf_array_push_text_string(const char *x) const;
  13263. /** Class-aware wrapper for `::pdf_array_put()`. */
  13264. FZ_FUNCTION void pdf_array_put(int i, const PdfObj& obj) const;
  13265. /** Class-aware wrapper for `::pdf_array_put_array()`. */
  13266. FZ_FUNCTION PdfObj pdf_array_put_array(int i, int initial) const;
  13267. /** Class-aware wrapper for `::pdf_array_put_bool()`. */
  13268. FZ_FUNCTION void pdf_array_put_bool(int i, int x) const;
  13269. /** Class-aware wrapper for `::pdf_array_put_dict()`. */
  13270. FZ_FUNCTION PdfObj pdf_array_put_dict(int i, int initial) const;
  13271. /** Class-aware wrapper for `::pdf_array_put_int()`. */
  13272. FZ_FUNCTION void pdf_array_put_int(int i, int64_t x) const;
  13273. /** Class-aware wrapper for `::pdf_array_put_name()`. */
  13274. FZ_FUNCTION void pdf_array_put_name(int i, const char *x) const;
  13275. /** Class-aware wrapper for `::pdf_array_put_real()`. */
  13276. FZ_FUNCTION void pdf_array_put_real(int i, double x) const;
  13277. /** Class-aware wrapper for `::pdf_array_put_string()`. */
  13278. FZ_FUNCTION void pdf_array_put_string(int i, const char *x, size_t n) const;
  13279. /** Class-aware wrapper for `::pdf_array_put_text_string()`. */
  13280. FZ_FUNCTION void pdf_array_put_text_string(int i, const char *x) const;
  13281. /** Class-aware wrapper for `::pdf_button_field_on_state()`. */
  13282. FZ_FUNCTION PdfObj pdf_button_field_on_state() const;
  13283. /** Class-aware wrapper for `::pdf_choice_field_option()`. */
  13284. FZ_FUNCTION const char *pdf_choice_field_option(int exportval, int i) const;
  13285. /** Class-aware wrapper for `::pdf_choice_field_option_count()`. */
  13286. FZ_FUNCTION int pdf_choice_field_option_count() const;
  13287. /** Class-aware wrapper for `::pdf_clean_obj()`. */
  13288. FZ_FUNCTION void pdf_clean_obj() const;
  13289. /** Class-aware wrapper for `::pdf_copy_array()`. */
  13290. FZ_FUNCTION PdfObj pdf_copy_array() const;
  13291. /** Class-aware wrapper for `::pdf_copy_dict()`. */
  13292. FZ_FUNCTION PdfObj pdf_copy_dict() const;
  13293. /** Class-aware wrapper for `::pdf_debug_obj()`. */
  13294. FZ_FUNCTION void pdf_debug_obj() const;
  13295. /** Class-aware wrapper for `::pdf_debug_ref()`. */
  13296. FZ_FUNCTION void pdf_debug_ref() const;
  13297. /** Class-aware wrapper for `::pdf_deep_copy_obj()`. */
  13298. FZ_FUNCTION PdfObj pdf_deep_copy_obj() const;
  13299. /** Class-aware wrapper for `::pdf_dict_del()`. */
  13300. FZ_FUNCTION void pdf_dict_del(const PdfObj& key) const;
  13301. /** Class-aware wrapper for `::pdf_dict_dels()`. */
  13302. FZ_FUNCTION void pdf_dict_dels(const char *key) const;
  13303. /** Class-aware wrapper for `::pdf_dict_get()`. */
  13304. FZ_FUNCTION PdfObj pdf_dict_get(const PdfObj& key) const;
  13305. /** Class-aware wrapper for `::pdf_dict_get_bool()`. */
  13306. FZ_FUNCTION int pdf_dict_get_bool(const PdfObj& key) const;
  13307. /** Class-aware wrapper for `::pdf_dict_get_bool_default()`. */
  13308. FZ_FUNCTION int pdf_dict_get_bool_default(const PdfObj& key, int def) const;
  13309. /** Class-aware wrapper for `::pdf_dict_get_date()`. */
  13310. FZ_FUNCTION int64_t pdf_dict_get_date(const PdfObj& key) const;
  13311. /** Class-aware wrapper for `::pdf_dict_get_inheritable()`. */
  13312. FZ_FUNCTION PdfObj pdf_dict_get_inheritable(const PdfObj& key) const;
  13313. /** Class-aware wrapper for `::pdf_dict_get_inheritable_bool()`. */
  13314. FZ_FUNCTION int pdf_dict_get_inheritable_bool(const PdfObj& key) const;
  13315. /** Class-aware wrapper for `::pdf_dict_get_inheritable_date()`. */
  13316. FZ_FUNCTION int64_t pdf_dict_get_inheritable_date(const PdfObj& key) const;
  13317. /** Class-aware wrapper for `::pdf_dict_get_inheritable_int()`. */
  13318. FZ_FUNCTION int pdf_dict_get_inheritable_int(const PdfObj& key) const;
  13319. /** Class-aware wrapper for `::pdf_dict_get_inheritable_int64()`. */
  13320. FZ_FUNCTION int64_t pdf_dict_get_inheritable_int64(const PdfObj& key) const;
  13321. /** Class-aware wrapper for `::pdf_dict_get_inheritable_matrix()`. */
  13322. FZ_FUNCTION FzMatrix pdf_dict_get_inheritable_matrix(const PdfObj& key) const;
  13323. /** Class-aware wrapper for `::pdf_dict_get_inheritable_name()`. */
  13324. FZ_FUNCTION const char *pdf_dict_get_inheritable_name(const PdfObj& key) const;
  13325. /** Class-aware wrapper for `::pdf_dict_get_inheritable_real()`. */
  13326. FZ_FUNCTION float pdf_dict_get_inheritable_real(const PdfObj& key) const;
  13327. /** Class-aware wrapper for `::pdf_dict_get_inheritable_rect()`. */
  13328. FZ_FUNCTION FzRect pdf_dict_get_inheritable_rect(const PdfObj& key) const;
  13329. /** Class-aware wrapper for `::pdf_dict_get_inheritable_string()`.
  13330. This method has out-params. Python/C# wrappers look like:
  13331. `pdf_dict_get_inheritable_string(::pdf_obj *key)` => `(const char *, size_t sizep)`
  13332. */
  13333. FZ_FUNCTION const char *pdf_dict_get_inheritable_string(const PdfObj& key, size_t *sizep) const;
  13334. /** Class-aware wrapper for `::pdf_dict_get_inheritable_text_string()`. */
  13335. FZ_FUNCTION const char *pdf_dict_get_inheritable_text_string(const PdfObj& key) const;
  13336. /** Class-aware wrapper for `::pdf_dict_get_int()`. */
  13337. FZ_FUNCTION int pdf_dict_get_int(const PdfObj& key) const;
  13338. /** Class-aware wrapper for `::pdf_dict_get_int64()`. */
  13339. FZ_FUNCTION int64_t pdf_dict_get_int64(const PdfObj& key) const;
  13340. /** Class-aware wrapper for `::pdf_dict_get_int_default()`. */
  13341. FZ_FUNCTION int pdf_dict_get_int_default(const PdfObj& key, int def) const;
  13342. /** Class-aware wrapper for `::pdf_dict_get_key()`. */
  13343. FZ_FUNCTION PdfObj pdf_dict_get_key(int idx) const;
  13344. /** Class-aware wrapper for `::pdf_dict_get_matrix()`. */
  13345. FZ_FUNCTION FzMatrix pdf_dict_get_matrix(const PdfObj& key) const;
  13346. /** Class-aware wrapper for `::pdf_dict_get_name()`. */
  13347. FZ_FUNCTION const char *pdf_dict_get_name(const PdfObj& key) const;
  13348. /** Class-aware wrapper for `::pdf_dict_get_point()`. */
  13349. FZ_FUNCTION FzPoint pdf_dict_get_point(const PdfObj& key) const;
  13350. /** Class-aware wrapper for `::pdf_dict_get_real()`. */
  13351. FZ_FUNCTION float pdf_dict_get_real(const PdfObj& key) const;
  13352. /** Class-aware wrapper for `::pdf_dict_get_real_default()`. */
  13353. FZ_FUNCTION float pdf_dict_get_real_default(const PdfObj& key, float def) const;
  13354. /** Class-aware wrapper for `::pdf_dict_get_rect()`. */
  13355. FZ_FUNCTION FzRect pdf_dict_get_rect(const PdfObj& key) const;
  13356. /** Class-aware wrapper for `::pdf_dict_get_string()`.
  13357. This method has out-params. Python/C# wrappers look like:
  13358. `pdf_dict_get_string(::pdf_obj *key)` => `(const char *, size_t sizep)`
  13359. */
  13360. FZ_FUNCTION const char *pdf_dict_get_string(const PdfObj& key, size_t *sizep) const;
  13361. /** Class-aware wrapper for `::pdf_dict_get_text_string()`. */
  13362. FZ_FUNCTION const char *pdf_dict_get_text_string(const PdfObj& key) const;
  13363. /** Class-aware wrapper for `::pdf_dict_get_text_string_opt()`. */
  13364. FZ_FUNCTION const char *pdf_dict_get_text_string_opt(const PdfObj& key) const;
  13365. /** Class-aware wrapper for `::pdf_dict_get_val()`. */
  13366. FZ_FUNCTION PdfObj pdf_dict_get_val(int idx) const;
  13367. /** Class-aware wrapper for `::pdf_dict_geta()`. */
  13368. FZ_FUNCTION PdfObj pdf_dict_geta(const PdfObj& key, const PdfObj& abbrev) const;
  13369. /** Class-aware wrapper for `::pdf_dict_getp()`. */
  13370. FZ_FUNCTION PdfObj pdf_dict_getp(const char *path) const;
  13371. /** Class-aware wrapper for `::pdf_dict_getp_inheritable()`. */
  13372. FZ_FUNCTION PdfObj pdf_dict_getp_inheritable(const char *path) const;
  13373. /** Class-aware wrapper for `::pdf_dict_gets()`. */
  13374. FZ_FUNCTION PdfObj pdf_dict_gets(const char *key) const;
  13375. /** Class-aware wrapper for `::pdf_dict_gets_inheritable()`. */
  13376. FZ_FUNCTION PdfObj pdf_dict_gets_inheritable(const char *key) const;
  13377. /** Class-aware wrapper for `::pdf_dict_getsa()`. */
  13378. FZ_FUNCTION PdfObj pdf_dict_getsa(const char *key, const char *abbrev) const;
  13379. /** Class-aware wrapper for `::pdf_dict_len()`. */
  13380. FZ_FUNCTION int pdf_dict_len() const;
  13381. /** Class-aware wrapper for `::pdf_dict_put()`. */
  13382. FZ_FUNCTION void pdf_dict_put(const PdfObj& key, const PdfObj& val) const;
  13383. /** Class-aware wrapper for `::pdf_dict_put_array()`. */
  13384. FZ_FUNCTION PdfObj pdf_dict_put_array(const PdfObj& key, int initial) const;
  13385. /** Class-aware wrapper for `::pdf_dict_put_bool()`. */
  13386. FZ_FUNCTION void pdf_dict_put_bool(const PdfObj& key, int x) const;
  13387. /** Class-aware wrapper for `::pdf_dict_put_date()`. */
  13388. FZ_FUNCTION void pdf_dict_put_date(const PdfObj& key, int64_t time) const;
  13389. /** Class-aware wrapper for `::pdf_dict_put_dict()`. */
  13390. FZ_FUNCTION PdfObj pdf_dict_put_dict(const PdfObj& key, int initial) const;
  13391. /** Class-aware wrapper for `::pdf_dict_put_indirect()`. */
  13392. FZ_FUNCTION void pdf_dict_put_indirect(const PdfObj& key, int num) const;
  13393. /** Class-aware wrapper for `::pdf_dict_put_int()`. */
  13394. FZ_FUNCTION void pdf_dict_put_int(const PdfObj& key, int64_t x) const;
  13395. /** Class-aware wrapper for `::pdf_dict_put_matrix()`. */
  13396. FZ_FUNCTION void pdf_dict_put_matrix(const PdfObj& key, const FzMatrix& x) const;
  13397. /** Class-aware wrapper for `::pdf_dict_put_name()`. */
  13398. FZ_FUNCTION void pdf_dict_put_name(const PdfObj& key, const char *x) const;
  13399. /** Class-aware wrapper for `::pdf_dict_put_point()`. */
  13400. FZ_FUNCTION void pdf_dict_put_point(const PdfObj& key, const FzPoint& x) const;
  13401. /** Class-aware wrapper for `::pdf_dict_put_real()`. */
  13402. FZ_FUNCTION void pdf_dict_put_real(const PdfObj& key, double x) const;
  13403. /** Class-aware wrapper for `::pdf_dict_put_rect()`. */
  13404. FZ_FUNCTION void pdf_dict_put_rect(const PdfObj& key, const FzRect& x) const;
  13405. /** Class-aware wrapper for `::pdf_dict_put_string()`. */
  13406. FZ_FUNCTION void pdf_dict_put_string(const PdfObj& key, const char *x, size_t n) const;
  13407. /** Class-aware wrapper for `::pdf_dict_put_text_string()`. */
  13408. FZ_FUNCTION void pdf_dict_put_text_string(const PdfObj& key, const char *x) const;
  13409. /** Class-aware wrapper for `::pdf_dict_put_val_null()`. */
  13410. FZ_FUNCTION void pdf_dict_put_val_null(int idx) const;
  13411. /** Class-aware wrapper for `::pdf_dict_putp()`. */
  13412. FZ_FUNCTION void pdf_dict_putp(const char *path, const PdfObj& val) const;
  13413. /** Class-aware wrapper for `::pdf_dict_puts()`. */
  13414. FZ_FUNCTION void pdf_dict_puts(const char *key, const PdfObj& val) const;
  13415. /** Class-aware wrapper for `::pdf_dict_puts_dict()`. */
  13416. FZ_FUNCTION PdfObj pdf_dict_puts_dict(const char *key, int initial) const;
  13417. /** Class-aware wrapper for `::pdf_dirty_obj()`. */
  13418. FZ_FUNCTION void pdf_dirty_obj() const;
  13419. /** Class-aware wrapper for `::pdf_field_border_style()`. */
  13420. FZ_FUNCTION char *pdf_field_border_style() const;
  13421. /** Class-aware wrapper for `::pdf_field_display()`. */
  13422. FZ_FUNCTION int pdf_field_display() const;
  13423. /** Class-aware wrapper for `::pdf_field_flags()`. */
  13424. FZ_FUNCTION int pdf_field_flags() const;
  13425. /** Class-aware wrapper for `::pdf_field_label()`. */
  13426. FZ_FUNCTION const char *pdf_field_label() const;
  13427. /** Class-aware wrapper for `::pdf_field_set_border_style()`. */
  13428. FZ_FUNCTION void pdf_field_set_border_style(const char *text) const;
  13429. /** Class-aware wrapper for `::pdf_field_set_button_caption()`. */
  13430. FZ_FUNCTION void pdf_field_set_button_caption(const char *text) const;
  13431. /** Class-aware wrapper for `::pdf_field_set_display()`. */
  13432. FZ_FUNCTION void pdf_field_set_display(int d) const;
  13433. /** Class-aware wrapper for `::pdf_field_set_fill_color()`. */
  13434. FZ_FUNCTION void pdf_field_set_fill_color(const PdfObj& col) const;
  13435. /** Class-aware wrapper for `::pdf_field_set_text_color()`. */
  13436. FZ_FUNCTION void pdf_field_set_text_color(const PdfObj& col) const;
  13437. /** Class-aware wrapper for `::pdf_field_type()`. */
  13438. FZ_FUNCTION int pdf_field_type() const;
  13439. /** Class-aware wrapper for `::pdf_field_type_string()`. */
  13440. FZ_FUNCTION const char *pdf_field_type_string() const;
  13441. /** Class-aware wrapper for `::pdf_field_value()`. */
  13442. FZ_FUNCTION const char *pdf_field_value() const;
  13443. /** Class-aware wrapper for `::pdf_filter_xobject_instance()`. */
  13444. FZ_FUNCTION PdfObj pdf_filter_xobject_instance(const PdfObj& page_res, const FzMatrix& ctm, PdfFilterOptions& options, const PdfCycleList& cycle_up) const;
  13445. /** Class-aware wrapper for `::pdf_flatten_inheritable_page_items()`. */
  13446. FZ_FUNCTION void pdf_flatten_inheritable_page_items() const;
  13447. /** Class-aware wrapper for `::pdf_get_bound_document()`. */
  13448. FZ_FUNCTION PdfDocument pdf_get_bound_document() const;
  13449. /** Class-aware wrapper for `::pdf_get_filespec_params()`. */
  13450. FZ_FUNCTION void pdf_get_filespec_params(const PdfFilespecParams& out) const;
  13451. /** Class-aware wrapper for `::pdf_get_indirect_document()`. */
  13452. FZ_FUNCTION PdfDocument pdf_get_indirect_document() const;
  13453. /** Class-aware wrapper for `::pdf_intent_from_name()`. */
  13454. FZ_FUNCTION enum pdf_intent pdf_intent_from_name() const;
  13455. /** Class-aware wrapper for `::pdf_is_array()`. */
  13456. FZ_FUNCTION int pdf_is_array() const;
  13457. /** Class-aware wrapper for `::pdf_is_bool()`. */
  13458. FZ_FUNCTION int pdf_is_bool() const;
  13459. /** Class-aware wrapper for `::pdf_is_dict()`. */
  13460. FZ_FUNCTION int pdf_is_dict() const;
  13461. /** Class-aware wrapper for `::pdf_is_embedded_file()`. */
  13462. FZ_FUNCTION int pdf_is_embedded_file() const;
  13463. /** Class-aware wrapper for `::pdf_is_filespec()`. */
  13464. FZ_FUNCTION int pdf_is_filespec() const;
  13465. /** Class-aware wrapper for `::pdf_is_image_stream()`. */
  13466. FZ_FUNCTION int pdf_is_image_stream() const;
  13467. /** Class-aware wrapper for `::pdf_is_indirect()`. */
  13468. FZ_FUNCTION int pdf_is_indirect() const;
  13469. /** Class-aware wrapper for `::pdf_is_int()`. */
  13470. FZ_FUNCTION int pdf_is_int() const;
  13471. /** Class-aware wrapper for `::pdf_is_jpx_image()`. */
  13472. FZ_FUNCTION int pdf_is_jpx_image() const;
  13473. /** Class-aware wrapper for `::pdf_is_name()`. */
  13474. FZ_FUNCTION int pdf_is_name() const;
  13475. /** Class-aware wrapper for `::pdf_is_null()`. */
  13476. FZ_FUNCTION int pdf_is_null() const;
  13477. /** Class-aware wrapper for `::pdf_is_number()`. */
  13478. FZ_FUNCTION int pdf_is_number() const;
  13479. /** Class-aware wrapper for `::pdf_is_real()`. */
  13480. FZ_FUNCTION int pdf_is_real() const;
  13481. /** Class-aware wrapper for `::pdf_is_stream()`. */
  13482. FZ_FUNCTION int pdf_is_stream() const;
  13483. /** Class-aware wrapper for `::pdf_is_string()`. */
  13484. FZ_FUNCTION int pdf_is_string() const;
  13485. /** Class-aware wrapper for `::pdf_line_ending_from_name()`. */
  13486. FZ_FUNCTION enum pdf_line_ending pdf_line_ending_from_name() const;
  13487. /** Class-aware wrapper for `::pdf_load_colorspace()`. */
  13488. FZ_FUNCTION FzColorspace pdf_load_colorspace() const;
  13489. /** Class-aware wrapper for `::pdf_load_embedded_file_contents()`. */
  13490. FZ_FUNCTION FzBuffer pdf_load_embedded_file_contents() const;
  13491. /** Class-aware wrapper for `::pdf_load_field_name()`. */
  13492. FZ_FUNCTION char *pdf_load_field_name() const;
  13493. /** Class-aware wrapper for `::pdf_load_function()`. */
  13494. FZ_FUNCTION PdfFunction pdf_load_function(int in, int out) const;
  13495. /** Class-aware wrapper for `::pdf_load_raw_stream()`. */
  13496. FZ_FUNCTION FzBuffer pdf_load_raw_stream() const;
  13497. /** Class-aware wrapper for `::pdf_load_stream()`. */
  13498. FZ_FUNCTION FzBuffer pdf_load_stream() const;
  13499. /** Class-aware wrapper for `::pdf_load_stream_or_string_as_utf8()`. */
  13500. FZ_FUNCTION char *pdf_load_stream_or_string_as_utf8() const;
  13501. /** Class-aware wrapper for `::pdf_lookup_field()`. */
  13502. FZ_FUNCTION PdfObj pdf_lookup_field(const char *name) const;
  13503. /** Class-aware wrapper for `::pdf_lookup_number()`. */
  13504. FZ_FUNCTION PdfObj pdf_lookup_number(int needle) const;
  13505. /** Class-aware wrapper for `::pdf_mark_obj()`. */
  13506. FZ_FUNCTION int pdf_mark_obj() const;
  13507. /** Class-aware wrapper for `::pdf_name_eq()`. */
  13508. FZ_FUNCTION int pdf_name_eq(const PdfObj& b) const;
  13509. /** Class-aware wrapper for `::pdf_new_utf8_from_pdf_stream_obj()`. */
  13510. FZ_FUNCTION char *pdf_new_utf8_from_pdf_stream_obj() const;
  13511. /** Class-aware wrapper for `::pdf_new_utf8_from_pdf_string_obj()`. */
  13512. FZ_FUNCTION char *pdf_new_utf8_from_pdf_string_obj() const;
  13513. /** Class-aware wrapper for `::pdf_obj_is_dirty()`. */
  13514. FZ_FUNCTION int pdf_obj_is_dirty() const;
  13515. /** Class-aware wrapper for `::pdf_obj_is_incremental()`. */
  13516. FZ_FUNCTION int pdf_obj_is_incremental() const;
  13517. /** Class-aware wrapper for `::pdf_obj_marked()`. */
  13518. FZ_FUNCTION int pdf_obj_marked() const;
  13519. /** Class-aware wrapper for `::pdf_obj_memo()`.
  13520. This method has out-params. Python/C# wrappers look like:
  13521. `pdf_obj_memo(int bit)` => `(int, int memo)`
  13522. */
  13523. FZ_FUNCTION int pdf_obj_memo(int bit, int *memo) const;
  13524. /** Class-aware wrapper for `::pdf_obj_parent_num()`. */
  13525. FZ_FUNCTION int pdf_obj_parent_num() const;
  13526. /** Class-aware wrapper for `::pdf_obj_refs()`. */
  13527. FZ_FUNCTION int pdf_obj_refs() const;
  13528. /** Class-aware wrapper for `::pdf_objcmp()`. */
  13529. FZ_FUNCTION int pdf_objcmp(const PdfObj& b) const;
  13530. /** Class-aware wrapper for `::pdf_objcmp_deep()`. */
  13531. FZ_FUNCTION int pdf_objcmp_deep(const PdfObj& b) const;
  13532. /** Class-aware wrapper for `::pdf_objcmp_resolve()`. */
  13533. FZ_FUNCTION int pdf_objcmp_resolve(const PdfObj& b) const;
  13534. /** Class-aware wrapper for `::pdf_open_raw_stream()`. */
  13535. FZ_FUNCTION FzStream pdf_open_raw_stream() const;
  13536. /** Class-aware wrapper for `::pdf_open_stream()`. */
  13537. FZ_FUNCTION FzStream pdf_open_stream() const;
  13538. /** Class-aware wrapper for `::pdf_page_obj_transform()`. */
  13539. FZ_FUNCTION void pdf_page_obj_transform(FzRect& outbox, FzMatrix& outctm) const;
  13540. /** Class-aware wrapper for `::pdf_page_obj_transform_box()`. */
  13541. FZ_FUNCTION void pdf_page_obj_transform_box(FzRect& outbox, FzMatrix& out, ::fz_box_type box) const;
  13542. /** Class-aware wrapper for `::pdf_pin_document()`. */
  13543. FZ_FUNCTION PdfDocument pdf_pin_document() const;
  13544. /** Class-aware wrapper for `::pdf_recolor_shade()`. */
  13545. /**
  13546. Recolor a shade.
  13547. */
  13548. FZ_FUNCTION PdfObj pdf_recolor_shade(::pdf_shade_recolorer *reshade, void *opaque) const;
  13549. /** Class-aware wrapper for `::pdf_resolve_indirect()`. */
  13550. /**
  13551. Resolve an indirect object (or chain of objects).
  13552. This can cause xref reorganisations (solidifications etc) due to
  13553. repairs, so all held pdf_xref_entries should be considered
  13554. invalid after this call (other than the returned one).
  13555. */
  13556. FZ_FUNCTION PdfObj pdf_resolve_indirect() const;
  13557. /** Class-aware wrapper for `::pdf_resolve_indirect_chain()`. */
  13558. FZ_FUNCTION PdfObj pdf_resolve_indirect_chain() const;
  13559. /** Class-aware wrapper for `::pdf_set_int()`. */
  13560. FZ_FUNCTION void pdf_set_int(int64_t i) const;
  13561. /** Class-aware wrapper for `::pdf_set_obj_memo()`. */
  13562. FZ_FUNCTION void pdf_set_obj_memo(int bit, int memo) const;
  13563. /** Class-aware wrapper for `::pdf_set_obj_parent()`. */
  13564. FZ_FUNCTION void pdf_set_obj_parent(int num) const;
  13565. /** Class-aware wrapper for `::pdf_set_str_len()`. */
  13566. FZ_FUNCTION void pdf_set_str_len(size_t newlen) const;
  13567. /** Class-aware wrapper for `::pdf_sort_dict()`. */
  13568. FZ_FUNCTION void pdf_sort_dict() const;
  13569. /** Class-aware wrapper for `::pdf_store_item()`. */
  13570. FZ_FUNCTION void pdf_store_item(void *val, size_t itemsize) const;
  13571. /** Class-aware wrapper for `::pdf_to_bool()`. */
  13572. FZ_FUNCTION int pdf_to_bool() const;
  13573. /** Class-aware wrapper for `::pdf_to_bool_default()`. */
  13574. FZ_FUNCTION int pdf_to_bool_default(int def) const;
  13575. /** Class-aware wrapper for `::pdf_to_date()`. */
  13576. FZ_FUNCTION int64_t pdf_to_date() const;
  13577. /** Class-aware wrapper for `::pdf_to_gen()`. */
  13578. FZ_FUNCTION int pdf_to_gen() const;
  13579. /** Class-aware wrapper for `::pdf_to_int()`. */
  13580. FZ_FUNCTION int pdf_to_int() const;
  13581. /** Class-aware wrapper for `::pdf_to_int64()`. */
  13582. FZ_FUNCTION int64_t pdf_to_int64() const;
  13583. /** Class-aware wrapper for `::pdf_to_int_default()`. */
  13584. FZ_FUNCTION int pdf_to_int_default(int def) const;
  13585. /** Class-aware wrapper for `::pdf_to_matrix()`. */
  13586. FZ_FUNCTION FzMatrix pdf_to_matrix() const;
  13587. /** Class-aware wrapper for `::pdf_to_name()`. */
  13588. FZ_FUNCTION const char *pdf_to_name() const;
  13589. /** Class-aware wrapper for `::pdf_to_num()`. */
  13590. FZ_FUNCTION int pdf_to_num() const;
  13591. /** Class-aware wrapper for `::pdf_to_point()`. */
  13592. FZ_FUNCTION FzPoint pdf_to_point(int offset) const;
  13593. /** Class-aware wrapper for `::pdf_to_quad()`. */
  13594. FZ_FUNCTION FzQuad pdf_to_quad(int offset) const;
  13595. /** Class-aware wrapper for `::pdf_to_real()`. */
  13596. FZ_FUNCTION float pdf_to_real() const;
  13597. /** Class-aware wrapper for `::pdf_to_real_default()`. */
  13598. FZ_FUNCTION float pdf_to_real_default(float def) const;
  13599. /** Class-aware wrapper for `::pdf_to_rect()`. */
  13600. FZ_FUNCTION FzRect pdf_to_rect() const;
  13601. /** Class-aware wrapper for `::pdf_to_str_buf()`. */
  13602. FZ_FUNCTION char *pdf_to_str_buf() const;
  13603. /** Class-aware wrapper for `::pdf_to_str_len()`. */
  13604. FZ_FUNCTION size_t pdf_to_str_len() const;
  13605. /** Class-aware wrapper for `::pdf_to_string()`.
  13606. This method has out-params. Python/C# wrappers look like:
  13607. `pdf_to_string()` => `(const char *, size_t sizep)`
  13608. */
  13609. FZ_FUNCTION const char *pdf_to_string(size_t *sizep) const;
  13610. /** Class-aware wrapper for `::pdf_to_text_string()`. */
  13611. FZ_FUNCTION const char *pdf_to_text_string() const;
  13612. /** Class-aware wrapper for `::pdf_unmark_obj()`. */
  13613. FZ_FUNCTION void pdf_unmark_obj() const;
  13614. /** Class-aware wrapper for `::pdf_verify_embedded_file_checksum()`. */
  13615. FZ_FUNCTION int pdf_verify_embedded_file_checksum() const;
  13616. /** Class-aware wrapper for `::pdf_walk_tree()`.
  13617. This method has out-params. Python/C# wrappers look like:
  13618. `pdf_walk_tree(::pdf_obj *kid_name, void (*arrive)(::fz_context *, ::pdf_obj *, void *, ::pdf_obj **), void (*leave)(::fz_context *, ::pdf_obj *, void *), void *arg, ::pdf_obj **names, ::pdf_obj **values)` => `()`
  13619. */
  13620. FZ_FUNCTION void pdf_walk_tree(const PdfObj& kid_name, void (*arrive)(::fz_context *, ::pdf_obj *, void *, ::pdf_obj **), void (*leave)(::fz_context *, ::pdf_obj *, void *), void *arg, PdfObj& names, PdfObj& values) const;
  13621. /** Class-aware wrapper for `::pdf_xobject_bbox()`. */
  13622. FZ_FUNCTION FzRect pdf_xobject_bbox() const;
  13623. /** Class-aware wrapper for `::pdf_xobject_colorspace()`. */
  13624. FZ_FUNCTION FzColorspace pdf_xobject_colorspace() const;
  13625. /** Class-aware wrapper for `::pdf_xobject_isolated()`. */
  13626. FZ_FUNCTION int pdf_xobject_isolated() const;
  13627. /** Class-aware wrapper for `::pdf_xobject_knockout()`. */
  13628. FZ_FUNCTION int pdf_xobject_knockout() const;
  13629. /** Class-aware wrapper for `::pdf_xobject_matrix()`. */
  13630. FZ_FUNCTION FzMatrix pdf_xobject_matrix() const;
  13631. /** Class-aware wrapper for `::pdf_xobject_resources()`. */
  13632. FZ_FUNCTION PdfObj pdf_xobject_resources() const;
  13633. /** Class-aware wrapper for `::pdf_xobject_transparency()`. */
  13634. FZ_FUNCTION int pdf_xobject_transparency() const;
  13635. /** Typesafe wrapper for looking up things such as PDF_ENUM_NAME_Annots. */
  13636. FZ_FUNCTION PdfObj pdf_dict_get(int key);
  13637. /** Alternative to `pdf_load_field_name()` that returns a std::string. */
  13638. FZ_FUNCTION std::string pdf_load_field_name2();
  13639. /** Constructor using raw copy of pre-existing `::pdf_obj`. */
  13640. /* This constructor is marked as `explicit` because wrapper classes do not
  13641. call `keep`in constructors, but do call `drop` in destructors. So
  13642. automatic construction from a pdf_obj* will generally cause an
  13643. unbalanced `drop` resulting in errors such as SEGV. */
  13644. FZ_FUNCTION explicit PdfObj(::pdf_obj* internal=NULL);
  13645. /** Destructor using pdf_drop_obj(). */
  13646. FZ_FUNCTION ~PdfObj();
  13647. /** Return numerical value of .m_internal; helps with Python debugging. */
  13648. FZ_FUNCTION long long m_internal_value();
  13649. /** Return true iff `m_internal` is not null. */
  13650. FZ_FUNCTION operator bool();
  13651. /* == Member data. */
  13652. /** Pointer to wrapped data. */
  13653. ::pdf_obj* m_internal;
  13654. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13655. generate code regardless so we always need to have this available. */
  13656. FZ_DATA static int s_num_instances;
  13657. };
  13658. /** Wrapper class for struct `pdf_object_labels`. Not copyable or assignable. */
  13659. struct PdfObjectLabels
  13660. {
  13661. /** Default constructor, sets `m_internal` to null. */
  13662. FZ_FUNCTION PdfObjectLabels();
  13663. /* == Methods. */
  13664. /** Class-aware wrapper for `::pdf_label_object()`. */
  13665. FZ_FUNCTION void pdf_label_object(int num, ::pdf_label_object_fn *callback, void *arg) const;
  13666. /** Constructor using raw copy of pre-existing `::pdf_object_labels`. */
  13667. FZ_FUNCTION PdfObjectLabels(::pdf_object_labels* internal);
  13668. /** Destructor using pdf_drop_object_labels(). */
  13669. FZ_FUNCTION ~PdfObjectLabels();
  13670. /** Return numerical value of .m_internal; helps with Python debugging. */
  13671. FZ_FUNCTION long long m_internal_value();
  13672. /** Return true iff `m_internal` is not null. */
  13673. FZ_FUNCTION operator bool();
  13674. /* == Member data. */
  13675. /** Pointer to wrapped data. */
  13676. ::pdf_object_labels* m_internal;
  13677. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13678. generate code regardless so we always need to have this available. */
  13679. FZ_DATA static int s_num_instances;
  13680. private:
  13681. /** This class is not copyable or assignable. */
  13682. PdfObjectLabels(const PdfObjectLabels& rhs);
  13683. PdfObjectLabels& operator=(const PdfObjectLabels& rhs);
  13684. };
  13685. /** Wrapper class for struct `pdf_ocg_descriptor`. Not copyable or assignable. */
  13686. struct PdfOcgDescriptor
  13687. {
  13688. /** Default constructor, sets `m_internal` to null. */
  13689. FZ_FUNCTION PdfOcgDescriptor();
  13690. /** Constructor using raw copy of pre-existing `::pdf_ocg_descriptor`. */
  13691. FZ_FUNCTION PdfOcgDescriptor(::pdf_ocg_descriptor* internal);
  13692. #ifndef NDEBUG
  13693. /** Destructor only decrements s_num_instances. */
  13694. FZ_FUNCTION ~PdfOcgDescriptor();
  13695. #else
  13696. /** We use default destructor. */
  13697. #endif
  13698. /** Return numerical value of .m_internal; helps with Python debugging. */
  13699. FZ_FUNCTION long long m_internal_value();
  13700. /** Return true iff `m_internal` is not null. */
  13701. FZ_FUNCTION operator bool();
  13702. /* == Member data. */
  13703. /** Pointer to wrapped data. */
  13704. ::pdf_ocg_descriptor* m_internal;
  13705. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13706. generate code regardless so we always need to have this available. */
  13707. FZ_DATA static int s_num_instances;
  13708. private:
  13709. /** This class is not copyable or assignable. */
  13710. PdfOcgDescriptor(const PdfOcgDescriptor& rhs);
  13711. PdfOcgDescriptor& operator=(const PdfOcgDescriptor& rhs);
  13712. };
  13713. /** Wrapper class for struct `pdf_page`. */
  13714. struct PdfPage
  13715. {
  13716. /** Copy constructor using `pdf_keep_page()`. */
  13717. FZ_FUNCTION PdfPage(const PdfPage& rhs);
  13718. /** operator= using `pdf_keep_page()` and `pdf_drop_page()`. */
  13719. FZ_FUNCTION PdfPage& operator=(const PdfPage& rhs);
  13720. /** Default constructor, sets `m_internal` to null. */
  13721. FZ_FUNCTION PdfPage();
  13722. /* == Methods. */
  13723. /** Class-aware wrapper for `::pdf_bound_page()`. */
  13724. FZ_FUNCTION FzRect pdf_bound_page(::fz_box_type box) const;
  13725. /** Class-aware wrapper for `::pdf_clip_page()`. */
  13726. FZ_FUNCTION void pdf_clip_page(FzRect& clip) const;
  13727. /** Class-aware wrapper for `::pdf_count_page_associated_files()`. */
  13728. FZ_FUNCTION int pdf_count_page_associated_files() const;
  13729. /** Class-aware wrapper for `::pdf_create_annot()`. */
  13730. FZ_FUNCTION PdfAnnot pdf_create_annot(enum pdf_annot_type type) const;
  13731. /** Class-aware wrapper for `::pdf_create_annot_raw()`. */
  13732. FZ_FUNCTION PdfAnnot pdf_create_annot_raw(enum pdf_annot_type type) const;
  13733. /** Class-aware wrapper for `::pdf_create_link()`. */
  13734. FZ_FUNCTION FzLink pdf_create_link(const FzRect& bbox, const char *uri) const;
  13735. /** Class-aware wrapper for `::pdf_create_signature_widget()`. */
  13736. FZ_FUNCTION PdfAnnot pdf_create_signature_widget(char *name) const;
  13737. /** Class-aware wrapper for `::pdf_delete_annot()`. */
  13738. FZ_FUNCTION void pdf_delete_annot(const PdfAnnot& annot) const;
  13739. /** Class-aware wrapper for `::pdf_delete_link()`. */
  13740. FZ_FUNCTION void pdf_delete_link(const FzLink& link) const;
  13741. /** Class-aware wrapper for `::pdf_first_annot()`. */
  13742. FZ_FUNCTION PdfAnnot pdf_first_annot() const;
  13743. /** Class-aware wrapper for `::pdf_first_widget()`. */
  13744. FZ_FUNCTION PdfAnnot pdf_first_widget() const;
  13745. /** Class-aware wrapper for `::pdf_load_links()`. */
  13746. FZ_FUNCTION FzLink pdf_load_links() const;
  13747. /** Class-aware wrapper for `::pdf_new_link()`. */
  13748. FZ_FUNCTION FzLink pdf_new_link(const FzRect& rect, const char *uri, const PdfObj& obj) const;
  13749. /** Class-aware wrapper for `::pdf_new_pixmap_from_page_contents_with_separations_and_usage()`. */
  13750. FZ_FUNCTION FzPixmap pdf_new_pixmap_from_page_contents_with_separations_and_usage(const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha, const char *usage, ::fz_box_type box) const;
  13751. /** Class-aware wrapper for `::pdf_new_pixmap_from_page_contents_with_usage()`. */
  13752. FZ_FUNCTION FzPixmap pdf_new_pixmap_from_page_contents_with_usage(const FzMatrix& ctm, const FzColorspace& cs, int alpha, const char *usage, ::fz_box_type box) const;
  13753. /** Class-aware wrapper for `::pdf_new_pixmap_from_page_with_separations_and_usage()`. */
  13754. FZ_FUNCTION FzPixmap pdf_new_pixmap_from_page_with_separations_and_usage(const FzMatrix& ctm, const FzColorspace& cs, const FzSeparations& seps, int alpha, const char *usage, ::fz_box_type box) const;
  13755. /** Class-aware wrapper for `::pdf_new_pixmap_from_page_with_usage()`. */
  13756. FZ_FUNCTION FzPixmap pdf_new_pixmap_from_page_with_usage(const FzMatrix& ctm, const FzColorspace& cs, int alpha, const char *usage, ::fz_box_type box) const;
  13757. /** Class-aware wrapper for `::pdf_nuke_annots()`. */
  13758. FZ_FUNCTION void pdf_nuke_annots() const;
  13759. /** Class-aware wrapper for `::pdf_nuke_links()`. */
  13760. FZ_FUNCTION void pdf_nuke_links() const;
  13761. /** Class-aware wrapper for `::pdf_nuke_page()`. */
  13762. FZ_FUNCTION void pdf_nuke_page() const;
  13763. /** Class-aware wrapper for `::pdf_page_associated_file()`. */
  13764. FZ_FUNCTION PdfObj pdf_page_associated_file(int idx) const;
  13765. /** Class-aware wrapper for `::pdf_page_contents()`. */
  13766. FZ_FUNCTION PdfObj pdf_page_contents() const;
  13767. /** Class-aware wrapper for `::pdf_page_event_close()`. */
  13768. FZ_FUNCTION void pdf_page_event_close() const;
  13769. /** Class-aware wrapper for `::pdf_page_event_open()`. */
  13770. FZ_FUNCTION void pdf_page_event_open() const;
  13771. /** Class-aware wrapper for `::pdf_page_group()`. */
  13772. FZ_FUNCTION PdfObj pdf_page_group() const;
  13773. /** Class-aware wrapper for `::pdf_page_has_transparency()`. */
  13774. FZ_FUNCTION int pdf_page_has_transparency() const;
  13775. /** Class-aware wrapper for `::pdf_page_presentation()`.
  13776. This method has out-params. Python/C# wrappers look like:
  13777. `pdf_page_presentation(::fz_transition *transition)` => `(fz_transition *, float duration)`
  13778. */
  13779. FZ_FUNCTION FzTransition pdf_page_presentation(FzTransition& transition, float *duration) const;
  13780. /** Class-aware wrapper for `::pdf_page_resources()`. */
  13781. FZ_FUNCTION PdfObj pdf_page_resources() const;
  13782. /** Class-aware wrapper for `::pdf_page_separations()`. */
  13783. FZ_FUNCTION FzSeparations pdf_page_separations() const;
  13784. /** Class-aware wrapper for `::pdf_page_transform()`. */
  13785. FZ_FUNCTION void pdf_page_transform(FzRect& mediabox, FzMatrix& ctm) const;
  13786. /** Class-aware wrapper for `::pdf_page_transform_box()`. */
  13787. FZ_FUNCTION void pdf_page_transform_box(FzRect& mediabox, FzMatrix& ctm, ::fz_box_type box) const;
  13788. /** Class-aware wrapper for `::pdf_run_page()`. */
  13789. FZ_FUNCTION void pdf_run_page(const FzDevice& dev, const FzMatrix& ctm, FzCookie& cookie) const;
  13790. /** Class-aware wrapper for `::pdf_run_page_annots()`. */
  13791. FZ_FUNCTION void pdf_run_page_annots(const FzDevice& dev, const FzMatrix& ctm, FzCookie& cookie) const;
  13792. /** Class-aware wrapper for `::pdf_run_page_annots_with_usage()`. */
  13793. FZ_FUNCTION void pdf_run_page_annots_with_usage(const FzDevice& dev, const FzMatrix& ctm, const char *usage, FzCookie& cookie) const;
  13794. /** Class-aware wrapper for `::pdf_run_page_contents()`. */
  13795. FZ_FUNCTION void pdf_run_page_contents(const FzDevice& dev, const FzMatrix& ctm, FzCookie& cookie) const;
  13796. /** Class-aware wrapper for `::pdf_run_page_contents_with_usage()`. */
  13797. FZ_FUNCTION void pdf_run_page_contents_with_usage(const FzDevice& dev, const FzMatrix& ctm, const char *usage, FzCookie& cookie) const;
  13798. /** Class-aware wrapper for `::pdf_run_page_widgets()`. */
  13799. FZ_FUNCTION void pdf_run_page_widgets(const FzDevice& dev, const FzMatrix& ctm, FzCookie& cookie) const;
  13800. /** Class-aware wrapper for `::pdf_run_page_widgets_with_usage()`. */
  13801. FZ_FUNCTION void pdf_run_page_widgets_with_usage(const FzDevice& dev, const FzMatrix& ctm, const char *usage, FzCookie& cookie) const;
  13802. /** Class-aware wrapper for `::pdf_run_page_with_usage()`. */
  13803. FZ_FUNCTION void pdf_run_page_with_usage(const FzDevice& dev, const FzMatrix& ctm, const char *usage, FzCookie& cookie) const;
  13804. /** Class-aware wrapper for `::pdf_set_page_box()`. */
  13805. FZ_FUNCTION void pdf_set_page_box(::fz_box_type box, const FzRect& rect) const;
  13806. /** Class-aware wrapper for `::pdf_sync_annots()`. */
  13807. FZ_FUNCTION void pdf_sync_annots() const;
  13808. /** Class-aware wrapper for `::pdf_sync_links()`. */
  13809. FZ_FUNCTION void pdf_sync_links() const;
  13810. /** Class-aware wrapper for `::pdf_sync_page()`. */
  13811. FZ_FUNCTION void pdf_sync_page() const;
  13812. /** Class-aware wrapper for `::pdf_update_page()`. */
  13813. FZ_FUNCTION int pdf_update_page() const;
  13814. /** Returns wrapper for .super member. */
  13815. FZ_FUNCTION FzPage super();
  13816. /** Returns wrapper for .doc member. */
  13817. FZ_FUNCTION PdfDocument doc();
  13818. /** Returns wrapper for .obj member. */
  13819. FZ_FUNCTION PdfObj obj();
  13820. /** Constructor using raw copy of pre-existing `::pdf_page`. */
  13821. /* This constructor is marked as `explicit` because wrapper classes do not
  13822. call `keep`in constructors, but do call `drop` in destructors. So
  13823. automatic construction from a pdf_page* will generally cause an
  13824. unbalanced `drop` resulting in errors such as SEGV. */
  13825. FZ_FUNCTION explicit PdfPage(::pdf_page* internal);
  13826. /** Destructor using pdf_drop_page(). */
  13827. FZ_FUNCTION ~PdfPage();
  13828. /** Return numerical value of .m_internal; helps with Python debugging. */
  13829. FZ_FUNCTION long long m_internal_value();
  13830. /** Return true iff `m_internal` is not null. */
  13831. FZ_FUNCTION operator bool();
  13832. /* == Member data. */
  13833. /** Pointer to wrapped data. */
  13834. ::pdf_page* m_internal;
  13835. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13836. generate code regardless so we always need to have this available. */
  13837. FZ_DATA static int s_num_instances;
  13838. };
  13839. /** Wrapper class for struct `pdf_pattern`. */
  13840. struct PdfPattern
  13841. {
  13842. /** Copy constructor using `pdf_keep_pattern()`. */
  13843. FZ_FUNCTION PdfPattern(const PdfPattern& rhs);
  13844. /** operator= using `pdf_keep_pattern()` and `pdf_drop_pattern()`. */
  13845. FZ_FUNCTION PdfPattern& operator=(const PdfPattern& rhs);
  13846. /** Default constructor, sets `m_internal` to null. */
  13847. FZ_FUNCTION PdfPattern();
  13848. /** Constructor using raw copy of pre-existing `::pdf_pattern`. */
  13849. /* This constructor is marked as `explicit` because wrapper classes do not
  13850. call `keep`in constructors, but do call `drop` in destructors. So
  13851. automatic construction from a pdf_pattern* will generally cause an
  13852. unbalanced `drop` resulting in errors such as SEGV. */
  13853. FZ_FUNCTION explicit PdfPattern(::pdf_pattern* internal);
  13854. /** Destructor using pdf_drop_pattern(). */
  13855. FZ_FUNCTION ~PdfPattern();
  13856. /** Return numerical value of .m_internal; helps with Python debugging. */
  13857. FZ_FUNCTION long long m_internal_value();
  13858. /** Return true iff `m_internal` is not null. */
  13859. FZ_FUNCTION operator bool();
  13860. /* == Member data. */
  13861. /** Pointer to wrapped data. */
  13862. ::pdf_pattern* m_internal;
  13863. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13864. generate code regardless so we always need to have this available. */
  13865. FZ_DATA static int s_num_instances;
  13866. };
  13867. /** Wrapper class for struct `pdf_pkcs7_distinguished_name`. Not copyable or assignable. */
  13868. struct PdfPkcs7DistinguishedName
  13869. {
  13870. /** Default constructor, sets `m_internal` to null. */
  13871. FZ_FUNCTION PdfPkcs7DistinguishedName();
  13872. /* == Methods. */
  13873. /** Class-aware wrapper for `::pdf_signature_drop_distinguished_name()`. */
  13874. FZ_FUNCTION void pdf_signature_drop_distinguished_name() const;
  13875. /** Class-aware wrapper for `::pdf_signature_format_distinguished_name()`. */
  13876. FZ_FUNCTION char *pdf_signature_format_distinguished_name() const;
  13877. /** Constructor using raw copy of pre-existing `::pdf_pkcs7_distinguished_name`. */
  13878. FZ_FUNCTION PdfPkcs7DistinguishedName(::pdf_pkcs7_distinguished_name* internal);
  13879. #ifndef NDEBUG
  13880. /** Destructor only decrements s_num_instances. */
  13881. FZ_FUNCTION ~PdfPkcs7DistinguishedName();
  13882. #else
  13883. /** We use default destructor. */
  13884. #endif
  13885. /** Return numerical value of .m_internal; helps with Python debugging. */
  13886. FZ_FUNCTION long long m_internal_value();
  13887. /** Return true iff `m_internal` is not null. */
  13888. FZ_FUNCTION operator bool();
  13889. /* == Member data. */
  13890. /** Pointer to wrapped data. */
  13891. ::pdf_pkcs7_distinguished_name* m_internal;
  13892. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13893. generate code regardless so we always need to have this available. */
  13894. FZ_DATA static int s_num_instances;
  13895. private:
  13896. /** This class is not copyable or assignable. */
  13897. PdfPkcs7DistinguishedName(const PdfPkcs7DistinguishedName& rhs);
  13898. PdfPkcs7DistinguishedName& operator=(const PdfPkcs7DistinguishedName& rhs);
  13899. };
  13900. /** Wrapper class for struct `pdf_pkcs7_signer`. Not copyable or assignable. */
  13901. struct PdfPkcs7Signer
  13902. {
  13903. /** Default constructor, sets `m_internal` to null. */
  13904. FZ_FUNCTION PdfPkcs7Signer();
  13905. /** Constructor using raw copy of pre-existing `::pdf_pkcs7_signer`. */
  13906. FZ_FUNCTION PdfPkcs7Signer(::pdf_pkcs7_signer* internal);
  13907. #ifndef NDEBUG
  13908. /** Destructor only decrements s_num_instances. */
  13909. FZ_FUNCTION ~PdfPkcs7Signer();
  13910. #else
  13911. /** We use default destructor. */
  13912. #endif
  13913. /** Return numerical value of .m_internal; helps with Python debugging. */
  13914. FZ_FUNCTION long long m_internal_value();
  13915. /** Return true iff `m_internal` is not null. */
  13916. FZ_FUNCTION operator bool();
  13917. /* == Member data. */
  13918. /** Pointer to wrapped data. */
  13919. ::pdf_pkcs7_signer* m_internal;
  13920. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13921. generate code regardless so we always need to have this available. */
  13922. FZ_DATA static int s_num_instances;
  13923. private:
  13924. /** This class is not copyable or assignable. */
  13925. PdfPkcs7Signer(const PdfPkcs7Signer& rhs);
  13926. PdfPkcs7Signer& operator=(const PdfPkcs7Signer& rhs);
  13927. };
  13928. /** Wrapper class for struct `pdf_pkcs7_verifier`. Not copyable or assignable. */
  13929. struct PdfPkcs7Verifier
  13930. {
  13931. /** Default constructor, sets `m_internal` to null. */
  13932. FZ_FUNCTION PdfPkcs7Verifier();
  13933. /** Constructor using raw copy of pre-existing `::pdf_pkcs7_verifier`. */
  13934. FZ_FUNCTION PdfPkcs7Verifier(::pdf_pkcs7_verifier* internal);
  13935. #ifndef NDEBUG
  13936. /** Destructor only decrements s_num_instances. */
  13937. FZ_FUNCTION ~PdfPkcs7Verifier();
  13938. #else
  13939. /** We use default destructor. */
  13940. #endif
  13941. /** Return numerical value of .m_internal; helps with Python debugging. */
  13942. FZ_FUNCTION long long m_internal_value();
  13943. /** Return true iff `m_internal` is not null. */
  13944. FZ_FUNCTION operator bool();
  13945. /* == Member data. */
  13946. /** Pointer to wrapped data. */
  13947. ::pdf_pkcs7_verifier* m_internal;
  13948. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  13949. generate code regardless so we always need to have this available. */
  13950. FZ_DATA static int s_num_instances;
  13951. private:
  13952. /** This class is not copyable or assignable. */
  13953. PdfPkcs7Verifier(const PdfPkcs7Verifier& rhs);
  13954. PdfPkcs7Verifier& operator=(const PdfPkcs7Verifier& rhs);
  13955. };
  13956. /** Wrapper class for struct `pdf_processor`. */
  13957. struct PdfProcessor
  13958. {
  13959. /** == Constructors. */
  13960. /** Constructor using `pdf_new_buffer_processor()`. */
  13961. FZ_FUNCTION PdfProcessor(const FzBuffer& buffer, int ahxencode, int newlines);
  13962. /** Constructor using `pdf_new_output_processor()`. */
  13963. FZ_FUNCTION PdfProcessor(const FzOutput& out, int ahxencode, int newlines);
  13964. /** Constructor using `pdf_new_run_processor()`. */
  13965. FZ_FUNCTION PdfProcessor(const PdfDocument& doc, const FzDevice& dev, const FzMatrix& ctm, int struct_parent, const char *usage, const PdfGstate& gstate, const FzDefaultColorspaces& default_cs, FzCookie& cookie, const PdfGstate& fill_gstate, const PdfGstate& stroke_gstate);
  13966. /** Constructor using `pdf_new_sanitize_filter()`. */
  13967. FZ_FUNCTION PdfProcessor(const PdfDocument& doc, const PdfProcessor& chain, int struct_parents, const FzMatrix& transform, PdfFilterOptions& options, void *sopts);
  13968. /** Copy constructor using `pdf_keep_processor()`. */
  13969. FZ_FUNCTION PdfProcessor(const PdfProcessor& rhs);
  13970. /** operator= using `pdf_keep_processor()` and `pdf_drop_processor()`. */
  13971. FZ_FUNCTION PdfProcessor& operator=(const PdfProcessor& rhs);
  13972. /** Default constructor, sets `m_internal` to null. */
  13973. FZ_FUNCTION PdfProcessor();
  13974. /* == Static methods. */
  13975. /** Class-aware wrapper for `::pdf_new_color_filter()`. */
  13976. FZ_FUNCTION static PdfProcessor pdf_new_color_filter(const PdfDocument& doc, const PdfProcessor& chain, int struct_parents, const FzMatrix& transform, PdfFilterOptions& options, void *copts);
  13977. /* == Methods. */
  13978. /** Class-aware wrapper for `::pdf_close_processor()`. */
  13979. FZ_FUNCTION void pdf_close_processor() const;
  13980. /** Class-aware wrapper for `::pdf_process_annot()`. */
  13981. FZ_FUNCTION void pdf_process_annot(const PdfAnnot& annot, FzCookie& cookie) const;
  13982. /** Class-aware wrapper for `::pdf_process_contents()`.
  13983. This method has out-params. Python/C# wrappers look like:
  13984. `pdf_process_contents(::pdf_document *doc, ::pdf_obj *res, ::pdf_obj *stm, ::fz_cookie *cookie, ::pdf_obj **out_res)` =>
  13985. */
  13986. FZ_FUNCTION void pdf_process_contents(const PdfDocument& doc, const PdfObj& res, const PdfObj& stm, FzCookie& cookie, PdfObj& out_res) const;
  13987. /** Class-aware wrapper for `::pdf_process_glyph()`. */
  13988. FZ_FUNCTION void pdf_process_glyph(const PdfDocument& doc, const PdfObj& resources, const FzBuffer& contents) const;
  13989. /** Class-aware wrapper for `::pdf_process_raw_contents()`. */
  13990. FZ_FUNCTION void pdf_process_raw_contents(const PdfDocument& doc, const PdfObj& stmobj, FzCookie& cookie) const;
  13991. /** Class-aware wrapper for `::pdf_processor_pop_resources()`. */
  13992. FZ_FUNCTION PdfObj pdf_processor_pop_resources() const;
  13993. /** Class-aware wrapper for `::pdf_processor_push_resources()`. */
  13994. FZ_FUNCTION void pdf_processor_push_resources(const PdfObj& res) const;
  13995. /** Class-aware wrapper for `::pdf_reset_processor()`. */
  13996. FZ_FUNCTION void pdf_reset_processor() const;
  13997. /** Constructor using raw copy of pre-existing `::pdf_processor`. */
  13998. /* This constructor is marked as `explicit` because wrapper classes do not
  13999. call `keep`in constructors, but do call `drop` in destructors. So
  14000. automatic construction from a pdf_processor* will generally cause an
  14001. unbalanced `drop` resulting in errors such as SEGV. */
  14002. FZ_FUNCTION explicit PdfProcessor(::pdf_processor* internal);
  14003. /** Destructor using pdf_drop_processor(). */
  14004. FZ_FUNCTION ~PdfProcessor();
  14005. /** Return numerical value of .m_internal; helps with Python debugging. */
  14006. FZ_FUNCTION long long m_internal_value();
  14007. /** Return true iff `m_internal` is not null. */
  14008. FZ_FUNCTION operator bool();
  14009. /* == Member data. */
  14010. /** Pointer to wrapped data. */
  14011. ::pdf_processor* m_internal;
  14012. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14013. generate code regardless so we always need to have this available. */
  14014. FZ_DATA static int s_num_instances;
  14015. };
  14016. /** Wrapper class for struct pdf_processor with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  14017. struct PdfProcessor2 : PdfProcessor
  14018. {
  14019. /** == Constructor. */
  14020. FZ_FUNCTION PdfProcessor2();
  14021. /** == Destructor. */
  14022. FZ_FUNCTION virtual ~PdfProcessor2();
  14023. /** These methods set the function pointers in *m_internal
  14024. to point to internal callbacks that call our virtual methods. */
  14025. FZ_FUNCTION void use_virtual_close_processor( bool use=true);
  14026. FZ_FUNCTION void use_virtual_drop_processor( bool use=true);
  14027. FZ_FUNCTION void use_virtual_reset_processor( bool use=true);
  14028. FZ_FUNCTION void use_virtual_push_resources( bool use=true);
  14029. FZ_FUNCTION void use_virtual_pop_resources( bool use=true);
  14030. FZ_FUNCTION void use_virtual_op_w( bool use=true);
  14031. FZ_FUNCTION void use_virtual_op_j( bool use=true);
  14032. FZ_FUNCTION void use_virtual_op_J( bool use=true);
  14033. FZ_FUNCTION void use_virtual_op_M( bool use=true);
  14034. FZ_FUNCTION void use_virtual_op_d( bool use=true);
  14035. FZ_FUNCTION void use_virtual_op_ri( bool use=true);
  14036. FZ_FUNCTION void use_virtual_op_i( bool use=true);
  14037. FZ_FUNCTION void use_virtual_op_gs_begin( bool use=true);
  14038. FZ_FUNCTION void use_virtual_op_gs_BM( bool use=true);
  14039. FZ_FUNCTION void use_virtual_op_gs_ca( bool use=true);
  14040. FZ_FUNCTION void use_virtual_op_gs_CA( bool use=true);
  14041. FZ_FUNCTION void use_virtual_op_gs_SMask( bool use=true);
  14042. FZ_FUNCTION void use_virtual_op_gs_end( bool use=true);
  14043. FZ_FUNCTION void use_virtual_op_q( bool use=true);
  14044. FZ_FUNCTION void use_virtual_op_Q( bool use=true);
  14045. FZ_FUNCTION void use_virtual_op_cm( bool use=true);
  14046. FZ_FUNCTION void use_virtual_op_m( bool use=true);
  14047. FZ_FUNCTION void use_virtual_op_l( bool use=true);
  14048. FZ_FUNCTION void use_virtual_op_c( bool use=true);
  14049. FZ_FUNCTION void use_virtual_op_v( bool use=true);
  14050. FZ_FUNCTION void use_virtual_op_y( bool use=true);
  14051. FZ_FUNCTION void use_virtual_op_h( bool use=true);
  14052. FZ_FUNCTION void use_virtual_op_re( bool use=true);
  14053. FZ_FUNCTION void use_virtual_op_S( bool use=true);
  14054. FZ_FUNCTION void use_virtual_op_s( bool use=true);
  14055. FZ_FUNCTION void use_virtual_op_F( bool use=true);
  14056. FZ_FUNCTION void use_virtual_op_f( bool use=true);
  14057. FZ_FUNCTION void use_virtual_op_fstar( bool use=true);
  14058. FZ_FUNCTION void use_virtual_op_B( bool use=true);
  14059. FZ_FUNCTION void use_virtual_op_Bstar( bool use=true);
  14060. FZ_FUNCTION void use_virtual_op_b( bool use=true);
  14061. FZ_FUNCTION void use_virtual_op_bstar( bool use=true);
  14062. FZ_FUNCTION void use_virtual_op_n( bool use=true);
  14063. FZ_FUNCTION void use_virtual_op_W( bool use=true);
  14064. FZ_FUNCTION void use_virtual_op_Wstar( bool use=true);
  14065. FZ_FUNCTION void use_virtual_op_BT( bool use=true);
  14066. FZ_FUNCTION void use_virtual_op_ET( bool use=true);
  14067. FZ_FUNCTION void use_virtual_op_Tc( bool use=true);
  14068. FZ_FUNCTION void use_virtual_op_Tw( bool use=true);
  14069. FZ_FUNCTION void use_virtual_op_Tz( bool use=true);
  14070. FZ_FUNCTION void use_virtual_op_TL( bool use=true);
  14071. FZ_FUNCTION void use_virtual_op_Tf( bool use=true);
  14072. FZ_FUNCTION void use_virtual_op_Tr( bool use=true);
  14073. FZ_FUNCTION void use_virtual_op_Ts( bool use=true);
  14074. FZ_FUNCTION void use_virtual_op_Td( bool use=true);
  14075. FZ_FUNCTION void use_virtual_op_TD( bool use=true);
  14076. FZ_FUNCTION void use_virtual_op_Tm( bool use=true);
  14077. FZ_FUNCTION void use_virtual_op_Tstar( bool use=true);
  14078. FZ_FUNCTION void use_virtual_op_TJ( bool use=true);
  14079. FZ_FUNCTION void use_virtual_op_Tj( bool use=true);
  14080. FZ_FUNCTION void use_virtual_op_squote( bool use=true);
  14081. FZ_FUNCTION void use_virtual_op_dquote( bool use=true);
  14082. FZ_FUNCTION void use_virtual_op_d0( bool use=true);
  14083. FZ_FUNCTION void use_virtual_op_d1( bool use=true);
  14084. FZ_FUNCTION void use_virtual_op_CS( bool use=true);
  14085. FZ_FUNCTION void use_virtual_op_cs( bool use=true);
  14086. FZ_FUNCTION void use_virtual_op_SC_pattern( bool use=true);
  14087. FZ_FUNCTION void use_virtual_op_sc_pattern( bool use=true);
  14088. FZ_FUNCTION void use_virtual_op_SC_shade( bool use=true);
  14089. FZ_FUNCTION void use_virtual_op_sc_shade( bool use=true);
  14090. FZ_FUNCTION void use_virtual_op_SC_color( bool use=true);
  14091. FZ_FUNCTION void use_virtual_op_sc_color( bool use=true);
  14092. FZ_FUNCTION void use_virtual_op_G( bool use=true);
  14093. FZ_FUNCTION void use_virtual_op_g( bool use=true);
  14094. FZ_FUNCTION void use_virtual_op_RG( bool use=true);
  14095. FZ_FUNCTION void use_virtual_op_rg( bool use=true);
  14096. FZ_FUNCTION void use_virtual_op_K( bool use=true);
  14097. FZ_FUNCTION void use_virtual_op_k( bool use=true);
  14098. FZ_FUNCTION void use_virtual_op_BI( bool use=true);
  14099. FZ_FUNCTION void use_virtual_op_sh( bool use=true);
  14100. FZ_FUNCTION void use_virtual_op_Do_image( bool use=true);
  14101. FZ_FUNCTION void use_virtual_op_Do_form( bool use=true);
  14102. FZ_FUNCTION void use_virtual_op_MP( bool use=true);
  14103. FZ_FUNCTION void use_virtual_op_DP( bool use=true);
  14104. FZ_FUNCTION void use_virtual_op_BMC( bool use=true);
  14105. FZ_FUNCTION void use_virtual_op_BDC( bool use=true);
  14106. FZ_FUNCTION void use_virtual_op_EMC( bool use=true);
  14107. FZ_FUNCTION void use_virtual_op_BX( bool use=true);
  14108. FZ_FUNCTION void use_virtual_op_EX( bool use=true);
  14109. FZ_FUNCTION void use_virtual_op_gs_OP( bool use=true);
  14110. FZ_FUNCTION void use_virtual_op_gs_op( bool use=true);
  14111. FZ_FUNCTION void use_virtual_op_gs_OPM( bool use=true);
  14112. FZ_FUNCTION void use_virtual_op_gs_UseBlackPtComp( bool use=true);
  14113. FZ_FUNCTION void use_virtual_op_EOD( bool use=true);
  14114. FZ_FUNCTION void use_virtual_op_END( bool use=true);
  14115. /** Default virtual method implementations; these all throw an exception. */
  14116. FZ_FUNCTION virtual void close_processor(::fz_context *arg_0);
  14117. FZ_FUNCTION virtual void drop_processor(::fz_context *arg_0);
  14118. FZ_FUNCTION virtual void reset_processor(::fz_context *arg_0);
  14119. FZ_FUNCTION virtual void push_resources(::fz_context *arg_0, ::pdf_obj *arg_2);
  14120. FZ_FUNCTION virtual ::pdf_obj * pop_resources(::fz_context *arg_0);
  14121. FZ_FUNCTION virtual void op_w(::fz_context *arg_0, float arg_2);
  14122. FZ_FUNCTION virtual void op_j(::fz_context *arg_0, int arg_2);
  14123. FZ_FUNCTION virtual void op_J(::fz_context *arg_0, int arg_2);
  14124. FZ_FUNCTION virtual void op_M(::fz_context *arg_0, float arg_2);
  14125. FZ_FUNCTION virtual void op_d(::fz_context *arg_0, ::pdf_obj *arg_2, float arg_3);
  14126. FZ_FUNCTION virtual void op_ri(::fz_context *arg_0, const char *arg_2);
  14127. FZ_FUNCTION virtual void op_i(::fz_context *arg_0, float arg_2);
  14128. FZ_FUNCTION virtual void op_gs_begin(::fz_context *arg_0, const char *arg_2, ::pdf_obj *arg_3);
  14129. FZ_FUNCTION virtual void op_gs_BM(::fz_context *arg_0, const char *arg_2);
  14130. FZ_FUNCTION virtual void op_gs_ca(::fz_context *arg_0, float arg_2);
  14131. FZ_FUNCTION virtual void op_gs_CA(::fz_context *arg_0, float arg_2);
  14132. FZ_FUNCTION virtual void op_gs_SMask(::fz_context *arg_0, ::pdf_obj *arg_2, ::fz_colorspace *arg_3, float *arg_4, int arg_5, ::pdf_obj *arg_6);
  14133. FZ_FUNCTION virtual void op_gs_end(::fz_context *arg_0);
  14134. FZ_FUNCTION virtual void op_q(::fz_context *arg_0);
  14135. FZ_FUNCTION virtual void op_Q(::fz_context *arg_0);
  14136. FZ_FUNCTION virtual void op_cm(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5, float arg_6, float arg_7);
  14137. FZ_FUNCTION virtual void op_m(::fz_context *arg_0, float arg_2, float arg_3);
  14138. FZ_FUNCTION virtual void op_l(::fz_context *arg_0, float arg_2, float arg_3);
  14139. FZ_FUNCTION virtual void op_c(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5, float arg_6, float arg_7);
  14140. FZ_FUNCTION virtual void op_v(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  14141. FZ_FUNCTION virtual void op_y(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  14142. FZ_FUNCTION virtual void op_h(::fz_context *arg_0);
  14143. FZ_FUNCTION virtual void op_re(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  14144. FZ_FUNCTION virtual void op_S(::fz_context *arg_0);
  14145. FZ_FUNCTION virtual void op_s(::fz_context *arg_0);
  14146. FZ_FUNCTION virtual void op_F(::fz_context *arg_0);
  14147. FZ_FUNCTION virtual void op_f(::fz_context *arg_0);
  14148. FZ_FUNCTION virtual void op_fstar(::fz_context *arg_0);
  14149. FZ_FUNCTION virtual void op_B(::fz_context *arg_0);
  14150. FZ_FUNCTION virtual void op_Bstar(::fz_context *arg_0);
  14151. FZ_FUNCTION virtual void op_b(::fz_context *arg_0);
  14152. FZ_FUNCTION virtual void op_bstar(::fz_context *arg_0);
  14153. FZ_FUNCTION virtual void op_n(::fz_context *arg_0);
  14154. FZ_FUNCTION virtual void op_W(::fz_context *arg_0);
  14155. FZ_FUNCTION virtual void op_Wstar(::fz_context *arg_0);
  14156. FZ_FUNCTION virtual void op_BT(::fz_context *arg_0);
  14157. FZ_FUNCTION virtual void op_ET(::fz_context *arg_0);
  14158. FZ_FUNCTION virtual void op_Tc(::fz_context *arg_0, float arg_2);
  14159. FZ_FUNCTION virtual void op_Tw(::fz_context *arg_0, float arg_2);
  14160. FZ_FUNCTION virtual void op_Tz(::fz_context *arg_0, float arg_2);
  14161. FZ_FUNCTION virtual void op_TL(::fz_context *arg_0, float arg_2);
  14162. FZ_FUNCTION virtual void op_Tf(::fz_context *arg_0, const char *arg_2, ::pdf_font_desc *arg_3, float arg_4);
  14163. FZ_FUNCTION virtual void op_Tr(::fz_context *arg_0, int arg_2);
  14164. FZ_FUNCTION virtual void op_Ts(::fz_context *arg_0, float arg_2);
  14165. FZ_FUNCTION virtual void op_Td(::fz_context *arg_0, float arg_2, float arg_3);
  14166. FZ_FUNCTION virtual void op_TD(::fz_context *arg_0, float arg_2, float arg_3);
  14167. FZ_FUNCTION virtual void op_Tm(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5, float arg_6, float arg_7);
  14168. FZ_FUNCTION virtual void op_Tstar(::fz_context *arg_0);
  14169. FZ_FUNCTION virtual void op_TJ(::fz_context *arg_0, ::pdf_obj *arg_2);
  14170. FZ_FUNCTION virtual void op_Tj(::fz_context *arg_0, char *arg_2, unsigned long long arg_3);
  14171. FZ_FUNCTION virtual void op_squote(::fz_context *arg_0, char *arg_2, unsigned long long arg_3);
  14172. FZ_FUNCTION virtual void op_dquote(::fz_context *arg_0, float arg_2, float arg_3, char *arg_4, unsigned long long arg_5);
  14173. FZ_FUNCTION virtual void op_d0(::fz_context *arg_0, float arg_2, float arg_3);
  14174. FZ_FUNCTION virtual void op_d1(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5, float arg_6, float arg_7);
  14175. FZ_FUNCTION virtual void op_CS(::fz_context *arg_0, const char *arg_2, ::fz_colorspace *arg_3);
  14176. FZ_FUNCTION virtual void op_cs(::fz_context *arg_0, const char *arg_2, ::fz_colorspace *arg_3);
  14177. FZ_FUNCTION virtual void op_SC_pattern(::fz_context *arg_0, const char *arg_2, ::pdf_pattern *arg_3, int arg_4, float *arg_5);
  14178. FZ_FUNCTION virtual void op_sc_pattern(::fz_context *arg_0, const char *arg_2, ::pdf_pattern *arg_3, int arg_4, float *arg_5);
  14179. FZ_FUNCTION virtual void op_SC_shade(::fz_context *arg_0, const char *arg_2, ::fz_shade *arg_3);
  14180. FZ_FUNCTION virtual void op_sc_shade(::fz_context *arg_0, const char *arg_2, ::fz_shade *arg_3);
  14181. FZ_FUNCTION virtual void op_SC_color(::fz_context *arg_0, int arg_2, float *arg_3);
  14182. FZ_FUNCTION virtual void op_sc_color(::fz_context *arg_0, int arg_2, float *arg_3);
  14183. FZ_FUNCTION virtual void op_G(::fz_context *arg_0, float arg_2);
  14184. FZ_FUNCTION virtual void op_g(::fz_context *arg_0, float arg_2);
  14185. FZ_FUNCTION virtual void op_RG(::fz_context *arg_0, float arg_2, float arg_3, float arg_4);
  14186. FZ_FUNCTION virtual void op_rg(::fz_context *arg_0, float arg_2, float arg_3, float arg_4);
  14187. FZ_FUNCTION virtual void op_K(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  14188. FZ_FUNCTION virtual void op_k(::fz_context *arg_0, float arg_2, float arg_3, float arg_4, float arg_5);
  14189. FZ_FUNCTION virtual void op_BI(::fz_context *arg_0, ::fz_image *arg_2, const char *arg_3);
  14190. FZ_FUNCTION virtual void op_sh(::fz_context *arg_0, const char *arg_2, ::fz_shade *arg_3);
  14191. FZ_FUNCTION virtual void op_Do_image(::fz_context *arg_0, const char *arg_2, ::fz_image *arg_3);
  14192. FZ_FUNCTION virtual void op_Do_form(::fz_context *arg_0, const char *arg_2, ::pdf_obj *arg_3);
  14193. FZ_FUNCTION virtual void op_MP(::fz_context *arg_0, const char *arg_2);
  14194. FZ_FUNCTION virtual void op_DP(::fz_context *arg_0, const char *arg_2, ::pdf_obj *arg_3, ::pdf_obj *arg_4);
  14195. FZ_FUNCTION virtual void op_BMC(::fz_context *arg_0, const char *arg_2);
  14196. FZ_FUNCTION virtual void op_BDC(::fz_context *arg_0, const char *arg_2, ::pdf_obj *arg_3, ::pdf_obj *arg_4);
  14197. FZ_FUNCTION virtual void op_EMC(::fz_context *arg_0);
  14198. FZ_FUNCTION virtual void op_BX(::fz_context *arg_0);
  14199. FZ_FUNCTION virtual void op_EX(::fz_context *arg_0);
  14200. FZ_FUNCTION virtual void op_gs_OP(::fz_context *arg_0, int arg_2);
  14201. FZ_FUNCTION virtual void op_gs_op(::fz_context *arg_0, int arg_2);
  14202. FZ_FUNCTION virtual void op_gs_OPM(::fz_context *arg_0, int arg_2);
  14203. FZ_FUNCTION virtual void op_gs_UseBlackPtComp(::fz_context *arg_0, ::pdf_obj *arg_2);
  14204. FZ_FUNCTION virtual void op_EOD(::fz_context *arg_0);
  14205. FZ_FUNCTION virtual void op_END(::fz_context *arg_0);
  14206. };
  14207. /** Wrapper class for struct `pdf_range`. Not copyable or assignable. */
  14208. struct PdfRange
  14209. {
  14210. /** Default constructor, sets `m_internal` to null. */
  14211. FZ_FUNCTION PdfRange();
  14212. /** Constructor using raw copy of pre-existing `::pdf_range`. */
  14213. FZ_FUNCTION PdfRange(::pdf_range* internal);
  14214. #ifndef NDEBUG
  14215. /** Destructor only decrements s_num_instances. */
  14216. FZ_FUNCTION ~PdfRange();
  14217. #else
  14218. /** We use default destructor. */
  14219. #endif
  14220. /** Return numerical value of .m_internal; helps with Python debugging. */
  14221. FZ_FUNCTION long long m_internal_value();
  14222. /** Return true iff `m_internal` is not null. */
  14223. FZ_FUNCTION operator bool();
  14224. /* == Member data. */
  14225. /** Pointer to wrapped data. */
  14226. ::pdf_range* m_internal;
  14227. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14228. generate code regardless so we always need to have this available. */
  14229. FZ_DATA static int s_num_instances;
  14230. private:
  14231. /** This class is not copyable or assignable. */
  14232. PdfRange(const PdfRange& rhs);
  14233. PdfRange& operator=(const PdfRange& rhs);
  14234. };
  14235. /** Wrapper class for struct `pdf_recolor_options`. */
  14236. struct PdfRecolorOptions
  14237. {
  14238. /** We use default copy constructor and operator=. */
  14239. /** Default constructor, sets each member to default value. */
  14240. FZ_FUNCTION PdfRecolorOptions();
  14241. /** Constructor using raw copy of pre-existing `::pdf_recolor_options`. */
  14242. FZ_FUNCTION PdfRecolorOptions(const ::pdf_recolor_options* internal);
  14243. /** Constructor using raw copy of pre-existing `::pdf_recolor_options`. */
  14244. FZ_FUNCTION PdfRecolorOptions(const ::pdf_recolor_options internal);
  14245. /** Access as underlying struct. */
  14246. FZ_FUNCTION ::pdf_recolor_options* internal();
  14247. /** Access as underlying struct. */
  14248. FZ_FUNCTION const ::pdf_recolor_options* internal() const;
  14249. #ifndef NDEBUG
  14250. /** Destructor only decrements s_num_instances. */
  14251. FZ_FUNCTION ~PdfRecolorOptions();
  14252. #else
  14253. /** We use default destructor. */
  14254. #endif
  14255. /* == Member data. */
  14256. /* These members are the same as the members of ::pdf_recolor_options. */
  14257. int num_comp;
  14258. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14259. generate code regardless so we always need to have this available. */
  14260. FZ_DATA static int s_num_instances;
  14261. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  14262. FZ_FUNCTION std::string to_string();
  14263. /** Comparison method. */
  14264. FZ_FUNCTION bool operator==(const PdfRecolorOptions& rhs);
  14265. /** Comparison method. */
  14266. FZ_FUNCTION bool operator!=(const PdfRecolorOptions& rhs);
  14267. };
  14268. /** Wrapper class for struct `pdf_redact_options`. */
  14269. struct PdfRedactOptions
  14270. {
  14271. /** We use default copy constructor and operator=. */
  14272. /** Default constructor, sets each member to default value. */
  14273. FZ_FUNCTION PdfRedactOptions();
  14274. /** Constructor using raw copy of pre-existing `::pdf_redact_options`. */
  14275. FZ_FUNCTION PdfRedactOptions(const ::pdf_redact_options* internal);
  14276. /** Constructor using raw copy of pre-existing `::pdf_redact_options`. */
  14277. FZ_FUNCTION PdfRedactOptions(const ::pdf_redact_options internal);
  14278. /** Access as underlying struct. */
  14279. FZ_FUNCTION ::pdf_redact_options* internal();
  14280. /** Access as underlying struct. */
  14281. FZ_FUNCTION const ::pdf_redact_options* internal() const;
  14282. #ifndef NDEBUG
  14283. /** Destructor only decrements s_num_instances. */
  14284. FZ_FUNCTION ~PdfRedactOptions();
  14285. #else
  14286. /** We use default destructor. */
  14287. #endif
  14288. /* == Member data. */
  14289. /* These members are the same as the members of ::pdf_redact_options. */
  14290. int black_boxes;
  14291. int image_method;
  14292. int line_art;
  14293. int text;
  14294. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14295. generate code regardless so we always need to have this available. */
  14296. FZ_DATA static int s_num_instances;
  14297. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  14298. FZ_FUNCTION std::string to_string();
  14299. /** Comparison method. */
  14300. FZ_FUNCTION bool operator==(const PdfRedactOptions& rhs);
  14301. /** Comparison method. */
  14302. FZ_FUNCTION bool operator!=(const PdfRedactOptions& rhs);
  14303. };
  14304. /** Wrapper class for struct `pdf_resource_stack`. Not copyable or assignable. */
  14305. struct PdfResourceStack
  14306. {
  14307. /** Default constructor, sets `m_internal` to null. */
  14308. FZ_FUNCTION PdfResourceStack();
  14309. /* == Methods. */
  14310. /** Class-aware wrapper for `::pdf_lookup_resource()`. */
  14311. FZ_FUNCTION PdfObj pdf_lookup_resource(const PdfObj& type, const char *name) const;
  14312. /** Constructor using raw copy of pre-existing `::pdf_resource_stack`. */
  14313. FZ_FUNCTION PdfResourceStack(::pdf_resource_stack* internal);
  14314. #ifndef NDEBUG
  14315. /** Destructor only decrements s_num_instances. */
  14316. FZ_FUNCTION ~PdfResourceStack();
  14317. #else
  14318. /** We use default destructor. */
  14319. #endif
  14320. /** Return numerical value of .m_internal; helps with Python debugging. */
  14321. FZ_FUNCTION long long m_internal_value();
  14322. /** Return true iff `m_internal` is not null. */
  14323. FZ_FUNCTION operator bool();
  14324. /* == Member data. */
  14325. /** Pointer to wrapped data. */
  14326. ::pdf_resource_stack* m_internal;
  14327. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14328. generate code regardless so we always need to have this available. */
  14329. FZ_DATA static int s_num_instances;
  14330. private:
  14331. /** This class is not copyable or assignable. */
  14332. PdfResourceStack(const PdfResourceStack& rhs);
  14333. PdfResourceStack& operator=(const PdfResourceStack& rhs);
  14334. };
  14335. /** Wrapper class for struct `pdf_rev_page_map`. Not copyable or assignable. */
  14336. struct PdfRevPageMap
  14337. {
  14338. /** Default constructor, sets `m_internal` to null. */
  14339. FZ_FUNCTION PdfRevPageMap();
  14340. /** Constructor using raw copy of pre-existing `::pdf_rev_page_map`. */
  14341. FZ_FUNCTION PdfRevPageMap(::pdf_rev_page_map* internal);
  14342. #ifndef NDEBUG
  14343. /** Destructor only decrements s_num_instances. */
  14344. FZ_FUNCTION ~PdfRevPageMap();
  14345. #else
  14346. /** We use default destructor. */
  14347. #endif
  14348. /** Return numerical value of .m_internal; helps with Python debugging. */
  14349. FZ_FUNCTION long long m_internal_value();
  14350. /** Return true iff `m_internal` is not null. */
  14351. FZ_FUNCTION operator bool();
  14352. /* == Member data. */
  14353. /** Pointer to wrapped data. */
  14354. ::pdf_rev_page_map* m_internal;
  14355. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14356. generate code regardless so we always need to have this available. */
  14357. FZ_DATA static int s_num_instances;
  14358. private:
  14359. /** This class is not copyable or assignable. */
  14360. PdfRevPageMap(const PdfRevPageMap& rhs);
  14361. PdfRevPageMap& operator=(const PdfRevPageMap& rhs);
  14362. };
  14363. /** Wrapper class for struct `pdf_sanitize_filter_options`. */
  14364. struct PdfSanitizeFilterOptions
  14365. {
  14366. /** We use default copy constructor and operator=. */
  14367. /** Default constructor, sets each member to default value. */
  14368. FZ_FUNCTION PdfSanitizeFilterOptions();
  14369. /** Constructor using raw copy of pre-existing `::pdf_sanitize_filter_options`. */
  14370. FZ_FUNCTION PdfSanitizeFilterOptions(const ::pdf_sanitize_filter_options* internal);
  14371. /** Constructor using raw copy of pre-existing `::pdf_sanitize_filter_options`. */
  14372. FZ_FUNCTION PdfSanitizeFilterOptions(const ::pdf_sanitize_filter_options internal);
  14373. /** Access as underlying struct. */
  14374. FZ_FUNCTION ::pdf_sanitize_filter_options* internal();
  14375. /** Access as underlying struct. */
  14376. FZ_FUNCTION const ::pdf_sanitize_filter_options* internal() const;
  14377. #ifndef NDEBUG
  14378. /** Destructor only decrements s_num_instances. */
  14379. FZ_FUNCTION ~PdfSanitizeFilterOptions();
  14380. #else
  14381. /** We use default destructor. */
  14382. #endif
  14383. /* == Member data. */
  14384. /* These members are the same as the members of ::pdf_sanitize_filter_options. */
  14385. void *opaque;
  14386. ::fz_image *(*image_filter)(::fz_context *, void *, ::fz_matrix , const char *, ::fz_image *, ::fz_rect );
  14387. int (*text_filter)(::fz_context *, void *, int *, int , ::fz_matrix , ::fz_matrix , ::fz_rect );
  14388. void (*after_text_object)(::fz_context *, void *, ::pdf_document *, ::pdf_processor *, ::fz_matrix );
  14389. int (*culler)(::fz_context *, void *, ::fz_rect , ::fz_cull_type );
  14390. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14391. generate code regardless so we always need to have this available. */
  14392. FZ_DATA static int s_num_instances;
  14393. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  14394. FZ_FUNCTION std::string to_string();
  14395. /** Comparison method. */
  14396. FZ_FUNCTION bool operator==(const PdfSanitizeFilterOptions& rhs);
  14397. /** Comparison method. */
  14398. FZ_FUNCTION bool operator!=(const PdfSanitizeFilterOptions& rhs);
  14399. };
  14400. /** Wrapper class for struct pdf_sanitize_filter_options with virtual fns for each fnptr; this is for use as a SWIG Director class. */
  14401. struct PdfSanitizeFilterOptions2 : PdfSanitizeFilterOptions
  14402. {
  14403. /** == Constructor. */
  14404. FZ_FUNCTION PdfSanitizeFilterOptions2();
  14405. /** == Destructor. */
  14406. FZ_FUNCTION virtual ~PdfSanitizeFilterOptions2();
  14407. /** These methods set the function pointers in *m_internal
  14408. to point to internal callbacks that call our virtual methods. */
  14409. FZ_FUNCTION void use_virtual_image_filter( bool use=true);
  14410. FZ_FUNCTION void use_virtual_text_filter( bool use=true);
  14411. FZ_FUNCTION void use_virtual_after_text_object( bool use=true);
  14412. FZ_FUNCTION void use_virtual_culler( bool use=true);
  14413. /** Default virtual method implementations; these all throw an exception. */
  14414. FZ_FUNCTION virtual ::fz_image * image_filter(::fz_context *arg_0, ::fz_matrix arg_2, const char *arg_3, ::fz_image *arg_4, ::fz_rect arg_5);
  14415. FZ_FUNCTION virtual int text_filter(::fz_context *arg_0, int *arg_2, int arg_3, ::fz_matrix arg_4, ::fz_matrix arg_5, ::fz_rect arg_6);
  14416. FZ_FUNCTION virtual void after_text_object(::fz_context *arg_0, ::pdf_document *arg_2, ::pdf_processor *arg_3, ::fz_matrix arg_4);
  14417. FZ_FUNCTION virtual int culler(::fz_context *arg_0, ::fz_rect arg_2, ::fz_cull_type arg_3);
  14418. };
  14419. /** Wrapper class for struct `pdf_text_object_state`. Not copyable or assignable. */
  14420. struct PdfTextObjectState
  14421. {
  14422. /** Default constructor, sets `m_internal` to null. */
  14423. FZ_FUNCTION PdfTextObjectState();
  14424. /* == Methods. */
  14425. /** Class-aware wrapper for `::pdf_tos_get_text()`. */
  14426. FZ_FUNCTION FzText pdf_tos_get_text() const;
  14427. /** Class-aware wrapper for `::pdf_tos_make_trm()`.
  14428. This method has out-params. Python/C# wrappers look like:
  14429. `pdf_tos_make_trm(::pdf_text_state *text, ::pdf_font_desc *fontdesc, int cid, ::fz_matrix *trm)` => `(int, float adv)`
  14430. */
  14431. FZ_FUNCTION int pdf_tos_make_trm(const PdfTextState& text, const PdfFontDesc& fontdesc, int cid, FzMatrix& trm, float *adv) const;
  14432. /** Class-aware wrapper for `::pdf_tos_move_after_char()`. */
  14433. FZ_FUNCTION void pdf_tos_move_after_char() const;
  14434. /** Class-aware wrapper for `::pdf_tos_newline()`. */
  14435. FZ_FUNCTION void pdf_tos_newline(float leading) const;
  14436. /** Class-aware wrapper for `::pdf_tos_reset()`. */
  14437. FZ_FUNCTION void pdf_tos_reset(int render) const;
  14438. /** Class-aware wrapper for `::pdf_tos_set_matrix()`. */
  14439. FZ_FUNCTION void pdf_tos_set_matrix(float a, float b, float c, float d, float e, float f) const;
  14440. /** Class-aware wrapper for `::pdf_tos_translate()`. */
  14441. FZ_FUNCTION void pdf_tos_translate(float tx, float ty) const;
  14442. /** Constructor using raw copy of pre-existing `::pdf_text_object_state`. */
  14443. FZ_FUNCTION PdfTextObjectState(::pdf_text_object_state* internal);
  14444. #ifndef NDEBUG
  14445. /** Destructor only decrements s_num_instances. */
  14446. FZ_FUNCTION ~PdfTextObjectState();
  14447. #else
  14448. /** We use default destructor. */
  14449. #endif
  14450. /** Return numerical value of .m_internal; helps with Python debugging. */
  14451. FZ_FUNCTION long long m_internal_value();
  14452. /** Return true iff `m_internal` is not null. */
  14453. FZ_FUNCTION operator bool();
  14454. /* == Member data. */
  14455. /** Pointer to wrapped data. */
  14456. ::pdf_text_object_state* m_internal;
  14457. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14458. generate code regardless so we always need to have this available. */
  14459. FZ_DATA static int s_num_instances;
  14460. private:
  14461. /** This class is not copyable or assignable. */
  14462. PdfTextObjectState(const PdfTextObjectState& rhs);
  14463. PdfTextObjectState& operator=(const PdfTextObjectState& rhs);
  14464. };
  14465. /** Wrapper class for struct `pdf_text_state`. Not copyable or assignable. */
  14466. struct PdfTextState
  14467. {
  14468. /** Default constructor, sets `m_internal` to null. */
  14469. FZ_FUNCTION PdfTextState();
  14470. /** Constructor using raw copy of pre-existing `::pdf_text_state`. */
  14471. FZ_FUNCTION PdfTextState(::pdf_text_state* internal);
  14472. #ifndef NDEBUG
  14473. /** Destructor only decrements s_num_instances. */
  14474. FZ_FUNCTION ~PdfTextState();
  14475. #else
  14476. /** We use default destructor. */
  14477. #endif
  14478. /** Return numerical value of .m_internal; helps with Python debugging. */
  14479. FZ_FUNCTION long long m_internal_value();
  14480. /** Return true iff `m_internal` is not null. */
  14481. FZ_FUNCTION operator bool();
  14482. /* == Member data. */
  14483. /** Pointer to wrapped data. */
  14484. ::pdf_text_state* m_internal;
  14485. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14486. generate code regardless so we always need to have this available. */
  14487. FZ_DATA static int s_num_instances;
  14488. private:
  14489. /** This class is not copyable or assignable. */
  14490. PdfTextState(const PdfTextState& rhs);
  14491. PdfTextState& operator=(const PdfTextState& rhs);
  14492. };
  14493. /** Wrapper class for struct `pdf_unsaved_sig`. Not copyable or assignable. */
  14494. struct PdfUnsavedSig
  14495. {
  14496. /** Default constructor, sets `m_internal` to null. */
  14497. FZ_FUNCTION PdfUnsavedSig();
  14498. /** Constructor using raw copy of pre-existing `::pdf_unsaved_sig`. */
  14499. FZ_FUNCTION PdfUnsavedSig(::pdf_unsaved_sig* internal);
  14500. #ifndef NDEBUG
  14501. /** Destructor only decrements s_num_instances. */
  14502. FZ_FUNCTION ~PdfUnsavedSig();
  14503. #else
  14504. /** We use default destructor. */
  14505. #endif
  14506. /** Return numerical value of .m_internal; helps with Python debugging. */
  14507. FZ_FUNCTION long long m_internal_value();
  14508. /** Return true iff `m_internal` is not null. */
  14509. FZ_FUNCTION operator bool();
  14510. /* == Member data. */
  14511. /** Pointer to wrapped data. */
  14512. ::pdf_unsaved_sig* m_internal;
  14513. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14514. generate code regardless so we always need to have this available. */
  14515. FZ_DATA static int s_num_instances;
  14516. private:
  14517. /** This class is not copyable or assignable. */
  14518. PdfUnsavedSig(const PdfUnsavedSig& rhs);
  14519. PdfUnsavedSig& operator=(const PdfUnsavedSig& rhs);
  14520. };
  14521. /** Wrapper class for struct `pdf_vmtx`. Not copyable or assignable. */
  14522. struct PdfVmtx
  14523. {
  14524. /** Default constructor, sets `m_internal` to null. */
  14525. FZ_FUNCTION PdfVmtx();
  14526. /** Constructor using raw copy of pre-existing `::pdf_vmtx`. */
  14527. FZ_FUNCTION PdfVmtx(::pdf_vmtx* internal);
  14528. #ifndef NDEBUG
  14529. /** Destructor only decrements s_num_instances. */
  14530. FZ_FUNCTION ~PdfVmtx();
  14531. #else
  14532. /** We use default destructor. */
  14533. #endif
  14534. /** Return numerical value of .m_internal; helps with Python debugging. */
  14535. FZ_FUNCTION long long m_internal_value();
  14536. /** Return true iff `m_internal` is not null. */
  14537. FZ_FUNCTION operator bool();
  14538. /* == Member data. */
  14539. /** Pointer to wrapped data. */
  14540. ::pdf_vmtx* m_internal;
  14541. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14542. generate code regardless so we always need to have this available. */
  14543. FZ_DATA static int s_num_instances;
  14544. private:
  14545. /** This class is not copyable or assignable. */
  14546. PdfVmtx(const PdfVmtx& rhs);
  14547. PdfVmtx& operator=(const PdfVmtx& rhs);
  14548. };
  14549. /** Wrapper class for struct `pdf_write_options`. */
  14550. struct PdfWriteOptions
  14551. {
  14552. /** Default constructor, makes copy of pdf_default_write_options. */
  14553. FZ_FUNCTION PdfWriteOptions();
  14554. /** Copy constructor using raw memcopy(). */
  14555. FZ_FUNCTION PdfWriteOptions(const PdfWriteOptions& rhs);
  14556. /** We use default copy constructor and operator=. */
  14557. /* == Methods. */
  14558. /** Class-aware wrapper for `::pdf_parse_write_options()`. */
  14559. FZ_FUNCTION PdfWriteOptions pdf_parse_write_options(const char *args);
  14560. /** Assignment using plain memcpy(). */
  14561. FZ_FUNCTION PdfWriteOptions& operator=(const PdfWriteOptions& rhs);
  14562. /** Copies <text> into opwd_utf8[]. */
  14563. FZ_FUNCTION void opwd_utf8_set_value(const std::string& text);
  14564. /** Copies <text> into upwd_utf8[]. */
  14565. FZ_FUNCTION void upwd_utf8_set_value(const std::string& text);
  14566. /** Constructor using raw copy of pre-existing `::pdf_write_options`. */
  14567. FZ_FUNCTION PdfWriteOptions(const ::pdf_write_options* internal);
  14568. /** Constructor using raw copy of pre-existing `::pdf_write_options`. */
  14569. FZ_FUNCTION PdfWriteOptions(const ::pdf_write_options internal);
  14570. /** Access as underlying struct. */
  14571. FZ_FUNCTION ::pdf_write_options* internal();
  14572. /** Access as underlying struct. */
  14573. FZ_FUNCTION const ::pdf_write_options* internal() const;
  14574. #ifndef NDEBUG
  14575. /** Destructor only decrements s_num_instances. */
  14576. FZ_FUNCTION ~PdfWriteOptions();
  14577. #else
  14578. /** We use default destructor. */
  14579. #endif
  14580. /* == Member data. */
  14581. /* These members are the same as the members of ::pdf_write_options. */
  14582. int do_incremental;
  14583. int do_pretty;
  14584. int do_ascii;
  14585. int do_compress;
  14586. int do_compress_images;
  14587. int do_compress_fonts;
  14588. int do_decompress;
  14589. int do_garbage;
  14590. int do_linear;
  14591. int do_clean;
  14592. int do_sanitize;
  14593. int do_appearance;
  14594. int do_encrypt;
  14595. int dont_regenerate_id;
  14596. int permissions;
  14597. char opwd_utf8[128];
  14598. char upwd_utf8[128];
  14599. int do_snapshot;
  14600. int do_preserve_metadata;
  14601. int do_use_objstms;
  14602. int compression_effort;
  14603. int do_labels;
  14604. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14605. generate code regardless so we always need to have this available. */
  14606. FZ_DATA static int s_num_instances;
  14607. /** Returns string containing our members, labelled and inside (...), using operator<<. */
  14608. FZ_FUNCTION std::string to_string();
  14609. /** Comparison method. */
  14610. FZ_FUNCTION bool operator==(const PdfWriteOptions& rhs);
  14611. /** Comparison method. */
  14612. FZ_FUNCTION bool operator!=(const PdfWriteOptions& rhs);
  14613. };
  14614. /** Wrapper class for struct `pdf_xrange`. Not copyable or assignable. */
  14615. struct PdfXrange
  14616. {
  14617. /** Default constructor, sets `m_internal` to null. */
  14618. FZ_FUNCTION PdfXrange();
  14619. /** Constructor using raw copy of pre-existing `::pdf_xrange`. */
  14620. FZ_FUNCTION PdfXrange(::pdf_xrange* internal);
  14621. #ifndef NDEBUG
  14622. /** Destructor only decrements s_num_instances. */
  14623. FZ_FUNCTION ~PdfXrange();
  14624. #else
  14625. /** We use default destructor. */
  14626. #endif
  14627. /** Return numerical value of .m_internal; helps with Python debugging. */
  14628. FZ_FUNCTION long long m_internal_value();
  14629. /** Return true iff `m_internal` is not null. */
  14630. FZ_FUNCTION operator bool();
  14631. /* == Member data. */
  14632. /** Pointer to wrapped data. */
  14633. ::pdf_xrange* m_internal;
  14634. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14635. generate code regardless so we always need to have this available. */
  14636. FZ_DATA static int s_num_instances;
  14637. private:
  14638. /** This class is not copyable or assignable. */
  14639. PdfXrange(const PdfXrange& rhs);
  14640. PdfXrange& operator=(const PdfXrange& rhs);
  14641. };
  14642. /** Wrapper class for struct `pdf_xref`. Not copyable or assignable. */
  14643. struct PdfXref
  14644. {
  14645. /** == Constructors. */
  14646. /** Constructor using `pdf_new_local_xref()`. */
  14647. FZ_FUNCTION PdfXref(const PdfDocument& doc);
  14648. /** Default constructor, sets `m_internal` to null. */
  14649. FZ_FUNCTION PdfXref();
  14650. /** Constructor using raw copy of pre-existing `::pdf_xref`. */
  14651. FZ_FUNCTION PdfXref(::pdf_xref* internal);
  14652. #ifndef NDEBUG
  14653. /** Destructor only decrements s_num_instances. */
  14654. FZ_FUNCTION ~PdfXref();
  14655. #else
  14656. /** We use default destructor. */
  14657. #endif
  14658. /** Return numerical value of .m_internal; helps with Python debugging. */
  14659. FZ_FUNCTION long long m_internal_value();
  14660. /** Return true iff `m_internal` is not null. */
  14661. FZ_FUNCTION operator bool();
  14662. /* == Member data. */
  14663. /** Pointer to wrapped data. */
  14664. ::pdf_xref* m_internal;
  14665. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14666. generate code regardless so we always need to have this available. */
  14667. FZ_DATA static int s_num_instances;
  14668. private:
  14669. /** This class is not copyable or assignable. */
  14670. PdfXref(const PdfXref& rhs);
  14671. PdfXref& operator=(const PdfXref& rhs);
  14672. };
  14673. /** Wrapper class for struct `pdf_xref_entry`. Not copyable or assignable. */
  14674. struct PdfXrefEntry
  14675. {
  14676. /** Default constructor, sets `m_internal` to null. */
  14677. FZ_FUNCTION PdfXrefEntry();
  14678. /** Constructor using raw copy of pre-existing `::pdf_xref_entry`. */
  14679. FZ_FUNCTION PdfXrefEntry(::pdf_xref_entry* internal);
  14680. #ifndef NDEBUG
  14681. /** Destructor only decrements s_num_instances. */
  14682. FZ_FUNCTION ~PdfXrefEntry();
  14683. #else
  14684. /** We use default destructor. */
  14685. #endif
  14686. /** Return numerical value of .m_internal; helps with Python debugging. */
  14687. FZ_FUNCTION long long m_internal_value();
  14688. /** Return true iff `m_internal` is not null. */
  14689. FZ_FUNCTION operator bool();
  14690. /* == Member data. */
  14691. /** Pointer to wrapped data. */
  14692. ::pdf_xref_entry* m_internal;
  14693. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14694. generate code regardless so we always need to have this available. */
  14695. FZ_DATA static int s_num_instances;
  14696. private:
  14697. /** This class is not copyable or assignable. */
  14698. PdfXrefEntry(const PdfXrefEntry& rhs);
  14699. PdfXrefEntry& operator=(const PdfXrefEntry& rhs);
  14700. };
  14701. /** Wrapper class for struct `pdf_xref_subsec`. Not copyable or assignable. */
  14702. struct PdfXrefSubsec
  14703. {
  14704. /** Default constructor, sets `m_internal` to null. */
  14705. FZ_FUNCTION PdfXrefSubsec();
  14706. /** Constructor using raw copy of pre-existing `::pdf_xref_subsec`. */
  14707. FZ_FUNCTION PdfXrefSubsec(::pdf_xref_subsec* internal);
  14708. #ifndef NDEBUG
  14709. /** Destructor only decrements s_num_instances. */
  14710. FZ_FUNCTION ~PdfXrefSubsec();
  14711. #else
  14712. /** We use default destructor. */
  14713. #endif
  14714. /** Return numerical value of .m_internal; helps with Python debugging. */
  14715. FZ_FUNCTION long long m_internal_value();
  14716. /** Return true iff `m_internal` is not null. */
  14717. FZ_FUNCTION operator bool();
  14718. /* == Member data. */
  14719. /** Pointer to wrapped data. */
  14720. ::pdf_xref_subsec* m_internal;
  14721. /* Ideally this would be in `#ifndef NDEBUG...#endif`, but Swig will
  14722. generate code regardless so we always need to have this available. */
  14723. FZ_DATA static int s_num_instances;
  14724. private:
  14725. /** This class is not copyable or assignable. */
  14726. PdfXrefSubsec(const PdfXrefSubsec& rhs);
  14727. PdfXrefSubsec& operator=(const PdfXrefSubsec& rhs);
  14728. };
  14729. /** Returns map from class name (for example FzDocument) to s_num_instances. */
  14730. FZ_FUNCTION std::map<std::string, int> num_instances();
  14731. struct FzLinkIterator
  14732. {
  14733. FZ_FUNCTION FzLinkIterator(const FzLink& item);
  14734. FZ_FUNCTION FzLinkIterator& operator++();
  14735. FZ_FUNCTION bool operator==( const FzLinkIterator& rhs);
  14736. FZ_FUNCTION bool operator!=( const FzLinkIterator& rhs);
  14737. FZ_FUNCTION FzLink operator*();
  14738. FZ_FUNCTION FzLink* operator->();
  14739. private:
  14740. FzLink m_item;
  14741. };
  14742. struct FzStextBlockIterator
  14743. {
  14744. FZ_FUNCTION FzStextBlockIterator(const FzStextLine& item);
  14745. FZ_FUNCTION FzStextBlockIterator& operator++();
  14746. FZ_FUNCTION bool operator==( const FzStextBlockIterator& rhs);
  14747. FZ_FUNCTION bool operator!=( const FzStextBlockIterator& rhs);
  14748. FZ_FUNCTION FzStextLine operator*();
  14749. FZ_FUNCTION FzStextLine* operator->();
  14750. private:
  14751. FzStextLine m_item;
  14752. };
  14753. struct FzStextLineIterator
  14754. {
  14755. FZ_FUNCTION FzStextLineIterator(const FzStextChar& item);
  14756. FZ_FUNCTION FzStextLineIterator& operator++();
  14757. FZ_FUNCTION bool operator==( const FzStextLineIterator& rhs);
  14758. FZ_FUNCTION bool operator!=( const FzStextLineIterator& rhs);
  14759. FZ_FUNCTION FzStextChar operator*();
  14760. FZ_FUNCTION FzStextChar* operator->();
  14761. private:
  14762. FzStextChar m_item;
  14763. };
  14764. struct FzStextPageIterator
  14765. {
  14766. FZ_FUNCTION FzStextPageIterator(const FzStextBlock& item);
  14767. FZ_FUNCTION FzStextPageIterator& operator++();
  14768. FZ_FUNCTION bool operator==( const FzStextPageIterator& rhs);
  14769. FZ_FUNCTION bool operator!=( const FzStextPageIterator& rhs);
  14770. FZ_FUNCTION FzStextBlock operator*();
  14771. FZ_FUNCTION FzStextBlock* operator->();
  14772. private:
  14773. FzStextBlock m_item;
  14774. };
  14775. } /* End of namespace mupdf. */
  14776. /** mupdf::FzAaContext: writes underlying fz_aa_context's members, labelled and inside (...), to a stream. */
  14777. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzAaContext& rhs);
  14778. /** mupdf::FzAaContext: comparison function. */
  14779. FZ_FUNCTION bool operator==( const mupdf::FzAaContext& lhs, const mupdf::FzAaContext& rhs);
  14780. /** mupdf::FzAaContext: comparison function. */
  14781. FZ_FUNCTION bool operator!=( const mupdf::FzAaContext& lhs, const mupdf::FzAaContext& rhs);
  14782. /** mupdf::FzColorParams: writes underlying fz_color_params's members, labelled and inside (...), to a stream. */
  14783. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzColorParams& rhs);
  14784. /** mupdf::FzColorParams: comparison function. */
  14785. FZ_FUNCTION bool operator==( const mupdf::FzColorParams& lhs, const mupdf::FzColorParams& rhs);
  14786. /** mupdf::FzColorParams: comparison function. */
  14787. FZ_FUNCTION bool operator!=( const mupdf::FzColorParams& lhs, const mupdf::FzColorParams& rhs);
  14788. /** mupdf::FzCookie: writes underlying fz_cookie's members, labelled and inside (...), to a stream. */
  14789. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzCookie& rhs);
  14790. /** mupdf::FzCookie: comparison function. */
  14791. FZ_FUNCTION bool operator==( const mupdf::FzCookie& lhs, const mupdf::FzCookie& rhs);
  14792. /** mupdf::FzCookie: comparison function. */
  14793. FZ_FUNCTION bool operator!=( const mupdf::FzCookie& lhs, const mupdf::FzCookie& rhs);
  14794. /** mupdf::FzDrawOptions: writes underlying fz_draw_options's members, labelled and inside (...), to a stream. */
  14795. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzDrawOptions& rhs);
  14796. /** mupdf::FzDrawOptions: comparison function. */
  14797. FZ_FUNCTION bool operator==( const mupdf::FzDrawOptions& lhs, const mupdf::FzDrawOptions& rhs);
  14798. /** mupdf::FzDrawOptions: comparison function. */
  14799. FZ_FUNCTION bool operator!=( const mupdf::FzDrawOptions& lhs, const mupdf::FzDrawOptions& rhs);
  14800. /** mupdf::FzInstallLoadSystemFontFuncsArgs: writes underlying fz_install_load_system_font_funcs_args's members, labelled and inside (...), to a stream. */
  14801. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzInstallLoadSystemFontFuncsArgs& rhs);
  14802. /** mupdf::FzInstallLoadSystemFontFuncsArgs: comparison function. */
  14803. FZ_FUNCTION bool operator==( const mupdf::FzInstallLoadSystemFontFuncsArgs& lhs, const mupdf::FzInstallLoadSystemFontFuncsArgs& rhs);
  14804. /** mupdf::FzInstallLoadSystemFontFuncsArgs: comparison function. */
  14805. FZ_FUNCTION bool operator!=( const mupdf::FzInstallLoadSystemFontFuncsArgs& lhs, const mupdf::FzInstallLoadSystemFontFuncsArgs& rhs);
  14806. /** mupdf::FzIrect: writes underlying fz_irect's members, labelled and inside (...), to a stream. */
  14807. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzIrect& rhs);
  14808. /** mupdf::FzIrect: comparison function. */
  14809. FZ_FUNCTION bool operator==( const mupdf::FzIrect& lhs, const mupdf::FzIrect& rhs);
  14810. /** mupdf::FzIrect: comparison function. */
  14811. FZ_FUNCTION bool operator!=( const mupdf::FzIrect& lhs, const mupdf::FzIrect& rhs);
  14812. /** mupdf::FzLocation: writes underlying fz_location's members, labelled and inside (...), to a stream. */
  14813. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzLocation& rhs);
  14814. /** mupdf::FzLocation: comparison function. */
  14815. FZ_FUNCTION bool operator==( const mupdf::FzLocation& lhs, const mupdf::FzLocation& rhs);
  14816. /** mupdf::FzLocation: comparison function. */
  14817. FZ_FUNCTION bool operator!=( const mupdf::FzLocation& lhs, const mupdf::FzLocation& rhs);
  14818. /** mupdf::FzMatrix: writes underlying fz_matrix's members, labelled and inside (...), to a stream. */
  14819. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzMatrix& rhs);
  14820. /** mupdf::FzMatrix: comparison function. */
  14821. FZ_FUNCTION bool operator==( const mupdf::FzMatrix& lhs, const mupdf::FzMatrix& rhs);
  14822. /** mupdf::FzMatrix: comparison function. */
  14823. FZ_FUNCTION bool operator!=( const mupdf::FzMatrix& lhs, const mupdf::FzMatrix& rhs);
  14824. /** mupdf::FzMd5: writes underlying fz_md5's members, labelled and inside (...), to a stream. */
  14825. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzMd5& rhs);
  14826. /** mupdf::FzMd5: comparison function. */
  14827. FZ_FUNCTION bool operator==( const mupdf::FzMd5& lhs, const mupdf::FzMd5& rhs);
  14828. /** mupdf::FzMd5: comparison function. */
  14829. FZ_FUNCTION bool operator!=( const mupdf::FzMd5& lhs, const mupdf::FzMd5& rhs);
  14830. /** mupdf::FzPdfocrOptions: writes underlying fz_pdfocr_options's members, labelled and inside (...), to a stream. */
  14831. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzPdfocrOptions& rhs);
  14832. /** mupdf::FzPdfocrOptions: comparison function. */
  14833. FZ_FUNCTION bool operator==( const mupdf::FzPdfocrOptions& lhs, const mupdf::FzPdfocrOptions& rhs);
  14834. /** mupdf::FzPdfocrOptions: comparison function. */
  14835. FZ_FUNCTION bool operator!=( const mupdf::FzPdfocrOptions& lhs, const mupdf::FzPdfocrOptions& rhs);
  14836. /** mupdf::FzPoint: writes underlying fz_point's members, labelled and inside (...), to a stream. */
  14837. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzPoint& rhs);
  14838. /** mupdf::FzPoint: comparison function. */
  14839. FZ_FUNCTION bool operator==( const mupdf::FzPoint& lhs, const mupdf::FzPoint& rhs);
  14840. /** mupdf::FzPoint: comparison function. */
  14841. FZ_FUNCTION bool operator!=( const mupdf::FzPoint& lhs, const mupdf::FzPoint& rhs);
  14842. /** mupdf::FzPwgOptions: writes underlying fz_pwg_options's members, labelled and inside (...), to a stream. */
  14843. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzPwgOptions& rhs);
  14844. /** mupdf::FzPwgOptions: comparison function. */
  14845. FZ_FUNCTION bool operator==( const mupdf::FzPwgOptions& lhs, const mupdf::FzPwgOptions& rhs);
  14846. /** mupdf::FzPwgOptions: comparison function. */
  14847. FZ_FUNCTION bool operator!=( const mupdf::FzPwgOptions& lhs, const mupdf::FzPwgOptions& rhs);
  14848. /** mupdf::FzQuad: writes underlying fz_quad's members, labelled and inside (...), to a stream. */
  14849. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzQuad& rhs);
  14850. /** mupdf::FzQuad: comparison function. */
  14851. FZ_FUNCTION bool operator==( const mupdf::FzQuad& lhs, const mupdf::FzQuad& rhs);
  14852. /** mupdf::FzQuad: comparison function. */
  14853. FZ_FUNCTION bool operator!=( const mupdf::FzQuad& lhs, const mupdf::FzQuad& rhs);
  14854. /** mupdf::FzRect: writes underlying fz_rect's members, labelled and inside (...), to a stream. */
  14855. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzRect& rhs);
  14856. /** mupdf::FzRect: comparison function. */
  14857. FZ_FUNCTION bool operator==( const mupdf::FzRect& lhs, const mupdf::FzRect& rhs);
  14858. /** mupdf::FzRect: comparison function. */
  14859. FZ_FUNCTION bool operator!=( const mupdf::FzRect& lhs, const mupdf::FzRect& rhs);
  14860. /** mupdf::FzStextOptions: writes underlying fz_stext_options's members, labelled and inside (...), to a stream. */
  14861. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzStextOptions& rhs);
  14862. /** mupdf::FzStextOptions: comparison function. */
  14863. FZ_FUNCTION bool operator==( const mupdf::FzStextOptions& lhs, const mupdf::FzStextOptions& rhs);
  14864. /** mupdf::FzStextOptions: comparison function. */
  14865. FZ_FUNCTION bool operator!=( const mupdf::FzStextOptions& lhs, const mupdf::FzStextOptions& rhs);
  14866. /** mupdf::FzStoryElementPosition: writes underlying fz_story_element_position's members, labelled and inside (...), to a stream. */
  14867. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzStoryElementPosition& rhs);
  14868. /** mupdf::FzStoryElementPosition: comparison function. */
  14869. FZ_FUNCTION bool operator==( const mupdf::FzStoryElementPosition& lhs, const mupdf::FzStoryElementPosition& rhs);
  14870. /** mupdf::FzStoryElementPosition: comparison function. */
  14871. FZ_FUNCTION bool operator!=( const mupdf::FzStoryElementPosition& lhs, const mupdf::FzStoryElementPosition& rhs);
  14872. /** mupdf::FzTransition: writes underlying fz_transition's members, labelled and inside (...), to a stream. */
  14873. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::FzTransition& rhs);
  14874. /** mupdf::FzTransition: comparison function. */
  14875. FZ_FUNCTION bool operator==( const mupdf::FzTransition& lhs, const mupdf::FzTransition& rhs);
  14876. /** mupdf::FzTransition: comparison function. */
  14877. FZ_FUNCTION bool operator!=( const mupdf::FzTransition& lhs, const mupdf::FzTransition& rhs);
  14878. /** mupdf::PdfCleanOptions: writes underlying pdf_clean_options's members, labelled and inside (...), to a stream. */
  14879. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfCleanOptions& rhs);
  14880. /** mupdf::PdfCleanOptions: comparison function. */
  14881. FZ_FUNCTION bool operator==( const mupdf::PdfCleanOptions& lhs, const mupdf::PdfCleanOptions& rhs);
  14882. /** mupdf::PdfCleanOptions: comparison function. */
  14883. FZ_FUNCTION bool operator!=( const mupdf::PdfCleanOptions& lhs, const mupdf::PdfCleanOptions& rhs);
  14884. /** mupdf::PdfFilterFactory: writes underlying pdf_filter_factory's members, labelled and inside (...), to a stream. */
  14885. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfFilterFactory& rhs);
  14886. /** mupdf::PdfFilterFactory: comparison function. */
  14887. FZ_FUNCTION bool operator==( const mupdf::PdfFilterFactory& lhs, const mupdf::PdfFilterFactory& rhs);
  14888. /** mupdf::PdfFilterFactory: comparison function. */
  14889. FZ_FUNCTION bool operator!=( const mupdf::PdfFilterFactory& lhs, const mupdf::PdfFilterFactory& rhs);
  14890. /** mupdf::PdfFilterOptions: writes underlying pdf_filter_options's members, labelled and inside (...), to a stream. */
  14891. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfFilterOptions& rhs);
  14892. /** mupdf::PdfFilterOptions: comparison function. */
  14893. FZ_FUNCTION bool operator==( const mupdf::PdfFilterOptions& lhs, const mupdf::PdfFilterOptions& rhs);
  14894. /** mupdf::PdfFilterOptions: comparison function. */
  14895. FZ_FUNCTION bool operator!=( const mupdf::PdfFilterOptions& lhs, const mupdf::PdfFilterOptions& rhs);
  14896. /** mupdf::PdfImageRewriterOptions: writes underlying pdf_image_rewriter_options's members, labelled and inside (...), to a stream. */
  14897. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfImageRewriterOptions& rhs);
  14898. /** mupdf::PdfImageRewriterOptions: comparison function. */
  14899. FZ_FUNCTION bool operator==( const mupdf::PdfImageRewriterOptions& lhs, const mupdf::PdfImageRewriterOptions& rhs);
  14900. /** mupdf::PdfImageRewriterOptions: comparison function. */
  14901. FZ_FUNCTION bool operator!=( const mupdf::PdfImageRewriterOptions& lhs, const mupdf::PdfImageRewriterOptions& rhs);
  14902. /** mupdf::PdfLayerConfig: writes underlying pdf_layer_config's members, labelled and inside (...), to a stream. */
  14903. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfLayerConfig& rhs);
  14904. /** mupdf::PdfLayerConfig: comparison function. */
  14905. FZ_FUNCTION bool operator==( const mupdf::PdfLayerConfig& lhs, const mupdf::PdfLayerConfig& rhs);
  14906. /** mupdf::PdfLayerConfig: comparison function. */
  14907. FZ_FUNCTION bool operator!=( const mupdf::PdfLayerConfig& lhs, const mupdf::PdfLayerConfig& rhs);
  14908. /** mupdf::PdfLayerConfigUi: writes underlying pdf_layer_config_ui's members, labelled and inside (...), to a stream. */
  14909. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfLayerConfigUi& rhs);
  14910. /** mupdf::PdfLayerConfigUi: comparison function. */
  14911. FZ_FUNCTION bool operator==( const mupdf::PdfLayerConfigUi& lhs, const mupdf::PdfLayerConfigUi& rhs);
  14912. /** mupdf::PdfLayerConfigUi: comparison function. */
  14913. FZ_FUNCTION bool operator!=( const mupdf::PdfLayerConfigUi& lhs, const mupdf::PdfLayerConfigUi& rhs);
  14914. /** mupdf::PdfRecolorOptions: writes underlying pdf_recolor_options's members, labelled and inside (...), to a stream. */
  14915. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfRecolorOptions& rhs);
  14916. /** mupdf::PdfRecolorOptions: comparison function. */
  14917. FZ_FUNCTION bool operator==( const mupdf::PdfRecolorOptions& lhs, const mupdf::PdfRecolorOptions& rhs);
  14918. /** mupdf::PdfRecolorOptions: comparison function. */
  14919. FZ_FUNCTION bool operator!=( const mupdf::PdfRecolorOptions& lhs, const mupdf::PdfRecolorOptions& rhs);
  14920. /** mupdf::PdfRedactOptions: writes underlying pdf_redact_options's members, labelled and inside (...), to a stream. */
  14921. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfRedactOptions& rhs);
  14922. /** mupdf::PdfRedactOptions: comparison function. */
  14923. FZ_FUNCTION bool operator==( const mupdf::PdfRedactOptions& lhs, const mupdf::PdfRedactOptions& rhs);
  14924. /** mupdf::PdfRedactOptions: comparison function. */
  14925. FZ_FUNCTION bool operator!=( const mupdf::PdfRedactOptions& lhs, const mupdf::PdfRedactOptions& rhs);
  14926. /** mupdf::PdfSanitizeFilterOptions: writes underlying pdf_sanitize_filter_options's members, labelled and inside (...), to a stream. */
  14927. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfSanitizeFilterOptions& rhs);
  14928. /** mupdf::PdfSanitizeFilterOptions: comparison function. */
  14929. FZ_FUNCTION bool operator==( const mupdf::PdfSanitizeFilterOptions& lhs, const mupdf::PdfSanitizeFilterOptions& rhs);
  14930. /** mupdf::PdfSanitizeFilterOptions: comparison function. */
  14931. FZ_FUNCTION bool operator!=( const mupdf::PdfSanitizeFilterOptions& lhs, const mupdf::PdfSanitizeFilterOptions& rhs);
  14932. /** mupdf::PdfWriteOptions: writes underlying pdf_write_options's members, labelled and inside (...), to a stream. */
  14933. FZ_FUNCTION std::ostream& operator<< (std::ostream& out, const mupdf::PdfWriteOptions& rhs);
  14934. /** mupdf::PdfWriteOptions: comparison function. */
  14935. FZ_FUNCTION bool operator==( const mupdf::PdfWriteOptions& lhs, const mupdf::PdfWriteOptions& rhs);
  14936. /** mupdf::PdfWriteOptions: comparison function. */
  14937. FZ_FUNCTION bool operator!=( const mupdf::PdfWriteOptions& lhs, const mupdf::PdfWriteOptions& rhs);
  14938. #endif