png.h 139 KB

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