pngcrush  1.8.13
About: Pngcrush is an optimizer for PNG (Portable Network Graphics) files.
  Fossies Dox: pngcrush-1.8.13.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

pngread.c File Reference
#include "pngpriv.h"
#include <errno.h>
Include dependency graph for pngread.c:

Go to the source code of this file.

Data Structures

struct  png_image_read_control
 

Macros

#define P_NOTSET   0 /* File encoding not yet known */
 
#define P_sRGB   1 /* 8-bit encoded to sRGB gamma */
 
#define P_LINEAR   2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
 
#define P_FILE   3 /* 8-bit encoded to file gamma, not sRGB or linear */
 
#define P_LINEAR8   4 /* 8-bit linear: only from a file value */
 
#define PNG_CMAP_NONE   0
 
#define PNG_CMAP_GA   1 /* Process GA data to a color-map with alpha */
 
#define PNG_CMAP_TRANS   2 /* Process GA data to a background index */
 
#define PNG_CMAP_RGB   3 /* Process RGB data */
 
#define PNG_CMAP_RGB_ALPHA   4 /* Process RGBA data */
 
#define PNG_CMAP_NONE_BACKGROUND   256
 
#define PNG_CMAP_GA_BACKGROUND   231
 
#define PNG_CMAP_TRANS_BACKGROUND   254
 
#define PNG_CMAP_RGB_BACKGROUND   256
 
#define PNG_CMAP_RGB_ALPHA_BACKGROUND   216
 
#define PNG_SKIP_CHUNKS(p)   png_image_skip_unused_chunks(p)
 
#define PNG_DIV51(v8)   (((v8) * 5 + 130) >> 8)
 
#define PNG_GRAY_COLORMAP_ENTRIES   256
 
#define PNG_GA_COLORMAP_ENTRIES   256
 
#define PNG_RGB_COLORMAP_ENTRIES   216
 
#define PNG_RGB_INDEX(r, g, b)   ((png_byte)(6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b)))
 

Functions

png_structp png_create_read_struct (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn)
 
png_structp png_create_read_struct_2 (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)
 
void png_read_info (png_structrp png_ptr, png_inforp info_ptr)
 
void png_read_update_info (png_structrp png_ptr, png_inforp info_ptr)
 
void png_start_read_image (png_structrp png_ptr)
 
static void png_do_read_intrapixel (png_row_infop row_info, png_bytep row)
 
