NCEPLIBS-g2c  1.6.4
dec_png.c File Reference

PNG functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#include "grib2.h"

Go to the source code of this file.

Typedefs

typedef struct png_stream png_stream
 Typedef for PNG stream. More...
 

Functions

int dec_png (unsigned char *pngbuf, g2int *width, g2int *height, char *cout)
 Decode PNG. More...
 
void user_read_data (png_structp png_ptr, png_bytep data, png_uint_32 length)
 Custom read function used so that libpng will read a PNG stream from memory instead of a file on disk. More...
 

Detailed Description

PNG functions.

Author
Stephen Gilbert

Definition in file dec_png.c.

Typedef Documentation

◆ png_stream

typedef struct png_stream png_stream

Typedef for PNG stream.

Definition at line 1 of file dec_png.c.

Function Documentation

◆ dec_png()

int dec_png ( unsigned char *  pngbuf,
g2int width,
g2int height,
char *  cout 
)

Decode PNG.

Parameters
pngbufPointer to PNG buffer.
widthPointer to width.
heightPointer to height.
coutOutput buffer.
Returns
0 for success, error code otherwise.
Author
Stephen Gilbert

Definition at line 71 of file dec_png.c.

References user_read_data().

Referenced by pngunpack().

◆ user_read_data()

void user_read_data ( png_structp  png_ptr,
png_bytep  data,
png_uint_32  length 
)

Custom read function used so that libpng will read a PNG stream from memory instead of a file on disk.

Parameters
png_ptrPointer to PNG.
dataPointer to data.
lengthLength.
Author
Stephen Gilbert

Definition at line 44 of file dec_png.c.

Referenced by dec_png().