📄 depng.pas
字号:
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -