decenc_png.c(3)

πŸ“¦
version 2.3.0 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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, int flavored ✨
  • int g2c_enc_png (unsigned char *data, int width, int height, int nbits, unsigned char *pngbuf) β€” Encode PNG. same energy, int flavored ✨
  • 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 β€” pointer
  • data β€” data
  • length β€” 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