⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 png.h

📁 一套图像处理程序,支持三种图像文件格式,我调试过了,很好用
💻 H
📖 第 1 页 / 共 4 页
字号:

extern void png_set_compression_mem_level PNGARG((png_structp png_ptr,
   int mem_level));

extern void png_set_compression_strategy PNGARG((png_structp png_ptr,
   int strategy));

extern void png_set_compression_window_bits PNGARG((png_structp png_ptr,
   int window_bits));

extern void png_set_compression_method PNGARG((png_structp png_ptr,
   int method));

/* 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 */

/* Write the data to whatever output you are using. */
extern void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
   png_uint_32 length));

/* Read data from whatever input you are using */
extern void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
   png_uint_32 length));

/* Initialize the input/output for the png file to the default functions. */
extern void png_init_io PNGARG((png_structp png_ptr, FILE *fp));

/* Replace the error message and abort, and warning functions with user
   supplied functions.  If no messages are to be printed then you must
   supply replacement message 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 functions will be used. */
extern void png_set_error_fn PNGARG((png_structp png_ptr, png_voidp error_ptr,
   png_error_ptr error_fn, png_error_ptr warning_fn));

/* Return the user pointer associated with the error functions */
extern png_voidp png_get_error_ptr PNGARG((png_structp png_ptr));

/* 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). */
extern void png_set_write_fn PNGARG((png_structp png_ptr, png_voidp io_ptr,
   png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));

/* Replace the default data input function with a user supplied one. */
extern void png_set_read_fn PNGARG((png_structp png_ptr, png_voidp io_ptr,
   png_rw_ptr read_data_fn));

/* Return the user pointer associated with the I/O functions */
extern png_voidp png_get_io_ptr PNGARG((png_structp png_ptr));

#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
/* Replace the default push model read functions */
extern void png_set_push_fn PNGARG((png_structp png_ptr, png_voidp push_ptr,
   png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
   png_progressive_end_ptr end_fn));

/* returns the user pointer associated with the push read functions */
extern png_voidp png_get_progressive_ptr PNGARG((png_structp png_ptr));
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */

extern png_voidp png_large_malloc PNGARG((png_structp png_ptr,
   png_uint_32 size));

/* free's a pointer allocated by png_large_malloc() */
extern void png_large_free PNGARG((png_structp png_ptr, png_voidp ptr));

/* Allocate memory. */
extern void * png_malloc PNGARG((png_structp png_ptr, png_uint_32 size));

/* Reallocate memory. */
extern void * png_realloc PNGARG((png_structp png_ptr, void * ptr,
   png_uint_32 size, png_uint_32 old_size));

/* free's a pointer allocated by png_malloc() */
extern void png_free PNGARG((png_structp png_ptr, void * ptr));

/* allocate memory for an internal libpng struct */
extern png_voidp png_create_struct PNGARG((uInt type));

/* free memory from internal libpng struct */
extern void png_destroy_struct PNGARG((voidp struct_ptr));

/* Fatal error in libpng - can't continue */ 
extern void png_error PNGARG((png_structp png_ptr, png_const_charp error));

/* Non-fatal error in libpng.  Can continue, but may have a problem. */
extern void png_warning PNGARG((png_structp png_ptr, png_const_charp message));

/* These next functions are used internally in the code.  If you use
   them, make sure you read and understand the png spec.  More information
   about them can be found in the files where the functions are.
   Feel free to move any of these outside the PNG_INTERNAL define if
   you just need a few of them, but if you need access to more, you should
   define PNG_INTERNAL inside your code, so everyone who includes png.h
   won't get yet another definition the compiler has to deal with. */

#if defined(PNG_INTERNAL)

/* various modes of operation.  Note that after an init, mode is set to
   zero automatically */
#define PNG_BEFORE_IHDR  0x00
#define PNG_HAVE_IHDR    0x01
#define PNG_HAVE_PLTE    0x02
#define PNG_HAVE_IDAT    0x04
#define PNG_AT_LAST_IDAT 0x08
#define PNG_AFTER_IDAT   0x10
#define PNG_AFTER_IEND   0x20

