png.h 143 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523
  1. /* png.h - header file for PNG reference library
  2. *
  3. * libpng version 1.2.18 - May 15, 2007
  4. * Copyright (c) 1998-2007 Glenn Randers-Pehrson
  5. * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  6. * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  7. *
  8. * Authors and maintainers:
  9. * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  10. * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
  11. * libpng versions 0.97, January 1998, through 1.2.18 - May 15, 2007: Glenn
  12. * See also "Contributing Authors", below.
  13. *
  14. * Note about libpng version numbers:
  15. *
  16. * Due to various miscommunications, unforeseen code incompatibilities
  17. * and occasional factors outside the authors' control, version numbering
  18. * on the library has not always been consistent and straightforward.
  19. * The following table summarizes matters since version 0.89c, which was
  20. * the first widely used release:
  21. *
  22. * source png.h png.h shared-lib
  23. * version string int version
  24. * ------- ------ ----- ----------
  25. * 0.89c "1.0 beta 3" 0.89 89 1.0.89
  26. * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
  27. * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
  28. * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
  29. * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
  30. * 0.97c 0.97 97 2.0.97
  31. * 0.98 0.98 98 2.0.98
  32. * 0.99 0.99 98 2.0.99
  33. * 0.99a-m 0.99 99 2.0.99
  34. * 1.00 1.00 100 2.1.0 [100 should be 10000]
  35. * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
  36. * 1.0.1 png.h string is 10001 2.1.0
  37. * 1.0.1a-e identical to the 10002 from here on, the shared library
  38. * 1.0.2 source version) 10002 is 2.V where V is the source code
  39. * 1.0.2a-b 10003 version, except as noted.
  40. * 1.0.3 10003
  41. * 1.0.3a-d 10004
  42. * 1.0.4 10004
  43. * 1.0.4a-f 10005
  44. * 1.0.5 (+ 2 patches) 10005
  45. * 1.0.5a-d 10006
  46. * 1.0.5e-r 10100 (not source compatible)
  47. * 1.0.5s-v 10006 (not binary compatible)
  48. * 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
  49. * 1.0.6d-f 10007 (still binary incompatible)
  50. * 1.0.6g 10007
  51. * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
  52. * 1.0.6i 10007 10.6i
  53. * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
  54. * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
  55. * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
  56. * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
  57. * 1.0.7 1 10007 (still compatible)
  58. * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
  59. * 1.0.8rc1 1 10008 2.1.0.8rc1
  60. * 1.0.8 1 10008 2.1.0.8
  61. * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
  62. * 1.0.9rc1 1 10009 2.1.0.9rc1
  63. * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
  64. * 1.0.9rc2 1 10009 2.1.0.9rc2
  65. * 1.0.9 1 10009 2.1.0.9
  66. * 1.0.10beta1 1 10010 2.1.0.10beta1
  67. * 1.0.10rc1 1 10010 2.1.0.10rc1
  68. * 1.0.10 1 10010 2.1.0.10
  69. * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
  70. * 1.0.11rc1 1 10011 2.1.0.11rc1
  71. * 1.0.11 1 10011 2.1.0.11
  72. * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
  73. * 1.0.12rc1 2 10012 2.1.0.12rc1
  74. * 1.0.12 2 10012 2.1.0.12
  75. * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
  76. * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
  77. * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
  78. * 1.2.0rc1 3 10200 3.1.2.0rc1
  79. * 1.2.0 3 10200 3.1.2.0
  80. * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
  81. * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
  82. * 1.2.1 3 10201 3.1.2.1
  83. * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
  84. * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
  85. * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
  86. * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
  87. * 1.0.13 10 10013 10.so.0.1.0.13
  88. * 1.2.2 12 10202 12.so.0.1.2.2
  89. * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
  90. * 1.2.3 12 10203 12.so.0.1.2.3
  91. * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
  92. * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
  93. * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
  94. * 1.0.14 10 10014 10.so.0.1.0.14
  95. * 1.2.4 13 10204 12.so.0.1.2.4
  96. * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
  97. * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
  98. * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
  99. * 1.0.15 10 10015 10.so.0.1.0.15
  100. * 1.2.5 13 10205 12.so.0.1.2.5
  101. * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
  102. * 1.0.16 10 10016 10.so.0.1.0.16
  103. * 1.2.6 13 10206 12.so.0.1.2.6
  104. * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
  105. * 1.0.17rc1 10 10017 10.so.0.1.0.17rc1
  106. * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
  107. * 1.0.17 10 10017 10.so.0.1.0.17
  108. * 1.2.7 13 10207 12.so.0.1.2.7
  109. * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
  110. * 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5
  111. * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
  112. * 1.0.18 10 10018 10.so.0.1.0.18
  113. * 1.2.8 13 10208 12.so.0.1.2.8
  114. * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
  115. * 1.2.9beta4-11 13 10209 12.so.0.9[.0]
  116. * 1.2.9rc1 13 10209 12.so.0.9[.0]
  117. * 1.2.9 13 10209 12.so.0.9[.0]
  118. * 1.2.10beta1-8 13 10210 12.so.0.10[.0]
  119. * 1.2.10rc1-3 13 10210 12.so.0.10[.0]
  120. * 1.2.10 13 10210 12.so.0.10[.0]
  121. * 1.2.11beta1-4 13 10211 12.so.0.11[.0]
  122. * 1.0.19rc1-5 10 10019 10.so.0.19[.0]
  123. * 1.2.11rc1-5 13 10211 12.so.0.11[.0]
  124. * 1.0.19 10 10019 10.so.0.19[.0]
  125. * 1.2.11 13 10211 12.so.0.11[.0]
  126. * 1.0.20 10 10020 10.so.0.20[.0]
  127. * 1.2.12 13 10212 12.so.0.12[.0]
  128. * 1.2.13beta1 13 10213 12.so.0.13[.0]
  129. * 1.0.21 10 10021 10.so.0.21[.0]
  130. * 1.2.13 13 10213 12.so.0.13[.0]
  131. * 1.2.14beta1-2 13 10214 12.so.0.14[.0]
  132. * 1.0.22rc1 10 10022 10.so.0.22[.0]
  133. * 1.2.14rc1 13 10214 12.so.0.14[.0]
  134. * 1.0.22 10 10022 10.so.0.22[.0]
  135. * 1.2.14 13 10214 12.so.0.14[.0]
  136. * 1.2.15beta1-6 13 10215 12.so.0.15[.0]
  137. * 1.0.23rc1-5 10 10023 10.so.0.23[.0]
  138. * 1.2.15rc1-5 13 10215 12.so.0.15[.0]
  139. * 1.0.23 10 10023 10.so.0.23[.0]
  140. * 1.2.15 13 10215 12.so.0.15[.0]
  141. * 1.2.16beta1-2 13 10216 12.so.0.16[.0]
  142. * 1.2.16rc1 13 10216 12.so.0.16[.0]
  143. * 1.0.24 10 10024 10.so.0.24[.0]
  144. * 1.2.16 13 10216 12.so.0.16[.0]
  145. * 1.2.17beta1-2 13 10217 12.so.0.17[.0]
  146. * 1.0.25rc1 10 10025 10.so.0.25[.0]
  147. * 1.2.17rc1-3 13 10217 12.so.0.17[.0]
  148. * 1.0.25 10 10025 10.so.0.25[.0]
  149. * 1.2.17 13 10217 12.so.0.17[.0]
  150. * 1.0.26 10 10026 10.so.0.26[.0]
  151. * 1.2.18 13 10218 12.so.0.18[.0]
  152. *
  153. * Henceforth the source version will match the shared-library major
  154. * and minor numbers; the shared-library major version number will be
  155. * used for changes in backward compatibility, as it is intended. The
  156. * PNG_LIBPNG_VER macro, which is not used within libpng but is available
  157. * for applications, is an unsigned integer of the form xyyzz corresponding
  158. * to the source version x.y.z (leading zeros in y and z). Beta versions
  159. * were given the previous public release number plus a letter, until
  160. * version 1.0.6j; from then on they were given the upcoming public
  161. * release number plus "betaNN" or "rcN".
  162. *
  163. * Binary incompatibility exists only when applications make direct access
  164. * to the info_ptr or png_ptr members through png.h, and the compiled
  165. * application is loaded with a different version of the library.
  166. *
  167. * DLLNUM will change each time there are forward or backward changes
  168. * in binary compatibility (e.g., when a new feature is added).
  169. *
  170. * See libpng.txt or libpng.3 for more information. The PNG specification
  171. * is available as a W3C Recommendation and as an ISO Specification,
  172. * <http://www.w3.org/TR/2003/REC-PNG-20031110/
  173. */
  174. /*
  175. * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
  176. *
  177. * If you modify libpng you may insert additional notices immediately following
  178. * this sentence.
  179. *
  180. * libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are
  181. * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
  182. * distributed according to the same disclaimer and license as libpng-1.2.5
  183. * with the following individual added to the list of Contributing Authors:
  184. *
  185. * Cosmin Truta
  186. *
  187. * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
  188. * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
  189. * distributed according to the same disclaimer and license as libpng-1.0.6
  190. * with the following individuals added to the list of Contributing Authors:
  191. *
  192. * Simon-Pierre Cadieux
  193. * Eric S. Raymond
  194. * Gilles Vollant
  195. *
  196. * and with the following additions to the disclaimer:
  197. *
  198. * There is no warranty against interference with your enjoyment of the
  199. * library or against infringement. There is no warranty that our
  200. * efforts or the library will fulfill any of your particular purposes
  201. * or needs. This library is provided with all faults, and the entire
  202. * risk of satisfactory quality, performance, accuracy, and effort is with
  203. * the user.
  204. *
  205. * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
  206. * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
  207. * distributed according to the same disclaimer and license as libpng-0.96,
  208. * with the following individuals added to the list of Contributing Authors:
  209. *
  210. * Tom Lane
  211. * Glenn Randers-Pehrson
  212. * Willem van Schaik
  213. *
  214. * libpng versions 0.89, June 1996, through 0.96, May 1997, are
  215. * Copyright (c) 1996, 1997 Andreas Dilger
  216. * Distributed according to the same disclaimer and license as libpng-0.88,
  217. * with the following individuals added to the list of Contributing Authors:
  218. *
  219. * John Bowler
  220. * Kevin Bracey
  221. * Sam Bushell
  222. * Magnus Holmgren
  223. * Greg Roelofs
  224. * Tom Tanner
  225. *
  226. * libpng versions 0.5, May 1995, through 0.88, January 1996, are
  227. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  228. *
  229. * For the purposes of this copyright and license, "Contributing Authors"
  230. * is defined as the following set of individuals:
  231. *
  232. * Andreas Dilger
  233. * Dave Martindale
  234. * Guy Eric Schalnat
  235. * Paul Schmidt
  236. * Tim Wegner
  237. *
  238. * The PNG Reference Library is supplied "AS IS". The Contributing Authors
  239. * and Group 42, Inc. disclaim all warranties, expressed or implied,
  240. * including, without limitation, the warranties of merchantability and of
  241. * fitness for any purpose. The Contributing Authors and Group 42, Inc.
  242. * assume no liability for direct, indirect, incidental, special, exemplary,
  243. * or consequential damages, which may result from the use of the PNG
  244. * Reference Library, even if advised of the possibility of such damage.
  245. *
  246. * Permission is hereby granted to use, copy, modify, and distribute this
  247. * source code, or portions hereof, for any purpose, without fee, subject
  248. * to the following restrictions:
  249. *
  250. * 1. The origin of this source code must not be misrepresented.
  251. *
  252. * 2. Altered versions must be plainly marked as such and
  253. * must not be misrepresented as being the original source.
  254. *
  255. * 3. This Copyright notice may not be removed or altered from
  256. * any source or altered source distribution.
  257. *
  258. * The Contributing Authors and Group 42, Inc. specifically permit, without
  259. * fee, and encourage the use of this source code as a component to
  260. * supporting the PNG file format in commercial products. If you use this
  261. * source code in a product, acknowledgment is not required but would be
  262. * appreciated.
  263. */
  264. /*
  265. * A "png_get_copyright" function is available, for convenient use in "about"
  266. * boxes and the like:
  267. *
  268. * printf("%s",png_get_copyright(NULL));
  269. *
  270. * Also, the PNG logo (in PNG format, of course) is supplied in the
  271. * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
  272. */
  273. /*
  274. * Libpng is OSI Certified Open Source Software. OSI Certified is a
  275. * certification mark of the Open Source Initiative.
  276. */
  277. /*
  278. * The contributing authors would like to thank all those who helped
  279. * with testing, bug fixes, and patience. This wouldn't have been
  280. * possible without all of you.
  281. *
  282. * Thanks to Frank J. T. Wojcik for helping with the documentation.
  283. */
  284. /*
  285. * Y2K compliance in libpng:
  286. * =========================
  287. *
  288. * May 15, 2007
  289. *
  290. * Since the PNG Development group is an ad-hoc body, we can't make
  291. * an official declaration.
  292. *
  293. * This is your unofficial assurance that libpng from version 0.71 and
  294. * upward through 1.2.18 are Y2K compliant. It is my belief that earlier
  295. * versions were also Y2K compliant.
  296. *
  297. * Libpng only has three year fields. One is a 2-byte unsigned integer
  298. * that will hold years up to 65535. The other two hold the date in text
  299. * format, and will hold years up to 9999.
  300. *
  301. * The integer is
  302. * "png_uint_16 year" in png_time_struct.
  303. *
  304. * The strings are
  305. * "png_charp time_buffer" in png_struct and
  306. * "near_time_buffer", which is a local character string in png.c.
  307. *
  308. * There are seven time-related functions:
  309. * png.c: png_convert_to_rfc_1123() in png.c
  310. * (formerly png_convert_to_rfc_1152() in error)
  311. * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
  312. * png_convert_from_time_t() in pngwrite.c
  313. * png_get_tIME() in pngget.c
  314. * png_handle_tIME() in pngrutil.c, called in pngread.c
  315. * png_set_tIME() in pngset.c
  316. * png_write_tIME() in pngwutil.c, called in pngwrite.c
  317. *
  318. * All handle dates properly in a Y2K environment. The
  319. * png_convert_from_time_t() function calls gmtime() to convert from system
  320. * clock time, which returns (year - 1900), which we properly convert to
  321. * the full 4-digit year. There is a possibility that applications using
  322. * libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
  323. * function, or that they are incorrectly passing only a 2-digit year
  324. * instead of "year - 1900" into the png_convert_from_struct_tm() function,
  325. * but this is not under our control. The libpng documentation has always
  326. * stated that it works with 4-digit years, and the APIs have been
  327. * documented as such.
  328. *
  329. * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
  330. * integer to hold the year, and can hold years as large as 65535.
  331. *
  332. * zlib, upon which libpng depends, is also Y2K compliant. It contains
  333. * no date-related code.
  334. *
  335. * Glenn Randers-Pehrson
  336. * libpng maintainer
  337. * PNG Development Group
  338. */
  339. #ifndef PNG_H
  340. #define PNG_H
  341. /* This is not the place to learn how to use libpng. The file libpng.txt
  342. * describes how to use libpng, and the file example.c summarizes it
  343. * with some code on which to build. This file is useful for looking
  344. * at the actual function definitions and structure components.
  345. */
  346. /* Version information for png.h - this should match the version in png.c */
  347. #define PNG_LIBPNG_VER_STRING "1.2.18"
  348. #define PNG_HEADER_VERSION_STRING \
  349. " libpng version 1.2.18 - May 15, 2007 (header)\n"
  350. #define PNG_LIBPNG_VER_SONUM 0
  351. #define PNG_LIBPNG_VER_DLLNUM 13
  352. /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
  353. #define PNG_LIBPNG_VER_MAJOR 1
  354. #define PNG_LIBPNG_VER_MINOR 2
  355. #define PNG_LIBPNG_VER_RELEASE 18
  356. /* This should match the numeric part of the final component of
  357. * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
  358. #define PNG_LIBPNG_VER_BUILD 0
  359. /* Release Status */
  360. #define PNG_LIBPNG_BUILD_ALPHA 1
  361. #define PNG_LIBPNG_BUILD_BETA 2
  362. #define PNG_LIBPNG_BUILD_RC 3
  363. #define PNG_LIBPNG_BUILD_STABLE 4
  364. #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
  365. /* Release-Specific Flags */
  366. #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with
  367. PNG_LIBPNG_BUILD_STABLE only */
  368. #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
  369. PNG_LIBPNG_BUILD_SPECIAL */
  370. #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
  371. PNG_LIBPNG_BUILD_PRIVATE */
  372. #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
  373. /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
  374. * We must not include leading zeros.
  375. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
  376. * version 1.0.0 was mis-numbered 100 instead of 10000). From
  377. * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
  378. #define PNG_LIBPNG_VER 10218 /* 1.2.18 */
  379. #ifndef PNG_VERSION_INFO_ONLY
  380. /* include the compression library's header */
  381. #include "zlib.h"
  382. #endif
  383. /* include all user configurable info, including optional assembler routines */
  384. #include "pngconf.h"
  385. /*
  386. * Added at libpng-1.2.8 */
  387. /* Ref MSDN: Private as priority over Special
  388. * VS_FF_PRIVATEBUILD File *was not* built using standard release
  389. * procedures. If this value is given, the StringFileInfo block must
  390. * contain a PrivateBuild string.
  391. *
  392. * VS_FF_SPECIALBUILD File *was* built by the original company using
  393. * standard release procedures but is a variation of the standard
  394. * file of the same version number. If this value is given, the
  395. * StringFileInfo block must contain a SpecialBuild string.
  396. */
  397. #if defined(PNG_USER_PRIVATEBUILD)
  398. # define PNG_LIBPNG_BUILD_TYPE \
  399. (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
  400. #else
  401. # if defined(PNG_LIBPNG_SPECIALBUILD)
  402. # define PNG_LIBPNG_BUILD_TYPE \
  403. (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
  404. # else
  405. # define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
  406. # endif
  407. #endif
  408. #ifndef PNG_VERSION_INFO_ONLY
  409. /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
  410. #ifdef __cplusplus
  411. extern "C" {
  412. #endif /* __cplusplus */
  413. /* This file is arranged in several sections. The first section contains
  414. * structure and type definitions. The second section contains the external
  415. * library functions, while the third has the internal library functions,
  416. * which applications aren't expected to use directly.
  417. */
  418. #ifndef PNG_NO_TYPECAST_NULL
  419. #define int_p_NULL (int *)NULL
  420. #define png_bytep_NULL (png_bytep)NULL
  421. #define png_bytepp_NULL (png_bytepp)NULL
  422. #define png_doublep_NULL (png_doublep)NULL
  423. #define png_error_ptr_NULL (png_error_ptr)NULL
  424. #define png_flush_ptr_NULL (png_flush_ptr)NULL
  425. #define png_free_ptr_NULL (png_free_ptr)NULL
  426. #define png_infopp_NULL (png_infopp)NULL
  427. #define png_malloc_ptr_NULL (png_malloc_ptr)NULL
  428. #define png_read_status_ptr_NULL (png_read_status_ptr)NULL
  429. #define png_rw_ptr_NULL (png_rw_ptr)NULL
  430. #define png_structp_NULL (png_structp)NULL
  431. #define png_uint_16p_NULL (png_uint_16p)NULL
  432. #define png_voidp_NULL (png_voidp)NULL
  433. #define png_write_status_ptr_NULL (png_write_status_ptr)NULL
  434. #else
  435. #define int_p_NULL NULL
  436. #define png_bytep_NULL NULL
  437. #define png_bytepp_NULL NULL
  438. #define png_doublep_NULL NULL
  439. #define png_error_ptr_NULL NULL
  440. #define png_flush_ptr_NULL NULL
  441. #define png_free_ptr_NULL NULL
  442. #define png_infopp_NULL NULL
  443. #define png_malloc_ptr_NULL NULL
  444. #define png_read_status_ptr_NULL NULL
  445. #define png_rw_ptr_NULL NULL
  446. #define png_structp_NULL NULL
  447. #define png_uint_16p_NULL NULL
  448. #define png_voidp_NULL NULL
  449. #define png_write_status_ptr_NULL NULL
  450. #endif
  451. /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
  452. #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
  453. /* Version information for C files, stored in png.c. This had better match
  454. * the version above.
  455. */
  456. #ifdef PNG_USE_GLOBAL_ARRAYS
  457. PNG_EXPORT_VAR (const char) png_libpng_ver[18];
  458. /* need room for 99.99.99beta99z */
  459. #else
  460. #define png_libpng_ver png_get_header_ver(NULL)
  461. #endif
  462. #ifdef PNG_USE_GLOBAL_ARRAYS
  463. /* This was removed in version 1.0.5c */
  464. /* Structures to facilitate easy interlacing. See png.c for more details */
  465. PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7];
  466. PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7];
  467. PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7];
  468. PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7];
  469. PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7];
  470. PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7];
  471. #ifdef PNG_USE_PNGGCCRD
  472. PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7];
  473. #endif
  474. /* This isn't currently used. If you need it, see png.c for more details.
  475. PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7];
  476. */
  477. #endif
  478. #endif /* PNG_NO_EXTERN */
  479. /* Three color definitions. The order of the red, green, and blue, (and the
  480. * exact size) is not important, although the size of the fields need to
  481. * be png_byte or png_uint_16 (as defined below).
  482. */
  483. typedef struct png_color_struct
  484. {
  485. png_byte red;
  486. png_byte green;
  487. png_byte blue;
  488. } png_color;
  489. typedef png_color FAR * png_colorp;
  490. typedef png_color FAR * FAR * png_colorpp;
  491. typedef struct png_color_16_struct
  492. {
  493. png_byte index; /* used for palette files */
  494. png_uint_16 red; /* for use in red green blue files */
  495. png_uint_16 green;
  496. png_uint_16 blue;
  497. png_uint_16 gray; /* for use in grayscale files */
  498. } png_color_16;
  499. typedef png_color_16 FAR * png_color_16p;
  500. typedef png_color_16 FAR * FAR * png_color_16pp;
  501. typedef struct png_color_8_struct
  502. {
  503. png_byte red; /* for use in red green blue files */
  504. png_byte green;
  505. png_byte blue;
  506. png_byte gray; /* for use in grayscale files */
  507. png_byte alpha; /* for alpha channel files */
  508. } png_color_8;
  509. typedef png_color_8 FAR * png_color_8p;
  510. typedef png_color_8 FAR * FAR * png_color_8pp;
  511. /*
  512. * The following two structures are used for the in-core representation
  513. * of sPLT chunks.
  514. */
  515. typedef struct png_sPLT_entry_struct
  516. {
  517. png_uint_16 red;
  518. png_uint_16 green;
  519. png_uint_16 blue;
  520. png_uint_16 alpha;
  521. png_uint_16 frequency;
  522. } png_sPLT_entry;
  523. typedef png_sPLT_entry FAR * png_sPLT_entryp;
  524. typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
  525. /* When the depth of the sPLT palette is 8 bits, the color and alpha samples
  526. * occupy the LSB of their respective members, and the MSB of each member
  527. * is zero-filled. The frequency member always occupies the full 16 bits.
  528. */
  529. typedef struct png_sPLT_struct
  530. {
  531. png_charp name; /* palette name */
  532. png_byte depth; /* depth of palette samples */
  533. png_sPLT_entryp entries; /* palette entries */
  534. png_int_32 nentries; /* number of palette entries */
  535. } png_sPLT_t;
  536. typedef png_sPLT_t FAR * png_sPLT_tp;
  537. typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
  538. #ifdef PNG_TEXT_SUPPORTED
  539. /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
  540. * and whether that contents is compressed or not. The "key" field
  541. * points to a regular zero-terminated C string. The "text", "lang", and
  542. * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
  543. * However, the * structure returned by png_get_text() will always contain
  544. * regular zero-terminated C strings (possibly empty), never NULL pointers,
  545. * so they can be safely used in printf() and other string-handling functions.
  546. */
  547. typedef struct png_text_struct
  548. {
  549. int compression; /* compression value:
  550. -1: tEXt, none
  551. 0: zTXt, deflate
  552. 1: iTXt, none
  553. 2: iTXt, deflate */
  554. png_charp key; /* keyword, 1-79 character description of "text" */
  555. png_charp text; /* comment, may be an empty string (ie "")
  556. or a NULL pointer */
  557. png_size_t text_length; /* length of the text string */
  558. #ifdef PNG_iTXt_SUPPORTED
  559. png_size_t itxt_length; /* length of the itxt string */
  560. png_charp lang; /* language code, 0-79 characters
  561. or a NULL pointer */
  562. png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
  563. chars or a NULL pointer */
  564. #endif
  565. } png_text;
  566. typedef png_text FAR * png_textp;
  567. typedef png_text FAR * FAR * png_textpp;
  568. #endif
  569. /* Supported compression types for text in PNG files (tEXt, and zTXt).
  570. * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
  571. #define PNG_TEXT_COMPRESSION_NONE_WR -3
  572. #define PNG_TEXT_COMPRESSION_zTXt_WR -2
  573. #define PNG_TEXT_COMPRESSION_NONE -1
  574. #define PNG_TEXT_COMPRESSION_zTXt 0
  575. #define PNG_ITXT_COMPRESSION_NONE 1
  576. #define PNG_ITXT_COMPRESSION_zTXt 2
  577. #define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */
  578. /* png_time is a way to hold the time in an machine independent way.
  579. * Two conversions are provided, both from time_t and struct tm. There
  580. * is no portable way to convert to either of these structures, as far
  581. * as I know. If you know of a portable way, send it to me. As a side
  582. * note - PNG has always been Year 2000 compliant!
  583. */
  584. typedef struct png_time_struct
  585. {
  586. png_uint_16 year; /* full year, as in, 1995 */
  587. png_byte month; /* month of year, 1 - 12 */
  588. png_byte day; /* day of month, 1 - 31 */
  589. png_byte hour; /* hour of day, 0 - 23 */
  590. png_byte minute; /* minute of hour, 0 - 59 */
  591. png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
  592. } png_time;
  593. typedef png_time FAR * png_timep;
  594. typedef png_time FAR * FAR * png_timepp;
  595. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
  596. /* png_unknown_chunk is a structure to hold queued chunks for which there is
  597. * no specific support. The idea is that we can use this to queue
  598. * up private chunks for output even though the library doesn't actually
  599. * know about their semantics.
  600. */
  601. typedef struct png_unknown_chunk_t
  602. {
  603. png_byte name[5];
  604. png_byte *data;
  605. png_size_t size;
  606. /* libpng-using applications should NOT directly modify this byte. */
  607. png_byte location; /* mode of operation at read time */
  608. }
  609. png_unknown_chunk;
  610. typedef png_unknown_chunk FAR * png_unknown_chunkp;
  611. typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
  612. #endif
  613. /* png_info is a structure that holds the information in a PNG file so
  614. * that the application can find out the characteristics of the image.
  615. * If you are reading the file, this structure will tell you what is
  616. * in the PNG file. If you are writing the file, fill in the information
  617. * you want to put into the PNG file, then call png_write_info().
  618. * The names chosen should be very close to the PNG specification, so
  619. * consult that document for information about the meaning of each field.
  620. *
  621. * With libpng < 0.95, it was only possible to directly set and read the
  622. * the values in the png_info_struct, which meant that the contents and
  623. * order of the values had to remain fixed. With libpng 0.95 and later,
  624. * however, there are now functions that abstract the contents of
  625. * png_info_struct from the application, so this makes it easier to use
  626. * libpng with dynamic libraries, and even makes it possible to use
  627. * libraries that don't have all of the libpng ancillary chunk-handing
  628. * functionality.
  629. *
  630. * In any case, the order of the parameters in png_info_struct should NOT
  631. * be changed for as long as possible to keep compatibility with applications
  632. * that use the old direct-access method with png_info_struct.
  633. *
  634. * The following members may have allocated storage attached that should be
  635. * cleaned up before the structure is discarded: palette, trans, text,
  636. * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
  637. * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
  638. * are automatically freed when the info structure is deallocated, if they were
  639. * allocated internally by libpng. This behavior can be changed by means
  640. * of the png_data_freer() function.
  641. *
  642. * More allocation details: all the chunk-reading functions that
  643. * change these members go through the corresponding png_set_*
  644. * functions. A function to clear these members is available: see
  645. * png_free_data(). The png_set_* functions do not depend on being
  646. * able to point info structure members to any of the storage they are
  647. * passed (they make their own copies), EXCEPT that the png_set_text
  648. * functions use the same storage passed to them in the text_ptr or
  649. * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
  650. * functions do not make their own copies.
  651. */
  652. typedef struct png_info_struct
  653. {
  654. /* the following are necessary for every PNG file */
  655. png_uint_32 width; /* width of image in pixels (from IHDR) */
  656. png_uint_32 height; /* height of image in pixels (from IHDR) */
  657. png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
  658. png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */
  659. png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
  660. png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
  661. png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
  662. png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
  663. png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
  664. /* The following three should have been named *_method not *_type */
  665. png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
  666. png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
  667. png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  668. /* The following is informational only on read, and not used on writes. */
  669. png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
  670. png_byte pixel_depth; /* number of bits per pixel */
  671. png_byte spare_byte; /* to align the data, and for future use */
  672. png_byte signature[8]; /* magic bytes read by libpng from start of file */
  673. /* The rest of the data is optional. If you are reading, check the
  674. * valid field to see if the information in these are valid. If you
  675. * are writing, set the valid field to those chunks you want written,
  676. * and initialize the appropriate fields below.
  677. */
  678. #if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
  679. /* The gAMA chunk describes the gamma characteristics of the system
  680. * on which the image was created, normally in the range [1.0, 2.5].
  681. * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
  682. */
  683. float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
  684. #endif
  685. #if defined(PNG_sRGB_SUPPORTED)
  686. /* GR-P, 0.96a */
  687. /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
  688. png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
  689. #endif
  690. #if defined(PNG_TEXT_SUPPORTED)
  691. /* The tEXt, and zTXt chunks contain human-readable textual data in
  692. * uncompressed, compressed, and optionally compressed forms, respectively.
  693. * The data in "text" is an array of pointers to uncompressed,
  694. * null-terminated C strings. Each chunk has a keyword that describes the
  695. * textual data contained in that chunk. Keywords are not required to be
  696. * unique, and the text string may be empty. Any number of text chunks may
  697. * be in an image.
  698. */
  699. int num_text; /* number of comments read/to write */
  700. int max_text; /* current size of text array */
  701. png_textp text; /* array of comments read/to write */
  702. #endif /* PNG_TEXT_SUPPORTED */
  703. #if defined(PNG_tIME_SUPPORTED)
  704. /* The tIME chunk holds the last time the displayed image data was
  705. * modified. See the png_time struct for the contents of this struct.
  706. */
  707. png_time mod_time;
  708. #endif
  709. #if defined(PNG_sBIT_SUPPORTED)
  710. /* The sBIT chunk specifies the number of significant high-order bits
  711. * in the pixel data. Values are in the range [1, bit_depth], and are
  712. * only specified for the channels in the pixel data. The contents of
  713. * the low-order bits is not specified. Data is valid if
  714. * (valid & PNG_INFO_sBIT) is non-zero.
  715. */
  716. png_color_8 sig_bit; /* significant bits in color channels */
  717. #endif
  718. #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
  719. defined(PNG_READ_BACKGROUND_SUPPORTED)
  720. /* The tRNS chunk supplies transparency data for paletted images and
  721. * other image types that don't need a full alpha channel. There are
  722. * "num_trans" transparency values for a paletted image, stored in the
  723. * same order as the palette colors, starting from index 0. Values
  724. * for the data are in the range [0, 255], ranging from fully transparent
  725. * to fully opaque, respectively. For non-paletted images, there is a
  726. * single color specified that should be treated as fully transparent.
  727. * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
  728. */
  729. png_bytep trans; /* transparent values for paletted image */
  730. png_color_16 trans_values; /* transparent color for non-palette image */
  731. #endif
  732. #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  733. /* The bKGD chunk gives the suggested image background color if the
  734. * display program does not have its own background color and the image
  735. * is needs to composited onto a background before display. The colors
  736. * in "background" are normally in the same color space/depth as the
  737. * pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
  738. */
  739. png_color_16 background;
  740. #endif
  741. #if defined(PNG_oFFs_SUPPORTED)
  742. /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
  743. * and downwards from the top-left corner of the display, page, or other
  744. * application-specific co-ordinate space. See the PNG_OFFSET_ defines
  745. * below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
  746. */
  747. png_int_32 x_offset; /* x offset on page */
  748. png_int_32 y_offset; /* y offset on page */
  749. png_byte offset_unit_type; /* offset units type */
  750. #endif
  751. #if defined(PNG_pHYs_SUPPORTED)
  752. /* The pHYs chunk gives the physical pixel density of the image for
  753. * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
  754. * defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
  755. */
  756. png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
  757. png_uint_32 y_pixels_per_unit; /* vertical pixel density */
  758. png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
  759. #endif
  760. #if defined(PNG_hIST_SUPPORTED)
  761. /* The hIST chunk contains the relative frequency or importance of the
  762. * various palette entries, so that a viewer can intelligently select a
  763. * reduced-color palette, if required. Data is an array of "num_palette"
  764. * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
  765. * is non-zero.
  766. */
  767. png_uint_16p hist;
  768. #endif
  769. #ifdef PNG_cHRM_SUPPORTED
  770. /* The cHRM chunk describes the CIE color characteristics of the monitor
  771. * on which the PNG was created. This data allows the viewer to do gamut
  772. * mapping of the input image to ensure that the viewer sees the same
  773. * colors in the image as the creator. Values are in the range
  774. * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
  775. */
  776. #ifdef PNG_FLOATING_POINT_SUPPORTED
  777. float x_white;
  778. float y_white;
  779. float x_red;
  780. float y_red;
  781. float x_green;
  782. float y_green;
  783. float x_blue;
  784. float y_blue;
  785. #endif
  786. #endif
  787. #if defined(PNG_pCAL_SUPPORTED)
  788. /* The pCAL chunk describes a transformation between the stored pixel
  789. * values and original physical data values used to create the image.
  790. * The integer range [0, 2^bit_depth - 1] maps to the floating-point
  791. * range given by [pcal_X0, pcal_X1], and are further transformed by a
  792. * (possibly non-linear) transformation function given by "pcal_type"
  793. * and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
  794. * defines below, and the PNG-Group's PNG extensions document for a
  795. * complete description of the transformations and how they should be
  796. * implemented, and for a description of the ASCII parameter strings.
  797. * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
  798. */
  799. png_charp pcal_purpose; /* pCAL chunk description string */
  800. png_int_32 pcal_X0; /* minimum value */
  801. png_int_32 pcal_X1; /* maximum value */
  802. png_charp pcal_units; /* Latin-1 string giving physical units */
  803. png_charpp pcal_params; /* ASCII strings containing parameter values */
  804. png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
  805. png_byte pcal_nparams; /* number of parameters given in pcal_params */
  806. #endif
  807. /* New members added in libpng-1.0.6 */
  808. #ifdef PNG_FREE_ME_SUPPORTED
  809. png_uint_32 free_me; /* flags items libpng is responsible for freeing */
  810. #endif
  811. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
  812. /* storage for unknown chunks that the library doesn't recognize. */
  813. png_unknown_chunkp unknown_chunks;
  814. png_size_t unknown_chunks_num;
  815. #endif
  816. #if defined(PNG_iCCP_SUPPORTED)
  817. /* iCCP chunk data. */
  818. png_charp iccp_name; /* profile name */
  819. png_charp iccp_profile; /* International Color Consortium profile data */
  820. /* Note to maintainer: should be png_bytep */
  821. png_uint_32 iccp_proflen; /* ICC profile data length */
  822. png_byte iccp_compression; /* Always zero */
  823. #endif
  824. #if defined(PNG_sPLT_SUPPORTED)
  825. /* data on sPLT chunks (there may be more than one). */
  826. png_sPLT_tp splt_palettes;
  827. png_uint_32 splt_palettes_num;
  828. #endif
  829. #if defined(PNG_sCAL_SUPPORTED)
  830. /* The sCAL chunk describes the actual physical dimensions of the
  831. * subject matter of the graphic. The chunk contains a unit specification
  832. * a byte value, and two ASCII strings representing floating-point
  833. * values. The values are width and height corresponsing to one pixel
  834. * in the image. This external representation is converted to double
  835. * here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
  836. */
  837. png_byte scal_unit; /* unit of physical scale */
  838. #ifdef PNG_FLOATING_POINT_SUPPORTED
  839. double scal_pixel_width; /* width of one pixel */
  840. double scal_pixel_height; /* height of one pixel */
  841. #endif
  842. #ifdef PNG_FIXED_POINT_SUPPORTED
  843. png_charp scal_s_width; /* string containing height */
  844. png_charp scal_s_height; /* string containing width */
  845. #endif
  846. #endif
  847. #if defined(PNG_INFO_IMAGE_SUPPORTED)
  848. /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
  849. /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
  850. png_bytepp row_pointers; /* the image bits */
  851. #endif
  852. #if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
  853. png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
  854. #endif
  855. #if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
  856. png_fixed_point int_x_white;
  857. png_fixed_point int_y_white;
  858. png_fixed_point int_x_red;
  859. png_fixed_point int_y_red;
  860. png_fixed_point int_x_green;
  861. png_fixed_point int_y_green;
  862. png_fixed_point int_x_blue;
  863. png_fixed_point int_y_blue;
  864. #endif
  865. } png_info;
  866. typedef png_info FAR * png_infop;
  867. typedef png_info FAR * FAR * png_infopp;
  868. /* Maximum positive integer used in PNG is (2^31)-1 */
  869. #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  870. #define PNG_UINT_32_MAX ((png_uint_32)(-1))
  871. #define PNG_SIZE_MAX ((png_size_t)(-1))
  872. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  873. /* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
  874. #define PNG_MAX_UINT PNG_UINT_31_MAX
  875. #endif
  876. /* These describe the color_type field in png_info. */
  877. /* color type masks */
  878. #define PNG_COLOR_MASK_PALETTE 1
  879. #define PNG_COLOR_MASK_COLOR 2
  880. #define PNG_COLOR_MASK_ALPHA 4
  881. /* color types. Note that not all combinations are legal */
  882. #define PNG_COLOR_TYPE_GRAY 0
  883. #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  884. #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
  885. #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  886. #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  887. /* aliases */
  888. #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA
  889. #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA
  890. /* This is for compression type. PNG 1.0-1.2 only define the single type. */
  891. #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
  892. #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
  893. /* This is for filter type. PNG 1.0-1.2 only define the single type. */
  894. #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */
  895. #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
  896. #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
  897. /* These are for the interlacing type. These values should NOT be changed. */
  898. #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */
  899. #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */
  900. #define PNG_INTERLACE_LAST 2 /* Not a valid value */
  901. /* These are for the oFFs chunk. These values should NOT be changed. */
  902. #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */
  903. #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */
  904. #define PNG_OFFSET_LAST 2 /* Not a valid value */
  905. /* These are for the pCAL chunk. These values should NOT be changed. */
  906. #define PNG_EQUATION_LINEAR 0 /* Linear transformation */
  907. #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */
  908. #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */
  909. #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */
  910. #define PNG_EQUATION_LAST 4 /* Not a valid value */
  911. /* These are for the sCAL chunk. These values should NOT be changed. */
  912. #define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */
  913. #define PNG_SCALE_METER 1 /* meters per pixel */
  914. #define PNG_SCALE_RADIAN 2 /* radians per pixel */
  915. #define PNG_SCALE_LAST 3 /* Not a valid value */
  916. /* These are for the pHYs chunk. These values should NOT be changed. */
  917. #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */
  918. #define PNG_RESOLUTION_METER 1 /* pixels/meter */
  919. #define PNG_RESOLUTION_LAST 2 /* Not a valid value */
  920. /* These are for the sRGB chunk. These values should NOT be changed. */
  921. #define PNG_sRGB_INTENT_PERCEPTUAL 0
  922. #define PNG_sRGB_INTENT_RELATIVE 1
  923. #define PNG_sRGB_INTENT_SATURATION 2
  924. #define PNG_sRGB_INTENT_ABSOLUTE 3
  925. #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */
  926. /* This is for text chunks */
  927. #define PNG_KEYWORD_MAX_LENGTH 79
  928. /* Maximum number of entries in PLTE/sPLT/tRNS arrays */
  929. #define PNG_MAX_PALETTE_LENGTH 256
  930. /* These determine if an ancillary chunk's data has been successfully read
  931. * from the PNG header, or if the application has filled in the corresponding
  932. * data in the info_struct to be written into the output file. The values
  933. * of the PNG_INFO_<chunk> defines should NOT be changed.
  934. */
  935. #define PNG_INFO_gAMA 0x0001
  936. #define PNG_INFO_sBIT 0x0002
  937. #define PNG_INFO_cHRM 0x0004
  938. #define PNG_INFO_PLTE 0x0008
  939. #define PNG_INFO_tRNS 0x0010
  940. #define PNG_INFO_bKGD 0x0020
  941. #define PNG_INFO_hIST 0x0040
  942. #define PNG_INFO_pHYs 0x0080
  943. #define PNG_INFO_oFFs 0x0100
  944. #define PNG_INFO_tIME 0x0200
  945. #define PNG_INFO_pCAL 0x0400
  946. #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
  947. #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
  948. #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
  949. #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
  950. #define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */
  951. /* This is used for the transformation routines, as some of them
  952. * change these values for the row. It also should enable using
  953. * the routines for other purposes.
  954. */
  955. typedef struct png_row_info_struct
  956. {
  957. png_uint_32 width; /* width of row */
  958. png_uint_32 rowbytes; /* number of bytes in row */
  959. png_byte color_type; /* color type of row */
  960. png_byte bit_depth; /* bit depth of row */
  961. png_byte channels; /* number of channels (1, 2, 3, or 4) */
  962. png_byte pixel_depth; /* bits per pixel (depth * channels) */
  963. } png_row_info;
  964. typedef png_row_info FAR * png_row_infop;
  965. typedef png_row_info FAR * FAR * png_row_infopp;
  966. /* These are the function types for the I/O functions and for the functions
  967. * that allow the user to override the default I/O functions with his or her
  968. * own. The png_error_ptr type should match that of user-supplied warning
  969. * and error functions, while the png_rw_ptr type should match that of the
  970. * user read/write data functions.
  971. */
  972. typedef struct png_struct_def png_struct;
  973. typedef png_struct FAR * png_structp;
  974. typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
  975. typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
  976. typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
  977. typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
  978. int));
  979. typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
  980. int));
  981. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  982. typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
  983. typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
  984. typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
  985. png_uint_32, int));
  986. #endif
  987. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  988. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
  989. defined(PNG_LEGACY_SUPPORTED)
  990. typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
  991. png_row_infop, png_bytep));
  992. #endif
  993. #if defined(PNG_USER_CHUNKS_SUPPORTED)
  994. typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
  995. #endif
  996. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
  997. typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
  998. #endif
  999. /* Transform masks for the high-level interface */
  1000. #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */
  1001. #define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */
  1002. #define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */
  1003. #define PNG_TRANSFORM_PACKING 0x0004 /* read and write */
  1004. #define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */
  1005. #define PNG_TRANSFORM_EXPAND 0x0010 /* read only */
  1006. #define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */
  1007. #define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */
  1008. #define PNG_TRANSFORM_BGR 0x0080 /* read and write */
  1009. #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
  1010. #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
  1011. #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
  1012. #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
  1013. /* Flags for MNG supported features */
  1014. #define PNG_FLAG_MNG_EMPTY_PLTE 0x01
  1015. #define PNG_FLAG_MNG_FILTER_64 0x04
  1016. #define PNG_ALL_MNG_FEATURES 0x05
  1017. typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
  1018. typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
  1019. /* The structure that holds the information to read and write PNG files.
  1020. * The only people who need to care about what is inside of this are the
  1021. * people who will be modifying the library for their own special needs.
  1022. * It should NOT be accessed directly by an application, except to store
  1023. * the jmp_buf.
  1024. */
  1025. struct png_struct_def
  1026. {
  1027. #ifdef PNG_SETJMP_SUPPORTED
  1028. jmp_buf jmpbuf; /* used in png_error */
  1029. #endif
  1030. png_error_ptr error_fn; /* function for printing errors and aborting */
  1031. png_error_ptr warning_fn; /* function for printing warnings */
  1032. png_voidp error_ptr; /* user supplied struct for error functions */
  1033. png_rw_ptr write_data_fn; /* function for writing output data */
  1034. png_rw_ptr read_data_fn; /* function for reading input data */
  1035. png_voidp io_ptr; /* ptr to application struct for I/O functions */
  1036. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
  1037. png_user_transform_ptr read_user_transform_fn; /* user read transform */
  1038. #endif
  1039. #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  1040. png_user_transform_ptr write_user_transform_fn; /* user write transform */
  1041. #endif
  1042. /* These were added in libpng-1.0.2 */
  1043. #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
  1044. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  1045. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  1046. png_voidp user_transform_ptr; /* user supplied struct for user transform */
  1047. png_byte user_transform_depth; /* bit depth of user transformed pixels */
  1048. png_byte user_transform_channels; /* channels in user transformed pixels */
  1049. #endif
  1050. #endif
  1051. png_uint_32 mode; /* tells us where we are in the PNG file */
  1052. png_uint_32 flags; /* flags indicating various things to libpng */
  1053. png_uint_32 transformations; /* which transformations to perform */
  1054. z_stream zstream; /* pointer to decompression structure (below) */
  1055. png_bytep zbuf; /* buffer for zlib */
  1056. png_size_t zbuf_size; /* size of zbuf */
  1057. int zlib_level; /* holds zlib compression level */
  1058. int zlib_method; /* holds zlib compression method */
  1059. int zlib_window_bits; /* holds zlib compression window bits */
  1060. int zlib_mem_level; /* holds zlib compression memory level */
  1061. int zlib_strategy; /* holds zlib compression strategy */
  1062. png_uint_32 width; /* width of image in pixels */
  1063. png_uint_32 height; /* height of image in pixels */
  1064. png_uint_32 num_rows; /* number of rows in current pass */
  1065. png_uint_32 usr_width; /* width of row at start of write */
  1066. png_uint_32 rowbytes; /* size of row in bytes */
  1067. png_uint_32 irowbytes; /* size of current interlaced row in bytes */
  1068. png_uint_32 iwidth; /* width of current interlaced row in pixels */
  1069. png_uint_32 row_number; /* current row in interlace pass */
  1070. png_bytep prev_row; /* buffer to save previous (unfiltered) row */
  1071. png_bytep row_buf; /* buffer to save current (unfiltered) row */
  1072. png_bytep sub_row; /* buffer to save "sub" row when filtering */
  1073. png_bytep up_row; /* buffer to save "up" row when filtering */
  1074. png_bytep avg_row; /* buffer to save "avg" row when filtering */
  1075. png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
  1076. png_row_info row_info; /* used for transformation routines */
  1077. png_uint_32 idat_size; /* current IDAT size for read */
  1078. png_uint_32 crc; /* current chunk CRC value */
  1079. png_colorp palette; /* palette from the input file */
  1080. png_uint_16 num_palette; /* number of color entries in palette */
  1081. png_uint_16 num_trans; /* number of transparency values */
  1082. png_byte chunk_name[5]; /* null-terminated name of current chunk */
  1083. png_byte compression; /* file compression type (always 0) */
  1084. png_byte filter; /* file filter type (always 0) */
  1085. png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  1086. png_byte pass; /* current interlace pass (0 - 6) */
  1087. png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
  1088. png_byte color_type; /* color type of file */
  1089. png_byte bit_depth; /* bit depth of file */
  1090. png_byte usr_bit_depth; /* bit depth of users row */
  1091. png_byte pixel_depth; /* number of bits per pixel */
  1092. png_byte channels; /* number of channels in file */
  1093. png_byte usr_channels; /* channels at start of write */
  1094. png_byte sig_bytes; /* magic bytes read/written from start of file */
  1095. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  1096. #ifdef PNG_LEGACY_SUPPORTED
  1097. png_byte filler; /* filler byte for pixel expansion */
  1098. #else
  1099. png_uint_16 filler; /* filler bytes for pixel expansion */
  1100. #endif
  1101. #endif
  1102. #if defined(PNG_bKGD_SUPPORTED)
  1103. png_byte background_gamma_type;
  1104. # ifdef PNG_FLOATING_POINT_SUPPORTED
  1105. float background_gamma;
  1106. # endif
  1107. png_color_16 background; /* background color in screen gamma space */
  1108. #if defined(PNG_READ_GAMMA_SUPPORTED)
  1109. png_color_16 background_1; /* background normalized to gamma 1.0 */
  1110. #endif
  1111. #endif /* PNG_bKGD_SUPPORTED */
  1112. #if defined(PNG_WRITE_FLUSH_SUPPORTED)
  1113. png_flush_ptr output_flush_fn;/* Function for flushing output */
  1114. png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
  1115. png_uint_32 flush_rows; /* number of rows written since last flush */
  1116. #endif
  1117. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  1118. int gamma_shift; /* number of "insignificant" bits 16-bit gamma */
  1119. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1120. float gamma; /* file gamma value */
  1121. float screen_gamma; /* screen gamma value (display_exponent) */
  1122. #endif
  1123. #endif
  1124. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  1125. png_bytep gamma_table; /* gamma table for 8-bit depth files */
  1126. png_bytep gamma_from_1; /* converts from 1.0 to screen */
  1127. png_bytep gamma_to_1; /* converts from file to 1.0 */
  1128. png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
  1129. png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
  1130. png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
  1131. #endif
  1132. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
  1133. png_color_8 sig_bit; /* significant bits in each available channel */
  1134. #endif
  1135. #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
  1136. png_color_8 shift; /* shift for significant bit tranformation */
  1137. #endif
  1138. #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
  1139. || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  1140. png_bytep trans; /* transparency values for paletted files */
  1141. png_color_16 trans_values; /* transparency values for non-paletted files */
  1142. #endif
  1143. png_read_status_ptr read_row_fn; /* called after each row is decoded */
  1144. png_write_status_ptr write_row_fn; /* called after each row is encoded */
  1145. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  1146. png_progressive_info_ptr info_fn; /* called after header data fully read */
  1147. png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
  1148. png_progressive_end_ptr end_fn; /* called after image is complete */
  1149. png_bytep save_buffer_ptr; /* current location in save_buffer */
  1150. png_bytep save_buffer; /* buffer for previously read data */
  1151. png_bytep current_buffer_ptr; /* current location in current_buffer */
  1152. png_bytep current_buffer; /* buffer for recently used data */
  1153. png_uint_32 push_length; /* size of current input chunk */
  1154. png_uint_32 skip_length; /* bytes to skip in input data */
  1155. png_size_t save_buffer_size; /* amount of data now in save_buffer */
  1156. png_size_t save_buffer_max; /* total size of save_buffer */
  1157. png_size_t buffer_size; /* total amount of available input data */
  1158. png_size_t current_buffer_size; /* amount of data now in current_buffer */
  1159. int process_mode; /* what push library is currently doing */
  1160. int cur_palette; /* current push library palette index */
  1161. # if defined(PNG_TEXT_SUPPORTED)
  1162. png_size_t current_text_size; /* current size of text input data */
  1163. png_size_t current_text_left; /* how much text left to read in input */
  1164. png_charp current_text; /* current text chunk buffer */
  1165. png_charp current_text_ptr; /* current location in current_text */
  1166. # endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
  1167. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  1168. #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
  1169. /* for the Borland special 64K segment handler */
  1170. png_bytepp offset_table_ptr;
  1171. png_bytep offset_table;
  1172. png_uint_16 offset_table_number;
  1173. png_uint_16 offset_table_count;
  1174. png_uint_16 offset_table_count_free;
  1175. #endif
  1176. #if defined(PNG_READ_DITHER_SUPPORTED)
  1177. png_bytep palette_lookup; /* lookup table for dithering */
  1178. png_bytep dither_index; /* index translation for palette files */
  1179. #endif
  1180. #if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
  1181. png_uint_16p hist; /* histogram */
  1182. #endif
  1183. #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
  1184. png_byte heuristic_method; /* heuristic for row filter selection */
  1185. png_byte num_prev_filters; /* number of weights for previous rows */
  1186. png_bytep prev_filters; /* filter type(s) of previous row(s) */
  1187. png_uint_16p filter_weights; /* weight(s) for previous line(s) */
  1188. png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
  1189. png_uint_16p filter_costs; /* relative filter calculation cost */
  1190. png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
  1191. #endif
  1192. #if defined(PNG_TIME_RFC1123_SUPPORTED)
  1193. png_charp time_buffer; /* String to hold RFC 1123 time text */
  1194. #endif
  1195. /* New members added in libpng-1.0.6 */
  1196. #ifdef PNG_FREE_ME_SUPPORTED
  1197. png_uint_32 free_me; /* flags items libpng is responsible for freeing */
  1198. #endif
  1199. #if defined(PNG_USER_CHUNKS_SUPPORTED)
  1200. png_voidp user_chunk_ptr;
  1201. png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
  1202. #endif
  1203. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
  1204. int num_chunk_list;
  1205. png_bytep chunk_list;
  1206. #endif
  1207. /* New members added in libpng-1.0.3 */
  1208. #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
  1209. png_byte rgb_to_gray_status;
  1210. /* These were changed from png_byte in libpng-1.0.6 */
  1211. png_uint_16 rgb_to_gray_red_coeff;
  1212. png_uint_16 rgb_to_gray_green_coeff;
  1213. png_uint_16 rgb_to_gray_blue_coeff;
  1214. #endif
  1215. /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
  1216. #if defined(PNG_MNG_FEATURES_SUPPORTED) || \
  1217. defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
  1218. defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
  1219. /* changed from png_byte to png_uint_32 at version 1.2.0 */
  1220. #ifdef PNG_1_0_X
  1221. png_byte mng_features_permitted;
  1222. #else
  1223. png_uint_32 mng_features_permitted;
  1224. #endif /* PNG_1_0_X */
  1225. #endif
  1226. /* New member added in libpng-1.0.7 */
  1227. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  1228. png_fixed_point int_gamma;
  1229. #endif
  1230. /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
  1231. #if defined(PNG_MNG_FEATURES_SUPPORTED)
  1232. png_byte filter_type;
  1233. #endif
  1234. #if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD))
  1235. /* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
  1236. png_uint_32 row_buf_size;
  1237. #endif
  1238. /* New members added in libpng-1.2.0 */
  1239. #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
  1240. # if !defined(PNG_1_0_X)
  1241. # if defined(PNG_MMX_CODE_SUPPORTED)
  1242. png_byte mmx_bitdepth_threshold;
  1243. png_uint_32 mmx_rowbytes_threshold;
  1244. # endif
  1245. png_uint_32 asm_flags;
  1246. # endif
  1247. #endif
  1248. /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
  1249. #ifdef PNG_USER_MEM_SUPPORTED
  1250. png_voidp mem_ptr; /* user supplied struct for mem functions */
  1251. png_malloc_ptr malloc_fn; /* function for allocating memory */
  1252. png_free_ptr free_fn; /* function for freeing memory */
  1253. #endif
  1254. /* New member added in libpng-1.0.13 and 1.2.0 */
  1255. png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
  1256. #if defined(PNG_READ_DITHER_SUPPORTED)
  1257. /* The following three members were added at version 1.0.14 and 1.2.4 */
  1258. png_bytep dither_sort; /* working sort array */
  1259. png_bytep index_to_palette; /* where the original index currently is */
  1260. /* in the palette */
  1261. png_bytep palette_to_index; /* which original index points to this */
  1262. /* palette color */
  1263. #endif
  1264. /* New members added in libpng-1.0.16 and 1.2.6 */
  1265. png_byte compression_type;
  1266. #ifdef PNG_SET_USER_LIMITS_SUPPORTED
  1267. png_uint_32 user_width_max;
  1268. png_uint_32 user_height_max;
  1269. #endif
  1270. /* New member added in libpng-1.0.25 and 1.2.17 */
  1271. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
  1272. /* storage for unknown chunk that the library doesn't recognize. */
  1273. png_unknown_chunk unknown_chunk;
  1274. #endif
  1275. };
  1276. /* This triggers a compiler error in png.c, if png.c and png.h
  1277. * do not agree upon the version number.
  1278. */
  1279. typedef png_structp version_1_2_18;
  1280. typedef png_struct FAR * FAR * png_structpp;
  1281. /* Here are the function definitions most commonly used. This is not
  1282. * the place to find out how to use libpng. See libpng.txt for the
  1283. * full explanation, see example.c for the summary. This just provides
  1284. * a simple one line description of the use of each function.
  1285. */
  1286. /* Returns the version number of the library */
  1287. extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));
  1288. /* Tell lib we have already handled the first <num_bytes> magic bytes.
  1289. * Handling more than 8 bytes from the beginning of the file is an error.
  1290. */
  1291. extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
  1292. int num_bytes));
  1293. /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
  1294. * PNG file. Returns zero if the supplied bytes match the 8-byte PNG
  1295. * signature, and non-zero otherwise. Having num_to_check == 0 or
  1296. * start > 7 will always fail (ie return non-zero).
  1297. */
  1298. extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
  1299. png_size_t num_to_check));
  1300. /* Simple signature checking function. This is the same as calling
  1301. * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
  1302. */
  1303. extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
  1304. /* Allocate and initialize png_ptr struct for reading, and any other memory. */
  1305. extern PNG_EXPORT(png_structp,png_create_read_struct)
  1306. PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
  1307. png_error_ptr error_fn, png_error_ptr warn_fn));
  1308. /* Allocate and initialize png_ptr struct for writing, and any other memory */
  1309. extern PNG_EXPORT(png_structp,png_create_write_struct)
  1310. PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
  1311. png_error_ptr error_fn, png_error_ptr warn_fn));
  1312. #ifdef PNG_WRITE_SUPPORTED
  1313. extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
  1314. PNGARG((png_structp png_ptr));
  1315. #endif
  1316. #ifdef PNG_WRITE_SUPPORTED
  1317. extern PNG_EXPORT(void,png_set_compression_buffer_size)
  1318. PNGARG((png_structp png_ptr, png_uint_32 size));
  1319. #endif
  1320. /* Reset the compression stream */
  1321. extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
  1322. /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
  1323. #ifdef PNG_USER_MEM_SUPPORTED
  1324. extern PNG_EXPORT(png_structp,png_create_read_struct_2)
  1325. PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
  1326. png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
  1327. png_malloc_ptr malloc_fn, png_free_ptr free_fn));
  1328. extern PNG_EXPORT(png_structp,png_create_write_struct_2)
  1329. PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
  1330. png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
  1331. png_malloc_ptr malloc_fn, png_free_ptr free_fn));
  1332. #endif
  1333. /* Write a PNG chunk - size, type, (optional) data, CRC. */
  1334. extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
  1335. png_bytep chunk_name, png_bytep data, png_size_t length));
  1336. /* Write the start of a PNG chunk - length and chunk name. */
  1337. extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,
  1338. png_bytep chunk_name, png_uint_32 length));
  1339. /* Write the data of a PNG chunk started with png_write_chunk_start(). */
  1340. extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,
  1341. png_bytep data, png_size_t length));
  1342. /* Finish a chunk started with png_write_chunk_start() (includes CRC). */
  1343. extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
  1344. /* Allocate and initialize the info structure */
  1345. extern PNG_EXPORT(png_infop,png_create_info_struct)
  1346. PNGARG((png_structp png_ptr));
  1347. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  1348. /* Initialize the info structure (old interface - DEPRECATED) */
  1349. extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
  1350. #undef png_info_init
  1351. #define png_info_init(info_ptr) png_info_init_3(&info_ptr,\
  1352. png_sizeof(png_info));
  1353. #endif
  1354. extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
  1355. png_size_t png_info_struct_size));
  1356. /* Writes all the PNG information before the image. */
  1357. extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
  1358. png_infop info_ptr));
  1359. extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
  1360. png_infop info_ptr));
  1361. #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
  1362. /* read the information before the actual image data. */
  1363. extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
  1364. png_infop info_ptr));
  1365. #endif
  1366. #if defined(PNG_TIME_RFC1123_SUPPORTED)
  1367. extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
  1368. PNGARG((png_structp png_ptr, png_timep ptime));
  1369. #endif
  1370. #if !defined(_WIN32_WCE)
  1371. /* "time.h" functions are not supported on WindowsCE */
  1372. #if defined(PNG_WRITE_tIME_SUPPORTED)
  1373. /* convert from a struct tm to png_time */
  1374. extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
  1375. struct tm FAR * ttime));
  1376. /* convert from time_t to png_time. Uses gmtime() */
  1377. extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
  1378. time_t ttime));
  1379. #endif /* PNG_WRITE_tIME_SUPPORTED */
  1380. #endif /* _WIN32_WCE */
  1381. #if defined(PNG_READ_EXPAND_SUPPORTED)
  1382. /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
  1383. extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
  1384. #if !defined(PNG_1_0_X)
  1385. extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp
  1386. png_ptr));
  1387. #endif
  1388. extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
  1389. extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
  1390. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  1391. /* Deprecated */
  1392. extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
  1393. #endif
  1394. #endif
  1395. #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
  1396. /* Use blue, green, red order for pixels. */
  1397. extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
  1398. #endif
  1399. #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
  1400. /* Expand the grayscale to 24-bit RGB if necessary. */
  1401. extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
  1402. #endif
  1403. #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
  1404. /* Reduce RGB to grayscale. */
  1405. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1406. extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
  1407. int error_action, double red, double green ));
  1408. #endif
  1409. extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,
  1410. int error_action, png_fixed_point red, png_fixed_point green ));
  1411. extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
  1412. png_ptr));
  1413. #endif
  1414. extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
  1415. png_colorp palette));
  1416. #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
  1417. extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
  1418. #endif
  1419. #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
  1420. defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
  1421. extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));
  1422. #endif
  1423. #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
  1424. defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
  1425. extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
  1426. #endif
  1427. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  1428. /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
  1429. extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
  1430. png_uint_32 filler, int flags));
  1431. /* The values of the PNG_FILLER_ defines should NOT be changed */
  1432. #define PNG_FILLER_BEFORE 0
  1433. #define PNG_FILLER_AFTER 1
  1434. /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
  1435. #if !defined(PNG_1_0_X)
  1436. extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,
  1437. png_uint_32 filler, int flags));
  1438. #endif
  1439. #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
  1440. #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
  1441. /* Swap bytes in 16-bit depth files. */
  1442. extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
  1443. #endif
  1444. #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
  1445. /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
  1446. extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
  1447. #endif
  1448. #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
  1449. /* Swap packing order of pixels in bytes. */
  1450. extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
  1451. #endif
  1452. #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
  1453. /* Converts files to legal bit depths. */
  1454. extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,
  1455. png_color_8p true_bits));
  1456. #endif
  1457. #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
  1458. defined(PNG_WRITE_INTERLACING_SUPPORTED)
  1459. /* Have the code handle the interlacing. Returns the number of passes. */
  1460. extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
  1461. #endif
  1462. #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
  1463. /* Invert monochrome files */
  1464. extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
  1465. #endif
  1466. #if defined(PNG_READ_BACKGROUND_SUPPORTED)
  1467. /* Handle alpha and tRNS by replacing with a background color. */
  1468. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1469. extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
  1470. png_color_16p background_color, int background_gamma_code,
  1471. int need_expand, double background_gamma));
  1472. #endif
  1473. #define PNG_BACKGROUND_GAMMA_UNKNOWN 0
  1474. #define PNG_BACKGROUND_GAMMA_SCREEN 1
  1475. #define PNG_BACKGROUND_GAMMA_FILE 2
  1476. #define PNG_BACKGROUND_GAMMA_UNIQUE 3
  1477. #endif
  1478. #if defined(PNG_READ_16_TO_8_SUPPORTED)
  1479. /* strip the second byte of information from a 16-bit depth file. */
  1480. extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
  1481. #endif
  1482. #if defined(PNG_READ_DITHER_SUPPORTED)
  1483. /* Turn on dithering, and reduce the palette to the number of colors available. */
  1484. extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
  1485. png_colorp palette, int num_palette, int maximum_colors,
  1486. png_uint_16p histogram, int full_dither));
  1487. #endif
  1488. #if defined(PNG_READ_GAMMA_SUPPORTED)
  1489. /* Handle gamma correction. Screen_gamma=(display_exponent) */
  1490. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1491. extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
  1492. double screen_gamma, double default_file_gamma));
  1493. #endif
  1494. #endif
  1495. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  1496. #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
  1497. defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
  1498. /* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
  1499. /* Deprecated and will be removed. Use png_permit_mng_features() instead. */
  1500. extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
  1501. int empty_plte_permitted));
  1502. #endif
  1503. #endif
  1504. #if defined(PNG_WRITE_FLUSH_SUPPORTED)
  1505. /* Set how many lines between output flushes - 0 for no flushing */
  1506. extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
  1507. /* Flush the current PNG output buffer */
  1508. extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
  1509. #endif
  1510. /* optional update palette with requested transformations */
  1511. extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
  1512. /* optional call to update the users info structure */
  1513. extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
  1514. png_infop info_ptr));
  1515. #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
  1516. /* read one or more rows of image data. */
  1517. extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
  1518. png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
  1519. #endif
  1520. #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
  1521. /* read a row of data. */
  1522. extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
  1523. png_bytep row,
  1524. png_bytep display_row));
  1525. #endif
  1526. #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
  1527. /* read the whole image into memory at once. */
  1528. extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
  1529. png_bytepp image));
  1530. #endif
  1531. /* write a row of image data */
  1532. extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
  1533. png_bytep row));
  1534. /* write a few rows of image data */
  1535. extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
  1536. png_bytepp row, png_uint_32 num_rows));
  1537. /* write the image data */
  1538. extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
  1539. png_bytepp image));
  1540. /* writes the end of the PNG file. */
  1541. extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
  1542. png_infop info_ptr));
  1543. #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
  1544. /* read the end of the PNG file. */
  1545. extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
  1546. png_infop info_ptr));
  1547. #endif
  1548. /* free any memory associated with the png_info_struct */
  1549. extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
  1550. png_infopp info_ptr_ptr));
  1551. /* free any memory associated with the png_struct and the png_info_structs */
  1552. extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
  1553. png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
  1554. /* free all memory used by the read (old method - NOT DLL EXPORTED) */
  1555. extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
  1556. png_infop end_info_ptr));
  1557. /* free any memory associated with the png_struct and the png_info_structs */
  1558. extern PNG_EXPORT(void,png_destroy_write_struct)
  1559. PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
  1560. /* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
  1561. extern void png_write_destroy PNGARG((png_structp png_ptr));
  1562. /* set the libpng method of handling chunk CRC errors */
  1563. extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
  1564. int crit_action, int ancil_action));
  1565. /* Values for png_set_crc_action() to say how to handle CRC errors in
  1566. * ancillary and critical chunks, and whether to use the data contained
  1567. * therein. Note that it is impossible to "discard" data in a critical
  1568. * chunk. For versions prior to 0.90, the action was always error/quit,
  1569. * whereas in version 0.90 and later, the action for CRC errors in ancillary
  1570. * chunks is warn/discard. These values should NOT be changed.
  1571. *
  1572. * value action:critical action:ancillary
  1573. */
  1574. #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */
  1575. #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */
  1576. #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */
  1577. #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */
  1578. #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
  1579. #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
  1580. /* These functions give the user control over the scan-line filtering in
  1581. * libpng and the compression methods used by zlib. These functions are
  1582. * mainly useful for testing, as the defaults should work with most users.
  1583. * Those users who are tight on memory or want faster performance at the
  1584. * expense of compression can modify them. See the compression library
  1585. * header file (zlib.h) for an explination of the compression functions.
  1586. */
  1587. /* set the filtering method(s) used by libpng. Currently, the only valid
  1588. * value for "method" is 0.
  1589. */
  1590. extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
  1591. int filters));
  1592. /* Flags for png_set_filter() to say which filters to use. The flags
  1593. * are chosen so that they don't conflict with real filter types
  1594. * below, in case they are supplied instead of the #defined constants.
  1595. * These values should NOT be changed.
  1596. */
  1597. #define PNG_NO_FILTERS 0x00
  1598. #define PNG_FILTER_NONE 0x08
  1599. #define PNG_FILTER_SUB 0x10
  1600. #define PNG_FILTER_UP 0x20
  1601. #define PNG_FILTER_AVG 0x40
  1602. #define PNG_FILTER_PAETH 0x80
  1603. #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
  1604. PNG_FILTER_AVG | PNG_FILTER_PAETH)
  1605. /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
  1606. * These defines should NOT be changed.
  1607. */
  1608. #define PNG_FILTER_VALUE_NONE 0
  1609. #define PNG_FILTER_VALUE_SUB 1
  1610. #define PNG_FILTER_VALUE_UP 2
  1611. #define PNG_FILTER_VALUE_AVG 3
  1612. #define PNG_FILTER_VALUE_PAETH 4
  1613. #define PNG_FILTER_VALUE_LAST 5
  1614. #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */
  1615. /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
  1616. * defines, either the default (minimum-sum-of-absolute-differences), or
  1617. * the experimental method (weighted-minimum-sum-of-absolute-differences).
  1618. *
  1619. * Weights are factors >= 1.0, indicating how important it is to keep the
  1620. * filter type consistent between rows. Larger numbers mean the current
  1621. * filter is that many times as likely to be the same as the "num_weights"
  1622. * previous filters. This is cumulative for each previous row with a weight.
  1623. * There needs to be "num_weights" values in "filter_weights", or it can be
  1624. * NULL if the weights aren't being specified. Weights have no influence on
  1625. * the selection of the first row filter. Well chosen weights can (in theory)
  1626. * improve the compression for a given image.
  1627. *
  1628. * Costs are factors >= 1.0 indicating the relative decoding costs of a
  1629. * filter type. Higher costs indicate more decoding expense, and are
  1630. * therefore less likely to be selected over a filter with lower computational
  1631. * costs. There needs to be a value in "filter_costs" for each valid filter
  1632. * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
  1633. * setting the costs. Costs try to improve the speed of decompression without
  1634. * unduly increasing the compressed image size.
  1635. *
  1636. * A negative weight or cost indicates the default value is to be used, and
  1637. * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
  1638. * The default values for both weights and costs are currently 1.0, but may
  1639. * change if good general weighting/cost heuristics can be found. If both
  1640. * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
  1641. * to the UNWEIGHTED method, but with added encoding time/computation.
  1642. */
  1643. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1644. extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
  1645. int heuristic_method, int num_weights, png_doublep filter_weights,
  1646. png_doublep filter_costs));
  1647. #endif
  1648. #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
  1649. /* Heuristic used for row filter selection. These defines should NOT be
  1650. * changed.
  1651. */
  1652. #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
  1653. #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
  1654. #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
  1655. #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
  1656. /* Set the library compression level. Currently, valid values range from
  1657. * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
  1658. * (0 - no compression, 9 - "maximal" compression). Note that tests have
  1659. * shown that zlib compression levels 3-6 usually perform as well as level 9
  1660. * for PNG images, and do considerably fewer caclulations. In the future,
  1661. * these values may not correspond directly to the zlib compression levels.
  1662. */
  1663. extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,
  1664. int level));
  1665. extern PNG_EXPORT(void,png_set_compression_mem_level)
  1666. PNGARG((png_structp png_ptr, int mem_level));
  1667. extern PNG_EXPORT(void,png_set_compression_strategy)
  1668. PNGARG((png_structp png_ptr, int strategy));
  1669. extern PNG_EXPORT(void,png_set_compression_window_bits)
  1670. PNGARG((png_structp png_ptr, int window_bits));
  1671. extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
  1672. int method));
  1673. /* These next functions are called for input/output, memory, and error
  1674. * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
  1675. * and call standard C I/O routines such as fread(), fwrite(), and
  1676. * fprintf(). These functions can be made to use other I/O routines
  1677. * at run time for those applications that need to handle I/O in a
  1678. * different manner by calling png_set_???_fn(). See libpng.txt for
  1679. * more information.
  1680. */
  1681. #if !defined(PNG_NO_STDIO)
  1682. /* Initialize the input/output for the PNG file to the default functions. */
  1683. extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
  1684. #endif
  1685. /* Replace the (error and abort), and warning functions with user
  1686. * supplied functions. If no messages are to be printed you must still
  1687. * write and use replacement functions. The replacement error_fn should
  1688. * still do a longjmp to the last setjmp location if you are using this
  1689. * method of error handling. If error_fn or warning_fn is NULL, the
  1690. * default function will be used.
  1691. */
  1692. extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
  1693. png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
  1694. /* Return the user pointer associated with the error functions */
  1695. extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
  1696. /* Replace the default data output functions with a user supplied one(s).
  1697. * If buffered output is not used, then output_flush_fn can be set to NULL.
  1698. * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
  1699. * output_flush_fn will be ignored (and thus can be NULL).
  1700. */
  1701. extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
  1702. png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
  1703. /* Replace the default data input function with a user supplied one. */
  1704. extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,
  1705. png_voidp io_ptr, png_rw_ptr read_data_fn));
  1706. /* Return the user pointer associated with the I/O functions */
  1707. extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));
  1708. extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,
  1709. png_read_status_ptr read_row_fn));
  1710. extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,
  1711. png_write_status_ptr write_row_fn));
  1712. #ifdef PNG_USER_MEM_SUPPORTED
  1713. /* Replace the default memory allocation functions with user supplied one(s). */
  1714. extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
  1715. png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
  1716. /* Return the user pointer associated with the memory functions */
  1717. extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
  1718. #endif
  1719. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  1720. defined(PNG_LEGACY_SUPPORTED)
  1721. extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
  1722. png_ptr, png_user_transform_ptr read_user_transform_fn));
  1723. #endif
  1724. #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
  1725. defined(PNG_LEGACY_SUPPORTED)
  1726. extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
  1727. png_ptr, png_user_transform_ptr write_user_transform_fn));
  1728. #endif
  1729. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  1730. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
  1731. defined(PNG_LEGACY_SUPPORTED)
  1732. extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
  1733. png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
  1734. int user_transform_channels));
  1735. /* Return the user pointer associated with the user transform functions */
  1736. extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
  1737. PNGARG((png_structp png_ptr));
  1738. #endif
  1739. #ifdef PNG_USER_CHUNKS_SUPPORTED
  1740. extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,
  1741. png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
  1742. extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
  1743. png_ptr));
  1744. #endif
  1745. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  1746. /* Sets the function callbacks for the push reader, and a pointer to a
  1747. * user-defined structure available to the callback functions.
  1748. */
  1749. extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
  1750. png_voidp progressive_ptr,
  1751. png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
  1752. png_progressive_end_ptr end_fn));
  1753. /* returns the user pointer associated with the push read functions */
  1754. extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
  1755. PNGARG((png_structp png_ptr));
  1756. /* function to be called when data becomes available */
  1757. extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
  1758. png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
  1759. /* function that combines rows. Not very much different than the
  1760. * png_combine_row() call. Is this even used?????
  1761. */
  1762. extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
  1763. png_bytep old_row, png_bytep new_row));
  1764. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  1765. extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
  1766. png_uint_32 size));
  1767. #if defined(PNG_1_0_X)
  1768. # define png_malloc_warn png_malloc
  1769. #else
  1770. /* Added at libpng version 1.2.4 */
  1771. extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
  1772. png_uint_32 size));
  1773. #endif
  1774. /* frees a pointer allocated by png_malloc() */
  1775. extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
  1776. #if defined(PNG_1_0_X)
  1777. /* Function to allocate memory for zlib. */
  1778. extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
  1779. uInt size));
  1780. /* Function to free memory for zlib */
  1781. extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
  1782. #endif
  1783. /* Free data that was allocated internally */
  1784. extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
  1785. png_infop info_ptr, png_uint_32 free_me, int num));
  1786. #ifdef PNG_FREE_ME_SUPPORTED
  1787. /* Reassign responsibility for freeing existing data, whether allocated
  1788. * by libpng or by the application */
  1789. extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
  1790. png_infop info_ptr, int freer, png_uint_32 mask));
  1791. #endif
  1792. /* assignments for png_data_freer */
  1793. #define PNG_DESTROY_WILL_FREE_DATA 1
  1794. #define PNG_SET_WILL_FREE_DATA 1
  1795. #define PNG_USER_WILL_FREE_DATA 2
  1796. /* Flags for png_ptr->free_me and info_ptr->free_me */
  1797. #define PNG_FREE_HIST 0x0008
  1798. #define PNG_FREE_ICCP 0x0010
  1799. #define PNG_FREE_SPLT 0x0020
  1800. #define PNG_FREE_ROWS 0x0040
  1801. #define PNG_FREE_PCAL 0x0080
  1802. #define PNG_FREE_SCAL 0x0100
  1803. #define PNG_FREE_UNKN 0x0200
  1804. #define PNG_FREE_LIST 0x0400
  1805. #define PNG_FREE_PLTE 0x1000
  1806. #define PNG_FREE_TRNS 0x2000
  1807. #define PNG_FREE_TEXT 0x4000
  1808. #define PNG_FREE_ALL 0x7fff
  1809. #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
  1810. #ifdef PNG_USER_MEM_SUPPORTED
  1811. extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
  1812. png_uint_32 size));
  1813. extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
  1814. png_voidp ptr));
  1815. #endif
  1816. extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
  1817. png_voidp s1, png_voidp s2, png_uint_32 size));
  1818. extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
  1819. png_voidp s1, int value, png_uint_32 size));
  1820. #if defined(USE_FAR_KEYWORD) /* memory model conversion function */
  1821. extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
  1822. int check));
  1823. #endif /* USE_FAR_KEYWORD */
  1824. /* Fatal error in PNG image of libpng - can't continue */
  1825. extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
  1826. png_const_charp error_message));
  1827. /* The same, but the chunk name is prepended to the error string. */
  1828. extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
  1829. png_const_charp error_message));
  1830. /* Non-fatal error in libpng. Can continue, but may have a problem. */
  1831. extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
  1832. png_const_charp warning_message));
  1833. /* Non-fatal error in libpng, chunk name is prepended to message. */
  1834. extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
  1835. png_const_charp warning_message));
  1836. /* The png_set_<chunk> functions are for storing values in the png_info_struct.
  1837. * Similarly, the png_get_<chunk> calls are used to read values from the
  1838. * png_info_struct, either storing the parameters in the passed variables, or
  1839. * setting pointers into the png_info_struct where the data is stored. The
  1840. * png_get_<chunk> functions return a non-zero value if the data was available
  1841. * in info_ptr, or return zero and do not change any of the parameters if the
  1842. * data was not available.
  1843. *
  1844. * These functions should be used instead of directly accessing png_info
  1845. * to avoid problems with future changes in the size and internal layout of
  1846. * png_info_struct.
  1847. */
  1848. /* Returns "flag" if chunk data is valid in info_ptr. */
  1849. extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,
  1850. png_infop info_ptr, png_uint_32 flag));
  1851. /* Returns number of bytes needed to hold a transformed row. */
  1852. extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
  1853. png_infop info_ptr));
  1854. #if defined(PNG_INFO_IMAGE_SUPPORTED)
  1855. /* Returns row_pointers, which is an array of pointers to scanlines that was
  1856. returned from png_read_png(). */
  1857. extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,
  1858. png_infop info_ptr));
  1859. /* Set row_pointers, which is an array of pointers to scanlines for use
  1860. by png_write_png(). */
  1861. extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,
  1862. png_infop info_ptr, png_bytepp row_pointers));
  1863. #endif
  1864. /* Returns number of color channels in image. */
  1865. extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,
  1866. png_infop info_ptr));
  1867. #ifdef PNG_EASY_ACCESS_SUPPORTED
  1868. /* Returns image width in pixels. */
  1869. extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp
  1870. png_ptr, png_infop info_ptr));
  1871. /* Returns image height in pixels. */
  1872. extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp
  1873. png_ptr, png_infop info_ptr));
  1874. /* Returns image bit_depth. */
  1875. extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp
  1876. png_ptr, png_infop info_ptr));
  1877. /* Returns image color_type. */
  1878. extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp
  1879. png_ptr, png_infop info_ptr));
  1880. /* Returns image filter_type. */
  1881. extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp
  1882. png_ptr, png_infop info_ptr));
  1883. /* Returns image interlace_type. */
  1884. extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp
  1885. png_ptr, png_infop info_ptr));
  1886. /* Returns image compression_type. */
  1887. extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp
  1888. png_ptr, png_infop info_ptr));
  1889. /* Returns image resolution in pixels per meter, from pHYs chunk data. */
  1890. extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp
  1891. png_ptr, png_infop info_ptr));
  1892. extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp
  1893. png_ptr, png_infop info_ptr));
  1894. extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp
  1895. png_ptr, png_infop info_ptr));
  1896. /* Returns pixel aspect ratio, computed from pHYs chunk data. */
  1897. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1898. extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp
  1899. png_ptr, png_infop info_ptr));
  1900. #endif
  1901. /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
  1902. extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp
  1903. png_ptr, png_infop info_ptr));
  1904. extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp
  1905. png_ptr, png_infop info_ptr));
  1906. extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp
  1907. png_ptr, png_infop info_ptr));
  1908. extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp
  1909. png_ptr, png_infop info_ptr));
  1910. #endif /* PNG_EASY_ACCESS_SUPPORTED */
  1911. /* Returns pointer to signature string read from PNG header */
  1912. extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
  1913. png_infop info_ptr));
  1914. #if defined(PNG_bKGD_SUPPORTED)
  1915. extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
  1916. png_infop info_ptr, png_color_16p *background));
  1917. #endif
  1918. #if defined(PNG_bKGD_SUPPORTED)
  1919. extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
  1920. png_infop info_ptr, png_color_16p background));
  1921. #endif
  1922. #if defined(PNG_cHRM_SUPPORTED)
  1923. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1924. extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
  1925. png_infop info_ptr, double *white_x, double *white_y, double *red_x,
  1926. double *red_y, double *green_x, double *green_y, double *blue_x,
  1927. double *blue_y));
  1928. #endif
  1929. #ifdef PNG_FIXED_POINT_SUPPORTED
  1930. extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
  1931. png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point
  1932. *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,
  1933. png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point
  1934. *int_blue_x, png_fixed_point *int_blue_y));
  1935. #endif
  1936. #endif
  1937. #if defined(PNG_cHRM_SUPPORTED)
  1938. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1939. extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
  1940. png_infop info_ptr, double white_x, double white_y, double red_x,
  1941. double red_y, double green_x, double green_y, double blue_x, double blue_y));
  1942. #endif
  1943. #ifdef PNG_FIXED_POINT_SUPPORTED
  1944. extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
  1945. png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,
  1946. png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
  1947. int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
  1948. png_fixed_point int_blue_y));
  1949. #endif
  1950. #endif
  1951. #if defined(PNG_gAMA_SUPPORTED)
  1952. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1953. extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
  1954. png_infop info_ptr, double *file_gamma));
  1955. #endif
  1956. extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
  1957. png_infop info_ptr, png_fixed_point *int_file_gamma));
  1958. #endif
  1959. #if defined(PNG_gAMA_SUPPORTED)
  1960. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1961. extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
  1962. png_infop info_ptr, double file_gamma));
  1963. #endif
  1964. extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
  1965. png_infop info_ptr, png_fixed_point int_file_gamma));
  1966. #endif
  1967. #if defined(PNG_hIST_SUPPORTED)
  1968. extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
  1969. png_infop info_ptr, png_uint_16p *hist));
  1970. #endif
  1971. #if defined(PNG_hIST_SUPPORTED)
  1972. extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
  1973. png_infop info_ptr, png_uint_16p hist));
  1974. #endif
  1975. extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,
  1976. png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,
  1977. int *bit_depth, int *color_type, int *interlace_method,
  1978. int *compression_method, int *filter_method));
  1979. extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
  1980. png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
  1981. int color_type, int interlace_method, int compression_method,
  1982. int filter_method));
  1983. #if defined(PNG_oFFs_SUPPORTED)
  1984. extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
  1985. png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
  1986. int *unit_type));
  1987. #endif
  1988. #if defined(PNG_oFFs_SUPPORTED)
  1989. extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
  1990. png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
  1991. int unit_type));
  1992. #endif
  1993. #if defined(PNG_pCAL_SUPPORTED)
  1994. extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
  1995. png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
  1996. int *type, int *nparams, png_charp *units, png_charpp *params));
  1997. #endif
  1998. #if defined(PNG_pCAL_SUPPORTED)
  1999. extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
  2000. png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
  2001. int type, int nparams, png_charp units, png_charpp params));
  2002. #endif
  2003. #if defined(PNG_pHYs_SUPPORTED)
  2004. extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
  2005. png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
  2006. #endif
  2007. #if defined(PNG_pHYs_SUPPORTED)
  2008. extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
  2009. png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
  2010. #endif
  2011. extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
  2012. png_infop info_ptr, png_colorp *palette, int *num_palette));
  2013. extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
  2014. png_infop info_ptr, png_colorp palette, int num_palette));
  2015. #if defined(PNG_sBIT_SUPPORTED)
  2016. extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
  2017. png_infop info_ptr, png_color_8p *sig_bit));
  2018. #endif
  2019. #if defined(PNG_sBIT_SUPPORTED)
  2020. extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
  2021. png_infop info_ptr, png_color_8p sig_bit));
  2022. #endif
  2023. #if defined(PNG_sRGB_SUPPORTED)
  2024. extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
  2025. png_infop info_ptr, int *intent));
  2026. #endif
  2027. #if defined(PNG_sRGB_SUPPORTED)
  2028. extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
  2029. png_infop info_ptr, int intent));
  2030. extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
  2031. png_infop info_ptr, int intent));
  2032. #endif
  2033. #if defined(PNG_iCCP_SUPPORTED)
  2034. extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
  2035. png_infop info_ptr, png_charpp name, int *compression_type,
  2036. png_charpp profile, png_uint_32 *proflen));
  2037. /* Note to maintainer: profile should be png_bytepp */
  2038. #endif
  2039. #if defined(PNG_iCCP_SUPPORTED)
  2040. extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
  2041. png_infop info_ptr, png_charp name, int compression_type,
  2042. png_charp profile, png_uint_32 proflen));
  2043. /* Note to maintainer: profile should be png_bytep */
  2044. #endif
  2045. #if defined(PNG_sPLT_SUPPORTED)
  2046. extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
  2047. png_infop info_ptr, png_sPLT_tpp entries));
  2048. #endif
  2049. #if defined(PNG_sPLT_SUPPORTED)
  2050. extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
  2051. png_infop info_ptr, png_sPLT_tp entries, int nentries));
  2052. #endif
  2053. #if defined(PNG_TEXT_SUPPORTED)
  2054. /* png_get_text also returns the number of text chunks in *num_text */
  2055. extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
  2056. png_infop info_ptr, png_textp *text_ptr, int *num_text));
  2057. #endif
  2058. /*
  2059. * Note while png_set_text() will accept a structure whose text,
  2060. * language, and translated keywords are NULL pointers, the structure
  2061. * returned by png_get_text will always contain regular
  2062. * zero-terminated C strings. They might be empty strings but
  2063. * they will never be NULL pointers.
  2064. */
  2065. #if defined(PNG_TEXT_SUPPORTED)
  2066. extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
  2067. png_infop info_ptr, png_textp text_ptr, int num_text));
  2068. #endif
  2069. #if defined(PNG_tIME_SUPPORTED)
  2070. extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
  2071. png_infop info_ptr, png_timep *mod_time));
  2072. #endif
  2073. #if defined(PNG_tIME_SUPPORTED)
  2074. extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
  2075. png_infop info_ptr, png_timep mod_time));
  2076. #endif
  2077. #if defined(PNG_tRNS_SUPPORTED)
  2078. extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
  2079. png_infop info_ptr, png_bytep *trans, int *num_trans,
  2080. png_color_16p *trans_values));
  2081. #endif
  2082. #if defined(PNG_tRNS_SUPPORTED)
  2083. extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
  2084. png_infop info_ptr, png_bytep trans, int num_trans,
  2085. png_color_16p trans_values));
  2086. #endif
  2087. #if defined(PNG_tRNS_SUPPORTED)
  2088. #endif
  2089. #if defined(PNG_sCAL_SUPPORTED)
  2090. #ifdef PNG_FLOATING_POINT_SUPPORTED
  2091. extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
  2092. png_infop info_ptr, int *unit, double *width, double *height));
  2093. #else
  2094. #ifdef PNG_FIXED_POINT_SUPPORTED
  2095. extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
  2096. png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
  2097. #endif
  2098. #endif
  2099. #endif /* PNG_sCAL_SUPPORTED */
  2100. #if defined(PNG_sCAL_SUPPORTED)
  2101. #ifdef PNG_FLOATING_POINT_SUPPORTED
  2102. extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
  2103. png_infop info_ptr, int unit, double width, double height));
  2104. #else
  2105. #ifdef PNG_FIXED_POINT_SUPPORTED
  2106. extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
  2107. png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
  2108. #endif
  2109. #endif
  2110. #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
  2111. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
  2112. /* provide a list of chunks and how they are to be handled, if the built-in
  2113. handling or default unknown chunk handling is not desired. Any chunks not
  2114. listed will be handled in the default manner. The IHDR and IEND chunks
  2115. must not be listed.
  2116. keep = 0: follow default behaviour
  2117. = 1: do not keep
  2118. = 2: keep only if safe-to-copy
  2119. = 3: keep even if unsafe-to-copy
  2120. */
  2121. extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
  2122. png_ptr, int keep, png_bytep chunk_list, int num_chunks));
  2123. extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
  2124. png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
  2125. extern PNG_EXPORT(void, png_set_unknown_chunk_location)
  2126. PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));
  2127. extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
  2128. png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
  2129. #endif
  2130. #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  2131. PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
  2132. chunk_name));
  2133. #endif
  2134. /* Png_free_data() will turn off the "valid" flag for anything it frees.
  2135. If you need to turn it off for a chunk that your application has freed,
  2136. you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */
  2137. extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
  2138. png_infop info_ptr, int mask));
  2139. #if defined(PNG_INFO_IMAGE_SUPPORTED)
  2140. /* The "params" pointer is currently not used and is for future expansion. */
  2141. extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
  2142. png_infop info_ptr,
  2143. int transforms,
  2144. png_voidp params));
  2145. extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
  2146. png_infop info_ptr,
  2147. int transforms,
  2148. png_voidp params));
  2149. #endif
  2150. /* Define PNG_DEBUG at compile time for debugging information. Higher
  2151. * numbers for PNG_DEBUG mean more debugging information. This has
  2152. * only been added since version 0.95 so it is not implemented throughout
  2153. * libpng yet, but more support will be added as needed.
  2154. */
  2155. #ifdef PNG_DEBUG
  2156. #if (PNG_DEBUG > 0)
  2157. #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
  2158. #include <crtdbg.h>
  2159. #if (PNG_DEBUG > 1)
  2160. #define png_debug(l,m) _RPT0(_CRT_WARN,m)
  2161. #define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1)
  2162. #define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)
  2163. #endif
  2164. #else /* PNG_DEBUG_FILE || !_MSC_VER */
  2165. #ifndef PNG_DEBUG_FILE
  2166. #define PNG_DEBUG_FILE stderr
  2167. #endif /* PNG_DEBUG_FILE */
  2168. #if (PNG_DEBUG > 1)
  2169. #define png_debug(l,m) \
  2170. { \
  2171. int num_tabs=l; \
  2172. fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
  2173. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
  2174. }
  2175. #define png_debug1(l,m,p1) \
  2176. { \
  2177. int num_tabs=l; \
  2178. fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
  2179. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
  2180. }
  2181. #define png_debug2(l,m,p1,p2) \
  2182. { \
  2183. int num_tabs=l; \
  2184. fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
  2185. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
  2186. }
  2187. #endif /* (PNG_DEBUG > 1) */
  2188. #endif /* _MSC_VER */
  2189. #endif /* (PNG_DEBUG > 0) */
  2190. #endif /* PNG_DEBUG */
  2191. #ifndef png_debug
  2192. #define png_debug(l, m)
  2193. #endif
  2194. #ifndef png_debug1
  2195. #define png_debug1(l, m, p1)
  2196. #endif
  2197. #ifndef png_debug2
  2198. #define png_debug2(l, m, p1, p2)
  2199. #endif
  2200. #if 0
  2201. extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void));
  2202. #endif
  2203. extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
  2204. extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
  2205. extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
  2206. extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
  2207. #ifdef PNG_MNG_FEATURES_SUPPORTED
  2208. extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
  2209. png_ptr, png_uint_32 mng_features_permitted));
  2210. #endif
  2211. /* For use in png_set_keep_unknown, added to version 1.2.6 */
  2212. #define PNG_HANDLE_CHUNK_AS_DEFAULT 0
  2213. #define PNG_HANDLE_CHUNK_NEVER 1
  2214. #define PNG_HANDLE_CHUNK_IF_SAFE 2
  2215. #define PNG_HANDLE_CHUNK_ALWAYS 3
  2216. /* Added to version 1.2.0 */
  2217. #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
  2218. #if defined(PNG_MMX_CODE_SUPPORTED)
  2219. #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
  2220. #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
  2221. #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
  2222. #define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08
  2223. #define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10
  2224. #define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20
  2225. #define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40
  2226. #define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
  2227. #define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */
  2228. #define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
  2229. | PNG_ASM_FLAG_MMX_READ_INTERLACE \
  2230. | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
  2231. | PNG_ASM_FLAG_MMX_READ_FILTER_UP \
  2232. | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
  2233. | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )
  2234. #define PNG_MMX_WRITE_FLAGS ( 0 )
  2235. #define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \
  2236. | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \
  2237. | PNG_MMX_READ_FLAGS \
  2238. | PNG_MMX_WRITE_FLAGS )
  2239. #define PNG_SELECT_READ 1
  2240. #define PNG_SELECT_WRITE 2
  2241. #endif /* PNG_MMX_CODE_SUPPORTED */
  2242. #if !defined(PNG_1_0_X)
  2243. /* pngget.c */
  2244. extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
  2245. PNGARG((int flag_select, int *compilerID));
  2246. /* pngget.c */
  2247. extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)
  2248. PNGARG((int flag_select));
  2249. /* pngget.c */
  2250. extern PNG_EXPORT(png_uint_32,png_get_asm_flags)
  2251. PNGARG((png_structp png_ptr));
  2252. /* pngget.c */
  2253. extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)
  2254. PNGARG((png_structp png_ptr));
  2255. /* pngget.c */
  2256. extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)
  2257. PNGARG((png_structp png_ptr));
  2258. /* pngset.c */
  2259. extern PNG_EXPORT(void,png_set_asm_flags)
  2260. PNGARG((png_structp png_ptr, png_uint_32 asm_flags));
  2261. /* pngset.c */
  2262. extern PNG_EXPORT(void,png_set_mmx_thresholds)
  2263. PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,
  2264. png_uint_32 mmx_rowbytes_threshold));
  2265. #endif /* PNG_1_0_X */
  2266. #if !defined(PNG_1_0_X)
  2267. /* png.c, pnggccrd.c, or pngvcrd.c */
  2268. extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
  2269. #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
  2270. /* Strip the prepended error numbers ("#nnn ") from error and warning
  2271. * messages before passing them to the error or warning handler. */
  2272. #ifdef PNG_ERROR_NUMBERS_SUPPORTED
  2273. extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
  2274. png_ptr, png_uint_32 strip_mode));
  2275. #endif
  2276. #endif /* PNG_1_0_X */
  2277. /* Added at libpng-1.2.6 */
  2278. #ifdef PNG_SET_USER_LIMITS_SUPPORTED
  2279. extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
  2280. png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));
  2281. extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
  2282. png_ptr));
  2283. extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
  2284. png_ptr));
  2285. #endif
  2286. /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
  2287. #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
  2288. /* With these routines we avoid an integer divide, which will be slower on
  2289. * most machines. However, it does take more operations than the corresponding
  2290. * divide method, so it may be slower on a few RISC systems. There are two
  2291. * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
  2292. *
  2293. * Note that the rounding factors are NOT supposed to be the same! 128 and
  2294. * 32768 are correct for the NODIV code; 127 and 32767 are correct for the
  2295. * standard method.
  2296. *
  2297. * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
  2298. */
  2299. /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
  2300. # define png_composite(composite, fg, alpha, bg) \
  2301. { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
  2302. + (png_uint_16)(bg)*(png_uint_16)(255 - \
  2303. (png_uint_16)(alpha)) + (png_uint_16)128); \
  2304. (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
  2305. # define png_composite_16(composite, fg, alpha, bg) \
  2306. { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
  2307. + (png_uint_32)(bg)*(png_uint_32)(65535L - \
  2308. (png_uint_32)(alpha)) + (png_uint_32)32768L); \
  2309. (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
  2310. #else /* standard method using integer division */
  2311. # define png_composite(composite, fg, alpha, bg) \
  2312. (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
  2313. (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
  2314. (png_uint_16)127) / 255)
  2315. # define png_composite_16(composite, fg, alpha, bg) \
  2316. (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
  2317. (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
  2318. (png_uint_32)32767) / (png_uint_32)65535L)
  2319. #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
  2320. /* Inline macros to do direct reads of bytes from the input buffer. These
  2321. * require that you are using an architecture that uses PNG byte ordering
  2322. * (MSB first) and supports unaligned data storage. I think that PowerPC
  2323. * in big-endian mode and 680x0 are the only ones that will support this.
  2324. * The x86 line of processors definitely do not. The png_get_int_32()
  2325. * routine also assumes we are using two's complement format for negative
  2326. * values, which is almost certainly true.
  2327. */
  2328. #if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
  2329. # define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
  2330. # define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
  2331. # define png_get_int_32(buf) ( *((png_int_32p) (buf)))
  2332. #else
  2333. extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
  2334. extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));
  2335. extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));
  2336. #endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
  2337. extern PNG_EXPORT(png_uint_32,png_get_uint_31)
  2338. PNGARG((png_structp png_ptr, png_bytep buf));
  2339. /* No png_get_int_16 -- may be added if there's a real need for it. */
  2340. /* Place a 32-bit number into a buffer in PNG byte order (big-endian).
  2341. */
  2342. extern PNG_EXPORT(void,png_save_uint_32)
  2343. PNGARG((png_bytep buf, png_uint_32 i));
  2344. extern PNG_EXPORT(void,png_save_int_32)
  2345. PNGARG((png_bytep buf, png_int_32 i));
  2346. /* Place a 16-bit number into a buffer in PNG byte order.
  2347. * The parameter is declared unsigned int, not png_uint_16,
  2348. * just to avoid potential problems on pre-ANSI C compilers.
  2349. */
  2350. extern PNG_EXPORT(void,png_save_uint_16)
  2351. PNGARG((png_bytep buf, unsigned int i));
  2352. /* No png_save_int_16 -- may be added if there's a real need for it. */
  2353. /* ************************************************************************* */
  2354. /* These next functions are used internally in the code. They generally
  2355. * shouldn't be used unless you are writing code to add or replace some
  2356. * functionality in libpng. More information about most functions can
  2357. * be found in the files where the functions are located.
  2358. */
  2359. /* Various modes of operation, that are visible to applications because
  2360. * they are used for unknown chunk location.
  2361. */
  2362. #define PNG_HAVE_IHDR 0x01
  2363. #define PNG_HAVE_PLTE 0x02
  2364. #define PNG_HAVE_IDAT 0x04
  2365. #define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
  2366. #define PNG_HAVE_IEND 0x10
  2367. #if defined(PNG_INTERNAL)
  2368. /* More modes of operation. Note that after an init, mode is set to
  2369. * zero automatically when the structure is created.
  2370. */
  2371. #define PNG_HAVE_gAMA 0x20
  2372. #define PNG_HAVE_cHRM 0x40
  2373. #define PNG_HAVE_sRGB 0x80
  2374. #define PNG_HAVE_CHUNK_HEADER 0x100
  2375. #define PNG_WROTE_tIME 0x200
  2376. #define PNG_WROTE_INFO_BEFORE_PLTE 0x400
  2377. #define PNG_BACKGROUND_IS_GRAY 0x800
  2378. #define PNG_HAVE_PNG_SIGNATURE 0x1000
  2379. #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
  2380. /* flags for the transformations the PNG library does on the image data */
  2381. #define PNG_BGR 0x0001
  2382. #define PNG_INTERLACE 0x0002
  2383. #define PNG_PACK 0x0004
  2384. #define PNG_SHIFT 0x0008
  2385. #define PNG_SWAP_BYTES 0x0010
  2386. #define PNG_INVERT_MONO 0x0020
  2387. #define PNG_DITHER 0x0040
  2388. #define PNG_BACKGROUND 0x0080
  2389. #define PNG_BACKGROUND_EXPAND 0x0100
  2390. /* 0x0200 unused */
  2391. #define PNG_16_TO_8 0x0400
  2392. #define PNG_RGBA 0x0800
  2393. #define PNG_EXPAND 0x1000
  2394. #define PNG_GAMMA 0x2000
  2395. #define PNG_GRAY_TO_RGB 0x4000
  2396. #define PNG_FILLER 0x8000L
  2397. #define PNG_PACKSWAP 0x10000L
  2398. #define PNG_SWAP_ALPHA 0x20000L
  2399. #define PNG_STRIP_ALPHA 0x40000L
  2400. #define PNG_INVERT_ALPHA 0x80000L
  2401. #define PNG_USER_TRANSFORM 0x100000L
  2402. #define PNG_RGB_TO_GRAY_ERR 0x200000L
  2403. #define PNG_RGB_TO_GRAY_WARN 0x400000L
  2404. #define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
  2405. /* 0x800000L Unused */
  2406. #define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
  2407. #define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
  2408. /* 0x4000000L unused */
  2409. /* 0x8000000L unused */
  2410. /* 0x10000000L unused */
  2411. /* 0x20000000L unused */
  2412. /* 0x40000000L unused */
  2413. /* flags for png_create_struct */
  2414. #define PNG_STRUCT_PNG 0x0001
  2415. #define PNG_STRUCT_INFO 0x0002
  2416. /* Scaling factor for filter heuristic weighting calculations */
  2417. #define PNG_WEIGHT_SHIFT 8
  2418. #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
  2419. #define PNG_COST_SHIFT 3
  2420. #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
  2421. /* flags for the png_ptr->flags rather than declaring a byte for each one */
  2422. #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
  2423. #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
  2424. #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
  2425. #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
  2426. #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
  2427. #define PNG_FLAG_ZLIB_FINISHED 0x0020
  2428. #define PNG_FLAG_ROW_INIT 0x0040
  2429. #define PNG_FLAG_FILLER_AFTER 0x0080
  2430. #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
  2431. #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
  2432. #define PNG_FLAG_CRC_CRITICAL_USE 0x0400
  2433. #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
  2434. #define PNG_FLAG_FREE_PLTE 0x1000
  2435. #define PNG_FLAG_FREE_TRNS 0x2000
  2436. #define PNG_FLAG_FREE_HIST 0x4000
  2437. #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
  2438. #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
  2439. #define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
  2440. #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
  2441. #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
  2442. #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
  2443. #define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */
  2444. #define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */
  2445. /* 0x800000L unused */
  2446. /* 0x1000000L unused */
  2447. /* 0x2000000L unused */
  2448. /* 0x4000000L unused */
  2449. /* 0x8000000L unused */
  2450. /* 0x10000000L unused */
  2451. /* 0x20000000L unused */
  2452. /* 0x40000000L unused */
  2453. #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
  2454. PNG_FLAG_CRC_ANCILLARY_NOWARN)
  2455. #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
  2456. PNG_FLAG_CRC_CRITICAL_IGNORE)
  2457. #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
  2458. PNG_FLAG_CRC_CRITICAL_MASK)
  2459. /* save typing and make code easier to understand */
  2460. #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
  2461. abs((int)((c1).green) - (int)((c2).green)) + \
  2462. abs((int)((c1).blue) - (int)((c2).blue)))
  2463. /* Added to libpng-1.2.6 JB */
  2464. #define PNG_ROWBYTES(pixel_bits, width) \
  2465. ((pixel_bits) >= 8 ? \
  2466. ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \
  2467. (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
  2468. /* PNG_OUT_OF_RANGE returns true if value is outside the range
  2469. ideal-delta..ideal+delta. Each argument is evaluated twice.
  2470. "ideal" and "delta" should be constants, normally simple
  2471. integers, "value" a variable. Added to libpng-1.2.6 JB */
  2472. #define PNG_OUT_OF_RANGE(value, ideal, delta) \
  2473. ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  2474. /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
  2475. #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
  2476. /* place to hold the signature string for a PNG file. */
  2477. #ifdef PNG_USE_GLOBAL_ARRAYS
  2478. PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8];
  2479. #else
  2480. #if 0
  2481. #define png_sig png_sig_bytes(NULL)
  2482. #endif
  2483. #endif
  2484. #endif /* PNG_NO_EXTERN */
  2485. /* Constant strings for known chunk types. If you need to add a chunk,
  2486. * define the name here, and add an invocation of the macro in png.c and
  2487. * wherever it's needed.
  2488. */
  2489. #define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
  2490. #define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
  2491. #define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
  2492. #define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
  2493. #define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
  2494. #define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
  2495. #define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
  2496. #define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
  2497. #define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
  2498. #define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
  2499. #define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
  2500. #define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
  2501. #define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
  2502. #define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
  2503. #define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
  2504. #define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
  2505. #define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
  2506. #define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
  2507. #define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
  2508. #define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
  2509. #define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
  2510. #ifdef PNG_USE_GLOBAL_ARRAYS
  2511. PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5];
  2512. PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5];
  2513. PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5];
  2514. PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5];
  2515. PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5];
  2516. PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5];
  2517. PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5];
  2518. PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5];
  2519. PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5];
  2520. PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5];
  2521. PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5];
  2522. PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5];
  2523. PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5];
  2524. PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5];
  2525. PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5];
  2526. PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5];
  2527. PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5];
  2528. PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5];
  2529. PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5];
  2530. PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5];
  2531. PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
  2532. #endif /* PNG_USE_GLOBAL_ARRAYS */
  2533. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  2534. /* Initialize png_ptr struct for reading, and allocate any other memory.
  2535. * (old interface - DEPRECATED - use png_create_read_struct instead).
  2536. */
  2537. extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
  2538. #undef png_read_init
  2539. #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
  2540. PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
  2541. #endif
  2542. extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
  2543. png_const_charp user_png_ver, png_size_t png_struct_size));
  2544. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  2545. extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
  2546. png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
  2547. png_info_size));
  2548. #endif
  2549. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  2550. /* Initialize png_ptr struct for writing, and allocate any other memory.
  2551. * (old interface - DEPRECATED - use png_create_write_struct instead).
  2552. */
  2553. extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
  2554. #undef png_write_init
  2555. #define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
  2556. PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
  2557. #endif
  2558. extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
  2559. png_const_charp user_png_ver, png_size_t png_struct_size));
  2560. extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
  2561. png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
  2562. png_info_size));
  2563. /* Allocate memory for an internal libpng struct */
  2564. PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
  2565. /* Free memory from internal libpng struct */
  2566. PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
  2567. PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
  2568. malloc_fn, png_voidp mem_ptr));
  2569. PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
  2570. png_free_ptr free_fn, png_voidp mem_ptr));
  2571. /* Free any memory that info_ptr points to and reset struct. */
  2572. PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
  2573. png_infop info_ptr));
  2574. #ifndef PNG_1_0_X
  2575. /* Function to allocate memory for zlib. */
  2576. PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
  2577. /* Function to free memory for zlib */
  2578. PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
  2579. #ifdef PNG_SIZE_T
  2580. /* Function to convert a sizeof an item to png_sizeof item */
  2581. PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
  2582. #endif
  2583. /* Next four functions are used internally as callbacks. PNGAPI is required
  2584. * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
  2585. PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
  2586. png_bytep data, png_size_t length));
  2587. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  2588. PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
  2589. png_bytep buffer, png_size_t length));
  2590. #endif
  2591. PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
  2592. png_bytep data, png_size_t length));
  2593. #if defined(PNG_WRITE_FLUSH_SUPPORTED)
  2594. #if !defined(PNG_NO_STDIO)
  2595. PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
  2596. #endif
  2597. #endif
  2598. #else /* PNG_1_0_X */
  2599. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  2600. PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
  2601. png_bytep buffer, png_size_t length));
  2602. #endif
  2603. #endif /* PNG_1_0_X */
  2604. /* Reset the CRC variable */
  2605. PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
  2606. /* Write the "data" buffer to whatever output you are using. */
  2607. PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
  2608. png_size_t length));
  2609. /* Read data from whatever input you are using into the "data" buffer */
  2610. PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
  2611. png_size_t length));
  2612. /* Read bytes into buf, and update png_ptr->crc */
  2613. PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
  2614. png_size_t length));
  2615. /* Decompress data in a chunk that uses compression */
  2616. #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
  2617. defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
  2618. PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
  2619. int comp_type, png_charp chunkdata, png_size_t chunklength,
  2620. png_size_t prefix_length, png_size_t *data_length));
  2621. #endif
  2622. /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
  2623. PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
  2624. /* Read the CRC from the file and compare it to the libpng calculated CRC */
  2625. PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
  2626. /* Calculate the CRC over a section of data. Note that we are only
  2627. * passing a maximum of 64K on systems that have this as a memory limit,
  2628. * since this is the maximum buffer size we can specify.
  2629. */
  2630. PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
  2631. png_size_t length));
  2632. #if defined(PNG_WRITE_FLUSH_SUPPORTED)
  2633. PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
  2634. #endif
  2635. /* simple function to write the signature */
  2636. PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
  2637. /* write various chunks */
  2638. /* Write the IHDR chunk, and update the png_struct with the necessary
  2639. * information.
  2640. */
  2641. PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
  2642. png_uint_32 height,
  2643. int bit_depth, int color_type, int compression_method, int filter_method,
  2644. int interlace_method));
  2645. PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
  2646. png_uint_32 num_pal));
  2647. PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
  2648. png_size_t length));
  2649. PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
  2650. #if defined(PNG_WRITE_gAMA_SUPPORTED)
  2651. #ifdef PNG_FLOATING_POINT_SUPPORTED
  2652. PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
  2653. #endif
  2654. #ifdef PNG_FIXED_POINT_SUPPORTED
  2655. PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point
  2656. file_gamma));
  2657. #endif
  2658. #endif
  2659. #if defined(PNG_WRITE_sBIT_SUPPORTED)
  2660. PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
  2661. int color_type));
  2662. #endif
  2663. #if defined(PNG_WRITE_cHRM_SUPPORTED)
  2664. #ifdef PNG_FLOATING_POINT_SUPPORTED
  2665. PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
  2666. double white_x, double white_y,
  2667. double red_x, double red_y, double green_x, double green_y,
  2668. double blue_x, double blue_y));
  2669. #endif
  2670. #ifdef PNG_FIXED_POINT_SUPPORTED
  2671. PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
  2672. png_fixed_point int_white_x, png_fixed_point int_white_y,
  2673. png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
  2674. int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
  2675. png_fixed_point int_blue_y));
  2676. #endif
  2677. #endif
  2678. #if defined(PNG_WRITE_sRGB_SUPPORTED)
  2679. PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
  2680. int intent));
  2681. #endif
  2682. #if defined(PNG_WRITE_iCCP_SUPPORTED)
  2683. PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
  2684. png_charp name, int compression_type,
  2685. png_charp profile, int proflen));
  2686. /* Note to maintainer: profile should be png_bytep */
  2687. #endif
  2688. #if defined(PNG_WRITE_sPLT_SUPPORTED)
  2689. PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
  2690. png_sPLT_tp palette));
  2691. #endif
  2692. #if defined(PNG_WRITE_tRNS_SUPPORTED)
  2693. PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
  2694. png_color_16p values, int number, int color_type));
  2695. #endif
  2696. #if defined(PNG_WRITE_bKGD_SUPPORTED)
  2697. PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
  2698. png_color_16p values, int color_type));
  2699. #endif
  2700. #if defined(PNG_WRITE_hIST_SUPPORTED)
  2701. PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
  2702. int num_hist));
  2703. #endif
  2704. #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
  2705. defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
  2706. PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
  2707. png_charp key, png_charpp new_key));
  2708. #endif
  2709. #if defined(PNG_WRITE_tEXt_SUPPORTED)
  2710. PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
  2711. png_charp text, png_size_t text_len));
  2712. #endif
  2713. #if defined(PNG_WRITE_zTXt_SUPPORTED)
  2714. PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
  2715. png_charp text, png_size_t text_len, int compression));
  2716. #endif
  2717. #if defined(PNG_WRITE_iTXt_SUPPORTED)
  2718. PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
  2719. int compression, png_charp key, png_charp lang, png_charp lang_key,
  2720. png_charp text));
  2721. #endif
  2722. #if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */
  2723. PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
  2724. png_infop info_ptr, png_textp text_ptr, int num_text));
  2725. #endif
  2726. #if defined(PNG_WRITE_oFFs_SUPPORTED)
  2727. PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
  2728. png_int_32 x_offset, png_int_32 y_offset, int unit_type));
  2729. #endif
  2730. #if defined(PNG_WRITE_pCAL_SUPPORTED)
  2731. PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
  2732. png_int_32 X0, png_int_32 X1, int type, int nparams,
  2733. png_charp units, png_charpp params));
  2734. #endif
  2735. #if defined(PNG_WRITE_pHYs_SUPPORTED)
  2736. PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
  2737. png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
  2738. int unit_type));
  2739. #endif
  2740. #if defined(PNG_WRITE_tIME_SUPPORTED)
  2741. PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
  2742. png_timep mod_time));
  2743. #endif
  2744. #if defined(PNG_WRITE_sCAL_SUPPORTED)
  2745. #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
  2746. PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
  2747. int unit, double width, double height));
  2748. #else
  2749. #ifdef PNG_FIXED_POINT_SUPPORTED
  2750. PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
  2751. int unit, png_charp width, png_charp height));
  2752. #endif
  2753. #endif
  2754. #endif
  2755. /* Called when finished processing a row of data */
  2756. PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
  2757. /* Internal use only. Called before first row of data */
  2758. PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
  2759. #if defined(PNG_READ_GAMMA_SUPPORTED)
  2760. PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
  2761. #endif
  2762. /* combine a row of data, dealing with alpha, etc. if requested */
  2763. PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
  2764. int mask));
  2765. #if defined(PNG_READ_INTERLACING_SUPPORTED)
  2766. /* expand an interlaced row */
  2767. /* OLD pre-1.0.9 interface:
  2768. PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
  2769. png_bytep row, int pass, png_uint_32 transformations));
  2770. */
  2771. PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
  2772. #endif
  2773. /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
  2774. #if defined(PNG_WRITE_INTERLACING_SUPPORTED)
  2775. /* grab pixels out of a row for an interlaced pass */
  2776. PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
  2777. png_bytep row, int pass));
  2778. #endif
  2779. /* unfilter a row */
  2780. PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
  2781. png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
  2782. /* Choose the best filter to use and filter the row data */
  2783. PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
  2784. png_row_infop row_info));
  2785. /* Write out the filtered row. */
  2786. PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
  2787. png_bytep filtered_row));
  2788. /* finish a row while reading, dealing with interlacing passes, etc. */
  2789. PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
  2790. /* initialize the row buffers, etc. */
  2791. PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
  2792. /* optional call to update the users info structure */
  2793. PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
  2794. png_infop info_ptr));
  2795. /* these are the functions that do the transformations */
  2796. #if defined(PNG_READ_FILLER_SUPPORTED)
  2797. PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
  2798. png_bytep row, png_uint_32 filler, png_uint_32 flags));
  2799. #endif
  2800. #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
  2801. PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
  2802. png_bytep row));
  2803. #endif
  2804. #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
  2805. PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
  2806. png_bytep row));
  2807. #endif
  2808. #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
  2809. PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
  2810. png_bytep row));
  2811. #endif
  2812. #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
  2813. PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
  2814. png_bytep row));
  2815. #endif
  2816. #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
  2817. defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
  2818. PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
  2819. png_bytep row, png_uint_32 flags));
  2820. #endif
  2821. #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
  2822. PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
  2823. #endif
  2824. #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
  2825. PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
  2826. #endif
  2827. #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
  2828. PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
  2829. row_info, png_bytep row));
  2830. #endif
  2831. #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
  2832. PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
  2833. png_bytep row));
  2834. #endif
  2835. #if defined(PNG_READ_PACK_SUPPORTED)
  2836. PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
  2837. #endif
  2838. #if defined(PNG_READ_SHIFT_SUPPORTED)
  2839. PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
  2840. png_color_8p sig_bits));
  2841. #endif
  2842. #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
  2843. PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
  2844. #endif
  2845. #if defined(PNG_READ_16_TO_8_SUPPORTED)
  2846. PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
  2847. #endif
  2848. #if defined(PNG_READ_DITHER_SUPPORTED)
  2849. PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
  2850. png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
  2851. # if defined(PNG_CORRECT_PALETTE_SUPPORTED)
  2852. PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
  2853. png_colorp palette, int num_palette));
  2854. # endif
  2855. #endif
  2856. #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
  2857. PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
  2858. #endif
  2859. #if defined(PNG_WRITE_PACK_SUPPORTED)
  2860. PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
  2861. png_bytep row, png_uint_32 bit_depth));
  2862. #endif
  2863. #if defined(PNG_WRITE_SHIFT_SUPPORTED)
  2864. PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
  2865. png_color_8p bit_depth));
  2866. #endif
  2867. #if defined(PNG_READ_BACKGROUND_SUPPORTED)
  2868. #if defined(PNG_READ_GAMMA_SUPPORTED)
  2869. PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
  2870. png_color_16p trans_values, png_color_16p background,
  2871. png_color_16p background_1,
  2872. png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
  2873. png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
  2874. png_uint_16pp gamma_16_to_1, int gamma_shift));
  2875. #else
  2876. PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
  2877. png_color_16p trans_values, png_color_16p background));
  2878. #endif
  2879. #endif
  2880. #if defined(PNG_READ_GAMMA_SUPPORTED)
  2881. PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
  2882. png_bytep gamma_table, png_uint_16pp gamma_16_table,
  2883. int gamma_shift));
  2884. #endif
  2885. #if defined(PNG_READ_EXPAND_SUPPORTED)
  2886. PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
  2887. png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
  2888. PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
  2889. png_bytep row, png_color_16p trans_value));
  2890. #endif
  2891. /* The following decodes the appropriate chunks, and does error correction,
  2892. * then calls the appropriate callback for the chunk if it is valid.
  2893. */
  2894. /* decode the IHDR chunk */
  2895. PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
  2896. png_uint_32 length));
  2897. PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
  2898. png_uint_32 length));
  2899. PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
  2900. png_uint_32 length));
  2901. #if defined(PNG_READ_bKGD_SUPPORTED)
  2902. PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
  2903. png_uint_32 length));
  2904. #endif
  2905. #if defined(PNG_READ_cHRM_SUPPORTED)
  2906. PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
  2907. png_uint_32 length));
  2908. #endif
  2909. #if defined(PNG_READ_gAMA_SUPPORTED)
  2910. PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
  2911. png_uint_32 length));
  2912. #endif
  2913. #if defined(PNG_READ_hIST_SUPPORTED)
  2914. PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
  2915. png_uint_32 length));
  2916. #endif
  2917. #if defined(PNG_READ_iCCP_SUPPORTED)
  2918. extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
  2919. png_uint_32 length));
  2920. #endif /* PNG_READ_iCCP_SUPPORTED */
  2921. #if defined(PNG_READ_iTXt_SUPPORTED)
  2922. PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  2923. png_uint_32 length));
  2924. #endif
  2925. #if defined(PNG_READ_oFFs_SUPPORTED)
  2926. PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
  2927. png_uint_32 length));
  2928. #endif
  2929. #if defined(PNG_READ_pCAL_SUPPORTED)
  2930. PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
  2931. png_uint_32 length));
  2932. #endif
  2933. #if defined(PNG_READ_pHYs_SUPPORTED)
  2934. PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
  2935. png_uint_32 length));
  2936. #endif
  2937. #if defined(PNG_READ_sBIT_SUPPORTED)
  2938. PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
  2939. png_uint_32 length));
  2940. #endif
  2941. #if defined(PNG_READ_sCAL_SUPPORTED)
  2942. PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
  2943. png_uint_32 length));
  2944. #endif
  2945. #if defined(PNG_READ_sPLT_SUPPORTED)
  2946. extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
  2947. png_uint_32 length));
  2948. #endif /* PNG_READ_sPLT_SUPPORTED */
  2949. #if defined(PNG_READ_sRGB_SUPPORTED)
  2950. PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
  2951. png_uint_32 length));
  2952. #endif
  2953. #if defined(PNG_READ_tEXt_SUPPORTED)
  2954. PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  2955. png_uint_32 length));
  2956. #endif
  2957. #if defined(PNG_READ_tIME_SUPPORTED)
  2958. PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
  2959. png_uint_32 length));
  2960. #endif
  2961. #if defined(PNG_READ_tRNS_SUPPORTED)
  2962. PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
  2963. png_uint_32 length));
  2964. #endif
  2965. #if defined(PNG_READ_zTXt_SUPPORTED)
  2966. PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  2967. png_uint_32 length));
  2968. #endif
  2969. PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
  2970. png_infop info_ptr, png_uint_32 length));
  2971. PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
  2972. png_bytep chunk_name));
  2973. /* handle the transformations for reading and writing */
  2974. PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
  2975. PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
  2976. PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
  2977. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  2978. PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
  2979. png_infop info_ptr));
  2980. PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
  2981. png_infop info_ptr));
  2982. PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
  2983. PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
  2984. png_uint_32 length));
  2985. PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
  2986. PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
  2987. PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
  2988. png_bytep buffer, png_size_t buffer_length));
  2989. PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
  2990. PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
  2991. png_bytep buffer, png_size_t buffer_length));
  2992. PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
  2993. PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
  2994. png_infop info_ptr, png_uint_32 length));
  2995. PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
  2996. png_infop info_ptr));
  2997. PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
  2998. png_infop info_ptr));
  2999. PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
  3000. PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
  3001. png_infop info_ptr));
  3002. PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
  3003. png_infop info_ptr));
  3004. PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
  3005. #if defined(PNG_READ_tEXt_SUPPORTED)
  3006. PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
  3007. png_infop info_ptr, png_uint_32 length));
  3008. PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
  3009. png_infop info_ptr));
  3010. #endif
  3011. #if defined(PNG_READ_zTXt_SUPPORTED)
  3012. PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
  3013. png_infop info_ptr, png_uint_32 length));
  3014. PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
  3015. png_infop info_ptr));
  3016. #endif
  3017. #if defined(PNG_READ_iTXt_SUPPORTED)
  3018. PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
  3019. png_infop info_ptr, png_uint_32 length));
  3020. PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
  3021. png_infop info_ptr));
  3022. #endif
  3023. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  3024. #ifdef PNG_MNG_FEATURES_SUPPORTED
  3025. PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
  3026. png_bytep row));
  3027. PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
  3028. png_bytep row));
  3029. #endif
  3030. #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
  3031. #if defined(PNG_MMX_CODE_SUPPORTED)
  3032. /* png.c */ /* PRIVATE */
  3033. PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
  3034. #endif
  3035. #endif
  3036. #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
  3037. PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,
  3038. png_infop info_ptr));
  3039. PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr,
  3040. png_infop info_ptr));
  3041. PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr,
  3042. png_infop info_ptr));
  3043. PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr,
  3044. png_infop info_ptr));
  3045. PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr,
  3046. png_infop info_ptr));
  3047. #if defined(PNG_pHYs_SUPPORTED)
  3048. PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr,
  3049. png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
  3050. #endif /* PNG_pHYs_SUPPORTED */
  3051. #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
  3052. /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
  3053. #endif /* PNG_INTERNAL */
  3054. #ifdef __cplusplus
  3055. }
  3056. #endif
  3057. #endif /* PNG_VERSION_INFO_ONLY */
  3058. /* do not put anything past this line */
  3059. #endif /* PNG_H */