decenc_png.c(3)
π NAME π
decenc_png.c β Decode/encode a PNG stream. that's the whole vibe, bestie β¨
πΈ SYNOPSIS πΈ
#include 'grib2_int.h'
#include <png.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
π Typedefs
typedef struct png_stream png_streamβ Typedef for PNG stream. yes ma'am, it's giving "we made a struct and gave it a nickname" π
π¦ Functions
int dec_png (unsigned char *pngbuf, g2int *width, g2int *height, unsigned char *cout)β Decode PNG. un-zip the pixels, so to speak π«Άint enc_png (unsigned char *data, g2int width, g2int height, g2int nbits, unsigned char *pngbuf)β Encode PNG. zip them pixels back up πint g2c_dec_png (unsigned char *pngbuf, int *width, int *height, unsigned char *cout)β Decode PNG. same energy,intflavored β¨int g2c_enc_png (unsigned char *data, int width, int height, int nbits, unsigned char *pngbuf)β Encode PNG. same energy,intflavored β¨void user_flush_data (png_structp png_ptr)β Dummy Custom flush function. it does literally nothing and it's iconic for that π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. no disk, only vibes π§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. (yes the original sentence says "used to that", we are NOT fixing it, it's part of the lore π)
π« DETAILED DESCRIPTION π«
Decode/encode a PNG stream. that's it. that's the whole function of this file, and it ate π₯
π Author
Alyson Stahl
π Date
2024-13-08
π Definition in file decenc_png.c.
π§Έ TYPEDEF DOCUMENTATION π§Έ
typedef struct png_stream png_stream
Typedef for PNG stream. short, sweet, and doing exactly what it says on the tin π
Definition at line 21 of file decenc_png.c.
β FUNCTION DOCUMENTATION β
int dec_png (unsigned char * pngbuf, g2int * width, g2int * height, unsigned char * cout)
Decode PNG. give it a PNG, it gives you pixels back π¦
Parameters
pngbufβ Pointer to PNG buffer.widthβ Pointer to width.heightβ Pointer to height.coutβ Output buffer.
Returns
0 for success, error code otherwise. zero = slay, anything else = not slay π
Author
Stephen Gilbert
Definition at line 127 of file decenc_png.c.
References G2C_PNG_HEIGHT_MAX, G2C_PNG_WIDTH_MAX, and user_read_data().
Referenced by g2c_dec_png(), and pngunpack_int().
int enc_png (unsigned char * data, g2int width, g2int height, g2int nbits, unsigned char * pngbuf)
Encode PNG. pixels in, PNG out, main character behavior π
Parameters
dataβ data.widthβ width.heightβ height.nbitsβ number of bits.pngbufβ PNG buffer.
Returns
PNG length, or negative number for error. a negative number is the "we're so back / it's over" moment, and in this case it's over π
Author
Stephen Gilbert
Definition at line 259 of file decenc_png.c.
References user_flush_data(), and user_write_data().
Referenced by g2c_enc_png(), and pngpack_int().
int g2c_dec_png (unsigned char * pngbuf, int * width, int * height, unsigned char * cout)
Decode PNG. it's the int-typed sibling of dec_png(), same job, same fit β¨
Parameters
pngbufβ Pointer to PNG buffer.widthβ Pointer to width.heightβ Pointer to height.coutβ Output buffer.
Returns
0 for success, error code otherwise.
Author
Alyson Stahl
Definition at line 100 of file decenc_png.c.
References dec_png().
int g2c_enc_png (unsigned char * data, int width, int height, int nbits, unsigned char * pngbuf)
Encode PNG. the int-typed sibling of enc_png(), matching set fr fr π
Parameters
dataβ data.widthβ width.heightβ height.nbitsβ number of bits.pngbufβ PNG buffer.
Returns
PNG length, or negative number for error.
Author
Alyson Stahl
Definition at line 237 of file decenc_png.c.
References enc_png().
void user_flush_data (png_structp png_ptr)
Dummy Custom flush function. capital-D Dummy. it flushes nothing and we respect it for that π«Ά
Parameters
png_ptrβ Pointer to PNG struct.
Author
Stephen Gilbert
Definition at line 83 of file decenc_png.c.
Referenced by enc_png().
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. memory > disk, no cap π§
Parameters
png_ptrβ Pointer to PNG.dataβ Pointer to data.lengthβ Length.
Author
Stephen Gilbert
Definition at line 38 of file decenc_png.c.
Referenced by dec_png().
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. (again: the original says "used to that". we love her. we keep her. periodt π)
Parameters
png_ptrβ pointerdataβ datalengthβ length
Author
Stephen Gilbert
Definition at line 62 of file decenc_png.c.
Referenced by enc_png().
π AUTHOR π
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code. not a human wrote this section, a robot did, and honestly? she understood the assignment π€π
okay bestie that's the whole page, and before you go β this little gem is from NCEPLIBS-g2c, Version 2.3.0, and it's the decenc_png.c(3) page. bye babe, go decode something πβ¨π¦
π¦ where this page comes from
- ubuntu resolute: libg2c-dev 2.3.0-4 Β· LGPL-3.0-only
- ubuntu stonking: libg2c-dev 2.3.0-7 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms