NCEPLIBS-g2  3.4.7
enc_png.c File Reference

This program writes PNG stream to memory. More...

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

Go to the source code of this file.

Typedefs

typedef int g2int
 Long integer type. More...
 
typedef struct png_stream png_stream
 location to write PNG stream. More...
 

Functions

int enc_png (char *data, g2int *width, g2int *height, g2int *nbits, char *pngbuf)
 create png_structs to write png stream into memory. More...
 
static void user_flush_data (png_structp png_ptr)
 Dummy Custom flush function. More...
 
static 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

This program writes PNG stream to memory.

Author
Stephen Gilbert

Definition in file enc_png.c.

Typedef Documentation

◆ g2int

typedef int g2int

Long integer type.

Definition at line 12 of file enc_png.c.

◆ png_stream

typedef struct png_stream png_stream

location to write PNG stream.

Definition at line 12 of file enc_png.c.

Function Documentation

◆ enc_png()

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

create png_structs to write png stream into memory.

Parameters
datadata.
widthwidth.
heightheight.
nbitsnumber of bits.
pngbufPNG buffer.
Returns
pnglen the length of png stream
Author
Stephen Gilbert

Definition at line 79 of file enc_png.c.

References drstemplates::j, user_flush_data(), and user_write_data().

Referenced by pngpack().

◆ user_flush_data()

static void user_flush_data ( png_structp  png_ptr)
static

Dummy Custom flush function.

Parameters
png_ptrPointer to PNG struct.
Author
Stephen Gilbert

Definition at line 62 of file enc_png.c.

Referenced by enc_png().

◆ user_write_data()

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

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 40 of file enc_png.c.

Referenced by enc_png().