// pngreader.h - Public Domain - see unlicense at bottom of pvpngreader.cpp #pragma once #include <stdint.h> namespace pv_png { // PNG color types enum { … }; // PNG file description struct png_info { … }; // Retrieved information about the PNG file. // Returns false on any errors. bool get_png_info(const void* pImage_buf, size_t buf_size, png_info& info); // Input parameters: // pImage_buf, buf_size - pointer to PNG image data // desired_chans - desired number of output channels. 0=auto, 1=grayscale, 2=grayscale alpha, 3=24bpp RGB, 4=32bpp RGBA // // Output parameters: // width, height - PNG image resolution // num_chans - actual number of channels in PNG, from [1,4] (factoring in transparency) // // Returns nullptr on any errors. void* load_png(const void* pImage_buf, size_t buf_size, uint32_t desired_chans, uint32_t &width, uint32_t &height, uint32_t& num_chans); }