1793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* png.h - header file for PNG reference library 3793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 4793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng version 1.5.12 - July 11, 2012 5793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Copyright (c) 1998-2012 Glenn Randers-Pehrson 6793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 7793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 8793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 9793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This code is released under the libpng license (See LICENSE, below) 10793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 11793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Authors and maintainers: 12793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat 13793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger 14793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 0.97, January 1998, through 1.5.12 - July 11, 2012: Glenn 15793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * See also "Contributing Authors", below. 16793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 17793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Note about libpng version numbers: 18793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 19793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Due to various miscommunications, unforeseen code incompatibilities 20793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and occasional factors outside the authors' control, version numbering 21793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * on the library has not always been consistent and straightforward. 22793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The following table summarizes matters since version 0.89c, which was 23793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the first widely used release: 24793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 25793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * source png.h png.h shared-lib 26793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * version string int version 27793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * ------- ------ ----- ---------- 28793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.89c "1.0 beta 3" 0.89 89 1.0.89 29793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] 30793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] 31793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] 32793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] 33793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.97c 0.97 97 2.0.97 34793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.98 0.98 98 2.0.98 35793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.99 0.99 98 2.0.99 36793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.99a-m 0.99 99 2.0.99 37793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.00 1.00 100 2.1.0 [100 should be 10000] 38793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] 39793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.1 png.h string is 10001 2.1.0 40793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.1a-e identical to the 10002 from here on, the shared library 41793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.2 source version) 10002 is 2.V where V is the source code 42793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.2a-b 10003 version, except as noted. 43793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.3 10003 44793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.3a-d 10004 45793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.4 10004 46793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.4a-f 10005 47793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.5 (+ 2 patches) 10005 48793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.5a-d 10006 49793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.5e-r 10100 (not source compatible) 50793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.5s-v 10006 (not binary compatible) 51793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) 52793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.6d-f 10007 (still binary incompatible) 53793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.6g 10007 54793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.6h 10007 10.6h (testing xy.z so-numbering) 55793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.6i 10007 10.6i 56793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) 57793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) 58793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) 59793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) 60793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.7 1 10007 (still compatible) 61793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 62793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.8rc1 1 10008 2.1.0.8rc1 63793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.8 1 10008 2.1.0.8 64793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 65793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.9rc1 1 10009 2.1.0.9rc1 66793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 67793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.9rc2 1 10009 2.1.0.9rc2 68793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.9 1 10009 2.1.0.9 69793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.10beta1 1 10010 2.1.0.10beta1 70793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.10rc1 1 10010 2.1.0.10rc1 71793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.10 1 10010 2.1.0.10 72793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 73793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.11rc1 1 10011 2.1.0.11rc1 74793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.11 1 10011 2.1.0.11 75793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 76793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.12rc1 2 10012 2.1.0.12rc1 77793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.12 2 10012 2.1.0.12 78793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) 79793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 80793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 81793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.0rc1 3 10200 3.1.2.0rc1 82793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.0 3 10200 3.1.2.0 83793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 84793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 85793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.1 3 10201 3.1.2.1 86793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 87793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 88793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 89793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 90793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.13 10 10013 10.so.0.1.0.13 91793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.2 12 10202 12.so.0.1.2.2 92793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 93793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.3 12 10203 12.so.0.1.2.3 94793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 95793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 96793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 97793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.14 10 10014 10.so.0.1.0.14 98793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.4 13 10204 12.so.0.1.2.4 99793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 100793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 101793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 102793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.15 10 10015 10.so.0.1.0.15 103793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.5 13 10205 12.so.0.1.2.5 104793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 105793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.16 10 10016 10.so.0.1.0.16 106793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.6 13 10206 12.so.0.1.2.6 107793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 108793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1 109793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 110793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.17 10 10017 12.so.0.1.0.17 111793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.7 13 10207 12.so.0.1.2.7 112793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 113793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5 114793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 115793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.0.18 10 10018 12.so.0.1.0.18 116793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.8 13 10208 12.so.0.1.2.8 117793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 118793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.9beta4-11 13 10209 12.so.0.9[.0] 119793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.9rc1 13 10209 12.so.0.9[.0] 120793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.9 13 10209 12.so.0.9[.0] 121793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.10beta1-7 13 10210 12.so.0.10[.0] 122793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.10rc1-2 13 10210 12.so.0.10[.0] 123793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.10 13 10210 12.so.0.10[.0] 124793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0beta1-5 14 10400 14.so.0.0[.0] 125793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.11beta1-4 13 10211 12.so.0.11[.0] 126793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0beta7-8 14 10400 14.so.0.0[.0] 127793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.11 13 10211 12.so.0.11[.0] 128793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.12 13 10212 12.so.0.12[.0] 129793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0beta9-14 14 10400 14.so.0.0[.0] 130793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.2.13 13 10213 12.so.0.13[.0] 131793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0beta15-36 14 10400 14.so.0.0[.0] 132793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0beta37-87 14 10400 14.so.14.0[.0] 133793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0rc01 14 10400 14.so.14.0[.0] 134793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0beta88-109 14 10400 14.so.14.0[.0] 135793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0rc02-08 14 10400 14.so.14.0[.0] 136793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.0 14 10400 14.so.14.0[.0] 137793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.1beta01-03 14 10401 14.so.14.1[.0] 138793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.1rc01 14 10401 14.so.14.1[.0] 139793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.1beta04-12 14 10401 14.so.14.1[.0] 140793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.1 14 10401 14.so.14.1[.0] 141793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.2 14 10402 14.so.14.2[.0] 142793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.3 14 10403 14.so.14.3[.0] 143793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.4.4 14 10404 14.so.14.4[.0] 144793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.0beta01-58 15 10500 15.so.15.0[.0] 145793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.0rc01-07 15 10500 15.so.15.0[.0] 146793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.0 15 10500 15.so.15.0[.0] 147793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.1beta01-11 15 10501 15.so.15.1[.0] 148793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.1rc01-02 15 10501 15.so.15.1[.0] 149793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.1 15 10501 15.so.15.1[.0] 150793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.2beta01-03 15 10502 15.so.15.2[.0] 151793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.2rc01-03 15 10502 15.so.15.2[.0] 152793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.2 15 10502 15.so.15.2[.0] 153793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.3beta01-10 15 10503 15.so.15.3[.0] 154793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.3rc01-02 15 10503 15.so.15.3[.0] 155793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.3beta11 15 10503 15.so.15.3[.0] 156793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.3 [omitted] 157793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.4beta01-08 15 10504 15.so.15.4[.0] 158793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.4rc01 15 10504 15.so.15.4[.0] 159793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.4 15 10504 15.so.15.4[.0] 160793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.5beta01-08 15 10505 15.so.15.5[.0] 161793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.5rc01 15 10505 15.so.15.5[.0] 162793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.5 15 10505 15.so.15.5[.0] 163793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.6beta01-07 15 10506 15.so.15.6[.0] 164793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.6rc01-03 15 10506 15.so.15.6[.0] 165793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.6 15 10506 15.so.15.6[.0] 166793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.7beta01-05 15 10507 15.so.15.7[.0] 167793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.7rc01-03 15 10507 15.so.15.7[.0] 168793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.7 15 10507 15.so.15.7[.0] 169793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.8beta01 15 10508 15.so.15.8[.0] 170793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.8rc01 15 10508 15.so.15.8[.0] 171793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.8 15 10508 15.so.15.8[.0] 172793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.9beta01-02 15 10509 15.so.15.9[.0] 173793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.9rc01 15 10509 15.so.15.9[.0] 174793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.9 15 10509 15.so.15.9[.0] 175793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.10beta01-05 15 10510 15.so.15.10[.0] 176793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.10 15 10510 15.so.15.10[.0] 177793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.11beta01 15 10511 15.so.15.11[.0] 178793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.11rc01-05 15 10511 15.so.15.11[.0] 179793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.11 15 10511 15.so.15.11[.0] 180793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1.5.12 15 10512 15.so.15.12[.0] 181793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 182793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Henceforth the source version will match the shared-library major 183793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and minor numbers; the shared-library major version number will be 184793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * used for changes in backward compatibility, as it is intended. The 185793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_LIBPNG_VER macro, which is not used within libpng but is available 186793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * for applications, is an unsigned integer of the form xyyzz corresponding 187793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to the source version x.y.z (leading zeros in y and z). Beta versions 188793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * were given the previous public release number plus a letter, until 189793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * version 1.0.6j; from then on they were given the upcoming public 190793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * release number plus "betaNN" or "rcNN". 191793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 192793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Binary incompatibility exists only when applications make direct access 193793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to the info_ptr or png_ptr members through png.h, and the compiled 194793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * application is loaded with a different version of the library. 195793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 196793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * DLLNUM will change each time there are forward or backward changes 197793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * in binary compatibility (e.g., when a new feature is added). 198793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 199793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * See libpng-manual.txt or libpng.3 for more information. The PNG 200793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * specification is available as a W3C Recommendation and as an ISO 201793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/ 202793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 203793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 204793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* 205793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: 206793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 207793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If you modify libpng you may insert additional notices immediately following 208793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * this sentence. 209793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 210793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This code is released under the libpng license. 211793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 212793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 1.2.6, August 15, 2004, through 1.5.12, July 11, 2012, are 213793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are 214793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * distributed according to the same disclaimer and license as libpng-1.2.5 215793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with the following individual added to the list of Contributing Authors: 216793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 217793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Cosmin Truta 218793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 219793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are 220793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are 221793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * distributed according to the same disclaimer and license as libpng-1.0.6 222793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with the following individuals added to the list of Contributing Authors: 223793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 224793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Simon-Pierre Cadieux 225793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Eric S. Raymond 226793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Gilles Vollant 227793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 228793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and with the following additions to the disclaimer: 229793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 230793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * There is no warranty against interference with your enjoyment of the 231793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * library or against infringement. There is no warranty that our 232793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * efforts or the library will fulfill any of your particular purposes 233793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * or needs. This library is provided with all faults, and the entire 234793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * risk of satisfactory quality, performance, accuracy, and effort is with 235793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the user. 236793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 237793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are 238793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are 239793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * distributed according to the same disclaimer and license as libpng-0.96, 240793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with the following individuals added to the list of Contributing Authors: 241793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 242793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Tom Lane 243793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Glenn Randers-Pehrson 244793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Willem van Schaik 245793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 246793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 0.89, June 1996, through 0.96, May 1997, are 247793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Copyright (c) 1996, 1997 Andreas Dilger 248793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Distributed according to the same disclaimer and license as libpng-0.88, 249793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with the following individuals added to the list of Contributing Authors: 250793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 251793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * John Bowler 252793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Kevin Bracey 253793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Sam Bushell 254793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Magnus Holmgren 255793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Greg Roelofs 256793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Tom Tanner 257793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 258793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng versions 0.5, May 1995, through 0.88, January 1996, are 259793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. 260793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 261793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * For the purposes of this copyright and license, "Contributing Authors" 262793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is defined as the following set of individuals: 263793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 264793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Andreas Dilger 265793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Dave Martindale 266793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Guy Eric Schalnat 267793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Paul Schmidt 268793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Tim Wegner 269793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 270793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The PNG Reference Library is supplied "AS IS". The Contributing Authors 271793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and Group 42, Inc. disclaim all warranties, expressed or implied, 272793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * including, without limitation, the warranties of merchantability and of 273793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * fitness for any purpose. The Contributing Authors and Group 42, Inc. 274793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * assume no liability for direct, indirect, incidental, special, exemplary, 275793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * or consequential damages, which may result from the use of the PNG 276793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Reference Library, even if advised of the possibility of such damage. 277793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 278793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Permission is hereby granted to use, copy, modify, and distribute this 279793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * source code, or portions hereof, for any purpose, without fee, subject 280793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to the following restrictions: 281793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 282793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1. The origin of this source code must not be misrepresented. 283793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 284793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 2. Altered versions must be plainly marked as such and must not 285793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * be misrepresented as being the original source. 286793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 287793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 3. This Copyright notice may not be removed or altered from 288793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * any source or altered source distribution. 289793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 290793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The Contributing Authors and Group 42, Inc. specifically permit, without 291793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * fee, and encourage the use of this source code as a component to 292793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * supporting the PNG file format in commercial products. If you use this 293793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * source code in a product, acknowledgment is not required but would be 294793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * appreciated. 295793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 296793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 297793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* 298793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * A "png_get_copyright" function is available, for convenient use in "about" 299793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * boxes and the like: 300793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 301793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * printf("%s", png_get_copyright(NULL)); 302793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 303793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Also, the PNG logo (in PNG format, of course) is supplied in the 304793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). 305793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 306793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 307793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* 308793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Libpng is OSI Certified Open Source Software. OSI Certified is a 309793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * certification mark of the Open Source Initiative. 310793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 311793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 312793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* 313793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The contributing authors would like to thank all those who helped 314793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with testing, bug fixes, and patience. This wouldn't have been 315793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * possible without all of you. 316793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 317793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Thanks to Frank J. T. Wojcik for helping with the documentation. 318793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 319793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 320793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* 321793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Y2K compliance in libpng: 322793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * ========================= 323793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 324793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * July 11, 2012 325793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 326793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Since the PNG Development group is an ad-hoc body, we can't make 327793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * an official declaration. 328793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 329793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This is your unofficial assurance that libpng from version 0.71 and 330793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * upward through 1.5.12 are Y2K compliant. It is my belief that 331793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * earlier versions were also Y2K compliant. 332793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 333793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Libpng only has two year fields. One is a 2-byte unsigned integer 334793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * that will hold years up to 65535. The other holds the date in text 335793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * format, and will hold years up to 9999. 336793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 337793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The integer is 338793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * "png_uint_16 year" in png_time_struct. 339793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 340793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The string is 341793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * "char time_buffer[29]" in png_struct. This will be no 342793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * longer used in libpng-1.6.0 and will be removed from libpng-1.7.0. 343793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 344793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * There are seven time-related functions: 345793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png.c: png_convert_to_rfc_1123() in png.c 346793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (formerly png_convert_to_rfc_1152() in error) 347793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c 348793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_convert_from_time_t() in pngwrite.c 349793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_get_tIME() in pngget.c 350793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_handle_tIME() in pngrutil.c, called in pngread.c 351793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_tIME() in pngset.c 352793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_write_tIME() in pngwutil.c, called in pngwrite.c 353793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 354793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * All handle dates properly in a Y2K environment. The 355793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_convert_from_time_t() function calls gmtime() to convert from system 356793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * clock time, which returns (year - 1900), which we properly convert to 357793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the full 4-digit year. There is a possibility that applications using 358793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng are not passing 4-digit years into the png_convert_to_rfc_1123() 359793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * function, or that they are incorrectly passing only a 2-digit year 360793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * instead of "year - 1900" into the png_convert_from_struct_tm() function, 361793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * but this is not under our control. The libpng documentation has always 362793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * stated that it works with 4-digit years, and the APIs have been 363793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * documented as such. 364793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 365793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned 366793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * integer to hold the year, and can hold years as large as 65535. 367793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 368793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * zlib, upon which libpng depends, is also Y2K compliant. It contains 369793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * no date-related code. 370793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 371793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Glenn Randers-Pehrson 372793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng maintainer 373793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG Development Group 374793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 375793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 376793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifndef PNG_H 377793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_H 378793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 379793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This is not the place to learn how to use libpng. The file libpng-manual.txt 380793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * describes how to use libpng, and the file example.c summarizes it 381793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with some code on which to build. This file is useful for looking 382793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * at the actual function definitions and structure components. 383793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 384793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If you just need to read a PNG file and don't want to read the documentation 385793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * skip to the end of this file and read the section entitled 'simplified API'. 386793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 387793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 388793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Version information for png.h - this should match the version in png.c */ 389793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER_STRING "1.5.12" 390793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_HEADER_VERSION_STRING \ 391793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler " libpng version 1.5.12 - July 11, 2012\n" 392793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 393793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER_SONUM 15 394793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER_DLLNUM 15 395793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 396793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ 397793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER_MAJOR 1 398793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER_MINOR 5 399793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER_RELEASE 12 400793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 401793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This should match the numeric part of the final component of 402793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_LIBPNG_VER_STRING, omitting any leading zero: 403793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 404793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 405793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER_BUILD 0 406793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 407793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Release Status */ 408793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_ALPHA 1 409793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_BETA 2 410793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_RC 3 411793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_STABLE 4 412793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 413793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 414793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Release-Specific Flags */ 415793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with 416793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_LIBPNG_BUILD_STABLE only */ 417793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with 418793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_LIBPNG_BUILD_SPECIAL */ 419793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with 420793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_LIBPNG_BUILD_PRIVATE */ 421793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 422793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE 423793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 424793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Careful here. At one time, Guy wanted to use 082, but that would be octal. 425793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * We must not include leading zeros. 426793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only 427793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * version 1.0.0 was mis-numbered 100 instead of 10000). From 428793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release 429793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 430793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_LIBPNG_VER 10512 /* 1.5.12 */ 431793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 432793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Library configuration: these options cannot be changed after 433793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the library has been built. 434793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 435793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifndef PNGLCONF_H 436793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler /* If pnglibconf.h is missing, you can 437793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h 438793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 439793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# include "pnglibconf.h" 440793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 441793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 442793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifndef PNG_VERSION_INFO_ONLY 443793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# ifndef PNG_BUILDING_SYMBOL_TABLE 444793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler /* 445793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Standard header files (not needed for the version info or while 446793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * building symbol table -- see scripts/pnglibconf.dfa) 447793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 448793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# ifdef PNG_SETJMP_SUPPORTED 449793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# include <setjmp.h> 450793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# endif 451793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 452793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler /* Need the time information for converting tIME chunks, it 453793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * defines struct tm: 454793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 455793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# ifdef PNG_CONVERT_tIME_SUPPORTED 456793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler /* "time.h" functions are not supported on all operating systems */ 457793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# include <time.h> 458793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# endif 459793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# endif 460793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 461793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Machine specific configuration. */ 462793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# include "pngconf.h" 463793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 464793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 465793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* 466793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Added at libpng-1.2.8 467793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 468793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Ref MSDN: Private as priority over Special 469793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * VS_FF_PRIVATEBUILD File *was not* built using standard release 470793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * procedures. If this value is given, the StringFileInfo block must 471793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * contain a PrivateBuild string. 472793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 473793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * VS_FF_SPECIALBUILD File *was* built by the original company using 474793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * standard release procedures but is a variation of the standard 475793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * file of the same version number. If this value is given, the 476793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * StringFileInfo block must contain a SpecialBuild string. 477793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 478793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 479793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_PRIVATEBUILD /* From pnglibconf.h */ 480793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_LIBPNG_BUILD_TYPE \ 481793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE) 482793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#else 483793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# ifdef PNG_LIBPNG_SPECIALBUILD 484793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_LIBPNG_BUILD_TYPE \ 485793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL) 486793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# else 487793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE) 488793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# endif 489793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 490793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 491793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifndef PNG_VERSION_INFO_ONLY 492793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 493793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Inhibit C++ name-mangling for libpng functions but not for system calls. */ 494793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef __cplusplus 495793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslerextern "C" { 496793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* __cplusplus */ 497793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 498793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Version information for C files, stored in png.c. This had better match 499793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the version above. 500793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 501793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define png_libpng_ver png_get_header_ver(NULL) 502793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 503793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This file is arranged in several sections: 504793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 505793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1. Any configuration options that can be specified by for the application 506793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * code when it is built. (Build time configuration is in pnglibconf.h) 507793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 2. Type definitions (base types are defined in pngconf.h), structure 508793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * definitions. 509793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 3. Exported library functions. 510793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 511793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The library source code has additional files (principally pngpriv.h) that 512793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * allow configuration of the library. 513793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 514793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Section 1: run time configuration 515793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * See pnglibconf.h for build time configuration 516793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 517793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Run time configuration allows the application to choose between 518793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * implementations of certain arithmetic APIs. The default is set 519793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * at build time and recorded in pnglibconf.h, but it is safe to 520793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * override these (and only these) settings. Note that this won't 521793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * change what the library does, only application code, and the 522793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * settings can (and probably should) be made on a per-file basis 523793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * by setting the #defines before including png.h 524793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 525793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Use macros to read integers from PNG data or use the exported 526793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * functions? 527793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_USE_READ_MACROS: use the macros (see below) Note that 528793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the macros evaluate their argument multiple times. 529793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_NO_USE_READ_MACROS: call the relevant library function. 530793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 531793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Use the alternative algorithm for compositing alpha samples that 532793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * does not use division? 533793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division' 534793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * algorithm. 535793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm. 536793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 537793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is 538793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * false? 539793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error 540793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * APIs to png_warning. 541793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Otherwise the calls are mapped to png_error. 542793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 543793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 544793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Section 2: type definitions, including structures and compile time 545793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * constants. 546793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * See pngconf.h for base types that vary by machine/system 547793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 548793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 549793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This triggers a compiler error in png.c, if png.c and png.h 550793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * do not agree upon the version number. 551793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 552793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef char* png_libpng_version_1_5_12; 553793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 554793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Three color definitions. The order of the red, green, and blue, (and the 555793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * exact size) is not important, although the size of the fields need to 556793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * be png_byte or png_uint_16 (as defined below). 557793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 558793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_color_struct 559793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 560793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte red; 561793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte green; 562793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte blue; 563793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_color; 564793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_color FAR * png_colorp; 565793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_color FAR * png_const_colorp; 566793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_color FAR * FAR * png_colorpp; 567793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 568793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_color_16_struct 569793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 570793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte index; /* used for palette files */ 571793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 red; /* for use in red green blue files */ 572793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 green; 573793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 blue; 574793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 gray; /* for use in grayscale files */ 575793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_color_16; 576793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_color_16 FAR * png_color_16p; 577793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_color_16 FAR * png_const_color_16p; 578793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_color_16 FAR * FAR * png_color_16pp; 579793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 580793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_color_8_struct 581793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 582793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte red; /* for use in red green blue files */ 583793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte green; 584793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte blue; 585793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte gray; /* for use in grayscale files */ 586793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte alpha; /* for alpha channel files */ 587793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_color_8; 588793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_color_8 FAR * png_color_8p; 589793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_color_8 FAR * png_const_color_8p; 590793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_color_8 FAR * FAR * png_color_8pp; 591793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 592793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* 593793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The following two structures are used for the in-core representation 594793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * of sPLT chunks. 595793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 596793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_sPLT_entry_struct 597793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 598793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 red; 599793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 green; 600793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 blue; 601793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 alpha; 602793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 frequency; 603793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_sPLT_entry; 604793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_sPLT_entry FAR * png_sPLT_entryp; 605793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_sPLT_entry FAR * png_const_sPLT_entryp; 606793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp; 607793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 608793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* When the depth of the sPLT palette is 8 bits, the color and alpha samples 609793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * occupy the LSB of their respective members, and the MSB of each member 610793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is zero-filled. The frequency member always occupies the full 16 bits. 611793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 612793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 613793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_sPLT_struct 614793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 615793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charp name; /* palette name */ 616793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte depth; /* depth of palette samples */ 617793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_sPLT_entryp entries; /* palette entries */ 618793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_int_32 nentries; /* number of palette entries */ 619793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_sPLT_t; 620793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_sPLT_t FAR * png_sPLT_tp; 621793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_sPLT_t FAR * png_const_sPLT_tp; 622793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_sPLT_t FAR * FAR * png_sPLT_tpp; 623793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 624793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_TEXT_SUPPORTED 625793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, 626793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and whether that contents is compressed or not. The "key" field 627793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * points to a regular zero-terminated C string. The "text" fields can be a 628793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * regular C string, an empty string, or a NULL pointer. 629793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * However, the structure returned by png_get_text() will always contain 630793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the "text" field as a regular zero-terminated C string (possibly 631793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * empty), never a NULL pointer, so it can be safely used in printf() and 632793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * other string-handling functions. Note that the "itxt_length", "lang", and 633793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * "lang_key" members of the structure only exist when the library is built 634793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with iTXt chunk support. Prior to libpng-1.4.0 the library was built by 635793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * default without iTXt support. Also note that when iTXt *is* supported, 636793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the "lang" and "lang_key" fields contain NULL pointers when the 637793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or 638793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the 639793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag" 640793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * which is always 0 or 1, or its "compression method" which is always 0. 641793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 642793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_text_struct 643793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 644793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int compression; /* compression value: 645793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler -1: tEXt, none 646793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 0: zTXt, deflate 647793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1: iTXt, none 648793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2: iTXt, deflate */ 649793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charp key; /* keyword, 1-79 character description of "text" */ 650793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charp text; /* comment, may be an empty string (ie "") 651793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler or a NULL pointer */ 652793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_size_t text_length; /* length of the text string */ 653793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_size_t itxt_length; /* length of the itxt string */ 654793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charp lang; /* language code, 0-79 characters 655793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler or a NULL pointer */ 656793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charp lang_key; /* keyword translated UTF-8 string, 0 or more 657793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler chars or a NULL pointer */ 658793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_text; 659793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_text FAR * png_textp; 660793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_text FAR * png_const_textp; 661793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_text FAR * FAR * png_textpp; 662793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 663793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 664793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Supported compression types for text in PNG files (tEXt, and zTXt). 665793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ 666793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TEXT_COMPRESSION_NONE_WR -3 667793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TEXT_COMPRESSION_zTXt_WR -2 668793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TEXT_COMPRESSION_NONE -1 669793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TEXT_COMPRESSION_zTXt 0 670793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ITXT_COMPRESSION_NONE 1 671793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ITXT_COMPRESSION_zTXt 2 672793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */ 673793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 674793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* png_time is a way to hold the time in an machine independent way. 675793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Two conversions are provided, both from time_t and struct tm. There 676793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is no portable way to convert to either of these structures, as far 677793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * as I know. If you know of a portable way, send it to me. As a side 678793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * note - PNG has always been Year 2000 compliant! 679793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 680793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_time_struct 681793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 682793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16 year; /* full year, as in, 1995 */ 683793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte month; /* month of year, 1 - 12 */ 684793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte day; /* day of month, 1 - 31 */ 685793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte hour; /* hour of day, 0 - 23 */ 686793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte minute; /* minute of hour, 0 - 59 */ 687793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ 688793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_time; 689793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_time FAR * png_timep; 690793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_time FAR * png_const_timep; 691793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_time FAR * FAR * png_timepp; 692793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 693793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \ 694793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED) 695793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* png_unknown_chunk is a structure to hold queued chunks for which there is 696793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * no specific support. The idea is that we can use this to queue 697793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * up private chunks for output even though the library doesn't actually 698793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * know about their semantics. 699793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 700793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_unknown_chunk_t 701793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 702793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte name[5]; 703793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte *data; 704793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_size_t size; 705793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 706793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler /* libpng-using applications should NOT directly modify this byte. */ 707793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte location; /* mode of operation at read time */ 708793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} 709793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 710793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 711793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslerpng_unknown_chunk; 712793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_unknown_chunk FAR * png_unknown_chunkp; 713793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_unknown_chunk FAR * png_const_unknown_chunkp; 714793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp; 715793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 716793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 717793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Values for the unknown chunk location byte */ 718793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 719793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_HAVE_IHDR 0x01 720793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_HAVE_PLTE 0x02 721793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_AFTER_IDAT 0x08 722793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 723793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The complete definition of png_info has, as of libpng-1.5.0, 724793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * been moved into a separate header file that is not accessible to 725793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * applications. Read libpng-manual.txt or libpng.3 for more info. 726793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 727793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_info_def png_info; 728793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_info FAR * png_infop; 729793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_info FAR * png_const_infop; 730793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_info FAR * FAR * png_infopp; 731793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 732793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Maximum positive integer used in PNG is (2^31)-1 */ 733793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) 734793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_UINT_32_MAX ((png_uint_32)(-1)) 735793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_SIZE_MAX ((png_size_t)(-1)) 736793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 737793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are constants for fixed point values encoded in the 738793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG specification manner (x100000) 739793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 740793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FP_1 100000 741793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FP_HALF 50000 742793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FP_MAX ((png_fixed_point)0x7fffffffL) 743793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FP_MIN (-PNG_FP_MAX) 744793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 745793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These describe the color_type field in png_info. */ 746793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* color type masks */ 747793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_MASK_PALETTE 1 748793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_MASK_COLOR 2 749793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_MASK_ALPHA 4 750793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 751793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* color types. Note that not all combinations are legal */ 752793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_TYPE_GRAY 0 753793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) 754793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) 755793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) 756793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) 757793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* aliases */ 758793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA 759793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA 760793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 761793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This is for compression type. PNG 1.0-1.2 only define the single type. */ 762793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ 763793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE 764793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 765793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This is for filter type. PNG 1.0-1.2 only define the single type. */ 766793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ 767793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */ 768793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE 769793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 770793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are for the interlacing type. These values should NOT be changed. */ 771793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ 772793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ 773793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INTERLACE_LAST 2 /* Not a valid value */ 774793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 775793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are for the oFFs chunk. These values should NOT be changed. */ 776793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ 777793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ 778793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_OFFSET_LAST 2 /* Not a valid value */ 779793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 780793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are for the pCAL chunk. These values should NOT be changed. */ 781793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_EQUATION_LINEAR 0 /* Linear transformation */ 782793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ 783793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ 784793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ 785793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_EQUATION_LAST 4 /* Not a valid value */ 786793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 787793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are for the sCAL chunk. These values should NOT be changed. */ 788793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */ 789793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_SCALE_METER 1 /* meters per pixel */ 790793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_SCALE_RADIAN 2 /* radians per pixel */ 791793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_SCALE_LAST 3 /* Not a valid value */ 792793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 793793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are for the pHYs chunk. These values should NOT be changed. */ 794793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ 795793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_RESOLUTION_METER 1 /* pixels/meter */ 796793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_RESOLUTION_LAST 2 /* Not a valid value */ 797793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 798793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are for the sRGB chunk. These values should NOT be changed. */ 799793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_sRGB_INTENT_PERCEPTUAL 0 800793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_sRGB_INTENT_RELATIVE 1 801793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_sRGB_INTENT_SATURATION 2 802793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_sRGB_INTENT_ABSOLUTE 3 803793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ 804793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 805793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This is for text chunks */ 806793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_KEYWORD_MAX_LENGTH 79 807793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 808793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Maximum number of entries in PLTE/sPLT/tRNS arrays */ 809793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_MAX_PALETTE_LENGTH 256 810793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 811793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These determine if an ancillary chunk's data has been successfully read 812793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * from the PNG header, or if the application has filled in the corresponding 813793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * data in the info_struct to be written into the output file. The values 814793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * of the PNG_INFO_<chunk> defines should NOT be changed. 815793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 816793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_gAMA 0x0001 817793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_sBIT 0x0002 818793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_cHRM 0x0004 819793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_PLTE 0x0008 820793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_tRNS 0x0010 821793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_bKGD 0x0020 822793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_hIST 0x0040 823793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_pHYs 0x0080 824793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_oFFs 0x0100 825793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_tIME 0x0200 826793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_pCAL 0x0400 827793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ 828793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ 829793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ 830793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ 831793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */ 832793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 833793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This is used for the transformation routines, as some of them 834793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * change these values for the row. It also should enable using 835793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the routines for other purposes. 836793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 837793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_row_info_struct 838793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{ 839793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 width; /* width of row */ 840793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_size_t rowbytes; /* number of bytes in row */ 841793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte color_type; /* color type of row */ 842793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte bit_depth; /* bit depth of row */ 843793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte channels; /* number of channels (1, 2, 3, or 4) */ 844793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_byte pixel_depth; /* bits per pixel (depth * channels) */ 845793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} png_row_info; 846793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 847793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_row_info FAR * png_row_infop; 848793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_row_info FAR * FAR * png_row_infopp; 849793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 850793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The complete definition of png_struct has, as of libpng-1.5.0, 851793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * been moved into a separate header file that is not accessible to 852793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * applications. Read libpng-manual.txt or libpng.3 for more info. 853793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 854793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef struct png_struct_def png_struct; 855793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CONST png_struct FAR * png_const_structp; 856793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_struct FAR * png_structp; 857793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 858793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These are the function types for the I/O functions and for the functions 859793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * that allow the user to override the default I/O functions with his or her 860793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * own. The png_error_ptr type should match that of user-supplied warning 861793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and error functions, while the png_rw_ptr type should match that of the 862793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * user read/write data functions. Note that the 'write' function must not 863793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * modify the buffer it is passed. The 'read' function, on the other hand, is 864793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * expected to return the read data in the buffer. 865793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 866793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp)); 867793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t)); 868793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp)); 869793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32, 870793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int)); 871793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, 872793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int)); 873793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 874793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_PROGRESSIVE_READ_SUPPORTED 875793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); 876793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); 877793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 878793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The following callback receives png_uint_32 row_number, int pass for the 879793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_bytep data of the row. When transforming an interlaced image the 880793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * row number is the row number within the sub-image of the interlace pass, so 881793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the value will increase to the height of the sub-image (not the full image) 882793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * then reset to 0 for the next pass. 883793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 884793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to 885793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * find the output pixel (x,y) given an interlaced sub-image pixel 886793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (row,col,pass). (See below for these macros.) 887793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 888793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep, 889793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32, int)); 890793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 891793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 892793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ 893793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) 894793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop, 895793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_bytep)); 896793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 897793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 898793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_CHUNKS_SUPPORTED 899793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp, 900793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_unknown_chunkp)); 901793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 902793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED 903793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); 904793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 905793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 906793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SETJMP_SUPPORTED 907793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This must match the function definition in <setjmp.h>, and the application 908793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * must include this before png.h to obtain the definition of jmp_buf. The 909793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * function is required to be PNG_NORETURN, but this is not checked. If the 910793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * function does return the application will crash via an abort() or similar 911793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * system level call. 912793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 913793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If you get a warning here while building the library you may need to make 914793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * changes to ensure that pnglibconf.h records the calling convention used by 915793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * your compiler. This may be very difficult - try using a different compiler 916793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to build the library! 917793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 918793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef); 919793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 920793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 921793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Transform masks for the high-level interface */ 922793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ 923793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ 924793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ 925793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ 926793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ 927793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ 928793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ 929793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ 930793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ 931793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ 932793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ 933793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ 934793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */ 935793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added to libpng-1.2.34 */ 936793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER 937793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ 938793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added to libpng-1.4.0 */ 939793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ 940793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added to libpng-1.5.4 */ 941793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */ 942793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */ 943793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 944793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Flags for MNG supported features */ 945793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 946793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FLAG_MNG_FILTER_64 0x04 947793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALL_MNG_FEATURES 0x05 948793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 949793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* NOTE: prior to 1.5 these functions had no 'API' style declaration, 950793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * this allowed the zlib default functions to be used on Windows 951793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * platforms. In 1.5 the zlib default malloc (which just calls malloc and 952793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * ignores the first argument) should be completely compatible with the 953793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * following. 954793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 955793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp, 956793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_alloc_size_t)); 957793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); 958793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 959793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertypedef png_struct FAR * FAR * png_structpp; 960793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 961793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Section 3: exported functions 962793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Here are the function definitions most commonly used. This is not 963793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the place to find out how to use libpng. See libpng-manual.txt for the 964793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * full explanation, see example.c for the summary. This just provides 965793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * a simple one line description of the use of each function. 966793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 967793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in 968793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * pngconf.h and in the *.dfn files in the scripts directory. 969793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 970793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_EXPORT(ordinal, type, name, (args)); 971793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 972793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * ordinal: ordinal that is used while building 973793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * *.def files. The ordinal value is only 974793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * relevant when preprocessing png.h with 975793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the *.dfn files for building symbol table 976793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * entries, and are removed by pngconf.h. 977793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * type: return type of the function 978793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * name: function name 979793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * args: function arguments, with types 980793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 981793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * When we wish to append attributes to a function prototype we use 982793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the PNG_EXPORTA() macro instead. 983793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 984793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_EXPORTA(ordinal, type, name, (args), attributes); 985793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 986793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * ordinal, type, name, and args: same as in PNG_EXPORT(). 987793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * attributes: function attributes 988793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 989793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 990793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns the version number of the library */ 991793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(1, png_uint_32, png_access_version_number, (void)); 992793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 993793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Tell lib we have already handled the first <num_bytes> magic bytes. 994793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Handling more than 8 bytes from the beginning of the file is an error. 995793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 996793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(2, void, png_set_sig_bytes, (png_structp png_ptr, int num_bytes)); 997793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 998793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a 999793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG file. Returns zero if the supplied bytes match the 8-byte PNG 1000793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * signature, and non-zero otherwise. Having num_to_check == 0 or 1001793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * start > 7 will always fail (ie return non-zero). 1002793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1003793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start, 1004793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_size_t num_to_check)); 1005793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1006793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Simple signature checking function. This is the same as calling 1007793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). 1008793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1009793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n)) 1010793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1011793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Allocate and initialize png_ptr struct for reading, and any other memory. */ 1012793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(4, png_structp, png_create_read_struct, 1013793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_charp user_png_ver, png_voidp error_ptr, 1014793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_error_ptr error_fn, png_error_ptr warn_fn), 1015793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_ALLOCATED); 1016793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1017793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Allocate and initialize png_ptr struct for writing, and any other memory */ 1018793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(5, png_structp, png_create_write_struct, 1019793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, 1020793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_error_ptr warn_fn), 1021793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_ALLOCATED); 1022793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1023793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(6, png_size_t, png_get_compression_buffer_size, 1024793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 1025793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1026793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structp png_ptr, 1027793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_size_t size)); 1028793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1029793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp 1030793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * match up. 1031793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1032793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SETJMP_SUPPORTED 1033793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This function returns the jmp_buf built in to *png_ptr. It must be 1034793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * supplied with an appropriate 'longjmp' function to use on that jmp_buf 1035793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * unless the default error function is overridden in which case NULL is 1036793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * acceptable. The size of the jmp_buf is checked against the actual size 1037793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * allocated by the library - the call will return NULL on a mismatch 1038793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * indicating an ABI mismatch. 1039793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1040793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr, 1041793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); 1042793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_jmpbuf(png_ptr) \ 1043793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))) 1044793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#else 1045793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_jmpbuf(png_ptr) \ 1046793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) 1047793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1048793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* This function should be used by libpng applications in place of 1049793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * longjmp(png_ptr->jmpbuf, val). If longjmp_fn() has been set, it 1050793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * will use it; otherwise it will call PNG_ABORT(). This function was 1051793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * added in libpng-1.5.0. 1052793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1053793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(9, void, png_longjmp, (png_structp png_ptr, int val), 1054793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_NORETURN); 1055793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1056793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_SUPPORTED 1057793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Reset the compression stream */ 1058793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(10, int, png_reset_zstream, (png_structp png_ptr)); 1059793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1060793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1061793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ 1062793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_MEM_SUPPORTED 1063793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(11, png_structp, png_create_read_struct_2, 1064793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, 1065793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_error_ptr warn_fn, 1066793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), 1067793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_ALLOCATED); 1068793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(12, png_structp, png_create_write_struct_2, 1069793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, 1070793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_error_ptr warn_fn, 1071793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), 1072793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_ALLOCATED); 1073793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1074793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1075793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write the PNG file signature. */ 1076793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(13, void, png_write_sig, (png_structp png_ptr)); 1077793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1078793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write a PNG chunk - size, type, (optional) data, CRC. */ 1079793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(14, void, png_write_chunk, (png_structp png_ptr, png_const_bytep 1080793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler chunk_name, png_const_bytep data, png_size_t length)); 1081793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1082793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write the start of a PNG chunk - length and chunk name. */ 1083793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(15, void, png_write_chunk_start, (png_structp png_ptr, 1084793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_bytep chunk_name, png_uint_32 length)); 1085793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1086793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write the data of a PNG chunk started with png_write_chunk_start(). */ 1087793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(16, void, png_write_chunk_data, (png_structp png_ptr, 1088793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_bytep data, png_size_t length)); 1089793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1090793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ 1091793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(17, void, png_write_chunk_end, (png_structp png_ptr)); 1092793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1093793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Allocate and initialize the info structure */ 1094793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(18, png_infop, png_create_info_struct, (png_structp png_ptr), 1095793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_ALLOCATED); 1096793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1097793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(19, void, png_info_init_3, (png_infopp info_ptr, 1098793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_size_t png_info_struct_size)); 1099793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1100793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Writes all the PNG information before the image. */ 1101793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(20, void, png_write_info_before_PLTE, 1102793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr)); 1103793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(21, void, png_write_info, 1104793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr)); 1105793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1106793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SEQUENTIAL_READ_SUPPORTED 1107793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Read the information before the actual image data. */ 1108793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(22, void, png_read_info, 1109793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr)); 1110793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1111793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1112793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_TIME_RFC1123_SUPPORTED 1113793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(23, png_const_charp, png_convert_to_rfc1123, 1114793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, 1115793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_timep ptime)); 1116793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1117793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1118793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_CONVERT_tIME_SUPPORTED 1119793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Convert from a struct tm to png_time */ 1120793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime, 1121793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_CONST struct tm FAR * ttime)); 1122793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1123793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Convert from time_t to png_time. Uses gmtime() */ 1124793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(25, void, png_convert_from_time_t, 1125793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_timep ptime, time_t ttime)); 1126793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_CONVERT_tIME_SUPPORTED */ 1127793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1128793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_EXPAND_SUPPORTED 1129793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ 1130793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(26, void, png_set_expand, (png_structp png_ptr)); 1131793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structp png_ptr)); 1132793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structp png_ptr)); 1133793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structp png_ptr)); 1134793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1135793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1136793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_EXPAND_16_SUPPORTED 1137793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Expand to 16-bit channels, forces conversion of palette to RGB and expansion 1138793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * of a tRNS chunk if present. 1139793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1140793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(221, void, png_set_expand_16, (png_structp png_ptr)); 1141793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1142793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1143793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) 1144793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Use blue, green, red order for pixels. */ 1145793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(30, void, png_set_bgr, (png_structp png_ptr)); 1146793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1147793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1148793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED 1149793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Expand the grayscale to 24-bit RGB if necessary. */ 1150793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structp png_ptr)); 1151793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1152793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1153793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED 1154793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Reduce RGB to grayscale. */ 1155793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ERROR_ACTION_NONE 1 1156793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ERROR_ACTION_WARN 2 1157793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ERROR_ACTION_ERROR 3 1158793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ 1159793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1160793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structp png_ptr, 1161793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int error_action, double red, double green)); 1162793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr, 1163793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int error_action, png_fixed_point red, png_fixed_point green)); 1164793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1165793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp 1166793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_ptr)); 1167793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1168793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1169793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED 1170793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, 1171793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_colorp palette)); 1172793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1173793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1174793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_ALPHA_MODE_SUPPORTED 1175793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* How the alpha channel is interpreted - this affects how the color channels of 1176793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * a PNG file are returned when an alpha channel, or tRNS chunk in a palette 1177793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * file, is present. 1178793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1179793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This has no effect on the way pixels are written into a PNG output 1180793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * datastream. The color samples in a PNG datastream are never premultiplied 1181793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with the alpha samples. 1182793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1183793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The default is to return data according to the PNG specification: the alpha 1184793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * channel is a linear measure of the contribution of the pixel to the 1185793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * corresponding composited pixel. The gamma encoded color channels must be 1186793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * scaled according to the contribution and to do this it is necessary to undo 1187793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the encoding, scale the color values, perform the composition and reencode 1188793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the values. This is the 'PNG' mode. 1189793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1190793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The alternative is to 'associate' the alpha with the color information by 1191793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * storing color channel values that have been scaled by the alpha. The 1192793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * advantage is that the color channels can be resampled (the image can be 1193793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * scaled) in this form. The disadvantage is that normal practice is to store 1194793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * linear, not (gamma) encoded, values and this requires 16-bit channels for 1195793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * still images rather than the 8-bit channels that are just about sufficient if 1196793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * gamma encoding is used. In addition all non-transparent pixel values, 1197793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * including completely opaque ones, must be gamma encoded to produce the final 1198793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * image. This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the 1199793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * latter being the two common names for associated alpha color channels.) 1200793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1201793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Since it is not necessary to perform arithmetic on opaque color values so 1202793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * long as they are not to be resampled and are in the final color space it is 1203793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * possible to optimize the handling of alpha by storing the opaque pixels in 1204793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the PNG format (adjusted for the output color space) while storing partially 1205793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * opaque pixels in the standard, linear, format. The accuracy required for 1206793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * standard alpha composition is relatively low, because the pixels are 1207793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * isolated, therefore typically the accuracy loss in storing 8-bit linear 1208793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * values is acceptable. (This is not true if the alpha channel is used to 1209793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * simulate transparency over large areas - use 16 bits or the PNG mode in 1210793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is 1211793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * treated as opaque only if the alpha value is equal to the maximum value. 1212793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1213793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The final choice is to gamma encode the alpha channel as well. This is 1214793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * broken because, in practice, no implementation that uses this choice 1215793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * correctly undoes the encoding before handling alpha composition. Use this 1216793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * choice only if other serious errors in the software or hardware you use 1217793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * mandate it; the typical serious error is for dark halos to appear around 1218793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * opaque areas of the composited PNG image because of arithmetic overflow. 1219793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1220793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The API function png_set_alpha_mode specifies which of these choices to use 1221793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * with an enumerated 'mode' value and the gamma of the required output: 1222793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1223793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALPHA_PNG 0 /* according to the PNG standard */ 1224793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ 1225793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ 1226793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALPHA_PREMULTIPLIED 1 /* as above */ 1227793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ 1228793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ 1229793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1230793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structp png_ptr, int mode, 1231793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double output_gamma)); 1232793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structp png_ptr, 1233793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int mode, png_fixed_point output_gamma)); 1234793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1235793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1236793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) 1237793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The output_gamma value is a screen gamma in libpng terminology: it expresses 1238793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * how to decode the output values, not how they are encoded. The values used 1239793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * correspond to the normal numbers used to describe the overall gamma of a 1240793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * computer display system; for example 2.2 for an sRGB conformant system. The 1241793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * values are scaled by 100000 in the _fixed version of the API (so 220000 for 1242793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * sRGB.) 1243793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1244793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The inverse of the value is always used to provide a default for the PNG file 1245793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * encoding if it has no gAMA chunk and if png_set_gamma() has not been called 1246793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to override the PNG gamma information. 1247793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1248793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode 1249793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * opaque pixels however pixels with lower alpha values are not encoded, 1250793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * regardless of the output gamma setting. 1251793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1252793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * When the standard Porter Duff handling is requested with mode 1 the output 1253793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * encoding is set to be linear and the output_gamma value is only relevant 1254793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * as a default for input data that has no gamma information. The linear output 1255793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * encoding will be overridden if png_set_gamma() is called - the results may be 1256793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * highly unexpected! 1257793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1258793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The following numbers are derived from the sRGB standard and the research 1259793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of 1260793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0.45455 (1/2.2) for PNG. The value implicitly includes any viewing 1261793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * correction required to take account of any differences in the color 1262793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * environment of the original scene and the intended display environment; the 1263793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * value expresses how to *decode* the image for display, not how the original 1264793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * data was *encoded*. 1265793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1266793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * sRGB provides a peg for the PNG standard by defining a viewing environment. 1267793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * sRGB itself, and earlier TV standards, actually use a more complex transform 1268793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is 1269793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * limited to simple power laws.) By saying that an image for direct display on 1270793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * an sRGB conformant system should be stored with a gAMA chunk value of 45455 1271793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification 1272793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * makes it possible to derive values for other display systems and 1273793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * environments. 1274793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1275793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The Mac value is deduced from the sRGB based on an assumption that the actual 1276793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * extra viewing correction used in early Mac display systems was implemented as 1277793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * a power 1.45 lookup table. 1278793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1279793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Any system where a programmable lookup table is used or where the behavior of 1280793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the final display device characteristics can be changed requires system 1281793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * specific code to obtain the current characteristic. However this can be 1282793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * difficult and most PNG gamma correction only requires an approximate value. 1283793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1284793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * By default, if png_set_alpha_mode() is not called, libpng assumes that all 1285793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * values are unencoded, linear, values and that the output device also has a 1286793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * linear characteristic. This is only very rarely correct - it is invariably 1287793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the 1288793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * default if you don't know what the right answer is! 1289793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1290793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS 1291793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 10.6) which used a correction table to implement a somewhat lower gamma on an 1292793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * otherwise sRGB system. 1293793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1294793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Both these values are reserved (not simple gamma values) in order to allow 1295793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * more precise correction internally in the future. 1296793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1297793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * NOTE: the following values can be passed to either the fixed or floating 1298793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * point APIs, but the floating point API will also accept floating point 1299793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * values. 1300793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1301793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */ 1302793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */ 1303793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */ 1304793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */ 1305793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1306793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1307793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The following are examples of calls to png_set_alpha_mode to achieve the 1308793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * required overall gamma correction and, where necessary, alpha 1309793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * premultiplication. 1310793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1311793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); 1312793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This is the default libpng handling of the alpha channel - it is not 1313793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * pre-multiplied into the color components. In addition the call states 1314793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * that the output is for a sRGB system and causes all PNG files without gAMA 1315793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * chunks to be assumed to be encoded using sRGB. 1316793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1317793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); 1318793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * In this case the output is assumed to be something like an sRGB conformant 1319793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * display preceeded by a power-law lookup table of power 1.45. This is how 1320793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * early Mac systems behaved. 1321793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1322793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR); 1323793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This is the classic Jim Blinn approach and will work in academic 1324793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * environments where everything is done by the book. It has the shortcoming 1325793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * of assuming that input PNG data with no gamma information is linear - this 1326793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is unlikely to be correct unless the PNG files where generated locally. 1327793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Most of the time the output precision will be so low as to show 1328793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * significant banding in dark areas of the image. 1329793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1330793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_expand_16(pp); 1331793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB); 1332793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This is a somewhat more realistic Jim Blinn inspired approach. PNG files 1333793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * are assumed to have the sRGB encoding if not marked with a gamma value and 1334793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the output is always 16 bits per component. This permits accurate scaling 1335793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and processing of the data. If you know that your input PNG files were 1336793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * generated locally you might need to replace PNG_DEFAULT_sRGB with the 1337793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * correct value for your system. 1338793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1339793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB); 1340793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If you just need to composite the PNG image onto an existing background 1341793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and if you control the code that does this you can use the optimization 1342793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * setting. In this case you just copy completely opaque pixels to the 1343793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * output. For pixels that are not completely transparent (you just skip 1344793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * those) you do the composition math using png_composite or png_composite_16 1345793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * below then encode the resultant 8-bit or 16-bit values to match the output 1346793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * encoding. 1347793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1348793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Other cases 1349793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If neither the PNG nor the standard linear encoding work for you because 1350793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * of the software or hardware you use then you have a big problem. The PNG 1351793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * case will probably result in halos around the image. The linear encoding 1352793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * will probably result in a washed out, too bright, image (it's actually too 1353793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably 1354793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * substantially reduce the halos. Alternatively try: 1355793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1356793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB); 1357793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * This option will also reduce the halos, but there will be slight dark 1358793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * halos round the opaque parts of the image where the background is light. 1359793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * In the OPTIMIZED mode the halos will be light halos where the background 1360793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is dark. Take your pick - the halos are unavoidable unless you can get 1361793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * your hardware/software fixed! (The OPTIMIZED approach is slightly 1362793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * faster.) 1363793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1364793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * When the default gamma of PNG files doesn't match the output gamma. 1365793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If you have PNG files with no gamma information png_set_alpha_mode allows 1366793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * you to provide a default gamma, but it also sets the ouput gamma to the 1367793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * matching value. If you know your PNG files have a gamma that doesn't 1368793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * match the output you can take advantage of the fact that 1369793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode always sets the output gamma but only sets the PNG 1370793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * default if it is not already set: 1371793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1372793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); 1373793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); 1374793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The first call sets both the default and the output gamma values, the 1375793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * second call overrides the output gamma without changing the default. This 1376793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is easier than achieving the same effect with png_set_gamma. You must use 1377793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will 1378793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * fire if more than one call to png_set_alpha_mode and png_set_background is 1379793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * made in the same read operation, however multiple calls with PNG_ALPHA_PNG 1380793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * are ignored. 1381793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1382793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1383793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED 1384793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(36, void, png_set_strip_alpha, (png_structp png_ptr)); 1385793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1386793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1387793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ 1388793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) 1389793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(37, void, png_set_swap_alpha, (png_structp png_ptr)); 1390793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1391793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1392793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ 1393793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) 1394793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(38, void, png_set_invert_alpha, (png_structp png_ptr)); 1395793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1396793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1397793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) 1398793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ 1399793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(39, void, png_set_filler, (png_structp png_ptr, png_uint_32 filler, 1400793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int flags)); 1401793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The values of the PNG_FILLER_ defines should NOT be changed */ 1402793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_FILLER_BEFORE 0 1403793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_FILLER_AFTER 1 1404793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ 1405793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(40, void, png_set_add_alpha, 1406793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_uint_32 filler, 1407793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int flags)); 1408793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ 1409793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1410793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) 1411793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Swap bytes in 16-bit depth files. */ 1412793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(41, void, png_set_swap, (png_structp png_ptr)); 1413793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1414793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1415793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) 1416793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ 1417793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(42, void, png_set_packing, (png_structp png_ptr)); 1418793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1419793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1420793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ 1421793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler defined(PNG_WRITE_PACKSWAP_SUPPORTED) 1422793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Swap packing order of pixels in bytes. */ 1423793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(43, void, png_set_packswap, (png_structp png_ptr)); 1424793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1425793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1426793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) 1427793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Converts files to legal bit depths. */ 1428793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(44, void, png_set_shift, (png_structp png_ptr, png_const_color_8p 1429793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler true_bits)); 1430793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1431793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1432793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ 1433793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler defined(PNG_WRITE_INTERLACING_SUPPORTED) 1434793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Have the code handle the interlacing. Returns the number of passes. 1435793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * MUST be called before png_read_update_info or png_start_read_image, 1436793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * otherwise it will not have the desired effect. Note that it is still 1437793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * necessary to call png_read_row or png_read_rows png_get_image_height 1438793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * times for each pass. 1439793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*/ 1440793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(45, int, png_set_interlace_handling, (png_structp png_ptr)); 1441793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1442793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1443793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) 1444793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Invert monochrome files */ 1445793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(46, void, png_set_invert_mono, (png_structp png_ptr)); 1446793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1447793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1448793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_BACKGROUND_SUPPORTED 1449793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Handle alpha and tRNS by replacing with a background color. Prior to 1450793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng-1.5.4 this API must not be called before the PNG file header has been 1451793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * read. Doing so will result in unexpected behavior and possible warnings or 1452793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * errors if the PNG file contains a bKGD chunk. 1453793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1454793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(47, void, png_set_background, (png_structp png_ptr, 1455793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_color_16p background_color, int background_gamma_code, 1456793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int need_expand, double background_gamma)); 1457793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr, 1458793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_color_16p background_color, int background_gamma_code, 1459793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int need_expand, png_fixed_point background_gamma)); 1460793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1461793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_BACKGROUND_SUPPORTED 1462793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_BACKGROUND_GAMMA_UNKNOWN 0 1463793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_BACKGROUND_GAMMA_SCREEN 1 1464793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_BACKGROUND_GAMMA_FILE 2 1465793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_BACKGROUND_GAMMA_UNIQUE 3 1466793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1467793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1468793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED 1469793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Scale a 16-bit depth file down to 8-bit, accurately. */ 1470793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(229, void, png_set_scale_16, (png_structp png_ptr)); 1471793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1472793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1473793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED 1474793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */ 1475793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Strip the second byte of information from a 16-bit depth file. */ 1476793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr)); 1477793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1478793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1479793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_QUANTIZE_SUPPORTED 1480793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Turn on quantizing, and reduce the palette to the number of colors 1481793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * available. 1482793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1483793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(49, void, png_set_quantize, 1484793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_colorp palette, 1485793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int num_palette, int maximum_colors, png_const_uint_16p histogram, 1486793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int full_quantize)); 1487793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1488793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1489793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_GAMMA_SUPPORTED 1490793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The threshold on gamma processing is configurable but hard-wired into the 1491793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * library. The following is the floating point variant. 1492793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1493793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001) 1494793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1495793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Handle gamma correction. Screen_gamma=(display_exponent). 1496793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * NOTE: this API simply sets the screen and file gamma values. It will 1497793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * therefore override the value for gamma in a PNG file if it is called after 1498793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the file header has been read - use with care - call before reading the PNG 1499793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * file for best results! 1500793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1501793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * These routines accept the same gamma values as png_set_alpha_mode (described 1502793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either 1503793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * API (floating point or fixed.) Notice, however, that the 'file_gamma' value 1504793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is the inverse of a 'screen gamma' value. 1505793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1506793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(50, void, png_set_gamma, 1507793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, double screen_gamma, 1508793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double override_file_gamma)); 1509793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structp png_ptr, 1510793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point screen_gamma, png_fixed_point override_file_gamma)); 1511793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1512793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1513793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WRITE_FLUSH_SUPPORTED 1514793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Set how many lines between output flushes - 0 for no flushing */ 1515793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(51, void, png_set_flush, (png_structp png_ptr, int nrows)); 1516793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Flush the current PNG output buffer */ 1517793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(52, void, png_write_flush, (png_structp png_ptr)); 1518793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1519793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1520793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Optional update palette with requested transformations */ 1521793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(53, void, png_start_read_image, (png_structp png_ptr)); 1522793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1523793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Optional call to update the users info structure */ 1524793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(54, void, png_read_update_info, 1525793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr)); 1526793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1527793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SEQUENTIAL_READ_SUPPORTED 1528793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Read one or more rows of image data. */ 1529793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(55, void, png_read_rows, (png_structp png_ptr, png_bytepp row, 1530793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_bytepp display_row, png_uint_32 num_rows)); 1531793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1532793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1533793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SEQUENTIAL_READ_SUPPORTED 1534793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Read a row of data. */ 1535793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(56, void, png_read_row, (png_structp png_ptr, png_bytep row, 1536793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_bytep display_row)); 1537793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1538793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1539793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SEQUENTIAL_READ_SUPPORTED 1540793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Read the whole image into memory at once. */ 1541793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(57, void, png_read_image, (png_structp png_ptr, png_bytepp image)); 1542793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1543793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1544793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write a row of image data */ 1545793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(58, void, png_write_row, 1546793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_const_bytep row)); 1547793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1548793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write a few rows of image data: (*row) is not written; however, the type 1549793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is declared as writeable to maintain compatibility with previous versions 1550793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * of libpng and to allow the 'display_row' array from read_rows to be passed 1551793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * unchanged to write_rows. 1552793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1553793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(59, void, png_write_rows, (png_structp png_ptr, png_bytepp row, 1554793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 num_rows)); 1555793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1556793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write the image data */ 1557793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(60, void, png_write_image, 1558793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_bytepp image)); 1559793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1560793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Write the end of the PNG file. */ 1561793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(61, void, png_write_end, 1562793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr)); 1563793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1564793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SEQUENTIAL_READ_SUPPORTED 1565793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Read the end of the PNG file. */ 1566793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(62, void, png_read_end, (png_structp png_ptr, png_infop info_ptr)); 1567793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1568793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1569793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Free any memory associated with the png_info_struct */ 1570793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(63, void, png_destroy_info_struct, (png_structp png_ptr, 1571793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infopp info_ptr_ptr)); 1572793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1573793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Free any memory associated with the png_struct and the png_info_structs */ 1574793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr, 1575793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); 1576793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1577793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Free any memory associated with the png_struct and the png_info_structs */ 1578793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr, 1579793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infopp info_ptr_ptr)); 1580793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1581793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Set the libpng method of handling chunk CRC errors */ 1582793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(66, void, png_set_crc_action, 1583793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, int crit_action, int ancil_action)); 1584793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1585793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Values for png_set_crc_action() say how to handle CRC errors in 1586793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * ancillary and critical chunks, and whether to use the data contained 1587793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * therein. Note that it is impossible to "discard" data in a critical 1588793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * chunk. For versions prior to 0.90, the action was always error/quit, 1589793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * whereas in version 0.90 and later, the action for CRC errors in ancillary 1590793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * chunks is warn/discard. These values should NOT be changed. 1591793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1592793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * value action:critical action:ancillary 1593793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1594793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ 1595793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ 1596793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ 1597793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ 1598793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ 1599793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ 1600793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1601793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These functions give the user control over the scan-line filtering in 1602793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng and the compression methods used by zlib. These functions are 1603793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * mainly useful for testing, as the defaults should work with most users. 1604793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Those users who are tight on memory or want faster performance at the 1605793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * expense of compression can modify them. See the compression library 1606793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * header file (zlib.h) for an explination of the compression functions. 1607793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1608793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1609793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Set the filtering method(s) used by libpng. Currently, the only valid 1610793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * value for "method" is 0. 1611793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1612793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(67, void, png_set_filter, 1613793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, int method, int filters)); 1614793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1615793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Flags for png_set_filter() to say which filters to use. The flags 1616793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * are chosen so that they don't conflict with real filter types 1617793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * below, in case they are supplied instead of the #defined constants. 1618793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * These values should NOT be changed. 1619793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1620793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_NO_FILTERS 0x00 1621793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_NONE 0x08 1622793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_SUB 0x10 1623793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_UP 0x20 1624793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_AVG 0x40 1625793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_PAETH 0x80 1626793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ 1627793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_FILTER_AVG | PNG_FILTER_PAETH) 1628793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1629793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. 1630793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * These defines should NOT be changed. 1631793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1632793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_VALUE_NONE 0 1633793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_VALUE_SUB 1 1634793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_VALUE_UP 2 1635793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_VALUE_AVG 3 1636793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_VALUE_PAETH 4 1637793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_VALUE_LAST 5 1638793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1639793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */ 1640793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ 1641793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * defines, either the default (minimum-sum-of-absolute-differences), or 1642793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the experimental method (weighted-minimum-sum-of-absolute-differences). 1643793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1644793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Weights are factors >= 1.0, indicating how important it is to keep the 1645793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * filter type consistent between rows. Larger numbers mean the current 1646793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * filter is that many times as likely to be the same as the "num_weights" 1647793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * previous filters. This is cumulative for each previous row with a weight. 1648793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * There needs to be "num_weights" values in "filter_weights", or it can be 1649793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * NULL if the weights aren't being specified. Weights have no influence on 1650793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the selection of the first row filter. Well chosen weights can (in theory) 1651793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * improve the compression for a given image. 1652793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1653793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Costs are factors >= 1.0 indicating the relative decoding costs of a 1654793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * filter type. Higher costs indicate more decoding expense, and are 1655793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * therefore less likely to be selected over a filter with lower computational 1656793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * costs. There needs to be a value in "filter_costs" for each valid filter 1657793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't 1658793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * setting the costs. Costs try to improve the speed of decompression without 1659793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * unduly increasing the compressed image size. 1660793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1661793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * A negative weight or cost indicates the default value is to be used, and 1662793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * values in the range [0.0, 1.0) indicate the value is to remain unchanged. 1663793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The default values for both weights and costs are currently 1.0, but may 1664793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * change if good general weighting/cost heuristics can be found. If both 1665793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the weights and costs are set to 1.0, this degenerates the WEIGHTED method 1666793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to the UNWEIGHTED method, but with added encoding time/computation. 1667793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1668793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structp png_ptr, 1669793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int heuristic_method, int num_weights, png_const_doublep filter_weights, 1670793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_doublep filter_costs)); 1671793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, 1672793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, 1673793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int heuristic_method, int num_weights, png_const_fixed_point_p 1674793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler filter_weights, png_const_fixed_point_p filter_costs)); 1675793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ 1676793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1677793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Heuristic used for row filter selection. These defines should NOT be 1678793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * changed. 1679793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1680793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ 1681793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ 1682793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ 1683793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ 1684793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1685793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WRITE_SUPPORTED 1686793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Set the library compression level. Currently, valid values range from 1687793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 1688793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (0 - no compression, 9 - "maximal" compression). Note that tests have 1689793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * shown that zlib compression levels 3-6 usually perform as well as level 9 1690793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * for PNG images, and do considerably fewer caclulations. In the future, 1691793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * these values may not correspond directly to the zlib compression levels. 1692793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1693793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(69, void, png_set_compression_level, 1694793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, int level)); 1695793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1696793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(70, void, png_set_compression_mem_level, (png_structp png_ptr, 1697793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int mem_level)); 1698793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1699793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(71, void, png_set_compression_strategy, (png_structp png_ptr, 1700793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int strategy)); 1701793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1702793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a 1703793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * smaller value of window_bits if it can do so safely. 1704793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1705793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(72, void, png_set_compression_window_bits, (png_structp png_ptr, 1706793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int window_bits)); 1707793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1708793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(73, void, png_set_compression_method, (png_structp png_ptr, 1709793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int method)); 1710793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1711793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1712793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED 1713793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Also set zlib parameters for compressing non-IDAT chunks */ 1714793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(222, void, png_set_text_compression_level, 1715793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, int level)); 1716793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1717793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structp png_ptr, 1718793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int mem_level)); 1719793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1720793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structp png_ptr, 1721793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int strategy)); 1722793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1723793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a 1724793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * smaller value of window_bits if it can do so safely. 1725793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1726793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(225, void, png_set_text_compression_window_bits, (png_structp 1727793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_ptr, int window_bits)); 1728793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1729793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(226, void, png_set_text_compression_method, (png_structp png_ptr, 1730793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int method)); 1731793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */ 1732793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1733793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* These next functions are called for input/output, memory, and error 1734793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, 1735793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * and call standard C I/O routines such as fread(), fwrite(), and 1736793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * fprintf(). These functions can be made to use other I/O routines 1737793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * at run time for those applications that need to handle I/O in a 1738793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * different manner by calling png_set_???_fn(). See libpng-manual.txt for 1739793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * more information. 1740793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1741793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1742793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_STDIO_SUPPORTED 1743793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Initialize the input/output for the PNG file to the default functions. */ 1744793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(74, void, png_init_io, (png_structp png_ptr, png_FILE_p fp)); 1745793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1746793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1747793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Replace the (error and abort), and warning functions with user 1748793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * supplied functions. If no messages are to be printed you must still 1749793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * write and use replacement functions. The replacement error_fn should 1750793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * still do a longjmp to the last setjmp location if you are using this 1751793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * method of error handling. If error_fn or warning_fn is NULL, the 1752793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * default function will be used. 1753793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1754793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1755793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(75, void, png_set_error_fn, 1756793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_voidp error_ptr, 1757793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_error_ptr error_fn, png_error_ptr warning_fn)); 1758793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1759793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Return the user pointer associated with the error functions */ 1760793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structp png_ptr)); 1761793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1762793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Replace the default data output functions with a user supplied one(s). 1763793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If buffered output is not used, then output_flush_fn can be set to NULL. 1764793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time 1765793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * output_flush_fn will be ignored (and thus can be NULL). 1766793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * It is probably a mistake to use NULL for output_flush_fn if 1767793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * write_data_fn is not also NULL unless you have built libpng with 1768793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's 1769793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * default flush function, which uses the standard *FILE structure, will 1770793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * be used. 1771793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1772793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(77, void, png_set_write_fn, (png_structp png_ptr, png_voidp io_ptr, 1773793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); 1774793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1775793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Replace the default data input function with a user supplied one. */ 1776793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(78, void, png_set_read_fn, (png_structp png_ptr, png_voidp io_ptr, 1777793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_rw_ptr read_data_fn)); 1778793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1779793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Return the user pointer associated with the I/O functions */ 1780793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_structp png_ptr)); 1781793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1782793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(80, void, png_set_read_status_fn, (png_structp png_ptr, 1783793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_read_status_ptr read_row_fn)); 1784793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1785793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(81, void, png_set_write_status_fn, (png_structp png_ptr, 1786793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_write_status_ptr write_row_fn)); 1787793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1788793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_MEM_SUPPORTED 1789793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Replace the default memory allocation functions with user supplied one(s). */ 1790793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(82, void, png_set_mem_fn, (png_structp png_ptr, png_voidp mem_ptr, 1791793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_malloc_ptr malloc_fn, png_free_ptr free_fn)); 1792793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Return the user pointer associated with the memory functions */ 1793793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structp png_ptr)); 1794793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1795793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1796793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED 1797793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structp png_ptr, 1798793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_user_transform_ptr read_user_transform_fn)); 1799793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1800793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1801793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED 1802793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structp png_ptr, 1803793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_user_transform_ptr write_user_transform_fn)); 1804793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1805793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1806793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED 1807793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(86, void, png_set_user_transform_info, (png_structp png_ptr, 1808793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_voidp user_transform_ptr, int user_transform_depth, 1809793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int user_transform_channels)); 1810793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Return the user pointer associated with the user transform functions */ 1811793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, 1812793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 1813793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1814793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1815793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED 1816793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Return information about the row currently being processed. Note that these 1817793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * APIs do not fail but will return unexpected results if called outside a user 1818793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * transform callback. Also note that when transforming an interlaced image the 1819793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * row number is the row number within the sub-image of the interlace pass, so 1820793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the value will increase to the height of the sub-image (not the full image) 1821793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * then reset to 0 for the next pass. 1822793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1823793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to 1824793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * find the output pixel (x,y) given an interlaced sub-image pixel 1825793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (row,col,pass). (See below for these macros.) 1826793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1827793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structp)); 1828793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structp)); 1829793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1830793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1831793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_CHUNKS_SUPPORTED 1832793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structp png_ptr, 1833793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); 1834793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structp png_ptr)); 1835793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1836793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1837793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_PROGRESSIVE_READ_SUPPORTED 1838793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Sets the function callbacks for the push reader, and a pointer to a 1839793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * user-defined structure available to the callback functions. 1840793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1841793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structp png_ptr, 1842793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_voidp progressive_ptr, png_progressive_info_ptr info_fn, 1843793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); 1844793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1845793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns the user pointer associated with the push read functions */ 1846793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_const_structp png_ptr)); 1847793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1848793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Function to be called when data becomes available */ 1849793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(92, void, png_process_data, 1850793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 1851793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_bytep buffer, png_size_t buffer_size)); 1852793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1853793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* A function which may be called *only* within png_process_data to stop the 1854793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * processing of any more data. The function returns the number of bytes 1855793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * remaining, excluding any that libpng has cached internally. A subsequent 1856793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * call to png_process_data must supply these bytes again. If the argument 1857793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 'save' is set to true the routine will first save all the pending data and 1858793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * will always return 0. 1859793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1860793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structp, int save)); 1861793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1862793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* A function which may be called *only* outside (after) a call to 1863793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_process_data. It returns the number of bytes of data to skip in the 1864793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * input. Normally it will return 0, but if it returns a non-zero value the 1865793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * application must skip than number of bytes of input data and pass the 1866793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * following data to the next call to png_process_data. 1867793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1868793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structp)); 1869793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1870793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_INTERLACING_SUPPORTED 1871793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Function that combines rows. 'new_row' is a flag that should come from 1872793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the callback and be non-NULL if anything needs to be done; the library 1873793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * stores its own version of the new data internally and ignores the passed 1874793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * in value. 1875793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1876793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(93, void, png_progressive_combine_row, (png_structp png_ptr, 1877793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_bytep old_row, png_const_bytep new_row)); 1878793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_READ_INTERLACING_SUPPORTED */ 1879793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ 1880793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1881793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(94, png_voidp, png_malloc, 1882793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_alloc_size_t size), 1883793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_ALLOCATED); 1884793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added at libpng version 1.4.0 */ 1885793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(95, png_voidp, png_calloc, 1886793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_alloc_size_t size), 1887793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_ALLOCATED); 1888793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1889793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added at libpng version 1.2.4 */ 1890793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_structp png_ptr, 1891793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_alloc_size_t size), PNG_ALLOCATED); 1892793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1893793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Frees a pointer allocated by png_malloc() */ 1894793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(97, void, png_free, (png_structp png_ptr, png_voidp ptr)); 1895793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1896793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Free data that was allocated internally */ 1897793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(98, void, png_free_data, 1898793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, png_uint_32 free_me, int num)); 1899793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1900793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Reassign responsibility for freeing existing data, whether allocated 1901793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * by libpng or by the application */ 1902793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(99, void, png_data_freer, 1903793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask)); 1904793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1905793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Assignments for png_data_freer */ 1906793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_DESTROY_WILL_FREE_DATA 1 1907793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_SET_WILL_FREE_DATA 1 1908793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_USER_WILL_FREE_DATA 2 1909793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Flags for png_ptr->free_me and info_ptr->free_me */ 1910793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_HIST 0x0008 1911793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_ICCP 0x0010 1912793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_SPLT 0x0020 1913793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_ROWS 0x0040 1914793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_PCAL 0x0080 1915793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_SCAL 0x0100 1916793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_UNKN 0x0200 1917793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_LIST 0x0400 1918793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_PLTE 0x1000 1919793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_TRNS 0x2000 1920793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_TEXT 0x4000 1921793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_ALL 0x7fff 1922793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ 1923793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1924793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USER_MEM_SUPPORTED 1925793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(100, png_voidp, png_malloc_default, (png_structp png_ptr, 1926793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_alloc_size_t size), PNG_ALLOCATED); 1927793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(101, void, png_free_default, (png_structp png_ptr, png_voidp ptr)); 1928793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1929793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1930793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_ERROR_TEXT_SUPPORTED 1931793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Fatal error in PNG image of libpng - can't continue */ 1932793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(102, void, png_error, 1933793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_const_charp error_message), 1934793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_NORETURN); 1935793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1936793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The same, but the chunk name is prepended to the error string. */ 1937793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(103, void, png_chunk_error, (png_structp png_ptr, 1938793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_charp error_message), PNG_NORETURN); 1939793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1940793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#else 1941793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Fatal error in PNG image of libpng - can't continue */ 1942793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(104, void, png_err, (png_structp png_ptr), PNG_NORETURN); 1943793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1944793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1945793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WARNINGS_SUPPORTED 1946793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Non-fatal error in libpng. Can continue, but may have a problem. */ 1947793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(105, void, png_warning, (png_structp png_ptr, 1948793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_charp warning_message)); 1949793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1950793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Non-fatal error in libpng, chunk name is prepended to message. */ 1951793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(106, void, png_chunk_warning, (png_structp png_ptr, 1952793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_charp warning_message)); 1953793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1954793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1955793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_BENIGN_ERRORS_SUPPORTED 1956793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Benign error in libpng. Can continue, but may have a problem. 1957793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * User can choose whether to handle as a fatal error or as a warning. */ 1958793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# undef png_benign_error 1959793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(107, void, png_benign_error, (png_structp png_ptr, 1960793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_charp warning_message)); 1961793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1962793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Same, chunk name is prepended to message. */ 1963793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# undef png_chunk_benign_error 1964793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(108, void, png_chunk_benign_error, (png_structp png_ptr, 1965793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_charp warning_message)); 1966793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1967793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(109, void, png_set_benign_errors, 1968793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, int allowed)); 1969793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#else 1970793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# ifdef PNG_ALLOW_BENIGN_ERRORS 1971793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_benign_error png_warning 1972793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_chunk_benign_error png_chunk_warning 1973793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# else 1974793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_benign_error png_error 1975793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_chunk_benign_error png_chunk_error 1976793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# endif 1977793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 1978793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1979793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The png_set_<chunk> functions are for storing values in the png_info_struct. 1980793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Similarly, the png_get_<chunk> calls are used to read values from the 1981793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_info_struct, either storing the parameters in the passed variables, or 1982793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * setting pointers into the png_info_struct where the data is stored. The 1983793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_get_<chunk> functions return a non-zero value if the data was available 1984793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * in info_ptr, or return zero and do not change any of the parameters if the 1985793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * data was not available. 1986793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 1987793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * These functions should be used instead of directly accessing png_info 1988793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to avoid problems with future changes in the size and internal layout of 1989793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * png_info_struct. 1990793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 1991793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns "flag" if chunk data is valid in info_ptr. */ 1992793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(110, png_uint_32, png_get_valid, 1993793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 1994793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 flag)); 1995793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 1996793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns number of bytes needed to hold a transformed row. */ 1997793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structp png_ptr, 1998793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 1999793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2000793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_INFO_IMAGE_SUPPORTED 2001793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns row_pointers, which is an array of pointers to scanlines that was 2002793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * returned from png_read_png(). 2003793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2004793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(112, png_bytepp, png_get_rows, 2005793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2006793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Set row_pointers, which is an array of pointers to scanlines for use 2007793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * by png_write_png(). 2008793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2009793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(113, void, png_set_rows, (png_structp png_ptr, 2010793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, png_bytepp row_pointers)); 2011793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2012793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2013793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns number of color channels in image. */ 2014793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(114, png_byte, png_get_channels, 2015793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2016793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2017793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_EASY_ACCESS_SUPPORTED 2018793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image width in pixels. */ 2019793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structp png_ptr, 2020793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 2021793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2022793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image height in pixels. */ 2023793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structp png_ptr, 2024793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 2025793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2026793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image bit_depth. */ 2027793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(117, png_byte, png_get_bit_depth, 2028793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2029793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2030793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image color_type. */ 2031793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structp png_ptr, 2032793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 2033793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2034793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image filter_type. */ 2035793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structp png_ptr, 2036793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 2037793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2038793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image interlace_type. */ 2039793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structp png_ptr, 2040793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 2041793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2042793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image compression_type. */ 2043793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structp png_ptr, 2044793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 2045793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2046793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image resolution in pixels per meter, from pHYs chunk data. */ 2047793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, 2048793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2049793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, 2050793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2051793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, 2052793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2053793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2054793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns pixel aspect ratio, computed from pHYs chunk data. */ 2055793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, 2056793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2057793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, 2058793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2059793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2060793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ 2061793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, 2062793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2063793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, 2064793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2065793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(128, png_int_32, png_get_x_offset_microns, 2066793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2067793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(129, png_int_32, png_get_y_offset_microns, 2068793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2069793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2070793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_EASY_ACCESS_SUPPORTED */ 2071793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2072793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Returns pointer to signature string read from PNG header */ 2073793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(130, png_const_bytep, png_get_signature, 2074793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_infop info_ptr)); 2075793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2076793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_bKGD_SUPPORTED 2077793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(131, png_uint_32, png_get_bKGD, 2078793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_infop info_ptr, 2079793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_color_16p *background)); 2080793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2081793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2082793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_bKGD_SUPPORTED 2083793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(132, void, png_set_bKGD, (png_structp png_ptr, png_infop info_ptr, 2084793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_color_16p background)); 2085793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2086793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2087793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_cHRM_SUPPORTED 2088793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr, 2089793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr, double *white_x, double *white_y, double *red_x, 2090793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double *red_y, double *green_x, double *green_y, double *blue_x, 2091793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double *blue_y)); 2092793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_structp png_ptr, 2093793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr, double *red_X, double *red_Y, double *red_Z, 2094793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double *green_X, double *green_Y, double *green_Z, double *blue_X, 2095793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double *blue_Y, double *blue_Z)); 2096793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */ 2097793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, 2098793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, 2099793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr, png_fixed_point *int_white_x, 2100793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_white_y, png_fixed_point *int_red_x, 2101793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_red_y, png_fixed_point *int_green_x, 2102793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_green_y, png_fixed_point *int_blue_x, 2103793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_blue_y)); 2104793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2105793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, 2106793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_const_infop info_ptr, 2107793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_red_X, png_fixed_point *int_red_Y, 2108793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_red_Z, png_fixed_point *int_green_X, 2109793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, 2110793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, 2111793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_blue_Z)); 2112793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2113793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2114793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_cHRM_SUPPORTED 2115793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(135, void, png_set_cHRM, 2116793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2117793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double white_x, double white_y, double red_x, double red_y, double green_x, 2118793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double green_y, double blue_x, double blue_y)); 2119793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_structp png_ptr, 2120793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, double red_X, double red_Y, double red_Z, 2121793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double green_X, double green_Y, double green_Z, double blue_X, 2122793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double blue_Y, double blue_Z)); 2123793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_structp png_ptr, 2124793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, png_fixed_point int_white_x, 2125793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_white_y, png_fixed_point int_red_x, 2126793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_red_y, png_fixed_point int_green_x, 2127793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_green_y, png_fixed_point int_blue_x, 2128793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_blue_y)); 2129793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_structp png_ptr, 2130793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, 2131793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_red_Z, png_fixed_point int_green_X, 2132793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_green_Y, png_fixed_point int_green_Z, 2133793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_blue_X, png_fixed_point int_blue_Y, 2134793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point int_blue_Z)); 2135793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2136793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2137793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_gAMA_SUPPORTED 2138793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, 2139793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2140793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler double *file_gamma)); 2141793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, 2142793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2143793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *int_file_gamma)); 2144793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2145793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2146793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_gAMA_SUPPORTED 2147793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr, 2148793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, double file_gamma)); 2149793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr, 2150793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, png_fixed_point int_file_gamma)); 2151793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2152793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2153793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_hIST_SUPPORTED 2154793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(141, png_uint_32, png_get_hIST, 2155793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2156793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_16p *hist)); 2157793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2158793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2159793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_hIST_SUPPORTED 2160793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(142, void, png_set_hIST, (png_structp png_ptr, 2161793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, png_const_uint_16p hist)); 2162793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2163793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2164793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(143, png_uint_32, png_get_IHDR, 2165793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2166793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, 2167793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int *interlace_method, int *compression_method, int *filter_method)); 2168793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2169793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(144, void, png_set_IHDR, 2170793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2171793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, 2172793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int interlace_method, int compression_method, int filter_method)); 2173793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2174793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_oFFs_SUPPORTED 2175793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(145, png_uint_32, png_get_oFFs, 2176793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2177793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)); 2178793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2179793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2180793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_oFFs_SUPPORTED 2181793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(146, void, png_set_oFFs, 2182793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2183793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_int_32 offset_x, png_int_32 offset_y, int unit_type)); 2184793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2185793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2186793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_pCAL_SUPPORTED 2187793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(147, png_uint_32, png_get_pCAL, 2188793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2189793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, 2190793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int *nparams, 2191793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charp *units, png_charpp *params)); 2192793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2193793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2194793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_pCAL_SUPPORTED 2195793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(148, void, png_set_pCAL, (png_structp png_ptr, 2196793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, 2197793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type, 2198793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int nparams, png_const_charp units, png_charpp params)); 2199793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2200793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2201793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_pHYs_SUPPORTED 2202793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(149, png_uint_32, png_get_pHYs, 2203793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2204793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); 2205793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2206793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2207793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_pHYs_SUPPORTED 2208793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(150, void, png_set_pHYs, 2209793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2210793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 res_x, png_uint_32 res_y, int unit_type)); 2211793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2212793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2213793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(151, png_uint_32, png_get_PLTE, 2214793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2215793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_colorp *palette, int *num_palette)); 2216793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2217793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(152, void, png_set_PLTE, 2218793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2219793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_colorp palette, int num_palette)); 2220793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2221793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_sBIT_SUPPORTED 2222793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(153, png_uint_32, png_get_sBIT, 2223793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_infop info_ptr, 2224793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_color_8p *sig_bit)); 2225793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2226793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2227793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_sBIT_SUPPORTED 2228793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(154, void, png_set_sBIT, 2229793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, png_const_color_8p sig_bit)); 2230793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2231793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2232793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_sRGB_SUPPORTED 2233793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structp png_ptr, 2234793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr, int *file_srgb_intent)); 2235793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2236793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2237793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_sRGB_SUPPORTED 2238793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(156, void, png_set_sRGB, 2239793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, int srgb_intent)); 2240793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_structp png_ptr, 2241793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, int srgb_intent)); 2242793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2243793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2244793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_iCCP_SUPPORTED 2245793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(158, png_uint_32, png_get_iCCP, 2246793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2247793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_charpp name, int *compression_type, png_bytepp profile, 2248793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 *proflen)); 2249793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2250793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2251793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_iCCP_SUPPORTED 2252793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(159, void, png_set_iCCP, 2253793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2254793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_charp name, int compression_type, png_const_bytep profile, 2255793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 proflen)); 2256793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2257793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2258793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_sPLT_SUPPORTED 2259793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(160, png_uint_32, png_get_sPLT, 2260793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2261793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_sPLT_tpp entries)); 2262793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2263793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2264793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_sPLT_SUPPORTED 2265793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(161, void, png_set_sPLT, 2266793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2267793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_sPLT_tp entries, int nentries)); 2268793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2269793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2270793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_TEXT_SUPPORTED 2271793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* png_get_text also returns the number of text chunks in *num_text */ 2272793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(162, png_uint_32, png_get_text, 2273793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2274793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_textp *text_ptr, int *num_text)); 2275793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2276793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2277793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Note while png_set_text() will accept a structure whose text, 2278793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * language, and translated keywords are NULL pointers, the structure 2279793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * returned by png_get_text will always contain regular 2280793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * zero-terminated C strings. They might be empty strings but 2281793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * they will never be NULL pointers. 2282793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2283793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2284793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_TEXT_SUPPORTED 2285793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(163, void, png_set_text, 2286793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2287793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_textp text_ptr, int num_text)); 2288793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2289793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2290793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_tIME_SUPPORTED 2291793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(164, png_uint_32, png_get_tIME, 2292793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time)); 2293793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2294793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2295793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_tIME_SUPPORTED 2296793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(165, void, png_set_tIME, 2297793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time)); 2298793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2299793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2300793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_tRNS_SUPPORTED 2301793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(166, png_uint_32, png_get_tRNS, 2302793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_infop info_ptr, 2303793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)); 2304793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2305793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2306793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_tRNS_SUPPORTED 2307793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(167, void, png_set_tRNS, 2308793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2309793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_bytep trans_alpha, int num_trans, 2310793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_color_16p trans_color)); 2311793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2312793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2313793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_sCAL_SUPPORTED 2314793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, 2315793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2316793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int *unit, double *width, double *height)); 2317793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED 2318793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* NOTE: this API is currently implemented using floating point arithmetic, 2319793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * consequently it can only be used on systems with floating point support. 2320793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * In any case the range of values supported by png_fixed_point is small and it 2321793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * is highly recommended that png_get_sCAL_s be used instead. 2322793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2323793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, 2324793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_const_infop info_ptr, int *unit, 2325793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *width, 2326793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point *height)); 2327793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2328793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(169, png_uint_32, png_get_sCAL_s, 2329793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr, 2330793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int *unit, png_charpp swidth, png_charpp sheight)); 2331793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2332793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(170, void, png_set_sCAL, 2333793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2334793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int unit, double width, double height)); 2335793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_structp png_ptr, 2336793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, int unit, png_fixed_point width, 2337793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_fixed_point height)); 2338793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(171, void, png_set_sCAL_s, 2339793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, 2340793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int unit, png_const_charp swidth, png_const_charp sheight)); 2341793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_sCAL_SUPPORTED */ 2342793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2343793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED 2344793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Provide a list of chunks and how they are to be handled, if the built-in 2345793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler handling or default unknown chunk handling is not desired. Any chunks not 2346793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler listed will be handled in the default manner. The IHDR and IEND chunks 2347793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler must not be listed. Because this turns off the default handling for chunks 2348793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler that would otherwise be recognized the behavior of libpng transformations may 2349793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler well become incorrect! 2350793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler keep = 0: PNG_HANDLE_CHUNK_AS_DEFAULT: follow default behavior 2351793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler = 1: PNG_HANDLE_CHUNK_NEVER: do not keep 2352793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler = 2: PNG_HANDLE_CHUNK_IF_SAFE: keep only if safe-to-copy 2353793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler = 3: PNG_HANDLE_CHUNK_ALWAYS: keep even if unsafe-to-copy 2354793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler*/ 2355793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(172, void, png_set_keep_unknown_chunks, 2356793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, int keep, 2357793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_bytep chunk_list, int num_chunks)); 2358793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2359793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The handling code is returned; the result is therefore true (non-zero) if 2360793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * special handling is required, false for the default handling. 2361793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2362793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(173, int, png_handle_as_unknown, (png_structp png_ptr, 2363793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_bytep chunk_name)); 2364793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2365793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED 2366793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(174, void, png_set_unknown_chunks, (png_structp png_ptr, 2367793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_infop info_ptr, png_const_unknown_chunkp unknowns, 2368793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int num_unknowns)); 2369793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(175, void, png_set_unknown_chunk_location, 2370793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, int chunk, int location)); 2371793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structp png_ptr, 2372793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr, png_unknown_chunkpp entries)); 2373793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2374793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2375793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Png_free_data() will turn off the "valid" flag for anything it frees. 2376793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * If you need to turn it off for a chunk that your application has freed, 2377793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); 2378793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2379793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(177, void, png_set_invalid, 2380793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_infop info_ptr, int mask)); 2381793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2382793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_INFO_IMAGE_SUPPORTED 2383793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The "params" pointer is currently not used and is for future expansion. */ 2384793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(178, void, png_read_png, (png_structp png_ptr, png_infop info_ptr, 2385793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int transforms, png_voidp params)); 2386793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(179, void, png_write_png, (png_structp png_ptr, png_infop info_ptr, 2387793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int transforms, png_voidp params)); 2388793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2389793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2390793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(180, png_const_charp, png_get_copyright, 2391793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2392793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(181, png_const_charp, png_get_header_ver, 2393793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2394793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(182, png_const_charp, png_get_header_version, 2395793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2396793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(183, png_const_charp, png_get_libpng_ver, 2397793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2398793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2399793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_MNG_FEATURES_SUPPORTED 2400793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structp png_ptr, 2401793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 mng_features_permitted)); 2402793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2403793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2404793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* For use in png_set_keep_unknown, added to version 1.2.6 */ 2405793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 2406793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_HANDLE_CHUNK_NEVER 1 2407793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_HANDLE_CHUNK_IF_SAFE 2 2408793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_HANDLE_CHUNK_ALWAYS 3 2409793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2410793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Strip the prepended error numbers ("#nnn ") from error and warning 2411793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * messages before passing them to the error or warning handler. 2412793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2413793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_ERROR_NUMBERS_SUPPORTED 2414793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(185, void, png_set_strip_error_numbers, 2415793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, 2416793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 strip_mode)); 2417793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2418793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2419793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added in libpng-1.2.6 */ 2420793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SET_USER_LIMITS_SUPPORTED 2421793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(186, void, png_set_user_limits, (png_structp png_ptr, 2422793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 user_width_max, png_uint_32 user_height_max)); 2423793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(187, png_uint_32, png_get_user_width_max, 2424793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2425793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(188, png_uint_32, png_get_user_height_max, 2426793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2427793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added in libpng-1.4.0 */ 2428793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structp png_ptr, 2429793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_uint_32 user_chunk_cache_max)); 2430793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, 2431793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2432793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added in libpng-1.4.1 */ 2433793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structp png_ptr, 2434793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_alloc_size_t user_chunk_cache_max)); 2435793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max, 2436793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2437793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2438793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2439793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_INCH_CONVERSIONS_SUPPORTED) 2440793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, 2441793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2442793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2443793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, 2444793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2445793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2446793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, 2447793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2448793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2449793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(196, float, png_get_x_offset_inches, 2450793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr, png_const_infop info_ptr)); 2451793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ 2452793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, 2453793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_const_infop info_ptr)); 2454793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2455793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2456793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr, 2457793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr)); 2458793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ 2459793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, 2460793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr, png_const_infop info_ptr)); 2461793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2462793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2463793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# ifdef PNG_pHYs_SUPPORTED 2464793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structp png_ptr, 2465793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, 2466793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int *unit_type)); 2467793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# endif /* PNG_pHYs_SUPPORTED */ 2468793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */ 2469793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2470793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Added in libpng-1.4.0 */ 2471793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_IO_STATE_SUPPORTED 2472793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(199, png_uint_32, png_get_io_state, (png_structp png_ptr)); 2473793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2474793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORTA(200, png_const_bytep, png_get_io_chunk_name, 2475793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_structp png_ptr), PNG_DEPRECATED); 2476793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, 2477793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_const_structp png_ptr)); 2478793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2479793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The flags returned by png_get_io_state() are the following: */ 2480793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_NONE 0x0000 /* no I/O at this moment */ 2481793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_READING 0x0001 /* currently reading */ 2482793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_WRITING 0x0002 /* currently writing */ 2483793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ 2484793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ 2485793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */ 2486793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */ 2487793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */ 2488793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */ 2489793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* ?PNG_IO_STATE_SUPPORTED */ 2490793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2491793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Interlace support. The following macros are always defined so that if 2492793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * libpng interlace handling is turned off the macros may be used to handle 2493793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * interlaced images within the application. 2494793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2495793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_INTERLACE_ADAM7_PASSES 7 2496793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2497793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Two macros to return the first row and first column of the original, 2498793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * full, image which appears in a given pass. 'pass' is in the range 0 2499793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * to 6 and the result is in the range 0 to 7. 2500793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2501793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7) 2502793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7) 2503793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2504793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* A macro to return the offset between pixels in the output row for a pair of 2505793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that 2506793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * follows. Note that ROW_OFFSET is the offset from one row to the next whereas 2507793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * COL_OFFSET is from one column to the next, within a row. 2508793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2509793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8) 2510793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1)) 2511793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2512793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Two macros to help evaluate the number of rows or columns in each 2513793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * pass. This is expressed as a shift - effectively log2 of the number or 2514793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * rows or columns in each 8x8 tile of the original image. 2515793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2516793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3) 2517793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3) 2518793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2519793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Hence two macros to determine the number of rows or columns in a given 2520793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * pass of an image given its height or width. In fact these macros may 2521793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * return non-zero even though the sub-image is empty, because the other 2522793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * dimension may be empty for a small image. 2523793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2524793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_ROWS(height, pass) (((height)+(((1<<PNG_PASS_ROW_SHIFT(pass))\ 2525793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler -1)-PNG_PASS_START_ROW(pass)))>>PNG_PASS_ROW_SHIFT(pass)) 2526793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_COLS(width, pass) (((width)+(((1<<PNG_PASS_COL_SHIFT(pass))\ 2527793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler -1)-PNG_PASS_START_COL(pass)))>>PNG_PASS_COL_SHIFT(pass)) 2528793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2529793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* For the reader row callbacks (both progressive and sequential) it is 2530793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * necessary to find the row in the output image given a row in an interlaced 2531793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * image, so two more macros: 2532793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2533793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ROW_FROM_PASS_ROW(yIn, pass) \ 2534793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (((yIn)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass)) 2535793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COL_FROM_PASS_COL(xIn, pass) \ 2536793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (((xIn)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass)) 2537793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2538793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Two macros which return a boolean (0 or 1) saying whether the given row 2539793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * or column is in a particular pass. These use a common utility macro that 2540793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * returns a mask for a given pass - the offset 'off' selects the row or 2541793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * column version. The mask has the appropriate bit set for each column in 2542793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * the tile. 2543793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2544793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_PASS_MASK(pass,off) ( \ 2545793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((0x110145AF>>(((7-(off))-(pass))<<2)) & 0xF) | \ 2546793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0)) 2547793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2548793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_ROW_IN_INTERLACE_PASS(y, pass) \ 2549793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1) 2550793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define PNG_COL_IN_INTERLACE_PASS(x, pass) \ 2551793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1) 2552793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2553793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED 2554793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* With these routines we avoid an integer divide, which will be slower on 2555793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * most machines. However, it does take more operations than the corresponding 2556793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * divide method, so it may be slower on a few RISC systems. There are two 2557793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. 2558793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 2559793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * Note that the rounding factors are NOT supposed to be the same! 128 and 2560793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 32768 are correct for the NODIV code; 127 and 32767 are correct for the 2561793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * standard method. 2562793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * 2563793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] 2564793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2565793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2566793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ 2567793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2568793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_composite(composite, fg, alpha, bg) \ 2569793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \ 2570793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (png_uint_16)(alpha) \ 2571793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler + (png_uint_16)(bg)*(png_uint_16)(255 \ 2572793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler - (png_uint_16)(alpha)) + 128); \ 2573793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } 2574793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2575793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_composite_16(composite, fg, alpha, bg) \ 2576793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \ 2577793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * (png_uint_32)(alpha) \ 2578793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler + (png_uint_32)(bg)*(65535 \ 2579793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler - (png_uint_32)(alpha)) + 32768); \ 2580793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } 2581793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2582793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#else /* Standard method using integer division */ 2583793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2584793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_composite(composite, fg, alpha, bg) \ 2585793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ 2586793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ 2587793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 127) / 255) 2588793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2589793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_composite_16(composite, fg, alpha, bg) \ 2590793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ 2591793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \ 2592793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 32767) / 65535) 2593793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ 2594793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2595793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED 2596793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf)); 2597793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf)); 2598793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf)); 2599793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2600793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2601793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_structp png_ptr, 2602793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler png_const_bytep buf)); 2603793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* No png_get_int_16 -- may be added if there's a real need for it. */ 2604793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2605793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ 2606793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED 2607793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i)); 2608793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2609793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_SAVE_INT_32_SUPPORTED 2610793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i)); 2611793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2612793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2613793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Place a 16-bit number into a buffer in PNG byte order. 2614793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The parameter is declared unsigned int, not png_uint_16, 2615793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * just to avoid potential problems on pre-ANSI C compilers. 2616793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2617793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED 2618793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); 2619793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* No png_save_int_16 -- may be added if there's a real need for it. */ 2620793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2621793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2622793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_USE_READ_MACROS 2623793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Inline macros to do direct reads of bytes from the input buffer. 2624793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * The png_get_int_32() routine assumes we are using two's complement 2625793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * format for negative values, which is almost certainly true. 2626793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2627793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_get_uint_32(buf) \ 2628793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (((png_uint_32)(*(buf)) << 24) + \ 2629793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((png_uint_32)(*((buf) + 1)) << 16) + \ 2630793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((png_uint_32)(*((buf) + 2)) << 8) + \ 2631793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((png_uint_32)(*((buf) + 3)))) 2632793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2633793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the 2634793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * function) incorrectly returned a value of type png_uint_32. 2635793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2636793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_get_uint_16(buf) \ 2637793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((png_uint_16) \ 2638793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler (((unsigned int)(*(buf)) << 8) + \ 2639793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((unsigned int)(*((buf) + 1))))) 2640793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2641793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler# define png_get_int_32(buf) \ 2642793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ((png_int_32)((*(buf) & 0x80) \ 2643793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \ 2644793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler : (png_int_32)png_get_uint_32(buf))) 2645793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2646793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2647793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \ 2648793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED) 2649793ee12c6df9cad3806238d32528c49a3ff9331dNoah PreslerPNG_EXPORT(234, void, png_set_check_for_invalid_index, (png_structp png_ptr, 2650793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler int allowed)); 2651793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2652793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2653793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Maintainer: Put new public prototypes here ^, in libpng.3, and project 2654793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * defs 2655793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2656793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2657793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* The last ordinal number (this is the *last* one already used; the next 2658793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * one to use is one more than this.) Maintainer, remember to add an entry to 2659793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * scripts/symbols.def as well. 2660793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */ 2661793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef PNG_EXPORT_LAST_ORDINAL 2662793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler PNG_EXPORT_LAST_ORDINAL(234); 2663793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2664793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2665793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifdef __cplusplus 2666793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler} 2667793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif 2668793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler 2669793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_VERSION_INFO_ONLY */ 2670793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/* Do not put anything past this line */ 2671793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif /* PNG_H */ 2672