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

📄 png.h

📁 深入剖析Visual C++编程技术及应用实例
💻 H
📖 第 1 页 / 共 4 页
字号:
   png_uint_32 row_number; /* current row in pass */
   png_bytep row_buf; /* row buffer */
   png_bytep prev_row; /* previous row */
   png_bytep sub_row;  /* place to save row when filtering */
   png_bytep up_row;   /* place to save row when filtering */
   png_bytep avg_row;  /* place to save row when filtering */
   png_bytep paeth_row; /* place to save row when filtering */
   png_row_info row_info; /* used for transformation routines */

   png_uint_32 idat_size; /* current idat size for read */
   png_uint_32 crc; /* current crc value */
   png_colorp palette; /* files palette */
   png_uint_16 num_palette; /* number of entries in palette */
   png_uint_16 num_trans; /* number of transparency values */
   png_byte interlaced; /* interlace type of file */
   png_byte pass; /* current pass (0 - 6) */
   png_byte compression; /* compression type of file */
   png_byte filter; /* filter type */
   png_byte do_filter; /* non-zero if row filtering, zero if not */
   png_byte color_type; /* color type of file */
   png_byte bit_depth; /* bit depth of file */
   png_byte usr_bit_depth; /* bit depth of users row */
   png_byte pixel_depth; /* number of bits per pixel */
   png_byte channels; /* number of channels in file */
   png_byte usr_channels; /* channels at start of write */

#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
   png_byte filler; /* filler byte to be used for 32-bit frame buffers */
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
   png_byte background_gamma_type;
   float background_gamma;
   png_color_16 background; /* background color, gamma corrected for screen */
#if defined(PNG_READ_GAMMA_SUPPORTED)
   png_color_16 background_1; /* background normalized to gamma 1.0 */
#endif
#endif
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
   png_flush_ptr output_flush_fn;/* Function for flushing output */
   png_uint_32 flush_dist;  /* how many rows apart to flush, 0 for no flush */
   png_uint_32 flush_rows;  /* number of rows written since last flush */
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
#if defined(PNG_READ_GAMMA_SUPPORTED)
   int gamma_shift; /* amount of shift for 16 bit gammas */
   float gamma; /* file gamma value */
   float display_gamma; /* display gamma value */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
   png_bytep gamma_table; /* gamma table for 8 bit depth files */
   png_bytep gamma_from_1; /* converts from 1.0 to screen */
   png_bytep gamma_to_1; /* converts from file to 1.0 */
   png_uint_16pp gamma_16_table; /* gamma table for 16 bit depth files */
   png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
   png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED)
   png_color_8 sig_bit; /* significant bits in file */
#endif
#if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
   png_bytep trans; /* transparency values for paletted files */
   png_color_16 trans_values; /* transparency values for non-paletted files */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
   png_color_8 shift; /* shift for significant bit tranformation */
#endif
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
   png_progressive_info_ptr info_fn;
   png_progressive_row_ptr row_fn;
   png_progressive_end_ptr end_fn;
   png_bytep save_buffer_ptr;
   png_bytep save_buffer;
   png_bytep current_buffer_ptr;
   png_bytep current_buffer;
   png_uint_32 push_length;
   png_uint_32 skip_length;
   png_uint_32 save_buffer_size;
   png_uint_32 save_buffer_max;
   png_uint_32 buffer_size;
   png_uint_32 current_buffer_size;
   int process_mode;
   int cur_palette;
   png_byte push_chunk_name[4];
#if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
   png_uint_32 current_text_size;
   png_uint_32 current_text_left;
   png_charp current_text;
   png_charp current_text_ptr;
#endif
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* for the Borland special 64K segment handler */
   png_bytepp offset_table_ptr;
   png_bytep offset_table;
   png_uint_16 offset_table_number;
   png_uint_16 offset_table_count;
   png_uint_16 offset_table_count_free;
#endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(PNG_READ_DITHER_SUPPORTED)
   png_bytep palette_lookup; /* lookup table for dithering */
   png_bytep dither_index; /* index translation for palette files */
   png_uint_16p hist; /* histogram */
#endif
};

typedef png_struct      FAR * FAR * png_structpp;

/* 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, in case they
   are supplied instead of the #defined constants.
 */
#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)

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

/* check the first 1 - 8 bytes to see if it is a png file */
extern int png_check_sig PNGARG((png_bytep sig, int num));

/* allocate and initialize png structure for reading, and any other memory */
extern png_structp png_create_read_struct PNGARG((png_const_charp user_png_ver,
   voidp error_ptr, png_error_ptr warn_fn, png_error_ptr error_fn));
 
/* reset the png_struct to read a new image */
extern void png_reset_read_struct PNGARG((png_structpp png_ptr));

/* initialize png structure for reading, and allocate any other memory (old) */
extern void png_read_init PNGARG((png_structp png_ptr));

/* allocate and initialize png structure for reading, and any other memory */
extern png_structp png_create_write_struct
   PNGARG((png_const_charp user_png_ver, voidp error_ptr,
   png_error_ptr warn_fn, png_error_ptr error_fn));

/* reset the png_struct to read a new image */
extern void png_reset_write_struct PNGARG((png_structpp png_ptr));

/* initialize png structure for writing, and allocate any other memory (old) */
extern void png_write_init PNGARG((png_structp png_ptr));

/* allocate and initialize the info structure */
extern png_infop png_create_info_struct PNGARG((png_structp png_ptr));

/* initialize the info structure (old interface) */
extern void png_info_init PNGARG((png_infop info));

/* Writes all the png information before the image. */
extern void png_write_info PNGARG((png_structp png_ptr, png_infop info));

/* read the information before the actual image data. */
extern void png_read_info PNGARG((png_structp png_ptr, png_infop info));