/* push model modes */
#define PNG_READ_SIG_MODE   0
#define PNG_READ_CHUNK_MODE 1
#define PNG_READ_IDAT_MODE  2
#define PNG_READ_PLTE_MODE  3
#define PNG_READ_END_MODE   4
#define PNG_SKIP_MODE       5
#define PNG_READ_tEXt_MODE  6
#define PNG_READ_zTXt_MODE  7
#define PNG_READ_DONE_MODE  8
#define PNG_ERROR_MODE      9

/* read modes */
#define PNG_READ_PULL_MODE 0
#define PNG_READ_PUSH_MODE 1

/* defines for the transformations the png library does on the image data */
#define PNG_BGR                0x0001
#define PNG_INTERLACE          0x0002
#define PNG_PACK               0x0004
#define PNG_SHIFT              0x0008
#define PNG_SWAP_BYTES         0x0010
#define PNG_INVERT_MONO        0x0020
#define PNG_DITHER             0x0040
#define PNG_BACKGROUND         0x0080
#define PNG_BACKGROUND_EXPAND  0x0100
#define PNG_XRGB               0x0200
#define PNG_16_TO_8            0x0400
#define PNG_RGBA               0x0800
#define PNG_EXPAND             0x1000
#define PNG_GAMMA              0x2000
#define PNG_GRAY_TO_RGB        0x4000
#define PNG_FILLER             0x8000

/* flags for png_ptr->do_free to say if memory in png_info needs to be freed */
#define PNG_FREE_PALETTE 0x0001
#define PNG_FREE_HIST    0x0002
#define PNG_FREE_TRANS   0x0004
#define PNG_FREE_STRUCT  0x0008
#define PNG_FREE_INFO    0x0010

/* flags for png_create_struct */
#define PNG_STRUCT_PNG   0x0001
#define PNG_STRUCT_INFO  0x0002

/* flags for the png_ptr->flags rather than declaring a bye for each one */
#define PNG_FLAG_WROTE_tIME               0x0001
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0002
#define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0004
#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0008
#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0010
#define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0020
#define PNG_FLAG_ZLIB_FINISHED            0x0040
#define PNG_FLAG_ROW_INIT                 0x0080
#define PNG_FLAG_FILLER_AFTER             0x0100
#define PNG_FLAG_HAVE_CHUNK_HEADER        0x0200

/* save typing and make code easier to understand */
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
   abs((int)((c1).green) - (int)((c2).green)) + \
   abs((int)((c1).blue) - (int)((c2).blue)))

/* variables defined in png.c - only it needs to define PNG_NO_EXTERN */
#ifndef PNG_NO_EXTERN
/* place to hold the signiture string for a png file. */
extern png_byte png_sig[];

/* version information for c files, stored in png.c. */
extern char png_libpng_ver[];

/* constant strings for known chunk types.  If you need to add a chunk,
   add a string holding the name here.  See png.c for more details.  We
   can't selectively include these, since we still check for chunk in the
   wrong locations with these labels. */
extern png_byte FARDATA png_IHDR[];
extern png_byte FARDATA png_IDAT[];
extern png_byte FARDATA png_IEND[];
extern png_byte FARDATA png_PLTE[];
extern png_byte FARDATA png_gAMA[];
extern png_byte FARDATA png_sBIT[];
extern png_byte FARDATA png_cHRM[];
extern png_byte FARDATA png_tRNS[];
extern png_byte FARDATA png_bKGD[];
extern png_byte FARDATA png_hIST[];
extern png_byte FARDATA png_tEXt[];
extern png_byte FARDATA png_zTXt[];
extern png_byte FARDATA png_pHYs[];
extern png_byte FARDATA png_oFFs[];
extern png_byte FARDATA png_tIME[];
/* Structures to facilitate easy interlacing.  See png.c for more details */
extern int FARDATA png_pass_start[];
extern int FARDATA png_pass_inc[];
extern int FARDATA png_pass_ystart[];
extern int FARDATA png_pass_yinc[];
/* these are not currently used.  If you need them, see png.c
extern int FARDATA png_pass_width[];
extern int FARDATA png_pass_height[];
*/
extern int FARDATA png_pass_mask[];
extern int FARDATA png_pass_dsp_mask[];