void png_read_row (png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
 
void png_read_rows (png_structrp png_ptr, png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)
 
void png_read_image (png_structrp png_ptr, png_bytepp image)
 
void png_read_end (png_structrp png_ptr, png_inforp info_ptr)
 
static void png_read_destroy (png_structrp png_ptr)
 
void png_destroy_read_struct (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)
 
void png_set_read_status_fn (png_structrp png_ptr, png_read_status_ptr read_row_fn)
 
void png_read_png (png_structrp png_ptr, png_inforp info_ptr, int transforms, voidp params)
 
static int png_image_read_init (png_imagep image)
 
static png_uint_32 png_image_format (png_structrp png_ptr)
 
static int png_gamma_not_sRGB (png_fixed_point g)
 
static int png_image_read_header (png_voidp argument)
 
int png_image_begin_read_from_stdio (png_imagep image, FILE *file)
 
int png_image_begin_read_from_file (png_imagep image, const char *file_name)
 
static void png_image_memory_read (png_structp png_ptr, png_bytep out, png_size_t need)
 
int png_image_begin_read_from_memory (png_imagep image, png_const_voidp memory, png_size_t size)
 
static void png_image_skip_unused_chunks (png_structrp png_ptr)
 
static void set_file_encoding (png_image_read_control *display)
 
static unsigned int decode_gamma (png_image_read_control *display, png_uint_32 value, int encoding)
 
static png_uint_32 png_colormap_compose (png_image_read_control *display, png_uint_32 foreground, int foreground_encoding, png_uint_32 alpha, png_uint_32 background, int encoding)
 
static void png_create_colormap_entry (png_image_read_control *display, png_uint_32 ip, png_uint_32 red, png_uint_32 green, png_uint_32 blue, png_uint_32 alpha, int encoding)
 
static int make_gray_file_colormap (png_image_read_control *display)
 
static int make_gray_colormap (png_image_read_control *display)
 
static int make_ga_colormap (png_image_read_control *display)
 
static int make_rgb_colormap (png_image_read_control *display)
 
static int png_image_read_colormap (png_voidp argument)
 
static int png_image_read_and_map (png_voidp argument)
 
static int png_image_read_colormapped (png_voidp argument)
 
static int png_image_read_composite (png_voidp argument)
 
static int png_image_read_background (png_voidp argument)
 
static int png_image_read_direct (png_voidp argument)
 
int png_image_finish_read (png_imagep image, png_const_colorp background, void *buffer, png_int_32 row_stride, void *colormap)
 

Macro Definition Documentation

◆ P_FILE

#define P_FILE   3 /* 8-bit encoded to file gamma, not sRGB or linear */

Definition at line 1281 of file pngread.c.

◆ P_LINEAR

#define P_LINEAR   2 /* 16-bit linear: not encoded, NOT pre-multiplied! */

Definition at line 1280 of file pngread.c.

◆ P_LINEAR8

#define P_LINEAR8   4 /* 8-bit linear: only from a file value */

Definition at line 1282 of file pngread.c.

◆ P_NOTSET

#define P_NOTSET   0 /* File encoding not yet known */

Definition at line 1278 of file pngread.c.

◆ P_sRGB

#define P_sRGB   1 /* 8-bit encoded to sRGB gamma */

Definition at line 1279 of file pngread.c.

◆ PNG_CMAP_GA

#define PNG_CMAP_GA   1 /* Process GA data to a color-map with alpha */

Definition at line 1288 of file pngread.c.

◆ PNG_CMAP_GA_BACKGROUND

#define PNG_CMAP_GA_BACKGROUND   231

Definition at line 1295 of file pngread.c.

◆ PNG_CMAP_NONE

#define PNG_CMAP_NONE   0

Definition at line 1287 of file pngread.c.

◆ PNG_CMAP_NONE_BACKGROUND

#define PNG_CMAP_NONE_BACKGROUND   256

Definition at line 1294 of file pngread.c.

◆ PNG_CMAP_RGB

#define PNG_CMAP_RGB   3 /* Process RGB data */

Definition at line 1290 of file pngread.c.

◆ PNG_CMAP_RGB_ALPHA

#define PNG_CMAP_RGB_ALPHA   4 /* Process RGBA data */

Definition at line 1291 of file pngread.c.

◆ PNG_CMAP_RGB_ALPHA_BACKGROUND

#define PNG_CMAP_RGB_ALPHA_BACKGROUND   216

Definition at line 1298 of file pngread.c.

◆ PNG_CMAP_RGB_BACKGROUND

#define PNG_CMAP_RGB_BACKGROUND   256

Definition at line 1297 of file pngread.c.

◆ PNG_CMAP_TRANS

#define PNG_CMAP_TRANS   2 /* Process GA data to a background index */

Definition at line 1289 of file pngread.c.

◆ PNG_CMAP_TRANS_BACKGROUND

#define PNG_CMAP_TRANS_BACKGROUND   254

Definition at line 1296 of file pngread.c.

◆ PNG_DIV51

#define PNG_DIV51 (   v8)    (((v8) * 5 + 130) >> 8)

Definition at line 1679 of file pngread.c.

◆ PNG_GA_COLORMAP_ENTRIES

#define PNG_GA_COLORMAP_ENTRIES   256

Definition at line 2075 of file pngread.c.

◆ PNG_GRAY_COLORMAP_ENTRIES

#define PNG_GRAY_COLORMAP_ENTRIES   256

Definition at line 2020 of file pngread.c.

◆ PNG_RGB_COLORMAP_ENTRIES

#define PNG_RGB_COLORMAP_ENTRIES   216

Definition at line 2100 of file pngread.c.

◆ PNG_RGB_INDEX

#define PNG_RGB_INDEX (   r,
  g,
 
)    ((png_byte)(6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b)))

