#ifndef _LOAD_PNG_H
#define _LOAD_PNG_H

namespace ogl2d
{
    namespace Utilities
    {
        int DecodePngFileToGeneralBuffer(
            const char* lpszPathName,
            unsigned short* width,
            unsigned short* height,
            unsigned short* nchannels,
            unsigned char** buffer);
      
        int DecodePngBufferToGeneralBuffer(
            const unsigned char* pngdata,
            unsigned long pngdatasize,
            unsigned short* width,
            unsigned short* height,
            unsigned short* nchannels,
            unsigned char** buffer);
        /// CleanupPngGeneralBuffer
        /// @note 释放由DecodePngFileToGeneralBuffer/DecodePngBufferToGeneralBuffer分配的内存空间
        void CleanupPngGeneralBuffer();

        int EncodeGeneralBufferToPngBuffer(
            const unsigned char* buffer,
            unsigned short width,
            unsigned short height,
            unsigned short nchannels,
            unsigned char** pngbuffer,
            unsigned long *pngdatasize);

        void CleanupPngGeneralBuffer();
        

    };  // Utilities
};  // ogl2d

#endif//_LOAD_PNG_H