#if defined(PNG_WRITE_tIME_SUPPORTED)
/* convert from a struct tm to png_time */
extern void png_convert_from_struct_tm PNGARG((png_timep ptime,
   struct tm FAR * ttime));

/* convert from time_t to png_time.  Uses gmtime() */
extern void png_convert_from_time_t PNGARG((png_timep ptime, time_t ttime));
#endif

#if defined(PNG_READ_EXPAND_SUPPORTED)
/* Expand the data to 24 bit RGB, or 8 bit Grayscale,
   with alpha if necessary. */
extern void png_set_expand PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* Use blue, green, red order for pixels. */
extern void png_set_bgr PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
/* Expand the grayscale to 24 bit RGB if necessary. */
extern void png_set_gray_to_rgb PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
#define PNG_FILLER_BEFORE 0
#define PNG_FILLER_AFTER 1
/* Add a filler byte to rgb images. */
extern void png_set_filler PNGARG((png_structp png_ptr, int filler,
   int flags));

/* old ways of doing this, still supported through 1.x for backwards
   compatability, but not suggested */

/* Add a filler byte to rgb images after the colors. */
extern void png_set_rgbx PNGARG((png_structp png_ptr));

/* Add a filler byte to rgb images before the colors. */
extern void png_set_xrgb PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Swap bytes in 16 bit depth files. */
extern void png_set_swap PNGARG((png_structp png_ptr));
#endif

#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 void png_set_packing PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
/* Converts files to legal bit depths. */
extern void png_set_shift PNGARG((png_structp png_ptr,
   png_color_8p true_bits));
#endif

#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
    defined(PNG_WRITE_INTERLACING_SUPPORTED)
/* Have the code handle the interlacing.  Returns the number of passes. */
extern int png_set_interlace_handling PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
/* Invert monocrome files */
extern void png_set_invert_mono PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_BACKGROUND_SUPPORTED)
/* Handle alpha and tRNS by replacing with a background color. */
#define PNG_BACKGROUND_GAMMA_UNKNOWN 0
#define PNG_BACKGROUND_GAMMA_SCREEN  1
#define PNG_BACKGROUND_GAMMA_FILE    2
#define PNG_BACKGROUND_GAMMA_UNIQUE  3
extern void png_set_background PNGARG((png_structp png_ptr,
   png_color_16p background_color, int background_gamma_code,
   int need_expand, double background_gamma));
#endif

#if defined(PNG_READ_16_TO_8_SUPPORTED)
/* strip the second byte of information from a 16 bit depth file. */
extern void png_set_strip_16 PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_GRAY_TO_RGB_SUPPORTED)
/* convert a grayscale file into rgb. */
extern void png_set_gray_to_rgb PNGARG((png_structp png_ptr));
#endif

#if defined(PNG_READ_DITHER_SUPPORTED)
/* Turn on dithering, and reduce the palette to the number of colors available. */
extern 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

#if defined(PNG_READ_GAMMA_SUPPORTED)
/* Handle gamma correction. */
extern void png_set_gamma PNGARG((png_structp png_ptr, double screen_gamma,
   double default_file_gamma));
#endif

#if defined(PNG_WRITE_FLUSH_SUPPORTED)
/* Set how many lines between output flushes - 0 for no flushing */
extern void png_set_flush PNGARG((png_structp png_ptr, int nrows));

/* Flush the current PNG output buffer */
extern void png_write_flush PNGARG((png_structp png_ptr));
#endif /* PNG_WRITE_FLUSH_SUPPORTED */

/* optional update palette with requested transformations */
extern void png_start_read_image PNGARG((png_structp png_ptr));

/* optional call to update the users info structure */
extern void png_read_update_info PNGARG((png_structp png_ptr,
   png_infop info_ptr));

/* read a one or more rows of image data.*/
extern void png_read_rows PNGARG((png_structp png_ptr,
   png_bytepp row,
   png_bytepp display_row, png_uint_32 num_rows));

/* read a row of data.*/
extern 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 void png_read_image PNGARG((png_structp png_ptr,
   png_bytepp image));

/* write a row of image data */
extern void png_write_row PNGARG((png_structp png_ptr,
   png_bytep row));

/* write a few rows of image data */
extern void png_write_rows PNGARG((png_structp png_ptr,
   png_bytepp row,
   png_uint_32 num_rows));

/* write the image data */
extern void png_write_image PNGARG((png_structp png_ptr, png_bytepp image));

/* writes the end of the png file. */
extern void png_write_end PNGARG((png_structp png_ptr, png_infop info));

/* read the end of the png file. */
extern void png_read_end PNGARG((png_structp png_ptr, png_infop info));

/* free the info structure */
extern void png_destroy_info_struct PNGARG((png_structp png_ptr,
   png_infopp info_ptr));

/* free any memory associated with the png_struct and the info_structs */
extern void png_destroy_read_struct PNGARG((png_structpp png_ptr,
   png_infopp info, png_infopp end_info));

/* free all memory used by the read (old method) */
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info,
   png_infop end_info));

/* free any memory associated with the png_struct and the info_structs */
extern void png_destroy_write_struct PNGARG((png_structpp png_ptr,
   png_infopp info));

/* free any memory used in png struct */
extern void png_write_destroy PNGARG((png_structp png_ptr));

/* These functions give the user control over the filtering and
   compression libraries 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 are wanting faster
   performance at the expense of compression can modify them.
   See the compression library header file for an explination
   of these functions */
extern void png_set_filter PNGARG((png_structp png_ptr, int method,
   int filters));

extern void png_set_compression_level PNGARG((png_structp png_ptr,
   int level));

⌨️ 快捷键说明

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