BARE2D
PicoPNG.hpp
Go to the documentation of this file.
1 #include <vector>
2 
3 namespace BARE2D {
4 
5  /**
6  * @brief Loads a PNG from a file. That's... All I've got
7  * @param out_image output parameter, this will contain the raw pixels after decoding. By default the output is 32-bit RGBA color. The std::vector is automatically resized to the correct size.
8  * @param image_width output_parameter, this will contain the width of the image in pixels.
9  * @param image_height output_parameter, this will contain the height of the image in pixels.
10  * @param in_png pointer to the buffer of the PNG file in memory. To get it from a file on
11  disk, load it and store it in a memory buffer yourself first.
12  * @param in_size size of the input PNG file in bytes.
13  * @param convert_to_rgba32 optional parameter, true by default.
14  Set to true to get the output in RGBA 32-bit (8 bit per channel) color format
15  no matter what color type the original PNG image had. This gives predictable,
16  useable data from any random input PNG.
17  Set to false to do no color conversion at all. The result then has the same data
18  type as the PNG image, which can range from 1 bit to 64 bits per pixel.
19  Information about the color type or palette colors are not provided. You need
20  to know this information yourself to be able to use the data so this only
21  works for trusted PNG files. Use LodePNG instead of picoPNG if you need this information.
22  * @return 0 if success, not 0 if some error occured.
23  */
24  extern int decodePNG(std::vector<unsigned char>& out_image, unsigned long& image_width, unsigned long& image_height, const unsigned char* in_png, size_t in_size, bool convert_to_rgba32 = true);
25 
26 }
BARE2D
Definition: App.cpp:13
BARE2D::decodePNG
int decodePNG(std::vector< unsigned char > &out_image, unsigned long &image_width, unsigned long &image_height, const unsigned char *in_png, std::size_t in_size, bool convert_to_rgba32)
Definition: PicoPNG.cpp:28