Definition at line 2103 of file pngread.c.

◆ PNG_SKIP_CHUNKS

#define PNG_SKIP_CHUNKS (   p)    png_image_skip_unused_chunks(p)

Definition at line 1670 of file pngread.c.

Function Documentation

◆ decode_gamma()

static unsigned int decode_gamma ( png_image_read_control display,
png_uint_32  value,
int  encoding 
)
static

◆ make_ga_colormap()

static int make_ga_colormap ( png_image_read_control display)
static

Definition at line 2023 of file pngread.c.

References P_sRGB, and png_create_colormap_entry().

Referenced by png_image_read_colormap().

◆ make_gray_colormap()

static int make_gray_colormap ( png_image_read_control display)
static

Definition at line 2011 of file pngread.c.

References P_sRGB, and png_create_colormap_entry().

Referenced by png_image_read_colormap().

◆ make_gray_file_colormap()

static int make_gray_file_colormap ( png_image_read_control display)
static

Definition at line 2000 of file pngread.c.

References P_FILE, and png_create_colormap_entry().

Referenced by png_image_read_colormap().

◆ make_rgb_colormap()

static int make_rgb_colormap ( png_image_read_control display)
static

Definition at line 2078 of file pngread.c.

References P_sRGB, and png_create_colormap_entry().

Referenced by png_image_read_colormap().

◆ png_colormap_compose()

static png_uint_32 png_colormap_compose ( png_image_read_control display,
png_uint_32  foreground,
int  foreground_encoding,
png_uint_32  alpha,
png_uint_32  background,
int  encoding 
)
static

Definition at line 1742 of file pngread.c.

References decode_gamma(), P_LINEAR, and PNG_sRGB_FROM_LINEAR.

Referenced by png_image_read_colormap().

◆ png_create_colormap_entry()

static void png_create_colormap_entry ( png_image_read_control display,
png_uint_32  ip,
png_uint_32  red,
png_uint_32  green,
png_uint_32  blue,
png_uint_32  alpha,
int  encoding 
)
static

◆ png_create_read_struct()

png_structp png_create_read_struct ( png_const_charp  user_png_ver,
png_voidp  error_ptr,
png_error_ptr  error_fn,
png_error_ptr  warn_fn 
)

Definition at line 37 of file pngread.c.

References png_create_png_struct(), and png_create_read_struct_2().

Referenced by main(), measure_idats(), and png_image_read_init().

◆ png_create_read_struct_2()

png_structp png_create_read_struct_2 ( png_const_charp  user_png_ver,
png_voidp  error_ptr,
png_error_ptr  error_fn,
png_error_ptr  warn_fn,
png_voidp  mem_ptr,
png_malloc_ptr  malloc_fn,
png_free_ptr  free_fn 
)

◆ png_destroy_read_struct()

void png_destroy_read_struct ( png_structpp  png_ptr_ptr,
png_infopp  info_ptr_ptr,
png_infopp  end_info_ptr_ptr 
)

◆ png_do_read_intrapixel()

static void png_do_read_intrapixel ( png_row_infop  row_info,
png_bytep  row 
)
static

◆ png_gamma_not_sRGB()

static int png_gamma_not_sRGB ( png_fixed_point  g)
static

Definition at line 1405 of file pngread.c.

References PNG_FP_1, and png_gamma_significant().

Referenced by png_image_read_colormap(), and set_file_encoding().

◆ png_image_begin_read_from_file()

int png_image_begin_read_from_file ( png_imagep  image,
const char *  file_name 
)

◆ png_image_begin_read_from_memory()

int png_image_begin_read_from_memory ( png_imagep  image,
png_const_voidp  memory,
png_size_t  size 
)

◆ png_image_begin_read_from_stdio()

int png_image_begin_read_from_stdio ( png_imagep  image,
FILE *  file 
)

◆ png_image_finish_read()

◆ png_image_format()

◆ png_image_memory_read()

static void png_image_memory_read ( png_structp  png_ptr,
png_bytep  out,
png_size_t  need 
)
static

◆ png_image_read_and_map()

◆ png_image_read_background()

◆ png_image_read_colormap()

static int png_image_read_colormap ( png_voidp  argument)
static

Definition at line 2107 of file pngread.c.

References png_image_read_control::background, png_struct_def::bit_depth, png_color_16_struct::blue, png_struct_def::color_type, png_image_read_control::colormap, png_image_read_control::colormap_processing, png_struct_def::flags, png_color_16_struct::gray, png_color_16_struct::green, png_image_read_control::image, png_color_16_struct::index, make_ga_colormap(), make_gray_colormap(), make_gray_file_colormap(), make_rgb_colormap(), png_struct_def::num_palette, png_struct_def::num_trans, num_trans, output_format, P_FILE, P_LINEAR, P_NOTSET, P_sRGB, png_struct_def::palette, PNG_BACKGROUND_GAMMA_SCREEN, PNG_CMAP_GA, PNG_CMAP_GA_BACKGROUND, PNG_CMAP_NONE, PNG_CMAP_NONE_BACKGROUND, PNG_CMAP_RGB, PNG_CMAP_RGB_ALPHA, PNG_CMAP_RGB_ALPHA_BACKGROUND, PNG_CMAP_RGB_BACKGROUND, PNG_CMAP_TRANS, PNG_CMAP_TRANS_BACKGROUND, PNG_COLOR_MASK_ALPHA, PNG_COLOR_TYPE_GRAY, PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, PNG_COLOR_TYPE_RGB_ALPHA, png_colormap_compose(), png_const_bytep, png_const_colorp, png_create_colormap_entry(), PNG_DIV257, png_error(), PNG_ERROR_ACTION_NONE, PNG_GA_COLORMAP_ENTRIES, png_gamma_16bit_correct(), PNG_GAMMA_LINEAR, png_gamma_not_sRGB(), PNG_GAMMA_sRGB, PNG_GAMMA_sRGB_INVERSE, PNG_GRAY_COLORMAP_ENTRIES, PNG_RGB_COLORMAP_ENTRIES, PNG_RGB_INDEX, png_set_alpha_mode_fixed(), png_set_background_fixed(), png_set_packing(), png_set_rgb_to_gray_fixed(), png_set_scale_16(), png_set_tRNS_to_alpha(), PNG_sRGB_FROM_LINEAR, png_sRGB_table, png_voidcast, png_color_16_struct::red, and trans.

Referenced by png_image_finish_read().

◆ png_image_read_colormapped()

◆ png_image_read_composite()

◆ png_image_read_direct()

◆ png_image_read_header()

◆ png_image_read_init()

◆ png_image_skip_unused_chunks()

static void png_image_skip_unused_chunks ( png_structrp  png_ptr)
static

◆ png_read_destroy()

◆ png_read_end()

◆ png_read_image()

◆ png_read_info()

◆ png_read_png()

◆ png_read_row()

void png_read_row ( png_structrp  png_ptr,
png_bytep  row,
png_bytep  dsp_row 
)

◆ png_read_rows()

void png_read_rows ( png_structrp  png_ptr,
png_bytepp  row,
png_bytepp  display_row,
png_uint_32  num_rows 
)

Definition at line 668 of file pngread.c.

References png_debug, and png_read_row().

Referenced by main().

◆ png_read_update_info()

◆ png_set_read_status_fn()

void png_set_read_status_fn ( png_structrp  png_ptr,
png_read_status_ptr  read_row_fn 
)

Definition at line 1054 of file pngread.c.

References png_struct_def::read_row_fn.

◆ png_start_read_image()

void png_start_read_image ( png_structrp  png_ptr)

◆ set_file_encoding()