-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathpnglib.pas
More file actions
1180 lines (997 loc) · 55.8 KB
/
pnglib.pas
File metadata and controls
1180 lines (997 loc) · 55.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit pnglib;
{
PngLib.Pas
Conversion from C header file to Pascal Unit by Edmund H. Hand in
April of 1998.
For conditions of distribution and use, see the COPYRIGHT NOTICE from the
orginal C Header file below.
This unit is intended for use with LPng.DLL. LPng.DLL was compiled with
Microsoft Visual C++ 5.0 and is comprised of the standard PNG library
version 1.0.1. LPng.DLL uses ZLib 1.1.2 internally for compression and
decompression. The ZLib functions are also exported in the DLL, but they
have not yet been defined here.
The primary word of warning I must offer is that most of the function
pointers for callback functions have merely been declared as the pascal
Pointer type. I have only defined one procedure type for read and write
callback functions. So if you plan to use other callback types, check the
included header file for the function definition.
The header comments of the original C Header file follow.
* png.h - header file for PNG reference library
*
* libpng 1.0.1
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998 Glenn Randers-Pehrson
* March 15, 1998
*
* Note about libpng version numbers:
*
* Due to various miscommunications, unforeseen code incompatibilities
* and occasional factors outside the authors' control, version numbering
* on the library has not always been consistent and straightforward.
* The following table summarizes matters since version 0.89c, which was
* the first widely used release:
*
* source png.h png.h shared-lib
* version string int version
* ------- ------ ------ ----------
* 0.89c ("1.0 beta 3") 0.89 89 1.0.89
* 0.90 ("1.0 beta 4") 0.90 90 0.90 [should have been 2.0.90]
* 0.95 ("1.0 beta 5") 0.95 95 0.95 [should have been 2.0.95]
* 0.96 ("1.0 beta 6") 0.96 96 0.96 [should have been 2.0.96]
* 0.97b ("1.00.97 beta 7") 1.00.97 97 1.0.1 [should have been 2.0.97]
* 0.97c 0.97 97 2.0.97
* 0.98 0.98 98 2.0.98
* 0.99 0.99 98 2.0.99
* 0.99a-m 0.99 99 2.0.99
* 1.00 1.00 100 2.1.0 [int should be 10000]
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
* 1.0.1 1.0.1 10001 2.1.0
*
* Henceforth the source version will match the shared-library minor
* and patch numbers; the shared-library major version number will be
* used for changes in backward compatibility, as it is intended.
* The PNG_PNGLIB_VER macro, which is not used within libpng but
* is available for applications, is an unsigned integer of the form
* xyyzz corresponding to the source version x.y.z (leading zeros in y and z).
*
*
* See libpng.txt for more information. The PNG specification is available
* as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
* and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
*
* Contributing Authors:
* John Bowler
* Kevin Bracey
* Sam Bushell
* Andreas Dilger
* Magnus Holmgren
* Tom Lane
* Dave Martindale
* Glenn Randers-Pehrson
* Greg Roelofs
* Guy Eric Schalnat
* Paul Schmidt
* Tom Tanner
* Willem van Schaik
* Tim Wegner
*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
* possible without all of you.
*
* Thanks to Frank J. T. Wojcik for helping with the documentation.
*
* COPYRIGHT NOTICE:
*
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
* and Group 42, Inc. disclaim all warranties, expressed or implied,
* including, without limitation, the warranties of merchantability and of
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
* assume no liability for direct, indirect, incidental, special, exemplary,
* or consequential damages, which may result from the use of the PNG
* Reference Library, even if advised of the possibility of such damage.
*
* Permission is hereby granted to use, copy, modify, and distribute this
* source code, or portions hereof, for any purpose, without fee, subject
* to the following restrictions:
* 1. The origin of this source code must not be misrepresented.
* 2. Altered versions must be plainly marked as such and must not be
* misrepresented as being the original source.
* 3. This Copyright notice may not be removed or altered from any source or
* altered source distribution.
*
* The Contributing Authors and Group 42, Inc. specifically permit, without
* fee, and encourage the use of this source code as a component to
* supporting the PNG file format in commercial products. If you use this
* source code in a product, acknowledgment is not required but would be
* appreciated.
*}
interface
uses SysUtils;
type PByte = ^Byte;
type PPByte = ^PByte;
type PPChar = ^PChar;
type PWord = ^Word;
type PPWord = ^PWord;
type PDouble = ^Double;
type PSmallint = ^Smallint;
type PCardinal = ^Cardinal;
type PPCardinal = ^PCardinal;
type PInteger = ^Integer;
type PPInteger = ^PInteger;
const Lib = 'lpng.dll';
// Version information for png.h - this should match the version in png.c
const PNG_LIBPNG_VER_STRING = '1.0.1';
const PNG_LIBPNG_VER = '10001'; // 1.0.1
// Supported compression types for text in PNG files (tEXt, and zTXt).
// The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed.
const PNG_TEXT_COMPRESSION_NONE_WR: Integer = -3;
const PNG_TEXT_COMPRESSION_zTXt_WR: Integer = -2;
const PNG_TEXT_COMPRESSION_NONE: Integer = -1;
const PNG_TEXT_COMPRESSION_zTXt: Integer = 0;
const PNG_TEXT_COMPRESSION_LAST: Integer = 1; // Not a valid value
// These describe the color_type field in png_info.
// color type masks
const PNG_COLOR_MASK_PALETTE: Integer = 1;
const PNG_COLOR_MASK_COLOR: Integer = 2;
const PNG_COLOR_MASK_ALPHA: Integer = 4;
// color types. Note that not all combinations are legal
const PNG_COLOR_TYPE_GRAY: Integer = 0;
const PNG_COLOR_TYPE_PALETTE: Integer = 3;
const PNG_COLOR_TYPE_RGB: Integer = 2;
const PNG_COLOR_TYPE_RGB_ALPHA: Integer = 6;
const PNG_COLOR_TYPE_GRAY_ALPHA: Integer = 4;
// This is for compression type. PNG 1.0 only defines the single type.
const PNG_COMPRESSION_TYPE_BASE: Integer = 0; // Deflate method 8, 32K window
const PNG_COMPRESSION_TYPE_DEFAULT: Integer = 0;
// This is for filter type. PNG 1.0 only defines the single type.
const PNG_FILTER_TYPE_BASE: Integer = 0; // Single row per-byte filtering
const PNG_FILTER_TYPE_DEFAULT: Integer = 0;
// These are for the interlacing type. These values should NOT be changed.
const PNG_INTERLACE_NONE: Integer = 0; // Non-interlaced image
const PNG_INTERLACE_ADAM7: Integer = 1; // Adam7 interlacing
const PNG_INTERLACE_LAST: Integer = 2; // Not a valid value
// These are for the oFFs chunk. These values should NOT be changed.
const PNG_OFFSET_PIXEL: Integer = 0; // Offset in pixels
const PNG_OFFSET_MICROMETER: Integer = 1; // Offset in micrometers (1/10^6 meter)
const PNG_OFFSET_LAST: Integer = 2; // Not a valid value
// These are for the pCAL chunk. These values should NOT be changed.
const PNG_EQUATION_LINEAR: Integer = 0; // Linear transformation
const PNG_EQUATION_BASE_E: Integer = 1; // Exponential base e transform
const PNG_EQUATION_ARBITRARY: Integer = 2; // Arbitrary base exponential transform
const PNG_EQUATION_HYPERBOLIC: Integer = 3; // Hyperbolic sine transformation
const PNG_EQUATION_LAST: Integer = 4; // Not a valid value
// These are for the pHYs chunk. These values should NOT be changed.
const PNG_RESOLUTION_UNKNOWN: Integer = 0; // pixels/unknown unit (aspect ratio)
const PNG_RESOLUTION_METER: Integer = 1; // pixels/meter
const PNG_RESOLUTION_LAST: Integer = 2; // Not a valid value
// These are for the sRGB chunk. These values should NOT be changed.
const PNG_sRGB_INTENT_SATURATION: Integer = 0;
const PNG_sRGB_INTENT_PERCEPTUAL: Integer = 1;
const PNG_sRGB_INTENT_ABSOLUTE: Integer = 2;
const PNG_sRGB_INTENT_RELATIVE: Integer = 3;
const PNG_sRGB_INTENT_LAST: Integer = 4; // Not a valid value
{* These determine if an ancillary chunk's data has been successfully read
* from the PNG header, or if the application has filled in the corresponding
* data in the info_struct to be written into the output file. The values
* of the PNG_INFO_<chunk> defines should NOT be changed.
*}
const PNG_INFO_gAMA: Integer = $0001;
const PNG_INFO_sBIT: Integer = $0002;
const PNG_INFO_cHRM: Integer = $0004;
const PNG_INFO_PLTE: Integer = $0008;
const PNG_INFO_tRNS: Integer = $0010;
const PNG_INFO_bKGD: Integer = $0020;
const PNG_INFO_hIST: Integer = $0040;
const PNG_INFO_pHYs: Integer = $0080;
const PNG_INFO_oFFs: Integer = $0100;
const PNG_INFO_tIME: Integer = $0200;
const PNG_INFO_pCAL: Integer = $0400;
const PNG_INFO_sRGB: Integer = $0800; // GR-P, 0.96a
{* The values of the PNG_FILLER_ defines should NOT be changed *}
const PNG_FILLER_BEFORE: Integer = 0;
const PNG_FILLER_AFTER: Integer = 1;
{* Three color definitions. The order of the red, green, and blue, (and the
* exact size) is not important, although the size of the fields need to
* be png_byte or png_uint_16 (as defined below).
*}
type TPng_Color = record
red: Byte;
green: Byte;
blue: Byte;
end;
type PPng_Color = ^TPng_Color;
type PPPng_Color = ^PPng_Color;
type TPng_Color_16 = record
index: Byte; // Used for palette files
red: Word; // For use in reg, green, blue files
green: Word;
blue: Word;
gray: Word; // For use in grayscale files
end;
type PPng_Color_16 = ^TPng_Color_16;
type PPPng_Color_16 = ^PPng_Color_16;
type TPng_Color_8 = record
red: Byte; // for use in red green blue files
green: Byte;
blue: Byte;
gray: Byte; // for use in grayscale files
alpha: Byte; // for alpha channel files
end;
type PPng_Color_8 = ^TPng_Color_8;
type PPPng_Color_8 = ^PPng_Color_8;
{* png_text holds the text in a PNG file, and whether they are compressed
* in the PNG file or not. The "text" field points to a regular C string.
*}
type TPng_Text = record
compression: Integer; // compression value, see PNG_TEXT_COMPRESSION_
key: PChar; // keyword, 1-79 character description of "text"
text: PChar; // comment, may be an empty string (ie "")
text_length: Integer; // length of "text" field
end;
type PPng_Text = ^TPng_Text;
type PPPng_Text = ^PPng_Text;
type TPng_Text_Array = array[0..65535] of TPng_Text;
type PPng_Text_Array = ^TPng_Text_Array;
{* png_time is a way to hold the time in an machine independent way.
* Two conversions are provided, both from time_t and struct tm. There
* is no portable way to convert to either of these structures, as far
* as I know. If you know of a portable way, send it to me. As a side
* note - PNG is Year 2000 compliant!
*}
type TPng_Time = record
year: Word; // full year, as in, 1995
month: Byte; // month of year, 1 - 12
day: Byte; // day of month, 1 - 31
hour: Byte; // hour of day, 0 - 23
minute: Byte; // minute of hour, 0 - 59
second: Byte; // second of minute, 0 - 60 (for leap seconds)
end;
type PPng_Time = ^TPng_Time;
type PPPng_Time = ^PPng_Time;
type TM = record // Standard C time structure
tm_sec: Integer; // seconds after the minute - [0,59]
tm_min: Integer; // minutes after the hour - [0,59]
tm_hour: Integer; // hours since midnight - [0,23]
tm_mday: Integer; // day of the month - [1,31]
tm_mon: Integer; // months since January - [0,11]
tm_year: Integer; // years since 1900
tm_wday: Integer; // days since Sunday - [0,6]
tm_yday: Integer; // days since January 1 - [0,365]
tm_isdst: Integer; // daylight savings time flag
end;
type PTM = ^TM;
{ png_info is a structure that holds the information in a PNG file so
* that the application can find out the characteristics of the image.
* If you are reading the file, this structure will tell you what is
* in the PNG file. If you are writing the file, fill in the information
* you want to put into the PNG file, then call png_write_info().
* The names chosen should be very close to the PNG specification, so
* consult that document for information about the meaning of each field.
*
* With libpng < 0.95, it was only possible to directly set and read the
* the values in the png_info_struct, which meant that the contents and
* order of the values had to remain fixed. With libpng 0.95 and later,
* however, * there are now functions which abstract the contents of
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
* functionality.
*
* In any case, the order of the parameters in png_info_struct should NOT
* be changed for as long as possible to keep compatibility with applications
* that use the old direct-access method with png_info_struct.
*}
type TPng_Info = record
//the following are necessary for every PNG file
width: Cardinal; // width of image in pixels (from IHDR)
height: Cardinal; // height of image in pixels (from IHDR)
valid: Cardinal; // valid chunk data (see PNG_INFO_ below)
rowbytes: Cardinal; // bytes needed to hold an untransformed row
palette: PPng_Color;// array of color values (valid & PNG_INFO_PLTE)
num_palette: Word; // number of color entries in "palette" (PLTE)
num_trans: Word; // number of transparent palette color (tRNS)
bit_depth: Byte; // 1, 2, 4, 8, or 16 bits/channel (from IHDR)
color_type: Byte; // see PNG_COLOR_TYPE_ below (from IHDR)
compression_type: Byte; // must be PNG_COMPRESSION_TYPE_BASE (IHDR)
filter_type: Byte; // must be PNG_FILTER_TYPE_BASE (from IHDR)
interlace_type: Byte; // One of PNG_INTERLACE_NONE,PNG_INTERLACE_ADAM7
// The following is informational only on read, and not used on writes.
channels: Byte; // number of data channels per pixel (1, 3, 4)
pixel_depth: Byte; // number of bits per pixel
spare_byte: Byte; // to align the data, and for future use
signature: array[0..7] of Byte;// magic bytes read by libpng from start of file
{* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
* are writing, set the valid field to those chunks you want written,
* and initialize the appropriate fields below.
*}
{* The gAMA chunk describes the gamma characteristics of the system
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*}
gamma: Single; // gamma value of image, if (valid & PNG_INFO_gAMA)
// GR-P, 0.96a
// Data valid if (valid & PNG_INFO_sRGB) non-zero.
srgb_intent: Byte; // sRGB rendering intent [0, 1, 2, or 3]
{* The tEXt and zTXt chunks contain human-readable textual data in
* uncompressed and compressed forms, respectively. The data in "text"
* is an array of pointers to uncompressed, null-terminated C strings.
* Each chunk has a keyword which describes the textual data contained
* in that chunk. Keywords are not required to be unique, and the text
* string may be empty. Any number of text chunks may be in an image.
*}
num_text: Integer; // number of comments read/to write
max_text: Integer; // current size of text array
text: PPng_Text; // array of comments read/to write
{* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*}
mod_time: TPng_Time;
{* The sBIT chunk specifies the number of significant high-order bits
* in the pixel data. Values are in the range [1, bit_depth], and are
* only specified for the channels in the pixel data. The contents of
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*}
sig_bit: TPng_Color_8; // significant bits in color channels
{* The tRNS chunk supplies transparency data for paletted images and
* other image types that don't need a full alpha channel. There are
* "num_trans" transparency values for a paletted image, stored in the
* same order as the palette colors, starting from index 0. Values
* for the data are in the range [0, 255], ranging from fully transparent
* to fully opaque, respectively. For non-paletted images, there is a
* single color specified which should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*}
trans: PByte; // transparent values for paletted image
trans_values: TPng_Color_16; // transparent color for non-palette image
{* The bKGD chunk gives the suggested image background color if the
* display program does not have its own background color and the image
* is needs to composited onto a background before display. The colors
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*}
background: TPng_Color_16;
{* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
* and downwards from the top-left corner of the display, page, or other
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*}
x_offset: Cardinal; // x offset on page
y_offset: Cardinal; // y offset on page
offset_unit_type: Byte; // offset units type
{* The pHYs chunk gives the physical pixel density of the image for
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*}
x_pixels_per_unit: Cardinal; // horizontal pixel density
y_pixels_per_unit: Cardinal; // vertical pixel density
phys_unit_type: Byte; // resolution type (see PNG_RESOLUTION_ below)
{* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
* reduced-color palette, if required. Data is an array of "num_palette"
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*}
hist: PWord;
{* The cHRM chunk describes the CIE color characteristics of the monitor
* on which the PNG was created. This data allows the viewer to do gamut
* mapping of the input image to ensure that the viewer sees the same
* colors in the image as the creator. Values are in the range
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*}
x_white: Single;
y_white: Single;
x_red: Single;
y_red: Single;
x_green: Single;
y_green: Single;
x_blue: Single;
y_blue: Single;
{* The pCAL chunk describes a transformation between the stored pixel
* values and original physcical data values used to create the image.
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
* range given by [pcal_X0, pcal_X1], and are further transformed by a
* (possibly non-linear) transformation function given by "pcal_type"
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
* defines below, and the PNG-Group's Scientific Visualization extension
* chunks document png-scivis-19970203 for a complete description of the
* transformations and how they should be implemented, as well as the
* png-extensions document for a description of the ASCII parameter
* strings. Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*}
pcal_purpose: PChar; // pCAL chunk description string
pcal_X0: Integer; // minimum value
pcal_X1: Integer; // maximum value
pcal_units: PChar; // Latin-1 string giving physical units
pcal_params: PPChar; // ASCII strings containing parameter values
pcal_type: Byte; // equation type (see PNG_EQUATION_ below)
pcal_nparams: Byte; // number of parameters given in pcal_params
end;
type PPng_Info = ^TPng_Info;
type PPPng_Info = ^PPng_Info;
{* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
* the routines for other purposes.
*}
type TPng_Row_Info = record
width: Cardinal; // width of row
rowbytes: Cardinal; // number of bytes in row
color_type: Byte; // color type of row
bit_depth: Byte; // bit depth of row
channels: Byte; // number of channels (1, 2, 3, or 4)
pixel_depth: Byte; // bits per pixel (depth * channels)
end;
type PPng_Row_Info = ^TPng_Row_Info;
type PPPng_Row_Info = ^PPng_Row_Info;
{* The structure that holds the information to read and write PNG files.
* The only people who need to care about what is inside of this are the
* people who will be modifying the library for their own special needs.
* It should NOT be accessed directly by an application, except to store
* the jmp_buf.
*}
type TPng_Struct = record
jmpbuf: array[0..10] of Integer; // used in png_error
error_fn: Pointer; // function for printing errors and aborting
warning_fn: Pointer; // function for printing warnings
error_ptr: Pointer; // user supplied struct for error functions
write_data_fn: Pointer; // function for writing output data
read_data_fn: Pointer; // function for reading input data
read_user_transform_fn: Pointer; // user read transform
write_user_transform_fn: Pointer; // user write transform
io_ptr: Integer; // ptr to application struct for I/O functions
mode: Cardinal; // tells us where we are in the PNG file
flags: Cardinal; // flags indicating various things to libpng
transformations: Cardinal; // which transformations to perform
zstream: Pointer; // pointer to decompression structure (below)
zbuf: PByte; // buffer for zlib
zbuf_size: Integer; // size of zbuf
zlib_level: Integer; // holds zlib compression level
zlib_method: Integer; // holds zlib compression method
zlib_window_bits: Integer; // holds zlib compression window bits
zlib_mem_level: Integer; // holds zlib compression memory level
zlib_strategy: Integer; // holds zlib compression strategy
width: Cardinal; // width of image in pixels
height: Cardinal; // height of image in pixels
num_rows: Cardinal; // number of rows in current pass
usr_width: Cardinal; // width of row at start of write
rowbytes: Cardinal; // size of row in bytes
irowbytes: Cardinal; // size of current interlaced row in bytes
iwidth: Cardinal; // width of current interlaced row in pixels
row_number: Cardinal; // current row in interlace pass
prev_row: PByte; // buffer to save previous (unfiltered) row
row_buf: PByte; // buffer to save current (unfiltered) row
sub_row: PByte; // buffer to save "sub" row when filtering
up_row: PByte; // buffer to save "up" row when filtering
avg_row: PByte; // buffer to save "avg" row when filtering
paeth_row: PByte; // buffer to save "Paeth" row when filtering
row_info: TPng_Row_Info; // used for transformation routines
idat_size: Cardinal; // current IDAT size for read
crc: Cardinal; // current chunk CRC value
palette: PPng_Color; // palette from the input file
num_palette: Word; // number of color entries in palette
num_trans: Word; // number of transparency values
chunk_name: array[0..4] of Byte; // null-terminated name of current chunk
compression: Byte; // file compression type (always 0)
filter: Byte; // file filter type (always 0)
interlaced: Byte; // PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7
pass: Byte; // current interlace pass (0 - 6)
do_filter: Byte; // row filter flags (see PNG_FILTER_ below )
color_type: Byte; // color type of file
bit_depth: Byte; // bit depth of file
usr_bit_depth: Byte; // bit depth of users row
pixel_depth: Byte; // number of bits per pixel
channels: Byte; // number of channels in file
usr_channels: Byte; // channels at start of write
sig_bytes: Byte; // magic bytes read/written from start of file
filler: Byte; // filler byte for 24->32-bit pixel expansion
background_gamma_type: Byte;
background_gamma: Single;
background: TPng_Color_16; // background color in screen gamma space
background_1: TPng_Color_16; // background normalized to gamma 1.0
output_flush_fn: Pointer;// Function for flushing output
flush_dist: Cardinal; // how many rows apart to flush, 0 - no flush
flush_rows: Cardinal; // number of rows written since last flush
gamma_shift: Integer; // number of "insignificant" bits 16-bit gamma
gamma: Single; // file gamma value
screen_gamma: Single; // screen gamma value (display_gamma/viewing_gamma
gamma_table: PByte; // gamma table for 8 bit depth files
gamma_from_1: PByte; // converts from 1.0 to screen
gamma_to_1: PByte; // converts from file to 1.0
gamma_16_table: PPWord; // gamma table for 16 bit depth files
gamma_16_from_1: PPWord; // converts from 1.0 to screen
gamma_16_to_1: PPWord; // converts from file to 1.0
sig_bit: TPng_Color_8; // significant bits in each available channel
shift: TPng_Color_8; // shift for significant bit tranformation
trans: PByte; // transparency values for paletted files
trans_values: TPng_Color_16; // transparency values for non-paletted files
read_row_fn: Pointer; // called after each row is decoded
write_row_fn: Pointer; // called after each row is encoded
info_fn: Pointer; // called after header data fully read
row_fn: Pointer; // called after each prog. row is decoded
end_fn: Pointer; // called after image is complete
save_buffer_ptr: PByte; // current location in save_buffer
save_buffer: PByte; // buffer for previously read data
current_buffer_ptr: PByte; // current location in current_buffer
current_buffer: PByte; // buffer for recently used data
push_length: Cardinal; // size of current input chunk
skip_length: Cardinal; // bytes to skip in input data
save_buffer_size: Integer; // amount of data now in save_buffer
save_buffer_max: Integer; // total size of save_buffer
buffer_size: Integer; // total amount of available input data
current_buffer_size: Integer; // amount of data now in current_buffer
process_mode: Integer; // what push library is currently doing
cur_palette: Integer; // current push library palette index
current_text_size: Integer; // current size of text input data
current_text_left: Integer; // how much text left to read in input
current_text: PByte; // current text chunk buffer
current_text_ptr: PByte; // current location in current_text
palette_lookup: PByte; // lookup table for dithering
dither_index: PByte; // index translation for palette files
hist: PWord; // histogram
heuristic_method: Byte; // heuristic for row filter selection
num_prev_filters: Byte; // number of weights for previous rows
prev_filters: PByte; // filter type(s) of previous row(s)
filter_weights: PWord; // weight(s) for previous line(s)
inv_filter_weights: PWord; // 1/weight(s) for previous line(s)
filter_costs: PWord; // relative filter calculation cost
inv_filter_costs: PWord; // 1/relative filter calculation cost
time_buffer: PByte; // String to hold RFC 1123 time text
end;
type PPng_Struct = ^TPng_Struct;
type PPPng_Struct = ^PPng_Struct;
type TPng_RW_Fn = procedure(png_ptr: PPng_Struct; data: PByte; length: Integer);
{* Here are the function definitions most commonly used. This is not
* the place to find out how to use libpng. See libpng.txt for the
* full explanation, see example.c for the summary. This just provides
* a simple one line of the use of each function.
*}
{* Tell lib we have already handled the first <num_bytes> magic bytes.
* Handling more than 8 bytes from the beginning of the file is an error.
*}
procedure png_set_sig_bytes(png_ptr: PPng_Struct; num_bytes: Integer); cdecl; external Lib;
{* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
* PNG file. Returns zero if the supplied bytes match the 8-byte PNG
* signature, and non-zero otherwise. Having num_to_check == 0 or
* start > 7 will always fail (ie return non-zero).
*}
function png_sig_cmp(sig: PByte; start, num_to_check: Integer): Integer; cdecl; external Lib;
{* Simple signature checking function. This is the same as calling
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
*}
function png_check_sig(sig: PByte; num: Integer): Integer; cdecl; external Lib;
{* Allocate and initialize png_ptr struct for reading, and any other memory. *}
function png_create_read_struct(user_png_ver: PChar;
error_ptr, error_fn, warn_fn: Pointer): PPng_Struct; cdecl; external Lib;
{* Allocate and initialize png_ptr struct for reading, and any other memory *}
function png_create_write_struct(user_png_ver: PChar;
error_ptr, error_fn, warn_fn: Pointer): PPng_Struct; cdecl; external Lib;
{* Write a PNG chunk - size, type, (optional) data, CRC. *}
procedure png_write_chunk(png_ptr: PPng_Struct;
chunk_name, data: PByte; length: Integer); cdecl; external Lib;
{* Write the start of a PNG chunk - length and chunk name. *}
procedure png_write_chunk_start(png_ptr: PPng_Struct;
chunk_name: PByte; length: Cardinal); cdecl; external Lib;
{* Write the data of a PNG chunk started with png_write_chunk_start(). *}
procedure png_write_chunk_data(png_ptr: PPng_Struct;
data: PByte; length: Integer); cdecl; external Lib;
{* Finish a chunk started with png_write_chunk_start() (includes CRC). *}
procedure png_write_chunk_end(png_ptr: PPng_Struct); cdecl; external Lib;
{* Allocate and initialize the info structure *}
function png_create_info_struct(png_ptr: PPng_Struct): PPng_Info; cdecl; external Lib;
{* Writes all the PNG information before the image. *}
procedure png_write_info(png_ptr: PPng_Struct; info_ptr: PPng_Info); cdecl; external Lib;
{* read the information before the actual image data. *}
procedure png_read_info(png_ptr: PPng_Struct; info_ptr: PPng_Info); cdecl; external Lib;
function png_convert_to_rfc1123(png_ptr: PPng_Struct;
ptime: PPng_Time): PChar; cdecl; external Lib;
{* convert from a struct tm to png_time *}
procedure png_convert_from_struct_tm(ptime: PPng_Time;
ttime: PTM); cdecl; external Lib;
{* convert from time_t to png_time. Uses gmtime() *}
procedure png_convert_from_time_t(ptime: PPng_Time;
ttime: Integer); cdecl; external Lib;
{* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha if available. *}
procedure png_set_expand(png_ptr: PPng_Struct); cdecl; external Lib;
{* Use blue, green, red order for pixels. *}
procedure png_set_bgr(png_ptr: PPng_Struct); cdecl; external Lib;
{* Expand the grayscale to 24 bit RGB if necessary. *}
procedure png_set_gray_to_rgb(png_ptr: PPng_Struct); cdecl; external Lib;
{* Reduce RGB to grayscale. (Not yet implemented) *}
procedure png_set_rgb_to_gray(png_ptr: PPng_Struct); cdecl; external Lib;
procedure png_build_grayscale_palette(bit_depth: Integer;
palette: PPng_Color); cdecl; external Lib;
procedure png_set_strip_alpha(png_ptr: PPng_Struct); cdecl; external Lib;
procedure png_set_swap_alpha(png_ptr: PPng_Struct); cdecl; external Lib;
procedure png_set_invert_alpha(png_ptr: PPng_Struct); cdecl; external Lib;
{* Add a filler byte to 24-bit RGB images. *}
procedure png_set_filler(png_ptr: PPng_Struct; filler: Cardinal;
flags: Integer); cdecl; external Lib;
{* Swap bytes in 16 bit depth files. *}
procedure png_set_swap(png_ptr: PPng_Struct); cdecl; external Lib;
{* Use 1 byte per pixel in 1, 2, or 4 bit depth files. *}
procedure png_set_packing(png_ptr: PPng_Struct); cdecl; external Lib;
{* Swap packing order of pixels in bytes. *}
procedure png_set_packswap(png_ptr: PPng_Struct); cdecl; external Lib;
{* Converts files to legal bit depths. *}
procedure png_set_shift(png_ptr: PPng_Struct;
true_bits: PPng_Color_8); cdecl; external Lib;
{* Have the code handle the interlacing. Returns the number of passes. *}
function png_set_interlace_handling(png_ptr: PPng_Struct): Integer; cdecl; external Lib;
{* Invert monocrome files *}
procedure png_set_invert_mono(png_ptr: PPng_Struct); cdecl; external Lib;
{* Handle alpha and tRNS by replacing with a background color. *}
procedure png_set_background(png_ptr: PPng_Struct;
background_color: PPng_Color_16;
background_gamma_code, need_expand: Integer;
background_gamma: double); cdecl; external Lib;
const PNG_BACKGROUND_GAMMA_UNKNOWN: Integer = 0;
const PNG_BACKGROUND_GAMMA_SCREEN: Integer = 1;
const PNG_BACKGROUND_GAMMA_FILE: Integer = 2;
const PNG_BACKGROUND_GAMMA_UNIQUE: Integer = 3;
{* strip the second byte of information from a 16 bit depth file. *}
procedure png_set_strip_16(png_ptr: PPng_Struct); cdecl; external Lib;
{* Turn on dithering, and reduce the palette to the number of colors available. *}
procedure png_set_dither(png_ptr: PPng_Struct;
palette: PPng_Color; num_palette, maximum_colors: Integer;
histogram: PWord; full_dither: Integer); cdecl; external Lib;
{* Handle gamma correction. Screen_gamma=(display_gamma/viewing_gamma) *}
procedure png_set_gamma(png_ptr: PPng_Struct;
screen_gamma, default_file_gamma: Double); cdecl; external Lib;
{* Set how many lines between output flushes - 0 for no flushing *}
procedure png_set_flush(png_ptr: PPng_Struct;
nrows: Integer); cdecl; external Lib;
{* Flush the current PNG output buffer *}
procedure png_write_flush(png_ptr: PPng_Struct); cdecl; external Lib;
{* optional update palette with requested transformations *}
procedure png_start_read_image(png_ptr: PPng_Struct); cdecl; external Lib;
{* optional call to update the users info structure *}
procedure png_read_update_info(png_ptr: PPng_Struct;
info_ptr: PPng_Info); cdecl; external Lib;
{* read a one or more rows of image data.*}
procedure png_read_rows(png_ptr: PPng_Struct; row, display_row: PPByte;
num_rows: Cardinal); cdecl; external Lib;
{* read a row of data.*}
procedure png_read_row(png_ptr: PPng_Struct; row, display_row: PByte); cdecl; external Lib;
{* read the whole image into memory at once. *}
procedure png_read_image(png_ptr: PPng_Struct; image: PPByte); cdecl; external Lib;
{* write a row of image data *}
procedure png_write_row(png_ptr: PPng_Struct; row: PByte); cdecl; external Lib;
{* write a few rows of image data *}
procedure png_write_rows(png_ptr: PPng_Struct; row: PPByte;
num_rows: Cardinal); cdecl; external Lib;
{* write the image data *}
procedure png_write_image(png_ptr: PPng_Struct; image: PPByte); cdecl; external Lib;
{* writes the end of the PNG file. *}
procedure png_write_end(png_ptr: PPng_Struct; info_ptr: PPng_Info); cdecl; external Lib;
{* read the end of the PNG file. *}
procedure png_read_end(png_ptr: PPng_Struct; info_ptr: PPng_Info); cdecl; external Lib;
{* free any memory associated with the png_info_struct *}
procedure png_destroy_info_struct(png_ptr: PPng_Struct;
info_ptr_ptr: PPPng_Info); cdecl; external Lib;
{* free any memory associated with the png_struct and the png_info_structs *}
procedure png_destroy_read_struct(png_ptr_ptr: PPPng_Struct;
info_ptr_ptr, end_info_ptr_ptr: PPPng_Info); cdecl; external Lib;
{* free any memory associated with the png_struct and the png_info_structs *}
procedure png_destroy_write_struct(png_ptr_ptr: PPPng_Struct;
info_ptr_ptr: PPPng_Info); cdecl; external Lib;
{* set the libpng method of handling chunk CRC errors *}
procedure png_set_crc_action(png_ptr: PPng_Struct;
crit_action, ancil_action: Integer); cdecl; external Lib;
{* Values for png_set_crc_action() to say how to handle CRC errors in
* ancillary and critical chunks, and whether to use the data contained
* therein. Note that it is impossible to "discard" data in a critical
* chunk. For versions prior to 0.90, the action was always error/quit,
* whereas in version 0.90 and later, the action for CRC errors in ancillary
* chunks is warn/discard. These values should NOT be changed.
*
* value action:critical action:ancillary
*}
const PNG_CRC_DEFAULT: Integer = 0; // error/quit warn/discard data
const PNG_CRC_ERROR_QUIT: Integer = 1; // error/quit error/quit
const PNG_CRC_WARN_DISCARD: Integer = 2; // (INVALID) warn/discard data
const PNG_CRC_WARN_USE: Integer = 3; // warn/use data warn/use data
const PNG_CRC_QUIET_USE: Integer = 4; // quiet/use data quiet/use data
const PNG_CRC_NO_CHANGE: Integer = 5; // use current value use current value
{* These functions give the user control over the scan-line filtering in
* libpng and the compression methods used by zlib. These functions are
* mainly useful for testing, as the defaults should work with most users.
* Those users who are tight on memory or want faster performance at the
* expense of compression can modify them. See the compression library
* header file (zlib.h) for an explination of the compression functions.
*}
{* set the filtering method(s) used by libpng. Currently, the only valid
* value for "method" is 0.
*}
procedure png_set_filter(png_ptr: PPng_Struct;
method, filters: Integer); cdecl; external Lib;
{* Flags for png_set_filter() to say which filters to use. The flags
* are chosen so that they don't conflict with real filter types
* below, in case they are supplied instead of the #defined constants.
* These values should NOT be changed.
*}
const PNG_NO_FILTERS: Integer = $00;
const PNG_FILTER_NONE: Integer = $08;
const PNG_FILTER_SUB: Integer = $10;
const PNG_FILTER_UP: Integer = $20;
const PNG_FILTER_AVG: Integer = $40;
const PNG_FILTER_PAETH: Integer = $80;
const PNG_ALL_FILTERS: Integer = $F8;
{* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
* These defines should NOT be changed.
*}
const PNG_FILTER_VALUE_NONE: Integer = 0;
const PNG_FILTER_VALUE_SUB: Integer = 1;
const PNG_FILTER_VALUE_UP: Integer = 2;
const PNG_FILTER_VALUE_AVG: Integer = 3;
const PNG_FILTER_VALUE_PAETH: Integer = 4;
const PNG_FILTER_VALUE_LAST: Integer = 5;
{* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
* defines, either the default (minimum-sum-of-absolute-differences), or
* the experimental method (weighted-minimum-sum-of-absolute-differences).
*
* Weights are factors >= 1.0, indicating how important it is to keep the
* filter type consistent between rows. Larger numbers mean the current
* filter is that many times as likely to be the same as the "num_weights"
* previous filters. This is cumulative for each previous row with a weight.
* There needs to be "num_weights" values in "filter_weights", or it can be
* NULL if the weights aren't being specified. Weights have no influence on
* the selection of the first row filter. Well chosen weights can (in theory)
* improve the compression for a given image.
*
* Costs are factors >= 1.0 indicating the relative decoding costs of a
* filter type. Higher costs indicate more decoding expense, and are
* therefore less likely to be selected over a filter with lower computational
* costs. There needs to be a value in "filter_costs" for each valid filter
* type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
* setting the costs. Costs try to improve the speed of decompression without
* unduly increasing the compressed image size.
*
* A negative weight or cost indicates the default value is to be used, and
* values in the range [0.0, 1.0) indicate the value is to remain unchanged.
* The default values for both weights and costs are currently 1.0, but may
* change if good general weighting/cost heuristics can be found. If both
* the weights and costs are set to 1.0, this degenerates the WEIGHTED method
* to the UNWEIGHTED method, but with added encoding time/computation.
*}
procedure png_set_filter_heuristics(png_ptr: PPng_Struct;
heuristic_method, num_weights: Integer;
filter_weights, filter_costs: PDouble); cdecl; external Lib;
{* Heuristic used for row filter selection. These defines should NOT be
* changed.
*}
const PNG_FILTER_HEURISTIC_DEFAULT: Integer = 0; // Currently "UNWEIGHTED"
const PNG_FILTER_HEURISTIC_UNWEIGHTED: Integer = 1; // Used by libpng < 0.95
const PNG_FILTER_HEURISTIC_WEIGHTED: Integer = 2; // Experimental feature
const PNG_FILTER_HEURISTIC_LAST: Integer = 3; // Not a valid value
{* Set the library compression level. Currently, valid values range from
* 0 - 9, corresponding directly to the zlib compression levels 0 - 9
* (0 - no compression, 9 - "maximal" compression). Note that tests have
* shown that zlib compression levels 3-6 usually perform as well as level 9
* for PNG images, and do considerably fewer caclulations. In the future,
* these values may not correspond directly to the zlib compression levels.
*}
procedure png_set_compression_level(png_ptr: PPng_Struct;
level: Integer); cdecl; external Lib;
procedure png_set_compression_mem_level(png_ptr: PPng_Struct;
mem_level: Integer); cdecl; external Lib;
procedure png_set_compression_strategy(png_ptr: PPng_Struct;
strategy: Integer); cdecl; external Lib;
procedure png_set_compression_window_bits(png_ptr: PPng_Struct;
window_bits: Integer); cdecl; external Lib;
procedure png_set_compression_method(png_ptr: PPng_Struct;
method: Integer); cdecl; external Lib;
{* These next functions are called for input/output, memory, and error
* handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
* and call standard C I/O routines such as fread(), fwrite(), and
* fprintf(). These functions can be made to use other I/O routines
* at run time for those applications that need to handle I/O in a
* different manner by calling png_set_???_fn(). See libpng.txt for
* more information.
*}
{* Initialize the input/output for the PNG file to the default functions. *}
procedure png_init_io(png_ptr: PPng_Struct; fp: Pointer); cdecl; external Lib;
{* Replace the (error and abort), and warning functions with user
* supplied functions. If no messages are to be printed you must still
* write and use replacement functions. The replacement error_fn should
* still do a longjmp to the last setjmp location if you are using this
* method of error handling. If error_fn or warning_fn is NULL, the
* default function will be used.
*}
procedure png_set_error_fn(png_ptr: PPng_Struct;
error_ptr, error_fn, warning_fn: Pointer); cdecl; external Lib;
{* Return the user pointer associated with the error functions *}
function png_get_error_ptr(png_ptr: PPng_Struct): Pointer; cdecl; external Lib;
{* Replace the default data output functions with a user supplied one(s).
* If buffered output is not used, then output_flush_fn can be set to NULL.
* If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
* output_flush_fn will be ignored (and thus can be NULL).
*}
procedure png_set_write_fn(png_ptr: PPng_Struct; io_ptr: Integer;
write_data_fn: TPng_RW_Fn; output_flush_fn: Pointer); cdecl; external Lib;
{* Replace the default data input function with a user supplied one. *}
procedure png_set_read_fn(png_ptr: PPng_Struct;
io_ptr: Integer; read_data_fn: TPng_RW_Fn); cdecl; external Lib;
{* Return the user pointer associated with the I/O functions *}
function png_get_io_ptr(png_ptr: PPng_Struct): Pointer; cdecl; external Lib;
procedure png_set_read_status_fn(png_ptr: PPng_Struct;
read_row_fn: Pointer); cdecl; external Lib;
procedure png_set_write_status_fn(png_ptr: PPng_Struct;
write_row_fn: Pointer); cdecl; external Lib;
procedure png_set_read_user_transform_fn(png_ptr: PPng_Struct;
read_user_transform_fn: Pointer); cdecl; external Lib;
procedure png_set_write_user_transform_fn(png_ptr: PPng_Struct;
write_user_transform_fn: Pointer); cdecl; external Lib;
{* Sets the function callbacks for the push reader, and a pointer to a
* user-defined structure available to the callback functions.
*}
procedure png_set_progressive_read_fn(png_ptr: PPng_Struct;
progressive_ptr, info_fn, row_fn, end_fn: Pointer); cdecl; external Lib;
{* returns the user pointer associated with the push read functions *}
function png_get_progressive_ptr(png_ptr: PPng_Struct): Pointer; cdecl; external Lib;
{* function to be called when data becomes available *}
procedure png_process_data(png_ptr: PPng_Struct; info_ptr: Pointer;
buffer: PByte; buffer_size: Integer); cdecl; external Lib;
{* function which combines rows. Not very much different than the
* png_combine_row() call. Is this even used?????
*}
procedure png_progressive_combine_row(png_ptr: PPng_Struct;
old_row, new_row: PByte); cdecl; external Lib;
function png_malloc(png_ptr: PPng_Struct; size: Cardinal): Pointer; cdecl; external Lib;
{* frees a pointer allocated by png_malloc() *}
procedure png_free(png_ptr: PPng_Struct; ptr: Pointer); cdecl; external Lib;
function png_memcpy_check(png_ptr: PPng_Struct;
s1, s2: Pointer; size: Cardinal): Pointer; cdecl; external Lib;
function png_memset_check(png_ptr: PPng_Struct; s1: Pointer;
value: Integer; size: Cardinal): Pointer; cdecl; external Lib;
{* debugging versions of png_malloc() and png_free() *}
function png_debug_malloc(png_ptr: PPng_Struct;
size: Cardinal): Pointer; cdecl; external Lib;
procedure png_debug_free(png_ptr: PPng_Struct;
ptr: Pointer); cdecl; external Lib;
{* Fatal error in PNG image of libpng - can't continue *}
procedure png_error(png_ptr: PPng_Struct; error: PChar); cdecl; external Lib;
{* The same, but the chunk name is prepended to the error string. *}
procedure png_chunk_error(png_ptr: PPng_Struct; error: PChar); cdecl; external Lib;
{* Non-fatal error in libpng. Can continue, but may have a problem. *}
procedure png_warning(png_ptr: PPng_Struct; msg: PChar); cdecl; external Lib;
{* Non-fatal error in libpng, chunk name is prepended to message. *}
procedure png_chunk_warning(png_ptr: PPng_Struct; msg: PChar); cdecl; external Lib;