#endif /* PNG_NO_EXTERN */

/* Function to allocate memory for zlib. */
extern voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));

/* function to free memory for zlib */
extern void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));

/* reset the crc variable */
extern void png_reset_crc PNGARG((png_structp png_ptr));

/* calculate the crc over a section of data.  Note that while we
   are passing in a 32 bit value for length, on 16 bit machines, you
   would need to use huge pointers to access all that data.  See the
   code in png.c for more information. */
extern void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
   png_uint_32 length));

#if defined(PNG_WRITE_FLUSH_SUPPORTED)
extern void png_flush PNGARG((png_structp png_ptr));
#endif

/* place a 32 bit number into a buffer in png byte order.  We work
   with unsigned numbers for convenience, you may have to cast
   signed numbers (if you use any, most png data is unsigned). */
extern void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));

/* place a 16 bit number into a buffer in png byte order */
extern void png_save_uint_16 PNGARG((png_bytep buf, png_uint_16 i));

/* write a 32 bit number */
extern void png_write_uint_32 PNGARG((png_structp png_ptr, png_uint_32 i));

/* write a 16 bit number */
extern void png_write_uint_16 PNGARG((png_structp png_ptr, png_uint_16 i));

/* Write a png chunk.  */
extern void png_write_chunk PNGARG((png_structp png_ptr, png_bytep type,
   png_bytep data, png_uint_32 length));

/* Write the start of a png chunk. */
extern void png_write_chunk_start PNGARG((png_structp png_ptr, png_bytep type,
   png_uint_32 total_length));

/* write the data of a png chunk started with png_write_chunk_start(). */
extern void png_write_chunk_data PNGARG((png_structp png_ptr, png_bytep data,
   png_uint_32 length));

/* finish a chunk started with png_write_chunk_start() */
extern void png_write_chunk_end PNGARG((png_structp png_ptr));

/* simple function to write the signiture */
extern void png_write_sig PNGARG((png_structp png_ptr));

/* write various chunks */

/* Write the IHDR chunk, and update the png_struct with the necessary
   information. */
extern void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
   png_uint_32 height,
   int bit_depth, int color_type, int compression_type, int filter_type,
   int interlace_type));

extern void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
   int number));

extern void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
   png_uint_32 length));

extern void png_write_IEND PNGARG((png_structp png_ptr));

#if defined(PNG_WRITE_gAMA_SUPPORTED)
extern void png_write_gAMA PNGARG((png_structp png_ptr, double gamma));
#endif

#if defined(PNG_WRITE_sBIT_SUPPORTED)
extern void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
   int color_type));
#endif

#if defined(PNG_WRITE_cHRM_SUPPORTED)
extern void png_write_cHRM PNGARG((png_structp png_ptr,
   double white_x, double white_y,
   double red_x, double red_y, double green_x, double green_y,
   double blue_x, double blue_y));
#endif

#if defined(PNG_WRITE_tRNS_SUPPORTED)
extern void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
   png_color_16p values, int number, int color_type));
#endif

#if defined(PNG_WRITE_bKGD_SUPPORTED)
extern void png_write_bKGD PNGARG((png_structp png_ptr, png_color_16p values,
   int color_type));
#endif

#if defined(PNG_WRITE_hIST_SUPPORTED)
extern void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
   int number));
#endif

#if defined(PNG_WRITE_tEXt_SUPPORTED)
extern void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
   png_charp text, png_uint_32 text_len));
#endif

#if defined(PNG_WRITE_zTXt_SUPPORTED)
extern void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
   png_charp text, png_uint_32 text_len, int compression));
#endif

#if defined(PNG_WRITE_pHYs_SUPPORTED)
extern void png_write_pHYs PNGARG((png_structp png_ptr,
   png_uint_32 x_pixels_per_unit,
   png_uint_32 y_pixels_per_unit,
   int unit_type));
#endif

#if defined(PNG_WRITE_oFFs_SUPPORTED)
extern void png_write_oFFs PNGARG((png_structp png_ptr,
   png_uint_32 x_offset,
   png_uint_32 y_offset,
   int unit_type));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -