NCEPLIBS-g2c  1.6.4
enc_png.c File Reference

Functions for dealing with PNG. 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 enc_png (char *data, g2int width, g2int height, g2int nbits, char *pngbuf)
 Encode PNG. More...
 
void user_flush_data (png_structp png_ptr)
 Dummy Custom flush function. More...
 
void user_write_data (png_structp png_ptr, png_bytep data, png_uint_32 length)
 Custom write function used to that libpng will write to memory location instead of a file on disk. More...
 

Detailed Description

Functions for dealing with PNG.

Author
Stephen Gilbert

Definition in file enc_png.c.

Typedef Documentation

◆ png_stream

typedef struct png_stream png_stream

Typedef for PNG stream.

Definition at line 1 of file enc_png.c.

Function Documentation

◆ enc_png()

int enc_png ( char *  data,
g2int  width,
g2int  height,
g2int  nbits,
char *  pngbuf 
)

Encode PNG.

Parameters
datadata.
widthwidth.
heightheight.
nbitsnumber of bits.
pngbufPNG buffer.
Returns
PNG length, or negative number for error.
Author
Stephen Gilbert

Definition at line 81 of file enc_png.c.

References user_flush_data(), and user_write_data().

Referenced by pngpack().

◆ user_flush_data()

void user_flush_data ( png_structp  png_ptr)

Dummy Custom flush function.

Parameters
png_ptrPointer to PNG struct.
Author
Stephen Gilbert

Definition at line 61 of file enc_png.c.

Referenced by enc_png().

◆ user_write_data()

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

Custom write function used to that libpng will write to memory location instead of a file on disk.

Parameters
png_ptrpointer
datadata
lengthlength
Author
Stephen Gilbert

Definition at line 41 of file enc_png.c.

Referenced by enc_png().