📄 png.h
字号:
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));#endif /* PNG_READ_INVERT_ALPHA_SUPPORTED || PNG_WRITE_INVERT_ALPHA_SUPPORTED */#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)/* Add a filler byte to 24-bit RGB images. */extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, png_uint_32 filler, int flags));/* The values of the PNG_FILLER_ defines should NOT be changed */#define PNG_FILLER_BEFORE 0#define PNG_FILLER_AFTER 1#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)/* Swap bytes in 16 bit depth files. */extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));#endif /* PNG_READ_SWAP_SUPPORTED || PNG_WRITE_SWAP_SUPPORTED */#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)/* Use 1 byte per pixel in 1, 2, or 4 bit depth files. */extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));#endif /* PNG_READ_PACK_SUPPORTED || PNG_WRITE_PACK_SUPPORTED */#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)/* Swap packing order of pixels in bytes. */extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));#endif /* PNG_READ_PACKSWAP_SUPPORTED || PNG_WRITE_PACKSWAP_SUPPOR */#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)/* Converts files to legal bit depths. */extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, png_color_8p true_bits));#endif /* PNG_READ_SHIFT_SUPPORTED || PNG_WRITE_SHIFT_SUPPORTED */#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ defined(PNG_WRITE_INTERLACING_SUPPORTED)/* Have the code handle the interlacing. Returns the number of passes. */extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));#endif /* PNG_READ_INTERLACING_SUPPORTED || PNG_WRITE_INTERLACING_SUPPORTED */#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)/* Invert monocrome files */extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));#endif /* PNG_READ_INVERT_SUPPORTED || PNG_WRITE_INVERT_SUPPORTED */#if defined(PNG_READ_BACKGROUND_SUPPORTED)/* Handle alpha and tRNS by replacing with a background color. */extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, png_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma));#define PNG_BACKGROUND_GAMMA_UNKNOWN 0#define PNG_BACKGROUND_GAMMA_SCREEN 1#define PNG_BACKGROUND_GAMMA_FILE 2#define PNG_BACKGROUND_GAMMA_UNIQUE 3#endif /* PNG_READ_BACKGROUND_SUPPORTED */#if defined(PNG_READ_16_TO_8_SUPPORTED)/* strip the second byte of information from a 16 bit depth file. */extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));#endif /* PNG_READ_16_TO_8_SUPPORTED */#if defined(PNG_READ_DITHER_SUPPORTED)/* Turn on dithering, and reduce the palette to the number of colors available. */extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_uint_16p histogram, int full_dither));#endif /* PNG_READ_DITHER_SUPPORTED */#if defined(PNG_READ_GAMMA_SUPPORTED)/* Handle gamma correction. Screen_gamma=(display_gamma/viewing_gamma) */extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, double screen_gamma, double default_file_gamma));#endif /* PNG_READ_GAMMA_SUPPORTED */#if defined(PNG_WRITE_FLUSH_SUPPORTED)/* Set how many lines between output flushes - 0 for no flushing */extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));/* Flush the current PNG output buffer */extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));#endif /* PNG_WRITE_FLUSH_SUPPORTED *//* optional call to update the users info structure */extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, png_infop info_ptr));/* read a row of data.*/extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, png_bytep row, png_bytep display_row));/* read the whole image into memory at once. */extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, png_bytepp image));/* read the end of the PNG file. */extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, png_infop info_ptr));/* free any memory associated with the png_struct and the png_info_structs */extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));/* free all memory used by the read (old method - NOT DLL EXPORTED) */extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr));/* 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 */#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */#define PNG_CRC_NO_CHANGE 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. */extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, int filters));/* 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. */#define PNG_NO_FILTERS 0x00#define PNG_FILTER_NONE 0x08#define PNG_FILTER_SUB 0x10#define PNG_FILTER_UP 0x20#define PNG_FILTER_AVG 0x40#define PNG_FILTER_PAETH 0x80#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ PNG_FILTER_AVG | PNG_FILTER_PAETH)/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. * These defines should NOT be changed. */#define PNG_FILTER_VALUE_NONE 0#define PNG_FILTER_VALUE_SUB 1#define PNG_FILTER_VALUE_UP 2#define PNG_FILTER_VALUE_AVG 3#define PNG_FILTER_VALUE_PAETH 4#define PNG_FILTER_VALUE_LAST 5#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL *//* 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. */extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, int heuristic_method, int num_weights, png_doublep filter_weights, png_doublep filter_costs));#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED *//* Heuristic used for row filter selection. These defines should NOT be * changed. */#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */#define PNG_FILTER_HEURISTIC_LAST 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. */extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, int level));extern PNG_EXPORT(void,png_set_compression_mem_level) PNGARG((png_structp png_ptr, int mem_level));extern PNG_EXPORT(void,png_set_compression_strategy) PNGARG((png_structp png_ptr, int strategy));extern PNG_EXPORT(void,png_set_compression_window_bits) PNGARG((png_structp png_ptr, int window_bits));extern PNG_EXPORT(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. *//* Initialize the input/output for the PNG file to the default functions. */extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, FILE *fp));/* 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. */extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));/* 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 PNG_EXPORT(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 PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn));extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, png_write_status_ptr write_row_fn));#ifdef PNG_USER_MEM_SUPPORTED/* Replace the default memory allocation functions with user supplied one(s). */extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));/* Return the user pointer associated with the memory functions */extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));#endif /* PNG_USER_MEM_SUPPORTED */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -